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

Add failing test case for desired artist sort behaviour

This commit is contained in:
Bartłomiej Dach 2024-03-22 08:25:03 +01:00
parent b9b9ef671e
commit e2df098184
No known key found for this signature in database

View File

@ -666,6 +666,56 @@ namespace osu.Game.Tests.Visual.SongSelect
AddAssert($"Check {zzz_lowercase} is second last", () => carousel.BeatmapSets.SkipLast(1).Last().Metadata.Artist == zzz_lowercase);
}
[Test]
public void TestSortByArtistUsesTitleAsTiebreaker()
{
var sets = new List<BeatmapSetInfo>();
AddStep("Populuate beatmap sets", () =>
{
sets.Clear();
for (int i = 0; i < 20; i++)
{
var set = TestResources.CreateTestBeatmapSetInfo();
if (i == 4)
{
set.Beatmaps.ForEach(b =>
{
b.Metadata.Artist = "ZZZ";
b.Metadata.Title = "AAA";
});
}
if (i == 8)
{
set.Beatmaps.ForEach(b =>
{
b.Metadata.Artist = "ZZZ";
b.Metadata.Title = "ZZZ";
});
}
sets.Add(set);
}
});
loadBeatmaps(sets);
AddStep("Sort by artist", () => carousel.Filter(new FilterCriteria { Sort = SortMode.Artist }, false));
AddAssert("Check last item", () =>
{
var lastItem = carousel.BeatmapSets.Last();
return lastItem.Metadata.Artist == "ZZZ" && lastItem.Metadata.Title == "ZZZ";
});
AddAssert("Check second last item", () =>
{
var secondLastItem = carousel.BeatmapSets.SkipLast(1).Last();
return secondLastItem.Metadata.Artist == "ZZZ" && secondLastItem.Metadata.Title == "AAA";
});
}
/// <summary>
/// Ensures stability is maintained on different sort modes for items with equal properties.
/// </summary>