mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 17:07:38 +08:00
Add additional testing to check for extra children in the future
This commit is contained in:
parent
ab0ac7a82a
commit
b5e89e2f3b
@ -16,7 +16,7 @@ namespace osu.Game.Tests.Visual
|
||||
{
|
||||
public class TestCaseUpdateableBeatmapBackgroundSprite : OsuTestCase
|
||||
{
|
||||
private UpdateableBeatmapBackgroundSprite backgroundSprite;
|
||||
private TestUpdateableBeatmapBackgroundSprite backgroundSprite;
|
||||
|
||||
[Resolved]
|
||||
private BeatmapManager beatmaps { get; set; }
|
||||
@ -28,30 +28,39 @@ namespace osu.Game.Tests.Visual
|
||||
|
||||
var imported = ImportBeatmapTest.LoadOszIntoOsu(osu);
|
||||
|
||||
Child = backgroundSprite = new UpdateableBeatmapBackgroundSprite { RelativeSizeAxes = Axes.Both };
|
||||
Child = backgroundSprite = new TestUpdateableBeatmapBackgroundSprite { RelativeSizeAxes = Axes.Both };
|
||||
|
||||
backgroundSprite.Beatmap.BindTo(beatmapBindable);
|
||||
|
||||
var req = new GetBeatmapSetRequest(1);
|
||||
api.Queue(req);
|
||||
|
||||
AddStep("null", () => beatmapBindable.Value = null);
|
||||
|
||||
AddStep("imported", () => beatmapBindable.Value = imported.Beatmaps.First());
|
||||
AddStep("load null beatmap", () => beatmapBindable.Value = null);
|
||||
AddWaitStep(20, "wait for transition...");
|
||||
AddAssert("ensure only 1 child is present", () => backgroundSprite.ChildCount == 1);
|
||||
AddStep("load imported beatmap", () => beatmapBindable.Value = imported.Beatmaps.First());
|
||||
AddWaitStep(20, "wait for transition...");
|
||||
AddAssert("ensure only 1 child is present", () => backgroundSprite.ChildCount == 1);
|
||||
|
||||
if (api.IsLoggedIn)
|
||||
{
|
||||
AddUntilStep(() => req.Result != null, "wait for api response");
|
||||
|
||||
AddStep("online", () => beatmapBindable.Value = new BeatmapInfo
|
||||
AddStep("load online beatmap", () => beatmapBindable.Value = new BeatmapInfo
|
||||
{
|
||||
BeatmapSet = req.Result?.ToBeatmapSet(rulesets)
|
||||
});
|
||||
AddWaitStep(20, "wait for transition...");
|
||||
AddAssert("ensure only 1 child is present", () => backgroundSprite.ChildCount == 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddStep("online (login first)", () => { });
|
||||
}
|
||||
}
|
||||
|
||||
private class TestUpdateableBeatmapBackgroundSprite : UpdateableBeatmapBackgroundSprite
|
||||
{
|
||||
public int ChildCount => InternalChildren.Count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user