1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-19 09:07:18 +08:00

Fix test sometimes referencing old ModSelect object

This commit is contained in:
Dan Balasescu 2022-07-01 16:40:52 +09:00
parent 409224560f
commit c22e77e481
2 changed files with 14 additions and 15 deletions

View File

@ -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]
@ -219,8 +218,8 @@ 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);
// AddWaitStep("wait some", 3);
AddAssert("mod select not shown", () => this.ChildrenOfType<RoomSubScreen>().Single().UserModsSelectOverlay.State.Value == Visibility.Hidden);
}
[Test]

View File

@ -86,7 +86,7 @@ namespace osu.Game.Screens.OnlinePlay.Match
public readonly Room Room;
private readonly bool allowEdit;
private ModSelectOverlay userModsSelectOverlay;
public 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();
}