Use CreateRuleset() for editor test scenes as well

This commit is contained in:
Salman Ahmed
2020-06-04 00:47:10 +03:00
parent c72592c52c
commit 741fa20149
5 changed files with 18 additions and 22 deletions

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System.Linq;
using JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Testing;
using osu.Game.Rulesets;
@ -15,17 +16,11 @@ namespace osu.Game.Tests.Visual
{
protected Editor Editor { get; private set; }
private readonly Ruleset ruleset;
protected EditorTestScene(Ruleset ruleset)
{
this.ruleset = ruleset;
}
[BackgroundDependencyLoader]
private void load()
{
Beatmap.Value = CreateWorkingBeatmap(ruleset.RulesetInfo);
Ruleset.Value = CreateEditorRuleset().RulesetInfo;
Beatmap.Value = CreateWorkingBeatmap(Ruleset.Value);
}
public override void SetUpSteps()
@ -37,6 +32,14 @@ namespace osu.Game.Tests.Visual
&& Editor.ChildrenOfType<TimelineArea>().FirstOrDefault()?.IsLoaded == true);
}
/// <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();
protected virtual Editor CreateEditor() => new Editor();
}
}