From 8fba655d2e9007449f19b67abf2876ce61656b67 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 8 May 2021 21:20:17 +0300 Subject: [PATCH] Allow changing ruleset during test --- .../TestSceneBeatmapMetadataDisplay.cs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapMetadataDisplay.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapMetadataDisplay.cs index f41180acf2..0fbf42da6f 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapMetadataDisplay.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapMetadataDisplay.cs @@ -10,6 +10,7 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Utils; using osu.Game.Beatmaps; +using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; using osu.Game.Screens.Play; using osuTK; @@ -23,7 +24,18 @@ namespace osu.Game.Tests.Visual.SongSelect [Resolved] private BeatmapManager manager { get; set; } - private void createDisplay(Func getBeatmap) + [Resolved] + private RulesetStore rulesets { get; set; } + + protected override void LoadComplete() + { + base.LoadComplete(); + + foreach (var ruleset in rulesets.AvailableRulesets) + AddStep($"switch to {ruleset.Name}", () => Ruleset.Value = ruleset); + } + + private void createTest(Func getBeatmap) { AddStep("setup display", () => Child = display = new BeatmapMetadataDisplay(getBeatmap(), new Bindable>(getRandomMods()), Empty()) { @@ -43,7 +55,7 @@ namespace osu.Game.Tests.Visual.SongSelect [Values("Trial", "Some1's very hardest difficulty")] string version) { - createDisplay(() => CreateWorkingBeatmap(new Beatmap + createTest(() => CreateWorkingBeatmap(new Beatmap { BeatmapInfo = { @@ -60,7 +72,7 @@ namespace osu.Game.Tests.Visual.SongSelect [Test] public void TestRandomFromDatabase() { - createDisplay(() => + createTest(() => { var allBeatmapSets = manager.GetAllUsableBeatmapSets(IncludedDetails.Minimal); if (allBeatmapSets.Count == 0)