diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseEditor.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseEditor.cs new file mode 100644 index 0000000000..a11f32935e --- /dev/null +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseEditor.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using NUnit.Framework; +using osu.Game.Tests.Visual; + +namespace osu.Game.Rulesets.Osu.Tests +{ + [TestFixture] + public class TestCaseEditor : EditorTestCase + { + public TestCaseEditor() + : base(new OsuRuleset()) + { + } + } +} diff --git a/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj b/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj index 92cac71ad3..b4c5654de4 100644 --- a/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj +++ b/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj @@ -130,6 +130,7 @@ + diff --git a/osu.Game.Tests/Visual/TestCaseEditor.cs b/osu.Game.Tests/Visual/TestCaseEditor.cs deleted file mode 100644 index c626ca8e7f..0000000000 --- a/osu.Game.Tests/Visual/TestCaseEditor.cs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using System; -using System.Collections.Generic; -using NUnit.Framework; -using osu.Framework.Allocation; -using osu.Game.Beatmaps; -using osu.Game.Screens.Edit; -using osu.Game.Screens.Edit.Screens; - -namespace osu.Game.Tests.Visual -{ - [TestFixture] - public class TestCaseEditor : OsuTestCase - { - public override IReadOnlyList RequiredTypes => new[] { typeof(Editor), typeof(EditorScreen) }; - - private readonly Random rng; - - private BeatmapManager beatmaps; - private OsuGameBase osuGame; - - public TestCaseEditor() - { - rng = new Random(1337); - - Add(new Editor()); - AddStep("Next beatmap", nextBeatmap); - } - - [BackgroundDependencyLoader] - private void load(OsuGameBase osuGame, BeatmapManager beatmaps) - { - this.osuGame = osuGame; - this.beatmaps = beatmaps; - } - - private void nextBeatmap() - { - var sets = beatmaps.GetAllUsableBeatmapSets(); - if (sets.Count == 0) - return; - - BeatmapInfo info = sets[rng.Next(0, sets.Count)].Beatmaps[0]; - osuGame.Beatmap.Value = beatmaps.GetWorkingBeatmap(info); - } - } -} diff --git a/osu.Game.Tests/osu.Game.Tests.csproj b/osu.Game.Tests/osu.Game.Tests.csproj index 1cfa7bc111..ed9580211b 100644 --- a/osu.Game.Tests/osu.Game.Tests.csproj +++ b/osu.Game.Tests/osu.Game.Tests.csproj @@ -126,7 +126,6 @@ - diff --git a/osu.Game/Tests/Visual/EditorTestCase.cs b/osu.Game/Tests/Visual/EditorTestCase.cs new file mode 100644 index 0000000000..982a3c5d73 --- /dev/null +++ b/osu.Game/Tests/Visual/EditorTestCase.cs @@ -0,0 +1,33 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.Collections.Generic; +using osu.Framework.Allocation; +using osu.Game.Rulesets; +using osu.Game.Screens.Edit; +using osu.Game.Screens.Edit.Screens; +using osu.Game.Tests.Beatmaps; + +namespace osu.Game.Tests.Visual +{ + public abstract class EditorTestCase : ScreenTestCase + { + public override IReadOnlyList RequiredTypes => new[] { typeof(Editor), typeof(EditorScreen) }; + + private readonly Ruleset ruleset; + + protected EditorTestCase(Ruleset ruleset) + { + this.ruleset = ruleset; + } + + [BackgroundDependencyLoader] + private void load(OsuGameBase osuGame) + { + osuGame.Beatmap.Value = new TestWorkingBeatmap(ruleset.RulesetInfo); + + LoadComponentAsync(new Editor(), LoadScreen); + } + } +} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 3d89c859c4..7214a31639 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -902,6 +902,7 @@ +