Separate pausing test instead of using test cases

This commit is contained in:
Joseph Madamba 2023-01-07 11:28:09 -08:00
parent d79ee29f29
commit 93a57b6871

View File

@ -24,28 +24,40 @@ namespace osu.Game.Tests.Visual.Gameplay
AddUntilStep("player loaded", () => Player.IsLoaded); AddUntilStep("player loaded", () => Player.IsLoaded);
} }
[TestCase("space")] [Test]
[TestCase("mouse middle")] public void TestPauseViaSpace()
public void TestPause(string action)
{ {
double? lastTime = null; double? lastTime = null;
AddUntilStep("wait for first hit", () => Player.ScoreProcessor.TotalScore.Value > 0); AddUntilStep("wait for first hit", () => Player.ScoreProcessor.TotalScore.Value > 0);
AddStep("Pause playback", () => AddStep("Pause playback with space", () => InputManager.Key(Key.Space));
{
switch (action)
{
case "space":
InputManager.Key(Key.Space);
break;
case "mouse middle": AddAssert("player not exited", () => Player.IsCurrentScreen());
InputManager.Click(MouseButton.Middle);
break; AddUntilStep("Time stopped progressing", () =>
} {
double current = Player.GameplayClockContainer.CurrentTime;
bool changed = lastTime != current;
lastTime = current;
return !changed;
}); });
AddWaitStep("wait some", 10);
AddAssert("Time still stopped", () => lastTime == Player.GameplayClockContainer.CurrentTime);
}
[Test]
public void TestPauseViaMiddleMouse()
{
double? lastTime = null;
AddUntilStep("wait for first hit", () => Player.ScoreProcessor.TotalScore.Value > 0);
AddStep("Pause playback with middle mouse", () => InputManager.Click(MouseButton.Middle));
AddAssert("player not exited", () => Player.IsCurrentScreen()); AddAssert("player not exited", () => Player.IsCurrentScreen());
AddUntilStep("Time stopped progressing", () => AddUntilStep("Time stopped progressing", () =>