From 29bc2a27514a8573f17ebc1a9acf1e2e7813f003 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 5 Jul 2019 11:29:47 +0900 Subject: [PATCH] Split out tests --- .../UserInterface/TestSceneButtonSystem.cs | 36 +++++++++++++++---- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneButtonSystem.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneButtonSystem.cs index 88129308db..3b790d33b6 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneButtonSystem.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneButtonSystem.cs @@ -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().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); + }); + } } }