Split out tests

This commit is contained in:
Dean Herbert 2019-07-05 11:29:47 +09:00
parent f4dcbbbfef
commit 29bc2a2751
1 changed files with 29 additions and 7 deletions

View File

@ -24,11 +24,12 @@ public class TestSceneButtonSystem : OsuTestScene
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 @@ public TestSceneButtonSystem()
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 @@ public TestSceneButtonSystem()
.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 @@ public TestSceneButtonSystem()
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);
});
}
}
}