From 0c973feb53f1e76a593994340d522e1afb439e46 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 10 May 2021 12:34:21 +0900 Subject: [PATCH] Tidy up test scene --- .../TestSceneBeatmapMetadataDisplay.cs | 41 +++++++++---------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapMetadataDisplay.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapMetadataDisplay.cs index 0fbf42da6f..e80c453da9 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapMetadataDisplay.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapMetadataDisplay.cs @@ -35,27 +35,13 @@ namespace osu.Game.Tests.Visual.SongSelect 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()) - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Scale = new Vector2(1.5f), - Alpha = 0f, - }); - - AddStep("fade in", () => display.FadeIn(400, Easing.OutQuint)); - AddToggleStep("trigger loading", v => display.Loading = v); - } - [Test] public void TestLocal([Values("Beatmap", "Some long title and stuff")] string title, [Values("Trial", "Some1's very hardest difficulty")] string version) { - createTest(() => CreateWorkingBeatmap(new Beatmap + showMetadataForBeatmap(() => CreateWorkingBeatmap(new Beatmap { BeatmapInfo = { @@ -72,7 +58,7 @@ namespace osu.Game.Tests.Visual.SongSelect [Test] public void TestRandomFromDatabase() { - createTest(() => + showMetadataForBeatmap(() => { var allBeatmapSets = manager.GetAllUsableBeatmapSets(IncludedDetails.Minimal); if (allBeatmapSets.Count == 0) @@ -85,10 +71,23 @@ namespace osu.Game.Tests.Visual.SongSelect }); } - private IReadOnlyList getRandomMods() => Ruleset.Value.CreateInstance() - .GetAllMods() - .OrderBy(_ => RNG.Next()) - .Take(5) - .ToList(); + private void showMetadataForBeatmap(Func getBeatmap) + { + AddStep("setup display", () => + { + var randomMods = Ruleset.Value.CreateInstance().GetAllMods().OrderBy(_ => RNG.Next()).Take(5).ToList(); + + Child = display = new BeatmapMetadataDisplay(getBeatmap(), new Bindable>(randomMods), Empty()) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Scale = new Vector2(1.5f), + Alpha = 0f, + }; + }); + + AddStep("fade in", () => display.FadeIn(400, Easing.OutQuint)); + AddToggleStep("trigger loading", v => display.Loading = v); + } } }