1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-07 20:03:13 +08:00

Merge pull request #17165 from smoogipoo/fix-intermittent-test

Fix intermittent multiplayer ready button test failures
This commit is contained in:
Dean Herbert 2022-03-09 01:16:38 +09:00 committed by GitHub
commit 821de83e54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -43,8 +43,6 @@ namespace osu.Game.Tests.Visual.Multiplayer
Dependencies.Cache(rulesets = new RealmRulesetStore(Realm)); Dependencies.Cache(rulesets = new RealmRulesetStore(Realm));
Dependencies.Cache(beatmaps = new BeatmapManager(LocalStorage, Realm, rulesets, null, audio, Resources, host, Beatmap.Default)); Dependencies.Cache(beatmaps = new BeatmapManager(LocalStorage, Realm, rulesets, null, audio, Resources, host, Beatmap.Default));
Dependencies.Cache(Realm); Dependencies.Cache(Realm);
beatmaps.Import(TestResources.GetQuickTestBeatmapForImport()).WaitSafely();
} }
[SetUp] [SetUp]
@ -52,8 +50,10 @@ namespace osu.Game.Tests.Visual.Multiplayer
{ {
AvailabilityTracker.SelectedItem.BindTo(selectedItem); AvailabilityTracker.SelectedItem.BindTo(selectedItem);
beatmaps.Import(TestResources.GetQuickTestBeatmapForImport()).WaitSafely();
importedSet = beatmaps.GetAllUsableBeatmapSets().First(); importedSet = beatmaps.GetAllUsableBeatmapSets().First();
Beatmap.Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First()); Beatmap.Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First());
selectedItem.Value = new PlaylistItem(Beatmap.Value.BeatmapInfo) selectedItem.Value = new PlaylistItem(Beatmap.Value.BeatmapInfo)
{ {
RulesetID = Beatmap.Value.BeatmapInfo.Ruleset.OnlineID RulesetID = Beatmap.Value.BeatmapInfo.Ruleset.OnlineID
@ -92,16 +92,16 @@ namespace osu.Game.Tests.Visual.Multiplayer
{ {
OsuButton readyButton = null; OsuButton readyButton = null;
AddAssert("ensure ready button enabled", () => AddUntilStep("ensure ready button enabled", () =>
{ {
readyButton = button.ChildrenOfType<OsuButton>().Single(); readyButton = button.ChildrenOfType<OsuButton>().Single();
return readyButton.Enabled.Value; return readyButton.Enabled.Value;
}); });
AddStep("delete beatmap", () => beatmaps.Delete(importedSet)); AddStep("delete beatmap", () => beatmaps.Delete(importedSet));
AddAssert("ready button disabled", () => !readyButton.Enabled.Value); AddUntilStep("ready button disabled", () => !readyButton.Enabled.Value);
AddStep("undelete beatmap", () => beatmaps.Undelete(importedSet)); AddStep("undelete beatmap", () => beatmaps.Undelete(importedSet));
AddAssert("ready button enabled back", () => readyButton.Enabled.Value); AddUntilStep("ready button enabled back", () => readyButton.Enabled.Value);
} }
[Test] [Test]