Merge pull request #15871 from peppy/fix-wedge-test-intermittent-failure

Fix intermittent test failures in `TestSceneBeatmapInfoWedge` due to async load
This commit is contained in:
Dan Balasescu 2021-11-30 13:47:17 +09:00 committed by GitHub
commit f7b0d567bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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;