From f14774e795ab68f593008346a43c1c70401681e7 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 15 Jun 2020 11:47:31 +0300 Subject: [PATCH] Rename to TestSceneRulesetDependencies, mark as headless and avoid throwing Avoid throw not implemented exceptions from TestRuleset since it's now set as the global ruleset bindable automatically by base, throwing to innocent components is probably not needed. --- ...ene.cs => TestSceneRulesetDependencies.cs} | 41 +++++++++++++------ 1 file changed, 28 insertions(+), 13 deletions(-) rename osu.Game.Tests/Testing/{TestSceneRulesetTestScene.cs => TestSceneRulesetDependencies.cs} (73%) diff --git a/osu.Game.Tests/Testing/TestSceneRulesetTestScene.cs b/osu.Game.Tests/Testing/TestSceneRulesetDependencies.cs similarity index 73% rename from osu.Game.Tests/Testing/TestSceneRulesetTestScene.cs rename to osu.Game.Tests/Testing/TestSceneRulesetDependencies.cs index 6d8502e651..80f1b02794 100644 --- a/osu.Game.Tests/Testing/TestSceneRulesetTestScene.cs +++ b/osu.Game.Tests/Testing/TestSceneRulesetDependencies.cs @@ -9,21 +9,28 @@ using osu.Framework.Audio.Track; using osu.Framework.Configuration.Tracking; using osu.Framework.Graphics.Textures; using osu.Framework.IO.Stores; +using osu.Framework.Testing; using osu.Game.Beatmaps; using osu.Game.Configuration; using osu.Game.Rulesets; using osu.Game.Rulesets.Configuration; using osu.Game.Rulesets.Difficulty; using osu.Game.Rulesets.Mods; -using osu.Game.Rulesets.Testing; using osu.Game.Rulesets.UI; using osu.Game.Tests.Resources; using osu.Game.Tests.Visual; namespace osu.Game.Tests.Testing { - public class TestSceneRulesetTestScene : OsuTestScene, IRulesetTestScene + /// + /// A test scene ensuring the dependencies for the + /// provided ruleset below are cached at the base implementation. + /// + [HeadlessTest] + public class TestSceneRulesetDependencies : OsuTestScene { + protected override Ruleset CreateRuleset() => new TestRuleset(); + [Test] public void TestRetrieveTexture() { @@ -45,8 +52,6 @@ namespace osu.Game.Tests.Testing Dependencies.Get() != null); } - public Ruleset CreateRuleset() => new TestRuleset(); - private class TestRuleset : Ruleset { public override string Description => string.Empty; @@ -62,19 +67,29 @@ namespace osu.Game.Tests.Testing public override IResourceStore CreateResourceStore() => new NamespacedResourceStore(TestResources.GetStore(), @"Resources"); public override IRulesetConfigManager CreateConfig(SettingsStore settings) => new TestRulesetConfigManager(); - public override IEnumerable GetModsFor(ModType type) => throw new NotImplementedException(); - public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList mods = null) => throw new NotImplementedException(); - public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => throw new NotImplementedException(); - public override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => throw new NotImplementedException(); + public override IEnumerable GetModsFor(ModType type) => Array.Empty(); + public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList mods = null) => null; + public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => null; + public override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => null; } private class TestRulesetConfigManager : IRulesetConfigManager { - public void Load() => throw new NotImplementedException(); - public bool Save() => throw new NotImplementedException(); - public TrackedSettings CreateTrackedSettings() => throw new NotImplementedException(); - public void LoadInto(TrackedSettings settings) => throw new NotImplementedException(); - public void Dispose() => throw new NotImplementedException(); + public void Load() + { + } + + public bool Save() => true; + + public TrackedSettings CreateTrackedSettings() => new TrackedSettings(); + + public void LoadInto(TrackedSettings settings) + { + } + + public void Dispose() + { + } } } }