Skip to content

Commit

Permalink
Add test coverage governing new behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed Nov 28, 2024
1 parent ced8dda commit c26c84b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions osu.Game.Tests/Visual/Navigation/TestSceneScreenNavigation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,23 @@ public void TestRetryCountIncrements()
AddAssert("retry count is 1", () => player.RestartCount == 1);
}

[Test]
public void TestLastScoreNullAfterExitingPlayer()
{
AddUntilStep("wait for last play null", getLastPlay, () => Is.Null);

var getOriginalPlayer = playToCompletion();

AddStep("attempt to retry", () => getOriginalPlayer().ChildrenOfType<HotkeyRetryOverlay>().First().Action());
AddUntilStep("wait for last play matches player", getLastPlay, () => Is.EqualTo(getOriginalPlayer().Score.ScoreInfo));

AddUntilStep("wait for player", () => Game.ScreenStack.CurrentScreen != getOriginalPlayer() && Game.ScreenStack.CurrentScreen is Player);
AddStep("exit player", () => (Game.ScreenStack.CurrentScreen as Player)?.Exit());
AddUntilStep("wait for last play null", getLastPlay, () => Is.Null);

ScoreInfo getLastPlay() => Game.Dependencies.Get<SessionStatics>().Get<ScoreInfo>(Static.LastLocalUserScore);
}

[Test]
public void TestRetryImmediatelyAfterCompletion()
{
Expand Down

0 comments on commit c26c84b

Please sign in to comment.