mirror of
https://github.com/ppy/osu.git
synced 2025-02-15 23:03:02 +08:00
Fix song select tests not waiting for beatmap imports to arrive
After the change to realm, notification fires could take a frame or two. We aren't accounting for this. Fixes test failures like https://github.com/ppy/osu/runs/4963255990?check_suite_focus=true
This commit is contained in:
parent
df9f969030
commit
831fa44433
@ -13,6 +13,7 @@ using osu.Framework.Screens;
|
|||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
|
using osu.Game.Database;
|
||||||
using osu.Game.Extensions;
|
using osu.Game.Extensions;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
@ -73,6 +74,17 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
AddStep("delete all beatmaps", () => manager?.Delete());
|
AddStep("delete all beatmaps", () => manager?.Delete());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void TearDownSteps()
|
||||||
|
{
|
||||||
|
base.TearDownSteps();
|
||||||
|
|
||||||
|
AddStep("remove song select", () =>
|
||||||
|
{
|
||||||
|
songSelect?.Expire();
|
||||||
|
songSelect = null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestSingleFilterOnEnter()
|
public void TestSingleFilterOnEnter()
|
||||||
{
|
{
|
||||||
@ -870,9 +882,16 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
return set.ChildrenOfType<FilterableDifficultyIcon>().ToList().FindIndex(i => i == icon);
|
return set.ChildrenOfType<FilterableDifficultyIcon>().ToList().FindIndex(i => i == icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addRulesetImportStep(int id) => AddStep($"import test map for ruleset {id}", () => importForRuleset(id));
|
private void addRulesetImportStep(int id)
|
||||||
|
{
|
||||||
|
Live<BeatmapSetInfo> imported = null;
|
||||||
|
AddStep($"import test map for ruleset {id}", () => imported = importForRuleset(id));
|
||||||
|
// This is specifically for cases where the add is happening post song select load.
|
||||||
|
// For cases where song select is null, the assertions are provided by the load checks.
|
||||||
|
AddUntilStep("wait for imported to arrive in carousel", () => songSelect == null || songSelect.Carousel.BeatmapSets.Any(s => s.ID == imported?.ID));
|
||||||
|
}
|
||||||
|
|
||||||
private void importForRuleset(int id) => manager.Import(TestResources.CreateTestBeatmapSetInfo(3, rulesets.AvailableRulesets.Where(r => r.OnlineID == id).ToArray()));
|
private Live<BeatmapSetInfo> importForRuleset(int id) => manager.Import(TestResources.CreateTestBeatmapSetInfo(3, rulesets.AvailableRulesets.Where(r => r.OnlineID == id).ToArray()));
|
||||||
|
|
||||||
private void checkMusicPlaying(bool playing) =>
|
private void checkMusicPlaying(bool playing) =>
|
||||||
AddUntilStep($"music {(playing ? "" : "not ")}playing", () => music.IsPlaying == playing);
|
AddUntilStep($"music {(playing ? "" : "not ")}playing", () => music.IsPlaying == playing);
|
||||||
|
Loading…
Reference in New Issue
Block a user