1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 12:57:36 +08:00

Fix wrong counting and add test

This commit is contained in:
Dean Herbert 2021-03-31 14:09:38 +09:00
parent e0c61f4dc5
commit 0c53b4eb93
2 changed files with 24 additions and 1 deletions

View File

@ -43,6 +43,29 @@ namespace osu.Game.Tests.Visual.Navigation
exitViaEscapeAndConfirm();
}
[Test]
public void TestRetryCountIncrements()
{
Player player = null;
PushAndConfirm(() => new TestSongSelect());
AddStep("import beatmap", () => ImportBeatmapTest.LoadQuickOszIntoOsu(Game).Wait());
AddUntilStep("wait for selected", () => !Game.Beatmap.IsDefault);
AddStep("press enter", () => InputManager.Key(Key.Enter));
AddUntilStep("wait for player", () => (player = Game.ScreenStack.CurrentScreen as Player) != null);
AddAssert("retry count is 0", () => player.RestartCount == 0);
AddStep("attempt to retry", () => player.ChildrenOfType<HotkeyRetryOverlay>().First().Action());
AddUntilStep("wait for old player gone", () => Game.ScreenStack.CurrentScreen != player);
AddUntilStep("get new player", () => (player = Game.ScreenStack.CurrentScreen as Player) != null);
AddAssert("retry count is 1", () => player.RestartCount == 1);
}
[Test]
public void TestRetryFromResults()
{

View File

@ -310,7 +310,7 @@ namespace osu.Game.Screens.Play
return;
player = createPlayer();
player.RestartCount = ++restartCount;
player.RestartCount = restartCount++;
player.RestartRequested = restartRequested;
LoadTask = LoadComponentAsync(player, _ => MetadataInfo.Loading = false);