Add failing test coverage of beatmap update flow w/ split diffs

This commit is contained in:
Bartłomiej Dach 2023-08-28 09:51:37 +02:00
parent 10b1450138
commit 3a6920c306
No known key found for this signature in database
1 changed files with 52 additions and 0 deletions

View File

@ -15,6 +15,7 @@
using osu.Game.Overlays.Dialog;
using osu.Game.Screens.Select;
using osu.Game.Screens.Select.Carousel;
using osu.Game.Screens.Select.Filter;
using osu.Game.Tests.Online;
using osu.Game.Tests.Resources;
using osuTK.Input;
@ -192,6 +193,57 @@ public void TestUpdateLocalBeatmap()
AddStep("release mouse button", () => InputManager.ReleaseButton(MouseButton.Left));
}
[Test]
public void TestSplitDisplay()
{
ArchiveDownloadRequest<IBeatmapSetInfo>? downloadRequest = null;
AddStep("set difficulty sort mode", () => carousel.Filter(new FilterCriteria { Sort = SortMode.Difficulty }));
AddStep("update online hash", () =>
{
testBeatmapSetInfo.Beatmaps.First().OnlineMD5Hash = "different hash";
testBeatmapSetInfo.Beatmaps.First().LastOnlineUpdate = DateTimeOffset.Now;
carousel.UpdateBeatmapSet(testBeatmapSetInfo);
});
AddUntilStep("multiple \"sets\" visible", () => carousel.ChildrenOfType<DrawableCarouselBeatmapSet>().Count(), () => Is.GreaterThan(1));
AddUntilStep("update button visible", getUpdateButton, () => Is.Not.Null);
AddStep("click button", () => getUpdateButton()?.TriggerClick());
AddUntilStep("wait for download started", () =>
{
downloadRequest = beatmapDownloader.GetExistingDownload(testBeatmapSetInfo);
return downloadRequest != null;
});
AddUntilStep("wait for button disabled", () => getUpdateButton()?.Enabled.Value == false);
AddUntilStep("progress download to completion", () =>
{
if (downloadRequest is TestSceneOnlinePlayBeatmapAvailabilityTracker.TestDownloadRequest testRequest)
{
testRequest.SetProgress(testRequest.Progress + 0.1f);
if (testRequest.Progress >= 1)
{
testRequest.TriggerSuccess();
// usually this would be done by the import process.
testBeatmapSetInfo.Beatmaps.First().MD5Hash = "different hash";
testBeatmapSetInfo.Beatmaps.First().LastOnlineUpdate = DateTimeOffset.Now;
// usually this would be done by a realm subscription.
carousel.UpdateBeatmapSet(testBeatmapSetInfo);
return true;
}
}
return false;
});
}
private BeatmapCarousel createCarousel()
{
return carousel = new BeatmapCarousel