mirror of
https://github.com/ppy/osu
synced 2025-01-09 15:49:32 +00:00
Separate pausing test instead of using test cases
This commit is contained in:
parent
d79ee29f29
commit
93a57b6871
@ -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", () =>
|
||||||
|
Loading…
Reference in New Issue
Block a user