Merge pull request #30799 from peppy/fix-player-loader-focus-fux

Fix beatmap load not continuing when when settings slider is focused
This commit is contained in:
Bartłomiej Dach 2024-11-22 08:57:10 +01:00 committed by GitHub
commit 479ff7eb41
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 23 additions and 2 deletions

View File

@ -18,6 +18,7 @@ using osu.Framework.Testing;
using osu.Framework.Utils;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays;
using osu.Game.Overlays.Notifications;
using osu.Game.Rulesets.Mods;
@ -207,7 +208,25 @@ namespace osu.Game.Tests.Visual.Gameplay
}
[Test]
public void TestBlockLoadViaFocus()
public void TestLoadNotBlockedViaArbitraryFocus()
{
AddStep("load dummy beatmap", () => resetPlayer(false));
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
AddUntilStep("click settings slider", () =>
{
InputManager.MoveMouseTo(loader.ChildrenOfType<OsuSliderBar<float>>().First());
InputManager.Click(MouseButton.Left);
return InputManager.FocusedDrawable is OsuSliderBar<float>;
});
AddUntilStep("wait for load ready", () => player?.LoadState == LoadState.Ready);
AddUntilStep("loads", () => !loader.IsCurrentScreen());
}
[Test]
public void TestBlockLoadViaOverlayFocus()
{
AddStep("load dummy beatmap", () => resetPlayer(false));
AddUntilStep("wait for current", () => loader.IsCurrentScreen());

View File

@ -122,7 +122,9 @@ namespace osu.Game.Screens.Play
// not ready if the user is dragging a slider or otherwise.
&& (inputManager.DraggedDrawable == null || inputManager.DraggedDrawable is OsuLogo)
// not ready if a focused overlay is visible, like settings.
&& inputManager.FocusedDrawable == null;
&& inputManager.FocusedDrawable is not OsuFocusedOverlayContainer
// or if a child of a focused overlay is focused, like settings' search textbox.
&& inputManager.FocusedDrawable?.FindClosestParent<OsuFocusedOverlayContainer>() == null;
private readonly Func<Player> createPlayer;