1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 05:27:23 +08:00

Add additional testing to check for extra children in the future

This commit is contained in:
Jamie Taylor 2019-03-06 18:55:01 +09:00
parent ab0ac7a82a
commit b5e89e2f3b
No known key found for this signature in database
GPG Key ID: 2ACFA8B6370B8C8C

View File

@ -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;
}
}
}