Add test coverage

This commit is contained in:
Salman Ahmed 2023-11-09 22:57:12 +03:00
parent 768a31b2f5
commit cc9aeb5307

View File

@ -205,6 +205,30 @@ namespace osu.Game.Tests.Visual.Background
AddUntilStep("storyboard reloaded", () => screen.ChildrenOfType<DrawableStoryboard>().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<DrawableStoryboard>().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<DrawableStoryboard>().Any());
AddStep("go back", () => screen.MakeCurrent());
AddUntilStep("still no storyboard", () => !screen.ChildrenOfType<DrawableStoryboard>().Any());
}
[Test]
public void TestBackgroundTypeSwitch()
{