1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 15:33:21 +08:00

Fix TestSelectingFilteredRuleset failing under visual tests due to using local database

This commit is contained in:
Dean Herbert 2022-02-03 16:04:05 +09:00
parent cd806711f8
commit 41aa4b8cca

View File

@ -601,7 +601,7 @@ namespace osu.Game.Tests.Visual.SongSelect
{ {
BeatmapSetInfo testMixed = null; BeatmapSetInfo testMixed = null;
createCarousel(); createCarousel(new List<BeatmapSetInfo>());
AddStep("add mixed ruleset beatmapset", () => AddStep("add mixed ruleset beatmapset", () =>
{ {
@ -765,22 +765,22 @@ namespace osu.Game.Tests.Visual.SongSelect
{ {
bool changed = false; bool changed = false;
createCarousel(c => if (beatmapSets == null)
{
beatmapSets = new List<BeatmapSetInfo>();
for (int i = 1; i <= (count ?? set_count); i++)
{
beatmapSets.Add(randomDifficulties
? TestResources.CreateTestBeatmapSetInfo()
: TestResources.CreateTestBeatmapSetInfo(3));
}
}
createCarousel(beatmapSets, c =>
{ {
carouselAdjust?.Invoke(c); carouselAdjust?.Invoke(c);
if (beatmapSets == null)
{
beatmapSets = new List<BeatmapSetInfo>();
for (int i = 1; i <= (count ?? set_count); i++)
{
beatmapSets.Add(randomDifficulties
? TestResources.CreateTestBeatmapSetInfo()
: TestResources.CreateTestBeatmapSetInfo(3));
}
}
carousel.Filter(initialCriteria?.Invoke() ?? new FilterCriteria()); carousel.Filter(initialCriteria?.Invoke() ?? new FilterCriteria());
carousel.BeatmapSetsChanged = () => changed = true; carousel.BeatmapSetsChanged = () => changed = true;
carousel.BeatmapSets = beatmapSets; carousel.BeatmapSets = beatmapSets;
@ -789,7 +789,7 @@ namespace osu.Game.Tests.Visual.SongSelect
AddUntilStep("Wait for load", () => changed); AddUntilStep("Wait for load", () => changed);
} }
private void createCarousel(Action<BeatmapCarousel> carouselAdjust = null, Container target = null) private void createCarousel(List<BeatmapSetInfo> beatmapSets, Action<BeatmapCarousel> carouselAdjust = null, Container target = null)
{ {
AddStep("Create carousel", () => AddStep("Create carousel", () =>
{ {
@ -803,6 +803,8 @@ namespace osu.Game.Tests.Visual.SongSelect
carouselAdjust?.Invoke(carousel); carouselAdjust?.Invoke(carousel);
carousel.BeatmapSets = beatmapSets;
(target ?? this).Child = carousel; (target ?? this).Child = carousel;
}); });
} }