mirror of
https://github.com/ppy/osu
synced 2024-12-28 01:42:57 +00:00
Use CreateRuleset() for editor test scenes as well
This commit is contained in:
parent
c72592c52c
commit
741fa20149
@ -15,8 +15,9 @@ namespace osu.Game.Rulesets.Mania.Tests
|
||||
{
|
||||
private readonly Bindable<ManiaScrollingDirection> direction = new Bindable<ManiaScrollingDirection>();
|
||||
|
||||
protected override Ruleset CreateEditorRuleset() => new ManiaRuleset();
|
||||
|
||||
public TestSceneEditor()
|
||||
: base(new ManiaRuleset())
|
||||
{
|
||||
AddStep("upwards scroll", () => direction.Value = ManiaScrollingDirection.Up);
|
||||
AddStep("downwards scroll", () => direction.Value = ManiaScrollingDirection.Down);
|
||||
|
@ -9,9 +9,6 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
[TestFixture]
|
||||
public class TestSceneEditor : EditorTestScene
|
||||
{
|
||||
public TestSceneEditor()
|
||||
: base(new OsuRuleset())
|
||||
{
|
||||
}
|
||||
protected override Ruleset CreateEditorRuleset() => new OsuRuleset();
|
||||
}
|
||||
}
|
||||
|
@ -9,9 +9,6 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
||||
[TestFixture]
|
||||
public class TestSceneEditor : EditorTestScene
|
||||
{
|
||||
public TestSceneEditor()
|
||||
: base(new TaikoRuleset())
|
||||
{
|
||||
}
|
||||
protected override Ruleset CreateEditorRuleset() => new TaikoRuleset();
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
@ -13,13 +14,10 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
{
|
||||
public class TestSceneEditorChangeStates : EditorTestScene
|
||||
{
|
||||
public TestSceneEditorChangeStates()
|
||||
: base(new OsuRuleset())
|
||||
{
|
||||
}
|
||||
|
||||
private EditorBeatmap editorBeatmap;
|
||||
|
||||
protected override Ruleset CreateEditorRuleset() => new OsuRuleset();
|
||||
|
||||
public override void SetUpSteps()
|
||||
{
|
||||
base.SetUpSteps();
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user