1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 19:27:24 +08:00

Split out tests

This commit is contained in:
Dean Herbert 2019-07-05 11:29:47 +09:00
parent f4dcbbbfef
commit 29bc2a2751

View File

@ -24,11 +24,12 @@ namespace osu.Game.Tests.Visual.UserInterface
typeof(Button)
};
public TestSceneButtonSystem()
{
OsuLogo logo;
ButtonSystem buttons;
private OsuLogo logo;
private ButtonSystem buttons;
[SetUp]
public void SetUp() => Schedule(() =>
{
Children = new Drawable[]
{
new Box
@ -37,15 +38,23 @@ namespace osu.Game.Tests.Visual.UserInterface
RelativeSizeAxes = Axes.Both,
},
buttons = new ButtonSystem(),
logo = new OsuLogo { RelativePositionAxes = Axes.Both }
logo = new OsuLogo
{
RelativePositionAxes = Axes.Both,
Position = new Vector2(0.5f)
}
};
buttons.SetOsuLogo(logo);
});
[Test]
public void TestAllStates()
{
foreach (var s in Enum.GetValues(typeof(ButtonSystemState)).OfType<ButtonSystemState>().Skip(1))
AddStep($"State to {s}", () => buttons.State = s);
AddStep("Exiting menu", () =>
AddStep("Enter mode", () =>
{
buttons.State = ButtonSystemState.EnteringMode;
buttons.FadeOut(400, Easing.InSine);
@ -54,7 +63,7 @@ namespace osu.Game.Tests.Visual.UserInterface
.ScaleTo(0.2f, 300, Easing.InSine);
});
AddStep("Entering menu", () =>
AddStep("Return to menu", () =>
{
buttons.State = ButtonSystemState.Play;
buttons.FadeIn(400, Easing.OutQuint);
@ -63,5 +72,18 @@ namespace osu.Game.Tests.Visual.UserInterface
logo.FadeIn(100, Easing.OutQuint);
});
}
[Test]
public void TestSmoothExit()
{
AddStep("Enter mode", () =>
{
buttons.State = ButtonSystemState.EnteringMode;
buttons.FadeOut(400, Easing.InSine);
buttons.MoveTo(new Vector2(-800, 0), 400, Easing.InSine);
logo.FadeOut(300, Easing.InSine)
.ScaleTo(0.2f, 300, Easing.InSine);
});
}
}
}