1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-08 06:36:05 +08:00

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