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);
}
[TestCase("space")]
[TestCase("mouse middle")]
public void TestPause(string action)
[Test]
public void TestPauseViaSpace()
{
double? lastTime = null;
AddUntilStep("wait for first hit", () => Player.ScoreProcessor.TotalScore.Value > 0);
AddStep("Pause playback", () =>
{
switch (action)
{
case "space":
InputManager.Key(Key.Space);
break;
AddStep("Pause playback with space", () => InputManager.Key(Key.Space));
case "mouse middle":
InputManager.Click(MouseButton.Middle);
break;
}
AddAssert("player not exited", () => Player.IsCurrentScreen());
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());
AddUntilStep("Time stopped progressing", () =>