2019-05-31 13:40:53 +08:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
2019-01-24 16:43:03 +08:00
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
2018-04-13 17:19:50 +08:00
|
|
|
|
2020-04-22 18:49:21 +08:00
|
|
|
using System.Linq;
|
2020-06-04 05:47:10 +08:00
|
|
|
using JetBrains.Annotations;
|
2018-04-13 17:19:50 +08:00
|
|
|
using osu.Framework.Allocation;
|
2020-04-22 18:49:21 +08:00
|
|
|
using osu.Framework.Testing;
|
2018-04-13 17:19:50 +08:00
|
|
|
using osu.Game.Rulesets;
|
2020-04-22 18:49:21 +08:00
|
|
|
using osu.Game.Rulesets.Edit;
|
2018-04-13 17:19:50 +08:00
|
|
|
using osu.Game.Screens.Edit;
|
2020-04-22 18:49:21 +08:00
|
|
|
using osu.Game.Screens.Edit.Compose.Components.Timeline;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Tests.Visual
|
|
|
|
{
|
2019-05-15 03:37:25 +08:00
|
|
|
public abstract class EditorTestScene : ScreenTestScene
|
2018-04-13 17:19:50 +08:00
|
|
|
{
|
2020-04-22 18:49:21 +08:00
|
|
|
protected Editor Editor { get; private set; }
|
|
|
|
|
2018-04-13 17:19:50 +08:00
|
|
|
[BackgroundDependencyLoader]
|
2018-05-23 16:37:39 +08:00
|
|
|
private void load()
|
2018-04-13 17:19:50 +08:00
|
|
|
{
|
2020-06-04 05:47:10 +08:00
|
|
|
Beatmap.Value = CreateWorkingBeatmap(Ruleset.Value);
|
2020-02-07 15:42:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
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()));
|
2020-04-22 18:49:21 +08:00
|
|
|
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
|
|
|
|
2020-06-04 05:47:10 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Creates the ruleset for providing a corresponding beatmap to load the editor on.
|
|
|
|
/// </summary>
|
|
|
|
[NotNull]
|
|
|
|
protected abstract Ruleset CreateEditorRuleset();
|
|
|
|
|
|
|
|
protected sealed override Ruleset CreateRuleset() => CreateEditorRuleset();
|
|
|
|
|
2020-04-23 09:37:05 +08:00
|
|
|
protected virtual Editor CreateEditor() => new Editor();
|
2018-04-13 17:19:50 +08:00
|
|
|
}
|
|
|
|
}
|