1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 15:47:26 +08:00

Update test to match new behaviour

This commit is contained in:
Dean Herbert 2023-08-23 19:38:18 +09:00
parent 018be4c20f
commit 5555f73e97

View File

@ -758,7 +758,7 @@ namespace osu.Game.Tests.Visual.SongSelect
} }
[Test] [Test]
public void TestSortingWithFiltered() public void TestSortingWithDifficultyFiltered()
{ {
List<BeatmapSetInfo> sets = new List<BeatmapSetInfo>(); List<BeatmapSetInfo> sets = new List<BeatmapSetInfo>();
@ -777,13 +777,32 @@ namespace osu.Game.Tests.Visual.SongSelect
loadBeatmaps(sets); loadBeatmaps(sets);
AddStep("Sort by difficulty", () => carousel.Filter(new FilterCriteria { Sort = SortMode.Difficulty }, false));
checkVisibleItemCount(false, 9);
checkVisibleItemCount(true, 1);
AddStep("Filter to normal", () => carousel.Filter(new FilterCriteria { Sort = SortMode.Difficulty, SearchText = "Normal" }, false)); AddStep("Filter to normal", () => carousel.Filter(new FilterCriteria { Sort = SortMode.Difficulty, SearchText = "Normal" }, false));
AddAssert("Check first set at end", () => carousel.BeatmapSets.First().Equals(sets.Last())); checkVisibleItemCount(false, 3);
AddAssert("Check last set at start", () => carousel.BeatmapSets.Last().Equals(sets.First())); checkVisibleItemCount(true, 1);
AddUntilStep("Check all visible sets have one normal", () =>
{
return carousel.Items.OfType<DrawableCarouselBeatmapSet>()
.Where(p => p.IsPresent)
.Count(p => ((CarouselBeatmapSet)p.Item)!.Beatmaps.Single().BeatmapInfo.DifficultyName.StartsWith("Normal", StringComparison.Ordinal)) == 3;
});
AddStep("Filter to insane", () => carousel.Filter(new FilterCriteria { Sort = SortMode.Difficulty, SearchText = "Insane" }, false)); AddStep("Filter to insane", () => carousel.Filter(new FilterCriteria { Sort = SortMode.Difficulty, SearchText = "Insane" }, false));
AddAssert("Check first set at start", () => carousel.BeatmapSets.First().Equals(sets.First())); checkVisibleItemCount(false, 3);
AddAssert("Check last set at end", () => carousel.BeatmapSets.Last().Equals(sets.Last())); checkVisibleItemCount(true, 1);
AddUntilStep("Check all visible sets have one insane", () =>
{
return carousel.Items.OfType<DrawableCarouselBeatmapSet>()
.Where(p => p.IsPresent)
.Count(p => ((CarouselBeatmapSet)p.Item)!.Beatmaps.Single().BeatmapInfo.DifficultyName.StartsWith("Insane", StringComparison.Ordinal)) == 3;
});
} }
[Test] [Test]