From 9090d13e05ffe278e31c951f7f8ebf9d990da11c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 25 Dec 2019 15:01:05 +0900 Subject: [PATCH] Simplify tests --- .../TestSceneLegacyBeatmapSkin.cs | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneLegacyBeatmapSkin.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneLegacyBeatmapSkin.cs index 9adcf26529..e26b671d57 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneLegacyBeatmapSkin.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneLegacyBeatmapSkin.cs @@ -9,8 +9,8 @@ using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Graphics; using osu.Framework.IO.Stores; +using osu.Framework.Testing; using osu.Game.Beatmaps; -using osu.Game.Graphics.Containers; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Screens; using osu.Game.Screens.Play; @@ -30,39 +30,33 @@ namespace osu.Game.Rulesets.Osu.Tests public void TestBeatmapComboColours() { ExposedPlayer player = null; - IReadOnlyList colours = null; - AddStep("load beatmap", () => player = loadBeatmap(false, true)); + AddStep("load coloured beatmap", () => player = loadBeatmap(false, true)); AddUntilStep("wait for player", () => player.IsLoaded); - AddStep("retrieve combo colours", () => colours = player.BeatmapSkin.GetConfig>(GlobalSkinConfiguration.ComboColours)?.Value); - AddAssert("is beatmap skin colours", () => colours.SequenceEqual(TestBeatmapSkin.Colours)); + AddAssert("is beatmap skin colours", () => player.UsableComboColours.SequenceEqual(TestBeatmapSkin.Colours)); } [Test] public void TestEmptyBeatmapComboColours() { ExposedPlayer player = null; - IReadOnlyList colours = null; AddStep("load no-colour beatmap", () => player = loadBeatmap(false, false)); AddUntilStep("wait for player", () => player.IsLoaded); - AddStep("retrieve combo colours", () => colours = player.BeatmapSkin.GetConfig>(GlobalSkinConfiguration.ComboColours)?.Value); - AddAssert("is default user skin colours", () => colours.SequenceEqual(SkinConfiguration.DefaultComboColours)); + AddAssert("is default user skin colours", () => player.UsableComboColours.SequenceEqual(SkinConfiguration.DefaultComboColours)); } [Test] public void TestEmptyBeatmapCustomSkinColours() { ExposedPlayer player = null; - IReadOnlyList colours = null; - AddStep("load no-colour beatmap", () => player = loadBeatmap(true, false)); + AddStep("load custom-skin colour", () => player = loadBeatmap(true, false)); AddUntilStep("wait for player", () => player.IsLoaded); - AddStep("retrieve combo colours", () => colours = player.BeatmapSkin.GetConfig>(GlobalSkinConfiguration.ComboColours)?.Value); - AddAssert("is custom user skin colours", () => colours.SequenceEqual(TestSkin.Colours)); + AddAssert("is custom user skin colours", () => player.UsableComboColours.SequenceEqual(TestSkin.Colours)); } private ExposedPlayer loadBeatmap(bool userHasCustomColours, bool beatmapHasColours) @@ -92,7 +86,10 @@ namespace osu.Game.Rulesets.Osu.Tests return dependencies; } - public BeatmapSkinProvidingContainer BeatmapSkin => GameplayClockContainer.OfType().First().OfType().First(); + public IReadOnlyList UsableComboColours => + GameplayClockContainer.ChildrenOfType() + .First() + .GetConfig>(GlobalSkinConfiguration.ComboColours)?.Value; } private class CustomSkinWorkingBeatmap : ClockBackedTestWorkingBeatmap