1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 11:42:56 +08:00

Kill search focus when clicking on ModColumn

This commit is contained in:
Cootz 2023-05-14 18:32:16 +03:00
parent ca68850730
commit 6647d95ea7
2 changed files with 21 additions and 0 deletions

View File

@ -468,6 +468,24 @@ namespace osu.Game.Tests.Visual.UserInterface
AddAssert("unimplemented mod panel is filtered", () => !getPanelForMod(typeof(TestUnimplementedMod)).IsValid);
}
[Test]
public void TestSearchFocusChange()
{
createScreen();
AddStep("click on search", navigateAndClick<ShearedSearchTextBox>);
AddAssert("focused", () => modSelectOverlay.SearchTextBox.HasFocus);
AddStep("click on mod column", navigateAndClick<ModColumn>);
AddAssert("lost focus", () => !modSelectOverlay.SearchTextBox.HasFocus);
void navigateAndClick<T>() where T : Drawable
{
InputManager.MoveMouseTo(modSelectOverlay.ChildrenOfType<T>().FirstOrDefault());
InputManager.Click(MouseButton.Left);
}
}
[Test]
public void TestDeselectAllViaKey()
{

View File

@ -777,6 +777,9 @@ namespace osu.Game.Overlays.Mods
if (!Active.Value)
RequestScroll?.Invoke(this);
//Kill focus on SearchTextBox
Scheduler.Add(() => GetContainingInputManager().ChangeFocus(null));
return true;
}