mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 15:03:13 +08: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>();
|
private readonly Bindable<ManiaScrollingDirection> direction = new Bindable<ManiaScrollingDirection>();
|
||||||
|
|
||||||
|
protected override Ruleset CreateEditorRuleset() => new ManiaRuleset();
|
||||||
|
|
||||||
public TestSceneEditor()
|
public TestSceneEditor()
|
||||||
: base(new ManiaRuleset())
|
|
||||||
{
|
{
|
||||||
AddStep("upwards scroll", () => direction.Value = ManiaScrollingDirection.Up);
|
AddStep("upwards scroll", () => direction.Value = ManiaScrollingDirection.Up);
|
||||||
AddStep("downwards scroll", () => direction.Value = ManiaScrollingDirection.Down);
|
AddStep("downwards scroll", () => direction.Value = ManiaScrollingDirection.Down);
|
||||||
|
@ -9,9 +9,6 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class TestSceneEditor : EditorTestScene
|
public class TestSceneEditor : EditorTestScene
|
||||||
{
|
{
|
||||||
public TestSceneEditor()
|
protected override Ruleset CreateEditorRuleset() => new OsuRuleset();
|
||||||
: base(new OsuRuleset())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,9 +9,6 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class TestSceneEditor : EditorTestScene
|
public class TestSceneEditor : EditorTestScene
|
||||||
{
|
{
|
||||||
public TestSceneEditor()
|
protected override Ruleset CreateEditorRuleset() => new TaikoRuleset();
|
||||||
: base(new TaikoRuleset())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
@ -13,13 +14,10 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
{
|
{
|
||||||
public class TestSceneEditorChangeStates : EditorTestScene
|
public class TestSceneEditorChangeStates : EditorTestScene
|
||||||
{
|
{
|
||||||
public TestSceneEditorChangeStates()
|
|
||||||
: base(new OsuRuleset())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
private EditorBeatmap editorBeatmap;
|
private EditorBeatmap editorBeatmap;
|
||||||
|
|
||||||
|
protected override Ruleset CreateEditorRuleset() => new OsuRuleset();
|
||||||
|
|
||||||
public override void SetUpSteps()
|
public override void SetUpSteps()
|
||||||
{
|
{
|
||||||
base.SetUpSteps();
|
base.SetUpSteps();
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
@ -15,17 +16,11 @@ namespace osu.Game.Tests.Visual
|
|||||||
{
|
{
|
||||||
protected Editor Editor { get; private set; }
|
protected Editor Editor { get; private set; }
|
||||||
|
|
||||||
private readonly Ruleset ruleset;
|
|
||||||
|
|
||||||
protected EditorTestScene(Ruleset ruleset)
|
|
||||||
{
|
|
||||||
this.ruleset = ruleset;
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
Beatmap.Value = CreateWorkingBeatmap(ruleset.RulesetInfo);
|
Ruleset.Value = CreateEditorRuleset().RulesetInfo;
|
||||||
|
Beatmap.Value = CreateWorkingBeatmap(Ruleset.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void SetUpSteps()
|
public override void SetUpSteps()
|
||||||
@ -37,6 +32,14 @@ namespace osu.Game.Tests.Visual
|
|||||||
&& Editor.ChildrenOfType<TimelineArea>().FirstOrDefault()?.IsLoaded == true);
|
&& 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();
|
protected virtual Editor CreateEditor() => new Editor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user