1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 10:12:54 +08:00

Add test coverage of skip button failure with equal time

This commit is contained in:
Dean Herbert 2022-08-31 13:19:58 +09:00
parent 0afa775f3f
commit 7ce1cf7560

View File

@ -27,8 +27,7 @@ namespace osu.Game.Tests.Visual.Gameplay
private const double skip_time = 6000;
[SetUp]
public void SetUp() => Schedule(() =>
private void createTest(double skipTime = skip_time) => AddStep("create test", () =>
{
requestCount = 0;
increment = skip_time;
@ -40,7 +39,7 @@ namespace osu.Game.Tests.Visual.Gameplay
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
skip = new TestSkipOverlay(skip_time)
skip = new TestSkipOverlay(skipTime)
{
RequestSkip = () =>
{
@ -55,9 +54,25 @@ namespace osu.Game.Tests.Visual.Gameplay
gameplayClock = gameplayClockContainer;
});
[Test]
public void TestSkipTimeZero()
{
createTest(0);
AddUntilStep("wait for skip overlay expired", () => !skip.IsAlive);
}
[Test]
public void TestSkipTimeEqualToSkip()
{
createTest(MasterGameplayClockContainer.MINIMUM_SKIP_TIME);
AddUntilStep("wait for skip overlay expired", () => !skip.IsAlive);
}
[Test]
public void TestFadeOnIdle()
{
createTest();
AddStep("move mouse", () => InputManager.MoveMouseTo(Vector2.Zero));
AddUntilStep("fully visible", () => skip.FadingContent.Alpha == 1);
AddUntilStep("wait for fade", () => skip.FadingContent.Alpha < 1);
@ -70,6 +85,8 @@ namespace osu.Game.Tests.Visual.Gameplay
[Test]
public void TestClickableAfterFade()
{
createTest();
AddStep("move mouse", () => InputManager.MoveMouseTo(skip.ScreenSpaceDrawQuad.Centre));
AddUntilStep("wait for fade", () => skip.FadingContent.Alpha == 0);
AddStep("click", () => InputManager.Click(MouseButton.Left));
@ -79,6 +96,8 @@ namespace osu.Game.Tests.Visual.Gameplay
[Test]
public void TestClickOnlyActuatesOnce()
{
createTest();
AddStep("move mouse", () => InputManager.MoveMouseTo(skip.ScreenSpaceDrawQuad.Centre));
AddStep("click", () =>
{
@ -94,6 +113,8 @@ namespace osu.Game.Tests.Visual.Gameplay
[Test]
public void TestClickOnlyActuatesMultipleTimes()
{
createTest();
AddStep("set increment lower", () => increment = 3000);
AddStep("move mouse", () => InputManager.MoveMouseTo(skip.ScreenSpaceDrawQuad.Centre));
AddStep("click", () => InputManager.Click(MouseButton.Left));
@ -106,6 +127,8 @@ namespace osu.Game.Tests.Visual.Gameplay
[Test]
public void TestDoesntFadeOnMouseDown()
{
createTest();
AddStep("move mouse", () => InputManager.MoveMouseTo(skip.ScreenSpaceDrawQuad.Centre));
AddStep("button down", () => InputManager.PressButton(MouseButton.Left));
AddUntilStep("wait for overlay disappear", () => !skip.OverlayContent.IsPresent);