mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Add test coverage for keeping same background instance
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
@ -64,15 +65,17 @@ namespace osu.Game.Tests.Visual.Background
|
|||||||
AddUntilStep("is beatmap background", () => getCurrentBackground() is BeatmapBackground);
|
AddUntilStep("is beatmap background", () => getCurrentBackground() is BeatmapBackground);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[TestCase(BackgroundSource.Beatmap, typeof(BeatmapBackground))]
|
||||||
public void TestBeatmapDoesntReloadOnNoChange()
|
[TestCase(BackgroundSource.BeatmapWithStoryboard, typeof(BeatmapBackgroundWithStoryboard))]
|
||||||
|
[TestCase(BackgroundSource.Skin, typeof(SkinBackground))]
|
||||||
|
public void TestBackgroundDoesntReloadOnNoChange(BackgroundSource source, Type backgroundType)
|
||||||
{
|
{
|
||||||
BeatmapBackground last = null;
|
Graphics.Backgrounds.Background last = null;
|
||||||
|
|
||||||
setSourceMode(BackgroundSource.Beatmap);
|
setSourceMode(source);
|
||||||
setSupporter(true);
|
setSupporter(true);
|
||||||
|
|
||||||
AddUntilStep("wait for beatmap background to be loaded", () => (last = getCurrentBackground() as BeatmapBackground) != null);
|
AddUntilStep("wait for beatmap background to be loaded", () => (last = getCurrentBackground())?.GetType() == backgroundType);
|
||||||
AddAssert("next doesn't load new background", () => screen.Next() == false);
|
AddAssert("next doesn't load new background", () => screen.Next() == false);
|
||||||
|
|
||||||
// doesn't really need to be checked but might as well.
|
// doesn't really need to be checked but might as well.
|
||||||
|
Reference in New Issue
Block a user