mirror of
https://github.com/ppy/osu.git
synced 2025-01-07 21:32:57 +08:00
Add test coverage for desired mod overlay search box behaviour
This commit is contained in:
parent
70a546b23c
commit
839a080247
@ -13,6 +13,7 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Overlays.Mods;
|
using osu.Game.Overlays.Mods;
|
||||||
@ -38,6 +39,9 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
|
|
||||||
private TestModSelectOverlay modSelectOverlay = null!;
|
private TestModSelectOverlay modSelectOverlay = null!;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private OsuConfigManager configManager { get; set; } = null!;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
@ -566,17 +570,33 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestSearchFocusChangeViaKey()
|
public void TestTextSearchActiveByDefault()
|
||||||
{
|
{
|
||||||
|
configManager.SetValue(OsuSetting.ModSelectTextSearchStartsActive, true);
|
||||||
createScreen();
|
createScreen();
|
||||||
|
|
||||||
const Key focus_switch_key = Key.Tab;
|
AddUntilStep("search text box focused", () => modSelectOverlay.SearchTextBox.HasFocus);
|
||||||
|
|
||||||
AddStep("press tab", () => InputManager.Key(focus_switch_key));
|
AddStep("press tab", () => InputManager.Key(Key.Tab));
|
||||||
AddAssert("focused", () => modSelectOverlay.SearchTextBox.HasFocus);
|
AddAssert("search text box unfocused", () => !modSelectOverlay.SearchTextBox.HasFocus);
|
||||||
|
|
||||||
AddStep("press tab", () => InputManager.Key(focus_switch_key));
|
AddStep("press tab", () => InputManager.Key(Key.Tab));
|
||||||
AddAssert("lost focus", () => !modSelectOverlay.SearchTextBox.HasFocus);
|
AddAssert("search text box focused", () => modSelectOverlay.SearchTextBox.HasFocus);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestTextSearchNotActiveByDefault()
|
||||||
|
{
|
||||||
|
configManager.SetValue(OsuSetting.ModSelectTextSearchStartsActive, false);
|
||||||
|
createScreen();
|
||||||
|
|
||||||
|
AddUntilStep("search text box not focused", () => !modSelectOverlay.SearchTextBox.HasFocus);
|
||||||
|
|
||||||
|
AddStep("press tab", () => InputManager.Key(Key.Tab));
|
||||||
|
AddAssert("search text box focused", () => modSelectOverlay.SearchTextBox.HasFocus);
|
||||||
|
|
||||||
|
AddStep("press tab", () => InputManager.Key(Key.Tab));
|
||||||
|
AddAssert("search text box unfocused", () => !modSelectOverlay.SearchTextBox.HasFocus);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
Loading…
Reference in New Issue
Block a user