From cc9aeb53079f6f00af307fb0544e0335d9eebcc8 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 9 Nov 2023 22:57:12 +0300 Subject: [PATCH] Add test coverage --- .../TestSceneBackgroundScreenDefault.cs | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/osu.Game.Tests/Visual/Background/TestSceneBackgroundScreenDefault.cs b/osu.Game.Tests/Visual/Background/TestSceneBackgroundScreenDefault.cs index e902303505..37f2ee0b3f 100644 --- a/osu.Game.Tests/Visual/Background/TestSceneBackgroundScreenDefault.cs +++ b/osu.Game.Tests/Visual/Background/TestSceneBackgroundScreenDefault.cs @@ -205,6 +205,30 @@ namespace osu.Game.Tests.Visual.Background AddUntilStep("storyboard reloaded", () => screen.ChildrenOfType().SingleOrDefault()?.IsLoaded == true); } + [Test] + public void TestBeatmapBackgroundWithStoryboardButBeatmapHasNone() + { + BackgroundScreenBeatmap nestedScreen = null; + + setSupporter(true); + setSourceMode(BackgroundSource.BeatmapWithStoryboard); + + AddStep("change beatmap", () => Beatmap.Value = createTestWorkingBeatmapWithUniqueBackground()); + AddAssert("background changed", () => screen.CheckLastLoadChange() == true); + AddUntilStep("wait for beatmap background to be loaded", () => getCurrentBackground()?.GetType() == typeof(BeatmapBackgroundWithStoryboard)); + + AddUntilStep("no storyboard loaded", () => !screen.ChildrenOfType().Any()); + + AddStep("push new background to stack", () => stack.Push(nestedScreen = new BackgroundScreenBeatmap(Beatmap.Value))); + AddUntilStep("wait for screen to load", () => nestedScreen.IsLoaded && nestedScreen.IsCurrentScreen()); + + AddUntilStep("still no storyboard", () => !screen.ChildrenOfType().Any()); + + AddStep("go back", () => screen.MakeCurrent()); + + AddUntilStep("still no storyboard", () => !screen.ChildrenOfType().Any()); + } + [Test] public void TestBackgroundTypeSwitch() {