1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-19 11:32:54 +08:00

Add wait steps to ensure the player is completely loaded before continuing

This commit is contained in:
Dean Herbert 2017-11-29 17:25:55 +09:00
parent 1ea089eb74
commit bad970d1d1

View File

@ -50,7 +50,11 @@ namespace osu.Game.Tests.Visual
string instantiation = ruleset?.AssemblyQualifiedName;
foreach (var r in rulesets.AvailableRulesets.Where(rs => instantiation == null || rs.InstantiationInfo == instantiation))
AddStep(r.Name, () => loadPlayerFor(r));
{
Player p = null;
AddStep(r.Name, () => p = loadPlayerFor(r));
AddUntilStep(() => p.IsLoaded);
}
}
protected virtual Beatmap CreateBeatmap()
@ -64,7 +68,7 @@ namespace osu.Game.Tests.Visual
return beatmap;
}
private void loadPlayerFor(RulesetInfo r)
private Player loadPlayerFor(RulesetInfo r)
{
var beatmap = CreateBeatmap();
@ -78,7 +82,11 @@ namespace osu.Game.Tests.Visual
if (Player != null)
Remove(Player);
LoadComponentAsync(CreatePlayer(working, instance), LoadScreen);
var player = CreatePlayer(working, instance);
LoadComponentAsync(player, LoadScreen);
return player;
}
protected virtual Player CreatePlayer(WorkingBeatmap beatmap, Ruleset ruleset) => new Player