mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 06:12:56 +08:00
Create a base TestCaseEditor for rulests to derive
This commit is contained in:
parent
13c20438ef
commit
d2859d779d
16
osu.Game.Rulesets.Osu/Tests/TestCaseEditor.cs
Normal file
16
osu.Game.Rulesets.Osu/Tests/TestCaseEditor.cs
Normal file
@ -0,0 +1,16 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestCaseEditor : Game.Tests.Visual.TestCaseEditor
|
||||
{
|
||||
public TestCaseEditor()
|
||||
: base(new OsuRuleset())
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -130,6 +130,7 @@
|
||||
<Compile Include="Replays\OsuReplayFrame.cs" />
|
||||
<Compile Include="Replays\OsuReplayInputHandler.cs" />
|
||||
<Compile Include="Tests\OsuBeatmapConversionTest.cs" />
|
||||
<Compile Include="Tests\TestCaseEditor.cs" />
|
||||
<Compile Include="Tests\TestCaseHitCircle.cs" />
|
||||
<Compile Include="Tests\TestCaseHitCircleHidden.cs" />
|
||||
<Compile Include="Tests\TestCasePerformancePoints.cs" />
|
||||
|
@ -1,49 +0,0 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// 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<Type> 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);
|
||||
}
|
||||
}
|
||||
}
|
@ -126,7 +126,6 @@
|
||||
<Compile Include="Visual\TestCaseDirect.cs" />
|
||||
<Compile Include="Visual\TestCaseDrawableRoom.cs" />
|
||||
<Compile Include="Visual\TestCaseDrawings.cs" />
|
||||
<Compile Include="Visual\TestCaseEditor.cs" />
|
||||
<Compile Include="Visual\TestCaseEditorCompose.cs" />
|
||||
<Compile Include="Visual\TestCaseEditorComposeRadioButtons.cs" />
|
||||
<Compile Include="Visual\TestCaseEditorComposeTimeline.cs" />
|
||||
|
33
osu.Game/Tests/Visual/TestCaseEditor.cs
Normal file
33
osu.Game/Tests/Visual/TestCaseEditor.cs
Normal file
@ -0,0 +1,33 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// 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 TestCaseEditor : OsuTestCase
|
||||
{
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(Editor), typeof(EditorScreen) };
|
||||
|
||||
private readonly Ruleset ruleset;
|
||||
|
||||
protected TestCaseEditor(Ruleset ruleset)
|
||||
{
|
||||
this.ruleset = ruleset;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuGameBase osuGame)
|
||||
{
|
||||
osuGame.Beatmap.Value = new TestWorkingBeatmap(ruleset.RulesetInfo);
|
||||
|
||||
Child = new Editor();
|
||||
}
|
||||
}
|
||||
}
|
@ -902,6 +902,7 @@
|
||||
<Compile Include="Tests\Platform\TestStorage.cs" />
|
||||
<Compile Include="Tests\TestTestCase.cs" />
|
||||
<Compile Include="Tests\Visual\OsuTestCase.cs" />
|
||||
<Compile Include="Tests\Visual\TestCaseEditor.cs" />
|
||||
<Compile Include="Tests\Visual\TestCasePerformancePoints.cs" />
|
||||
<Compile Include="Tests\Visual\ScreenTestCase.cs" />
|
||||
<Compile Include="Tests\Visual\TestCasePlayer.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user