Refactor some shared code in TestScenePause

This commit is contained in:
Dean Herbert 2021-02-15 14:23:59 +09:00
parent 94f35825dd
commit a4dc544235

View File

@ -56,9 +56,7 @@ namespace osu.Game.Tests.Visual.Gameplay
pauseAndConfirm();
resume();
confirmClockRunning(false);
confirmPauseOverlayShown(false);
confirmPausedWithNoOverlay();
AddStep("click to resume", () => InputManager.Click(MouseButton.Left));
confirmClockRunning(true);
@ -73,9 +71,7 @@ namespace osu.Game.Tests.Visual.Gameplay
pauseAndConfirm();
resume();
confirmClockRunning(false);
confirmPauseOverlayShown(false);
confirmPausedWithNoOverlay();
pauseAndConfirm();
AddUntilStep("resume overlay is not active", () => Player.DrawableRuleset.ResumeOverlay.State.Value == Visibility.Hidden);
@ -94,7 +90,7 @@ namespace osu.Game.Tests.Visual.Gameplay
}
[Test]
public void TestPauseTooSoon()
public void TestPauseDuringCooldownTooSoon()
{
AddStep("move cursor outside", () => InputManager.MoveMouseTo(Player.ScreenSpaceDrawQuad.TopLeft - new Vector2(10)));
@ -103,8 +99,8 @@ namespace osu.Game.Tests.Visual.Gameplay
resume();
pause();
confirmClockRunning(true);
confirmPauseOverlayShown(false);
confirmResumed();
AddAssert("not exited", () => Player.IsCurrentScreen());
}
[Test]
@ -117,9 +113,7 @@ namespace osu.Game.Tests.Visual.Gameplay
AddStep("exit quick", () => Player.Exit());
confirmClockRunning(true);
confirmPauseOverlayShown(false);
confirmResumed();
AddAssert("exited", () => !Player.IsCurrentScreen());
}
@ -133,9 +127,7 @@ namespace osu.Game.Tests.Visual.Gameplay
pause();
confirmClockRunning(false);
confirmPauseOverlayShown(false);
confirmPausedWithNoOverlay();
AddAssert("fail overlay still shown", () => Player.FailOverlayVisible);
exitAndConfirm();
@ -277,6 +269,12 @@ namespace osu.Game.Tests.Visual.Gameplay
confirmPauseOverlayShown(false);
}
private void confirmPausedWithNoOverlay()
{
confirmClockRunning(false);
confirmPauseOverlayShown(false);
}
private void confirmExited()
{
AddUntilStep("player exited", () => !Player.IsCurrentScreen());