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