mirror of
https://github.com/osukey/osukey.git
synced 2025-05-09 23:57:18 +09:00
Add more tests for exitability
This commit is contained in:
parent
15f9a6b9df
commit
b17c5c0bb3
@ -43,17 +43,40 @@ namespace osu.Game.Tests.Visual
|
|||||||
AddAssert("pause overlay hidden", () => !Player.PauseOverlayVisible);
|
AddAssert("pause overlay hidden", () => !Player.PauseOverlayVisible);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestExitTooSoon()
|
||||||
|
{
|
||||||
|
AddStep("pause", () => Player.Pause());
|
||||||
|
AddAssert("clock stopped", () => !Player.GameplayClockContainer.GameplayClock.IsRunning);
|
||||||
|
AddStep("resume", () => Player.Resume());
|
||||||
|
AddAssert("clock started", () => Player.GameplayClockContainer.GameplayClock.IsRunning);
|
||||||
|
AddStep("pause too soon", () => Player.Exit());
|
||||||
|
AddAssert("clock not stopped", () => Player.GameplayClockContainer.GameplayClock.IsRunning);
|
||||||
|
AddAssert("pause overlay hidden", () => !Player.PauseOverlayVisible);
|
||||||
|
AddAssert("not exited", () => Player.IsCurrentScreen());
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestPauseAfterFail()
|
public void TestPauseAfterFail()
|
||||||
{
|
{
|
||||||
AddUntilStep("wait for fail", () => Player.HasFailed);
|
AddUntilStep("wait for fail", () => Player.HasFailed);
|
||||||
|
|
||||||
AddAssert("fail overlay shown", () => Player.FailOverlayVisible);
|
AddAssert("fail overlay shown", () => Player.FailOverlayVisible);
|
||||||
|
|
||||||
AddStep("try to pause", () => Player.Pause());
|
AddStep("try to pause", () => Player.Pause());
|
||||||
|
|
||||||
AddAssert("pause overlay hidden", () => !Player.PauseOverlayVisible);
|
AddAssert("pause overlay hidden", () => !Player.PauseOverlayVisible);
|
||||||
AddAssert("fail overlay still shown", () => Player.FailOverlayVisible);
|
AddAssert("fail overlay still shown", () => Player.FailOverlayVisible);
|
||||||
|
|
||||||
|
confirmExit();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestExitFromGameplay()
|
||||||
|
{
|
||||||
|
AddStep("exit", () => Player.Exit());
|
||||||
|
AddUntilStep("wait for pause", () => Player.PauseOverlayVisible);
|
||||||
|
|
||||||
|
confirmExit();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -65,6 +88,12 @@ namespace osu.Game.Tests.Visual
|
|||||||
return Player.PauseOverlayVisible;
|
return Player.PauseOverlayVisible;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
confirmExit();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void confirmExit()
|
||||||
|
{
|
||||||
|
AddUntilStep("player not exited", () => Player.IsCurrentScreen());
|
||||||
AddStep("exit", () => Player.Exit());
|
AddStep("exit", () => Player.Exit());
|
||||||
AddUntilStep("player exited", () => !Player.IsCurrentScreen());
|
AddUntilStep("player exited", () => !Player.IsCurrentScreen());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user