mirror of
https://github.com/ppy/osu.git
synced 2025-01-06 08:22:56 +08:00
Split out tests
This commit is contained in:
parent
f4dcbbbfef
commit
29bc2a2751
@ -24,11 +24,12 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
typeof(Button)
|
typeof(Button)
|
||||||
};
|
};
|
||||||
|
|
||||||
public TestSceneButtonSystem()
|
private OsuLogo logo;
|
||||||
{
|
private ButtonSystem buttons;
|
||||||
OsuLogo logo;
|
|
||||||
ButtonSystem buttons;
|
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void SetUp() => Schedule(() =>
|
||||||
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
new Box
|
||||||
@ -37,15 +38,23 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
},
|
},
|
||||||
buttons = new ButtonSystem(),
|
buttons = new ButtonSystem(),
|
||||||
logo = new OsuLogo { RelativePositionAxes = Axes.Both }
|
logo = new OsuLogo
|
||||||
|
{
|
||||||
|
RelativePositionAxes = Axes.Both,
|
||||||
|
Position = new Vector2(0.5f)
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
buttons.SetOsuLogo(logo);
|
buttons.SetOsuLogo(logo);
|
||||||
|
});
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestAllStates()
|
||||||
|
{
|
||||||
foreach (var s in Enum.GetValues(typeof(ButtonSystemState)).OfType<ButtonSystemState>().Skip(1))
|
foreach (var s in Enum.GetValues(typeof(ButtonSystemState)).OfType<ButtonSystemState>().Skip(1))
|
||||||
AddStep($"State to {s}", () => buttons.State = s);
|
AddStep($"State to {s}", () => buttons.State = s);
|
||||||
|
|
||||||
AddStep("Exiting menu", () =>
|
AddStep("Enter mode", () =>
|
||||||
{
|
{
|
||||||
buttons.State = ButtonSystemState.EnteringMode;
|
buttons.State = ButtonSystemState.EnteringMode;
|
||||||
buttons.FadeOut(400, Easing.InSine);
|
buttons.FadeOut(400, Easing.InSine);
|
||||||
@ -54,7 +63,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
.ScaleTo(0.2f, 300, Easing.InSine);
|
.ScaleTo(0.2f, 300, Easing.InSine);
|
||||||
});
|
});
|
||||||
|
|
||||||
AddStep("Entering menu", () =>
|
AddStep("Return to menu", () =>
|
||||||
{
|
{
|
||||||
buttons.State = ButtonSystemState.Play;
|
buttons.State = ButtonSystemState.Play;
|
||||||
buttons.FadeIn(400, Easing.OutQuint);
|
buttons.FadeIn(400, Easing.OutQuint);
|
||||||
@ -63,5 +72,18 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
logo.FadeIn(100, Easing.OutQuint);
|
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);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user