1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-08 01:23:05 +08:00

Use [SetUp] instead of reset method

This commit is contained in:
Bartłomiej Dach 2020-03-18 21:54:17 +01:00
parent 648e9fa21f
commit 4bda520695

View File

@ -4,7 +4,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Screens.Edit; using osu.Game.Screens.Edit;
using osu.Game.Screens.Edit.Compose.Components; using osu.Game.Screens.Edit.Compose.Components;
@ -18,21 +17,20 @@ namespace osu.Game.Tests.Visual.Editor
private BeatDivisorControl beatDivisorControl; private BeatDivisorControl beatDivisorControl;
private BindableBeatDivisor bindableBeatDivisor; private BindableBeatDivisor bindableBeatDivisor;
[BackgroundDependencyLoader] [SetUp]
private void load() public void SetUp() => Schedule(() =>
{ {
Child = beatDivisorControl = new BeatDivisorControl(bindableBeatDivisor = new BindableBeatDivisor()) Child = beatDivisorControl = new BeatDivisorControl(bindableBeatDivisor = new BindableBeatDivisor(16))
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Size = new Vector2(90, 90) Size = new Vector2(90, 90)
}; };
} });
[Test] [Test]
public void TestBindableBeatDivisor() public void TestBindableBeatDivisor()
{ {
AddStep("Reset", () => reset());
AddRepeatStep("Move previous", () => bindableBeatDivisor.Previous(), 4); AddRepeatStep("Move previous", () => bindableBeatDivisor.Previous(), 4);
AddAssert("Position at 4", () => bindableBeatDivisor.Value == 4); AddAssert("Position at 4", () => bindableBeatDivisor.Value == 4);
AddRepeatStep("Move next", () => bindableBeatDivisor.Next(), 3); AddRepeatStep("Move next", () => bindableBeatDivisor.Next(), 3);
@ -42,7 +40,6 @@ namespace osu.Game.Tests.Visual.Editor
[Test] [Test]
public void TestMouseInput() public void TestMouseInput()
{ {
AddStep("Reset", () => reset());
AddStep("Move to marker", () => AddStep("Move to marker", () =>
{ {
InputManager.MoveMouseTo(beatDivisorControl, new Vector2(38, -18)); InputManager.MoveMouseTo(beatDivisorControl, new Vector2(38, -18));
@ -66,11 +63,5 @@ namespace osu.Game.Tests.Visual.Editor
}); });
AddAssert("Position clamped to 8", () => bindableBeatDivisor.Value == 8); AddAssert("Position clamped to 8", () => bindableBeatDivisor.Value == 8);
} }
private void reset()
{
bindableBeatDivisor.Value = 16;
InputManager.MoveMouseTo(beatDivisorControl, new Vector2(beatDivisorControl.Width, beatDivisorControl.Height));
}
} }
} }