Add beatmap update button

This commit is contained in:
Dean Herbert
2022-07-18 18:06:11 +09:00
parent 6adcf82d2e
commit eaf4f6dbb7
5 changed files with 141 additions and 11 deletions

View File

@ -11,6 +11,7 @@ using osu.Framework.Allocation;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Testing;
using osu.Framework.Utils;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
@ -43,6 +44,29 @@ namespace osu.Game.Tests.Visual.SongSelect
this.rulesets = rulesets;
}
[Test]
public void TestBeatmapWithOnlineUpdates()
{
var testBeatmapSetInfo = TestResources.CreateTestBeatmapSetInfo();
createCarousel(new List<BeatmapSetInfo>
{
testBeatmapSetInfo,
});
AddAssert("update button not visible", () => !carousel.ChildrenOfType<UpdateBeatmapSetButton>().Any());
AddStep("update online hash", () =>
{
testBeatmapSetInfo.Beatmaps.First().OnlineMD5Hash = "different hash";
testBeatmapSetInfo.Beatmaps.First().LastOnlineUpdate = DateTimeOffset.Now;
carousel.UpdateBeatmapSet(testBeatmapSetInfo);
});
AddUntilStep("update button visible", () => carousel.ChildrenOfType<UpdateBeatmapSetButton>().Any());
}
[Test]
public void TestExternalRulesetChange()
{
@ -825,7 +849,8 @@ namespace osu.Game.Tests.Visual.SongSelect
checkVisibleItemCount(true, 15);
}
private void loadBeatmaps(List<BeatmapSetInfo> beatmapSets = null, Func<FilterCriteria> initialCriteria = null, Action<BeatmapCarousel> carouselAdjust = null, int? count = null, bool randomDifficulties = false)
private void loadBeatmaps(List<BeatmapSetInfo> beatmapSets = null, Func<FilterCriteria> initialCriteria = null, Action<BeatmapCarousel> carouselAdjust = null, int? count = null,
bool randomDifficulties = false)
{
bool changed = false;