mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 00:02:54 +08:00
Merge pull request #18966 from smoogipoo/fix-flaky-multiplayer-test
Fix test sometimes referencing old ModSelect object
This commit is contained in:
commit
b460a52faf
@ -176,8 +176,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
AddUntilStep("mod select contents loaded",
|
||||
() => this.ChildrenOfType<ModColumn>().Any() && this.ChildrenOfType<ModColumn>().All(col => col.IsLoaded && col.ItemsLoaded));
|
||||
AddUntilStep("mod select contains only double time mod",
|
||||
() => this.ChildrenOfType<UserModSelectOverlay>()
|
||||
.SingleOrDefault()?
|
||||
() => this.ChildrenOfType<RoomSubScreen>().Single().UserModsSelectOverlay
|
||||
.ChildrenOfType<ModPanel>()
|
||||
.SingleOrDefault(panel => !panel.Filtered.Value)?.Mod is OsuModDoubleTime);
|
||||
}
|
||||
@ -200,7 +199,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
|
||||
AddStep("press toggle mod select key", () => InputManager.Key(Key.F1));
|
||||
|
||||
AddUntilStep("mod select shown", () => this.ChildrenOfType<ModSelectOverlay>().Single().State.Value == Visibility.Visible);
|
||||
AddUntilStep("mod select shown", () => this.ChildrenOfType<RoomSubScreen>().Single().UserModsSelectOverlay.State.Value == Visibility.Visible);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -220,7 +219,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
AddStep("press toggle mod select key", () => InputManager.Key(Key.F1));
|
||||
|
||||
AddWaitStep("wait some", 3);
|
||||
AddAssert("mod select not shown", () => this.ChildrenOfType<ModSelectOverlay>().Single().State.Value == Visibility.Hidden);
|
||||
AddAssert("mod select not shown", () => this.ChildrenOfType<RoomSubScreen>().Single().UserModsSelectOverlay.State.Value == Visibility.Hidden);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -86,7 +86,7 @@ namespace osu.Game.Screens.OnlinePlay.Match
|
||||
public readonly Room Room;
|
||||
private readonly bool allowEdit;
|
||||
|
||||
private ModSelectOverlay userModsSelectOverlay;
|
||||
internal ModSelectOverlay UserModsSelectOverlay { get; private set; }
|
||||
|
||||
[CanBeNull]
|
||||
private IDisposable userModsSelectOverlayRegistration;
|
||||
@ -236,7 +236,7 @@ namespace osu.Game.Screens.OnlinePlay.Match
|
||||
}
|
||||
};
|
||||
|
||||
LoadComponent(userModsSelectOverlay = new UserModSelectOverlay(OverlayColourScheme.Plum)
|
||||
LoadComponent(UserModsSelectOverlay = new UserModSelectOverlay(OverlayColourScheme.Plum)
|
||||
{
|
||||
SelectedMods = { BindTarget = UserMods },
|
||||
IsValidMod = _ => false
|
||||
@ -269,7 +269,7 @@ namespace osu.Game.Screens.OnlinePlay.Match
|
||||
beatmapAvailabilityTracker.SelectedItem.BindTo(SelectedItem);
|
||||
beatmapAvailabilityTracker.Availability.BindValueChanged(_ => updateWorkingBeatmap());
|
||||
|
||||
userModsSelectOverlayRegistration = overlayManager?.RegisterBlockingOverlay(userModsSelectOverlay);
|
||||
userModsSelectOverlayRegistration = overlayManager?.RegisterBlockingOverlay(UserModsSelectOverlay);
|
||||
}
|
||||
|
||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||
@ -289,9 +289,9 @@ namespace osu.Game.Screens.OnlinePlay.Match
|
||||
return base.OnBackButton();
|
||||
}
|
||||
|
||||
if (userModsSelectOverlay.State.Value == Visibility.Visible)
|
||||
if (UserModsSelectOverlay.State.Value == Visibility.Visible)
|
||||
{
|
||||
userModsSelectOverlay.Hide();
|
||||
UserModsSelectOverlay.Hide();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -304,7 +304,7 @@ namespace osu.Game.Screens.OnlinePlay.Match
|
||||
return base.OnBackButton();
|
||||
}
|
||||
|
||||
protected void ShowUserModSelect() => userModsSelectOverlay.Show();
|
||||
protected void ShowUserModSelect() => UserModsSelectOverlay.Show();
|
||||
|
||||
public override void OnEntering(ScreenTransitionEvent e)
|
||||
{
|
||||
@ -385,13 +385,13 @@ namespace osu.Game.Screens.OnlinePlay.Match
|
||||
if (!selected.AllowedMods.Any())
|
||||
{
|
||||
UserModsSection?.Hide();
|
||||
userModsSelectOverlay.Hide();
|
||||
userModsSelectOverlay.IsValidMod = _ => false;
|
||||
UserModsSelectOverlay.Hide();
|
||||
UserModsSelectOverlay.IsValidMod = _ => false;
|
||||
}
|
||||
else
|
||||
{
|
||||
UserModsSection?.Show();
|
||||
userModsSelectOverlay.IsValidMod = m => allowedMods.Any(a => a.GetType() == m.GetType());
|
||||
UserModsSelectOverlay.IsValidMod = m => allowedMods.Any(a => a.GetType() == m.GetType());
|
||||
}
|
||||
}
|
||||
|
||||
@ -430,7 +430,7 @@ namespace osu.Game.Screens.OnlinePlay.Match
|
||||
|
||||
private void onLeaving()
|
||||
{
|
||||
userModsSelectOverlay.Hide();
|
||||
UserModsSelectOverlay.Hide();
|
||||
endHandlingTrack();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user