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

Fix intermittent test failures in TestScenBeatmapInfoWedge due to async load

https://github.com/ppy/osu/runs/4358685294?check_suite_focus=true

Occurs due to the wedge content also reloading on ruleset change, which
wasn't being accounted for. In a fail case, the content would change
during the "select beatmap" step's async load wait, causing incorrect
results.

51a353e12d/osu.Game/Screens/Select/BeatmapInfoWedge.cs (L70)
This commit is contained in:
Dean Herbert 2021-11-30 12:32:08 +09:00
parent eb596bed9e
commit a73919917c

View File

@ -82,7 +82,7 @@ namespace osu.Game.Tests.Visual.SongSelect
beatmaps.Add(testBeatmap);
AddStep("set ruleset", () => Ruleset.Value = rulesetInfo);
setRuleset(rulesetInfo);
selectBeatmap(testBeatmap);
@ -167,6 +167,22 @@ namespace osu.Game.Tests.Visual.SongSelect
label => label.Statistic.Name == "BPM" && label.Statistic.Content == target.ToString(CultureInfo.InvariantCulture)));
}
private void setRuleset(RulesetInfo rulesetInfo)
{
Container containerBefore = null;
AddStep("set ruleset", () =>
{
// wedge content is only refreshed if the ruleset changes, so only wait for load in that case.
if (!rulesetInfo.Equals(Ruleset.Value))
containerBefore = infoWedge.DisplayedContent;
Ruleset.Value = rulesetInfo;
});
AddUntilStep("wait for async load", () => infoWedge.DisplayedContent != containerBefore);
}
private void selectBeatmap([CanBeNull] IBeatmap b)
{
Container containerBefore = null;