mirror of
https://github.com/ppy/osu.git
synced 2025-03-23 07:27:45 +08:00
Merge pull request #8778 from frenzibyte/test-scene-create-ruleset
Add method of creating a ruleset for testing with in OsuTestScene
This commit is contained in:
commit
c09868780e
@ -13,8 +13,10 @@ namespace osu.Game.Rulesets.Catch.Tests.Mods
|
||||
{
|
||||
public class TestSceneCatchModPerfect : ModPerfectTestScene
|
||||
{
|
||||
protected override Ruleset CreatePlayerRuleset() => new CatchRuleset();
|
||||
|
||||
public TestSceneCatchModPerfect()
|
||||
: base(new CatchRuleset(), new CatchModPerfect())
|
||||
: base(new CatchModPerfect())
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -12,13 +12,8 @@ using osuTK;
|
||||
|
||||
namespace osu.Game.Rulesets.Catch.Tests
|
||||
{
|
||||
public class TestSceneAutoJuiceStream : PlayerTestScene
|
||||
public class TestSceneAutoJuiceStream : TestSceneCatchPlayer
|
||||
{
|
||||
public TestSceneAutoJuiceStream()
|
||||
: base(new CatchRuleset())
|
||||
{
|
||||
}
|
||||
|
||||
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset)
|
||||
{
|
||||
var beatmap = new Beatmap
|
||||
|
@ -4,18 +4,12 @@
|
||||
using NUnit.Framework;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Catch.Objects;
|
||||
using osu.Game.Tests.Visual;
|
||||
|
||||
namespace osu.Game.Rulesets.Catch.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestSceneBananaShower : PlayerTestScene
|
||||
public class TestSceneBananaShower : TestSceneCatchPlayer
|
||||
{
|
||||
public TestSceneBananaShower()
|
||||
: base(new CatchRuleset())
|
||||
{
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestBananaShower()
|
||||
{
|
||||
|
@ -9,9 +9,6 @@ namespace osu.Game.Rulesets.Catch.Tests
|
||||
[TestFixture]
|
||||
public class TestSceneCatchPlayer : PlayerTestScene
|
||||
{
|
||||
public TestSceneCatchPlayer()
|
||||
: base(new CatchRuleset())
|
||||
{
|
||||
}
|
||||
protected override Ruleset CreatePlayerRuleset() => new CatchRuleset();
|
||||
}
|
||||
}
|
||||
|
@ -4,18 +4,12 @@
|
||||
using NUnit.Framework;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Catch.Objects;
|
||||
using osu.Game.Tests.Visual;
|
||||
|
||||
namespace osu.Game.Rulesets.Catch.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestSceneCatchStacker : PlayerTestScene
|
||||
public class TestSceneCatchStacker : TestSceneCatchPlayer
|
||||
{
|
||||
public TestSceneCatchStacker()
|
||||
: base(new CatchRuleset())
|
||||
{
|
||||
}
|
||||
|
||||
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset)
|
||||
{
|
||||
var beatmap = new Beatmap
|
||||
|
@ -9,19 +9,13 @@ using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Catch.Objects;
|
||||
using osu.Game.Rulesets.Catch.UI;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Tests.Visual;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Rulesets.Catch.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestSceneHyperDash : PlayerTestScene
|
||||
public class TestSceneHyperDash : TestSceneCatchPlayer
|
||||
{
|
||||
public TestSceneHyperDash()
|
||||
: base(new CatchRuleset())
|
||||
{
|
||||
}
|
||||
|
||||
protected override bool Autoplay => true;
|
||||
|
||||
[Test]
|
||||
|
@ -7,18 +7,12 @@ using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Catch.Objects;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
using osu.Game.Tests.Visual;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Rulesets.Catch.Tests
|
||||
{
|
||||
public class TestSceneJuiceStream : PlayerTestScene
|
||||
public class TestSceneJuiceStream : TestSceneCatchPlayer
|
||||
{
|
||||
public TestSceneJuiceStream()
|
||||
: base(new CatchRuleset())
|
||||
{
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestJuiceStreamEndingCombo()
|
||||
{
|
||||
|
@ -10,8 +10,10 @@ namespace osu.Game.Rulesets.Mania.Tests.Mods
|
||||
{
|
||||
public class TestSceneManiaModPerfect : ModPerfectTestScene
|
||||
{
|
||||
protected override Ruleset CreatePlayerRuleset() => new ManiaRuleset();
|
||||
|
||||
public TestSceneManiaModPerfect()
|
||||
: base(new ManiaRuleset(), new ManiaModPerfect())
|
||||
: base(new ManiaModPerfect())
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -5,11 +5,8 @@ using osu.Game.Tests.Visual;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Tests
|
||||
{
|
||||
public class TestScenePlayer : PlayerTestScene
|
||||
public class TestSceneManiaPlayer : PlayerTestScene
|
||||
{
|
||||
public TestScenePlayer()
|
||||
: base(new ManiaRuleset())
|
||||
{
|
||||
}
|
||||
protected override Ruleset CreatePlayerRuleset() => new ManiaRuleset();
|
||||
}
|
||||
}
|
12
osu.Game.Rulesets.Osu.Tests/Mods/OsuModTestScene.cs
Normal file
12
osu.Game.Rulesets.Osu.Tests/Mods/OsuModTestScene.cs
Normal file
@ -0,0 +1,12 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Game.Tests.Visual;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Tests.Mods
|
||||
{
|
||||
public class OsuModTestScene : ModTestScene
|
||||
{
|
||||
protected override Ruleset CreatePlayerRuleset() => new OsuRuleset();
|
||||
}
|
||||
}
|
@ -9,17 +9,11 @@ using osu.Framework.Utils;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Rulesets.Osu.Mods;
|
||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||
using osu.Game.Tests.Visual;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Tests.Mods
|
||||
{
|
||||
public class TestSceneOsuModDifficultyAdjust : ModTestScene
|
||||
public class TestSceneOsuModDifficultyAdjust : OsuModTestScene
|
||||
{
|
||||
public TestSceneOsuModDifficultyAdjust()
|
||||
: base(new OsuRuleset())
|
||||
{
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestNoAdjustment() => CreateModTest(new ModTestData
|
||||
{
|
||||
|
@ -4,17 +4,11 @@
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Rulesets.Osu.Mods;
|
||||
using osu.Game.Tests.Visual;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Tests.Mods
|
||||
{
|
||||
public class TestSceneOsuModDoubleTime : ModTestScene
|
||||
public class TestSceneOsuModDoubleTime : OsuModTestScene
|
||||
{
|
||||
public TestSceneOsuModDoubleTime()
|
||||
: base(new OsuRuleset())
|
||||
{
|
||||
}
|
||||
|
||||
[TestCase(0.5)]
|
||||
[TestCase(1.01)]
|
||||
[TestCase(1.5)]
|
||||
|
@ -8,18 +8,12 @@ using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
using osu.Game.Rulesets.Osu.Mods;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Tests.Visual;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Tests.Mods
|
||||
{
|
||||
public class TestSceneOsuModHidden : ModTestScene
|
||||
public class TestSceneOsuModHidden : OsuModTestScene
|
||||
{
|
||||
public TestSceneOsuModHidden()
|
||||
: base(new OsuRuleset())
|
||||
{
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDefaultBeatmapTest() => CreateModTest(new ModTestData
|
||||
{
|
||||
|
@ -13,8 +13,10 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
|
||||
{
|
||||
public class TestSceneOsuModPerfect : ModPerfectTestScene
|
||||
{
|
||||
protected override Ruleset CreatePlayerRuleset() => new OsuRuleset();
|
||||
|
||||
public TestSceneOsuModPerfect()
|
||||
: base(new OsuRuleset(), new OsuModPerfect())
|
||||
: base(new OsuModPerfect())
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -4,19 +4,13 @@
|
||||
using NUnit.Framework;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Tests.Visual;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestSceneHitCircleLongCombo : PlayerTestScene
|
||||
public class TestSceneHitCircleLongCombo : TestSceneOsuPlayer
|
||||
{
|
||||
public TestSceneHitCircleLongCombo()
|
||||
: base(new OsuRuleset())
|
||||
{
|
||||
}
|
||||
|
||||
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset)
|
||||
{
|
||||
var beatmap = new Beatmap
|
||||
|
@ -19,10 +19,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
{
|
||||
public class TestSceneMissHitWindowJudgements : ModTestScene
|
||||
{
|
||||
public TestSceneMissHitWindowJudgements()
|
||||
: base(new OsuRuleset())
|
||||
{
|
||||
}
|
||||
protected override Ruleset CreatePlayerRuleset() => new OsuRuleset();
|
||||
|
||||
[Test]
|
||||
public void TestMissViaEarlyHit()
|
||||
|
@ -9,9 +9,6 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
[TestFixture]
|
||||
public class TestSceneOsuPlayer : PlayerTestScene
|
||||
{
|
||||
public TestSceneOsuPlayer()
|
||||
: base(new OsuRuleset())
|
||||
{
|
||||
}
|
||||
protected override Ruleset CreatePlayerRuleset() => new OsuRuleset();
|
||||
}
|
||||
}
|
||||
|
@ -25,13 +25,12 @@ using osu.Game.Tests.Visual;
|
||||
namespace osu.Game.Rulesets.Osu.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestSceneSkinFallbacks : PlayerTestScene
|
||||
public class TestSceneSkinFallbacks : TestSceneOsuPlayer
|
||||
{
|
||||
private readonly TestSource testUserSkin;
|
||||
private readonly TestSource testBeatmapSkin;
|
||||
|
||||
public TestSceneSkinFallbacks()
|
||||
: base(new OsuRuleset())
|
||||
{
|
||||
testUserSkin = new TestSource("user");
|
||||
testBeatmapSkin = new TestSource("beatmap");
|
||||
|
@ -12,8 +12,10 @@ namespace osu.Game.Rulesets.Taiko.Tests.Mods
|
||||
{
|
||||
public class TestSceneTaikoModPerfect : ModPerfectTestScene
|
||||
{
|
||||
protected override Ruleset CreatePlayerRuleset() => new TestTaikoRuleset();
|
||||
|
||||
public TestSceneTaikoModPerfect()
|
||||
: base(new TestTaikoRuleset(), new TaikoModPerfect())
|
||||
: base(new TaikoModPerfect())
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ using osu.Framework.Testing;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Taiko.Objects.Drawables;
|
||||
using osu.Game.Tests.Visual;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Tests
|
||||
{
|
||||
@ -14,13 +13,8 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
||||
/// Taiko has some interesting rules for legacy mappings.
|
||||
/// </summary>
|
||||
[HeadlessTest]
|
||||
public class TestSceneSampleOutput : PlayerTestScene
|
||||
public class TestSceneSampleOutput : TestSceneTaikoPlayer
|
||||
{
|
||||
public TestSceneSampleOutput()
|
||||
: base(new TaikoRuleset())
|
||||
{
|
||||
}
|
||||
|
||||
public override void SetUpSteps()
|
||||
{
|
||||
base.SetUpSteps();
|
||||
|
@ -5,17 +5,11 @@ using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Taiko.Objects;
|
||||
using osu.Game.Tests.Visual;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Tests
|
||||
{
|
||||
public class TestSceneSwellJudgements : PlayerTestScene
|
||||
public class TestSceneSwellJudgements : TestSceneTaikoPlayer
|
||||
{
|
||||
public TestSceneSwellJudgements()
|
||||
: base(new TaikoRuleset())
|
||||
{
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestZeroTickTimeOffsets()
|
||||
{
|
||||
|
12
osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoPlayer.cs
Normal file
12
osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoPlayer.cs
Normal file
@ -0,0 +1,12 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Game.Tests.Visual;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Tests
|
||||
{
|
||||
public class TestSceneTaikoPlayer : PlayerTestScene
|
||||
{
|
||||
protected override Ruleset CreatePlayerRuleset() => new TaikoRuleset();
|
||||
}
|
||||
}
|
@ -11,13 +11,8 @@ using osu.Game.Tests.Visual;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Tests
|
||||
{
|
||||
public class TestSceneTaikoSuddenDeath : PlayerTestScene
|
||||
public class TestSceneTaikoSuddenDeath : TestSceneTaikoPlayer
|
||||
{
|
||||
public TestSceneTaikoSuddenDeath()
|
||||
: base(new TaikoRuleset())
|
||||
{
|
||||
}
|
||||
|
||||
protected override bool AllowFail => true;
|
||||
|
||||
protected override TestPlayer CreatePlayer(Ruleset ruleset)
|
||||
|
@ -16,17 +16,16 @@ using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.Formats;
|
||||
using osu.Game.IO;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Skinning;
|
||||
using osu.Game.Storyboards;
|
||||
using osu.Game.Tests.Resources;
|
||||
using osu.Game.Tests.Visual;
|
||||
using osu.Game.Tests.Visual.Gameplay;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Tests.Gameplay
|
||||
{
|
||||
[HeadlessTest]
|
||||
public class TestSceneHitObjectSamples : PlayerTestScene
|
||||
public class TestSceneHitObjectSamples : OsuPlayerTestScene
|
||||
{
|
||||
private readonly SkinInfo userSkinInfo = new SkinInfo();
|
||||
|
||||
@ -44,11 +43,6 @@ namespace osu.Game.Tests.Gameplay
|
||||
|
||||
protected override bool HasCustomSteps => true;
|
||||
|
||||
public TestSceneHitObjectSamples()
|
||||
: base(new OsuRuleset())
|
||||
{
|
||||
}
|
||||
|
||||
private SkinSourceDependencyContainer dependencies;
|
||||
|
||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||
|
@ -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();
|
||||
|
16
osu.Game.Tests/Visual/Gameplay/OsuPlayerTestScene.cs
Normal file
16
osu.Game.Tests/Visual/Gameplay/OsuPlayerTestScene.cs
Normal file
@ -0,0 +1,16 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see cref="PlayerTestScene"/> with an arbitrary ruleset value to test with.
|
||||
/// </summary>
|
||||
public abstract class OsuPlayerTestScene : PlayerTestScene
|
||||
{
|
||||
protected override Ruleset CreatePlayerRuleset() => new OsuRuleset();
|
||||
}
|
||||
}
|
@ -10,14 +10,13 @@ using osu.Framework.Testing;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Storyboards;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
public class TestSceneCompletionCancellation : PlayerTestScene
|
||||
public class TestSceneCompletionCancellation : OsuPlayerTestScene
|
||||
{
|
||||
private Track track;
|
||||
|
||||
@ -29,11 +28,6 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
|
||||
protected override bool AllowFail => false;
|
||||
|
||||
public TestSceneCompletionCancellation()
|
||||
: base(new OsuRuleset())
|
||||
{
|
||||
}
|
||||
|
||||
[SetUpSteps]
|
||||
public override void SetUpSteps()
|
||||
{
|
||||
|
@ -10,23 +10,17 @@ using osu.Framework.Utils;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Storyboards;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
public class TestSceneGameplayRewinding : PlayerTestScene
|
||||
public class TestSceneGameplayRewinding : OsuPlayerTestScene
|
||||
{
|
||||
[Resolved]
|
||||
private AudioManager audioManager { get; set; }
|
||||
|
||||
public TestSceneGameplayRewinding()
|
||||
: base(new OsuRuleset())
|
||||
{
|
||||
}
|
||||
|
||||
private Track track;
|
||||
|
||||
protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap, Storyboard storyboard = null)
|
||||
|
@ -10,14 +10,13 @@ using osu.Framework.Testing;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Cursor;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Screens.Play;
|
||||
using osuTK;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
public class TestScenePause : PlayerTestScene
|
||||
public class TestScenePause : OsuPlayerTestScene
|
||||
{
|
||||
protected new PausePlayer Player => (PausePlayer)base.Player;
|
||||
|
||||
@ -26,7 +25,6 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
protected override Container<Drawable> Content => content;
|
||||
|
||||
public TestScenePause()
|
||||
: base(new OsuRuleset())
|
||||
{
|
||||
base.Content.Add(content = new MenuCursorContainer { RelativeSizeAxes = Axes.Both });
|
||||
}
|
||||
|
@ -8,12 +8,11 @@ using osu.Framework.Platform;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
[HeadlessTest] // we alter unsafe properties on the game host to test inactive window state.
|
||||
public class TestScenePauseWhenInactive : PlayerTestScene
|
||||
public class TestScenePauseWhenInactive : OsuPlayerTestScene
|
||||
{
|
||||
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset)
|
||||
{
|
||||
@ -27,11 +26,6 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
[Resolved]
|
||||
private GameHost host { get; set; }
|
||||
|
||||
public TestScenePauseWhenInactive()
|
||||
: base(new OsuRuleset())
|
||||
{
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDoesntPauseDuringIntro()
|
||||
{
|
||||
|
@ -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,10 @@ 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);
|
||||
Beatmap.Value = CreateWorkingBeatmap(Ruleset.Value);
|
||||
}
|
||||
|
||||
public override void SetUpSteps()
|
||||
@ -37,6 +31,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();
|
||||
}
|
||||
}
|
||||
|
@ -10,13 +10,10 @@ namespace osu.Game.Tests.Visual
|
||||
{
|
||||
public abstract class ModPerfectTestScene : ModTestScene
|
||||
{
|
||||
private readonly Ruleset ruleset;
|
||||
private readonly ModPerfect mod;
|
||||
|
||||
protected ModPerfectTestScene(Ruleset ruleset, ModPerfect mod)
|
||||
: base(ruleset)
|
||||
protected ModPerfectTestScene(ModPerfect mod)
|
||||
{
|
||||
this.ruleset = ruleset;
|
||||
this.mod = mod;
|
||||
}
|
||||
|
||||
@ -25,7 +22,7 @@ namespace osu.Game.Tests.Visual
|
||||
Mod = mod,
|
||||
Beatmap = new Beatmap
|
||||
{
|
||||
BeatmapInfo = { Ruleset = ruleset.RulesetInfo },
|
||||
BeatmapInfo = { Ruleset = CreatePlayerRuleset().RulesetInfo },
|
||||
HitObjects = { testData.HitObject }
|
||||
},
|
||||
Autoplay = !shouldMiss,
|
||||
|
@ -14,11 +14,6 @@ namespace osu.Game.Tests.Visual
|
||||
{
|
||||
protected sealed override bool HasCustomSteps => true;
|
||||
|
||||
protected ModTestScene(Ruleset ruleset)
|
||||
: base(ruleset)
|
||||
{
|
||||
}
|
||||
|
||||
private ModTestData currentTestData;
|
||||
|
||||
protected void CreateModTest(ModTestData testData) => CreateTest(() =>
|
||||
|
@ -6,6 +6,7 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
@ -125,6 +126,15 @@ namespace osu.Game.Tests.Visual
|
||||
[Resolved]
|
||||
protected AudioManager Audio { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates the ruleset to be used for this test scene.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// When testing against ruleset-specific components, this method must be overriden to their corresponding ruleset.
|
||||
/// </remarks>
|
||||
[CanBeNull]
|
||||
protected virtual Ruleset CreateRuleset() => null;
|
||||
|
||||
protected virtual IBeatmap CreateBeatmap(RulesetInfo ruleset) => new TestBeatmap(ruleset);
|
||||
|
||||
protected WorkingBeatmap CreateWorkingBeatmap(RulesetInfo ruleset) =>
|
||||
@ -136,7 +146,7 @@ namespace osu.Game.Tests.Visual
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(RulesetStore rulesets)
|
||||
{
|
||||
Ruleset.Value = rulesets.AvailableRulesets.First();
|
||||
Ruleset.Value = CreateRuleset()?.RulesetInfo ?? rulesets.AvailableRulesets.First();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Testing;
|
||||
@ -19,15 +20,8 @@ namespace osu.Game.Tests.Visual
|
||||
/// </summary>
|
||||
protected virtual bool HasCustomSteps { get; } = false;
|
||||
|
||||
private readonly Ruleset ruleset;
|
||||
|
||||
protected TestPlayer Player;
|
||||
|
||||
protected PlayerTestScene(Ruleset ruleset)
|
||||
{
|
||||
this.ruleset = ruleset;
|
||||
}
|
||||
|
||||
protected OsuConfigManager LocalConfig;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -53,7 +47,7 @@ namespace osu.Game.Tests.Visual
|
||||
|
||||
action?.Invoke();
|
||||
|
||||
AddStep(ruleset.RulesetInfo.Name, LoadPlayer);
|
||||
AddStep(CreatePlayerRuleset().Description, LoadPlayer);
|
||||
AddUntilStep("player loaded", () => Player.IsLoaded && Player.Alpha == 1);
|
||||
}
|
||||
|
||||
@ -63,11 +57,10 @@ namespace osu.Game.Tests.Visual
|
||||
|
||||
protected void LoadPlayer()
|
||||
{
|
||||
var ruleset = Ruleset.Value.CreateInstance();
|
||||
var beatmap = CreateBeatmap(ruleset.RulesetInfo);
|
||||
|
||||
Beatmap.Value = CreateWorkingBeatmap(beatmap);
|
||||
Ruleset.Value = ruleset.RulesetInfo;
|
||||
|
||||
SelectedMods.Value = Array.Empty<Mod>();
|
||||
|
||||
if (!AllowFail)
|
||||
@ -88,6 +81,14 @@ namespace osu.Game.Tests.Visual
|
||||
LoadScreen(Player);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates the ruleset for setting up the <see cref="Player"/> component.
|
||||
/// </summary>
|
||||
[NotNull]
|
||||
protected abstract Ruleset CreatePlayerRuleset();
|
||||
|
||||
protected sealed override Ruleset CreateRuleset() => CreatePlayerRuleset();
|
||||
|
||||
protected virtual TestPlayer CreatePlayer(Ruleset ruleset) => new TestPlayer(false, false);
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Graphics;
|
||||
@ -32,9 +33,6 @@ namespace osu.Game.Tests.Visual
|
||||
{
|
||||
}
|
||||
|
||||
// Required to be part of the per-ruleset implementation to construct the newer version of the Ruleset.
|
||||
protected abstract Ruleset CreateRulesetForSkinProvider();
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio, SkinManager skinManager)
|
||||
{
|
||||
@ -107,7 +105,7 @@ namespace osu.Game.Tests.Visual
|
||||
{
|
||||
new OutlineBox { Alpha = autoSize ? 1 : 0 },
|
||||
mainProvider.WithChild(
|
||||
new SkinProvidingContainer(CreateRulesetForSkinProvider().CreateLegacySkinProvider(mainProvider, beatmap))
|
||||
new SkinProvidingContainer(Ruleset.Value.CreateInstance().CreateLegacySkinProvider(mainProvider, beatmap))
|
||||
{
|
||||
Child = created,
|
||||
RelativeSizeAxes = !autoSize ? Axes.Both : Axes.None,
|
||||
@ -120,6 +118,14 @@ namespace osu.Game.Tests.Visual
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates the ruleset for adding the corresponding skin transforming component.
|
||||
/// </summary>
|
||||
[NotNull]
|
||||
protected abstract Ruleset CreateRulesetForSkinProvider();
|
||||
|
||||
protected sealed override Ruleset CreateRuleset() => CreateRulesetForSkinProvider();
|
||||
|
||||
protected virtual IBeatmap CreateBeatmapForSkinProvider() => CreateWorkingBeatmap(Ruleset.Value).GetPlayableBeatmap(Ruleset.Value);
|
||||
|
||||
private class OutlineBox : CompositeDrawable
|
||||
|
Loading…
x
Reference in New Issue
Block a user