1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 07:23:14 +08:00

Fix song select tests potentially failing due to difficulty panels not yet displayed

This commit is contained in:
Dean Herbert 2020-05-04 14:43:47 +09:00
parent 59dd523d27
commit a1cd007cad
2 changed files with 10 additions and 4 deletions

View File

@ -110,7 +110,7 @@ namespace osu.Game.Tests.Visual.SongSelect
createSongSelect();
AddUntilStep("wait for initial selection", () => !Beatmap.IsDefault);
waitForInitialSelection();
WorkingBeatmap selected = null;
@ -135,7 +135,7 @@ namespace osu.Game.Tests.Visual.SongSelect
createSongSelect();
AddUntilStep("wait for initial selection", () => !Beatmap.IsDefault);
waitForInitialSelection();
WorkingBeatmap selected = null;
@ -189,7 +189,7 @@ namespace osu.Game.Tests.Visual.SongSelect
createSongSelect();
AddUntilStep("wait for initial selection", () => !Beatmap.IsDefault);
waitForInitialSelection();
WorkingBeatmap selected = null;
@ -769,6 +769,12 @@ namespace osu.Game.Tests.Visual.SongSelect
AddAssert("Check first item in group selected", () => Beatmap.Value.BeatmapInfo == groupIcon.Items.First().Beatmap);
}
private void waitForInitialSelection()
{
AddUntilStep("wait for initial selection", () => !Beatmap.IsDefault);
AddUntilStep("wait for difficulty panels visible", () => songSelect.Carousel.ChildrenOfType<DrawableCarouselBeatmap>().Any());
}
private int getBeatmapIndex(BeatmapSetInfo set, BeatmapInfo info) => set.Beatmaps.FindIndex(b => b == info);
private int getCurrentBeatmapIndex() => getBeatmapIndex(songSelect.Carousel.SelectedBeatmapSet, songSelect.Carousel.SelectedBeatmap);

View File

@ -140,7 +140,7 @@ namespace osu.Game.Beatmaps
{
var beatmapIds = beatmapSet.Beatmaps.Where(b => b.OnlineBeatmapID.HasValue).Select(b => b.OnlineBeatmapID).ToList();
LogForModel(beatmapSet, "Validating online IDs...");
LogForModel(beatmapSet, $"Validating online IDs for {beatmapSet.Beatmaps.Count} beatmaps...");
// ensure all IDs are unique
if (beatmapIds.GroupBy(b => b).Any(g => g.Count() > 1))