1
0
mirror of https://github.com/ppy/osu.git synced 2024-10-01 17:17:25 +08:00
osu-lazer/osu.Game/Tests/Visual/EditorTestScene.cs

47 lines
1.5 KiB
C#
Raw Normal View History

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
2018-04-13 17:19:50 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
2018-04-13 17:19:50 +08:00
using osu.Framework.Allocation;
using osu.Framework.Testing;
2018-04-13 17:19:50 +08:00
using osu.Game.Rulesets;
using osu.Game.Rulesets.Edit;
2018-04-13 17:19:50 +08:00
using osu.Game.Screens.Edit;
using osu.Game.Screens.Edit.Compose.Components.Timeline;
2018-04-13 17:19:50 +08:00
namespace osu.Game.Tests.Visual
{
public abstract class EditorTestScene : ScreenTestScene
2018-04-13 17:19:50 +08:00
{
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(Editor), typeof(EditorScreen) };
protected Editor Editor { get; private set; }
2018-04-13 17:19:50 +08:00
private readonly Ruleset ruleset;
protected EditorTestScene(Ruleset ruleset)
2018-04-13 17:19:50 +08:00
{
this.ruleset = ruleset;
}
[BackgroundDependencyLoader]
private void load()
2018-04-13 17:19:50 +08:00
{
Beatmap.Value = CreateWorkingBeatmap(ruleset.RulesetInfo);
}
public override void SetUpSteps()
{
base.SetUpSteps();
2018-04-13 17:19:50 +08:00
2020-04-23 09:37:05 +08:00
AddStep("load editor", () => LoadScreen(Editor = CreateEditor()));
AddUntilStep("wait for editor to load", () => Editor.ChildrenOfType<HitObjectComposer>().FirstOrDefault()?.IsLoaded == true
&& Editor.ChildrenOfType<TimelineArea>().FirstOrDefault()?.IsLoaded == true);
2018-04-13 17:19:50 +08:00
}
2020-04-23 09:37:05 +08:00
protected virtual Editor CreateEditor() => new Editor();
2018-04-13 17:19:50 +08:00
}
}