mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 11:42:56 +08:00
Merge pull request #16167 from peppy/fix-song-select-test-failure
Fix occasional failures in `TestScenePlaySongSelect`
This commit is contained in:
commit
488e1f858b
@ -466,7 +466,9 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
public void TestExternalBeatmapChangeWhileFiltered(bool differentRuleset)
|
||||
{
|
||||
createSongSelect();
|
||||
addManyTestMaps();
|
||||
// ensure there is at least 1 difficulty for each of the rulesets
|
||||
// (catch is excluded inside of addManyTestMaps).
|
||||
addManyTestMaps(3);
|
||||
|
||||
changeRuleset(0);
|
||||
|
||||
@ -488,8 +490,9 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
AddStep("select beatmap externally", () =>
|
||||
{
|
||||
target = manager.GetAllUsableBeatmapSets()
|
||||
.Where(b => b.Beatmaps.Any(bi => bi.RulesetID == targetRuleset))
|
||||
.ElementAt(5).Beatmaps.First(bi => bi.RulesetID == targetRuleset);
|
||||
.First(b => b.Beatmaps.Any(bi => bi.RulesetID == targetRuleset))
|
||||
.Beatmaps
|
||||
.First(bi => bi.RulesetID == targetRuleset);
|
||||
|
||||
Beatmap.Value = manager.GetWorkingBeatmap(target);
|
||||
});
|
||||
@ -518,7 +521,9 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
public void TestExternalBeatmapChangeWhileFilteredThenRefilter()
|
||||
{
|
||||
createSongSelect();
|
||||
addManyTestMaps();
|
||||
// ensure there is at least 1 difficulty for each of the rulesets
|
||||
// (catch is excluded inside of addManyTestMaps).
|
||||
addManyTestMaps(3);
|
||||
|
||||
changeRuleset(0);
|
||||
|
||||
@ -534,8 +539,10 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
|
||||
AddStep("select beatmap externally", () =>
|
||||
{
|
||||
target = manager.GetAllUsableBeatmapSets().Where(b => b.Beatmaps.Any(bi => bi.RulesetID == 1))
|
||||
.ElementAt(5).Beatmaps.First();
|
||||
target = manager
|
||||
.GetAllUsableBeatmapSets()
|
||||
.First(b => b.Beatmaps.Any(bi => bi.RulesetID == 1))
|
||||
.Beatmaps.First();
|
||||
|
||||
Beatmap.Value = manager.GetWorkingBeatmap(target);
|
||||
});
|
||||
@ -877,14 +884,21 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
AddUntilStep("wait for carousel loaded", () => songSelect.Carousel.IsAlive);
|
||||
}
|
||||
|
||||
private void addManyTestMaps()
|
||||
/// <summary>
|
||||
/// Imports test beatmap sets to show in the carousel.
|
||||
/// </summary>
|
||||
/// <param name="difficultyCountPerSet">
|
||||
/// The exact count of difficulties to create for each beatmap set.
|
||||
/// A <see langword="null"/> value causes the count of difficulties to be selected randomly.
|
||||
/// </param>
|
||||
private void addManyTestMaps(int? difficultyCountPerSet = null)
|
||||
{
|
||||
AddStep("import test maps", () =>
|
||||
{
|
||||
var usableRulesets = rulesets.AvailableRulesets.Where(r => r.OnlineID != 2).ToArray();
|
||||
|
||||
for (int i = 0; i < 100; i += 10)
|
||||
manager.Import(TestResources.CreateTestBeatmapSetInfo(rulesets: usableRulesets)).Wait();
|
||||
for (int i = 0; i < 10; i++)
|
||||
manager.Import(TestResources.CreateTestBeatmapSetInfo(difficultyCountPerSet, usableRulesets)).Wait();
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user