Ensure editor tests wait for load to complete

This commit is contained in:
smoogipoo
2020-04-22 19:49:21 +09:00
parent 0a34fddcc3
commit 08982e0e00
2 changed files with 16 additions and 15 deletions

View File

@ -3,9 +3,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Testing;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Edit;
using osu.Game.Screens.Edit;
using osu.Game.Screens.Edit.Compose.Components.Timeline;
namespace osu.Game.Tests.Visual
{
@ -13,6 +17,8 @@ namespace osu.Game.Tests.Visual
{
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(Editor), typeof(EditorScreen) };
protected Editor Editor { get; private set; }
private readonly Ruleset ruleset;
protected EditorTestScene(Ruleset ruleset)
@ -30,7 +36,9 @@ namespace osu.Game.Tests.Visual
{
base.SetUpSteps();
AddStep("Load editor", () => LoadScreen(new Editor()));
AddStep("load editor", () => LoadScreen(Editor = new Editor()));
AddUntilStep("wait for editor to load", () => Editor.ChildrenOfType<HitObjectComposer>().FirstOrDefault()?.IsLoaded == true
&& Editor.ChildrenOfType<TimelineArea>().FirstOrDefault()?.IsLoaded == true);
}
}
}