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

Add (failing) test coverage of exit/retry during progress to results

This commit is contained in:
Dean Herbert 2023-10-12 15:42:16 +09:00
parent f26e3afd29
commit 256c95f045
No known key found for this signature in database

View File

@ -215,6 +215,24 @@ namespace osu.Game.Tests.Visual.Navigation
AddAssert("retry count is 1", () => player.RestartCount == 1);
}
[Test]
public void TestRetryImmediatelyAfterCompletion()
{
var getOriginalPlayer = playToCompletion();
AddStep("attempt to retry", () => getOriginalPlayer().ChildrenOfType<HotkeyRetryOverlay>().First().Action());
AddUntilStep("wait for player", () => Game.ScreenStack.CurrentScreen != getOriginalPlayer() && Game.ScreenStack.CurrentScreen is Player);
}
[Test]
public void TestExitImmediatelyAfterCompletion()
{
var player = playToCompletion();
AddStep("attempt to exit", () => player().ChildrenOfType<HotkeyExitOverlay>().First().Action());
AddUntilStep("wait for results", () => Game.ScreenStack.CurrentScreen is ResultsScreen);
}
[Test]
public void TestRetryFromResults()
{
@ -778,6 +796,13 @@ namespace osu.Game.Tests.Visual.Navigation
}
private Func<Player> playToResults()
{
var player = playToCompletion();
AddUntilStep("wait for results", () => (Game.ScreenStack.CurrentScreen as ResultsScreen)?.IsLoaded == true);
return player;
}
private Func<Player> playToCompletion()
{
Player player = null;
@ -803,7 +828,8 @@ namespace osu.Game.Tests.Visual.Navigation
AddUntilStep("wait for track playing", () => beatmap().Track.IsRunning);
AddStep("seek to near end", () => player.ChildrenOfType<GameplayClockContainer>().First().Seek(beatmap().Beatmap.HitObjects[^1].StartTime - 1000));
AddUntilStep("wait for pass", () => (Game.ScreenStack.CurrentScreen as ResultsScreen)?.IsLoaded == true);
AddUntilStep("wait for complete", () => player.GameplayState.HasPassed);
return () => player;
}