Crudely fix crashes when switching between `TestResultsWithPlayer` cases

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
6ef39b87fe, 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`.
This commit is contained in:
Bartłomiej Dach 2023-07-13 18:53:32 +02:00
parent 6ef39b87fe
commit 4b06b6f34e
No known key found for this signature in database
1 changed files with 11 additions and 6 deletions

View File

@ -69,6 +69,8 @@ public void TestScaling()
})); }));
} }
private int onlineScoreID = 1;
[TestCase(1, ScoreRank.X)] [TestCase(1, ScoreRank.X)]
[TestCase(0.9999, ScoreRank.S)] [TestCase(0.9999, ScoreRank.S)]
[TestCase(0.975, ScoreRank.S)] [TestCase(0.975, ScoreRank.S)]
@ -81,14 +83,17 @@ public void TestResultsWithPlayer(double accuracy, ScoreRank rank)
{ {
TestResultsScreen screen = null; TestResultsScreen screen = null;
var score = TestResources.CreateTestScoreInfo(); loadResultsScreen(() =>
{
var score = TestResources.CreateTestScoreInfo();
score.OnlineID = 1234; score.OnlineID = onlineScoreID++;
score.HitEvents = TestSceneStatisticsPanel.CreatePositionDistributedHitEvents(); score.HitEvents = TestSceneStatisticsPanel.CreatePositionDistributedHitEvents();
score.Accuracy = accuracy; score.Accuracy = accuracy;
score.Rank = rank; score.Rank = rank;
loadResultsScreen(() => screen = createResultsScreen(score)); return screen = createResultsScreen(score);
});
AddUntilStep("wait for loaded", () => screen.IsLoaded); AddUntilStep("wait for loaded", () => screen.IsLoaded);
AddAssert("retry overlay present", () => screen.RetryOverlay != null); AddAssert("retry overlay present", () => screen.RetryOverlay != null);
} }