Skip to content

Commit

Permalink
Crudely fix crashes when switching between TestResultsWithPlayer cases
Browse files Browse the repository at this point in the history
In the visual test browser, if two `TestResultsWithPlayer` test cases
are ran consecutively, the second would die on `SoloStatisticsWatcher`
seeing duplicated online score IDs. This surfaced after
6ef39b8, which changed
`TestResultsScreen` to inherit `SoloResultsScreen` rather than
`ResultsScreen`.

This is probably _not_ a very good fix, but I'm trying to be pragmatic
for now. `SoloStatisticsWatcher` should probably not live in
`OsuGameBase`.
  • Loading branch information
bdach committed Jul 13, 2023
1 parent 6ef39b8 commit 4b06b6f
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions osu.Game.Tests/Visual/Ranking/TestSceneResultsScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ public void TestScaling()
}));
}

private int onlineScoreID = 1;

[TestCase(1, ScoreRank.X)]
[TestCase(0.9999, ScoreRank.S)]
[TestCase(0.975, ScoreRank.S)]
Expand All @@ -81,14 +83,17 @@ public void TestResultsWithPlayer(double accuracy, ScoreRank rank)
{
TestResultsScreen screen = null;

var score = TestResources.CreateTestScoreInfo();
loadResultsScreen(() =>
{
var score = TestResources.CreateTestScoreInfo();
score.OnlineID = 1234;
score.HitEvents = TestSceneStatisticsPanel.CreatePositionDistributedHitEvents();
score.Accuracy = accuracy;
score.Rank = rank;
score.OnlineID = onlineScoreID++;
score.HitEvents = TestSceneStatisticsPanel.CreatePositionDistributedHitEvents();
score.Accuracy = accuracy;
score.Rank = rank;
loadResultsScreen(() => screen = createResultsScreen(score));
return screen = createResultsScreen(score);
});
AddUntilStep("wait for loaded", () => screen.IsLoaded);
AddAssert("retry overlay present", () => screen.RetryOverlay != null);
}
Expand Down

0 comments on commit 4b06b6f

Please sign in to comment.