From a978518a74c362016d2aeb39d4a8f1fdcb78a28d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 23 Apr 2024 12:32:52 +0200 Subject: [PATCH] Add failing tests --- .../Settings/TestSceneKeyBindingPanel.cs | 44 ++++++++++++++++++- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Settings/TestSceneKeyBindingPanel.cs b/osu.Game.Tests/Visual/Settings/TestSceneKeyBindingPanel.cs index 57c9770c9a..86008a56a4 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneKeyBindingPanel.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneKeyBindingPanel.cs @@ -296,7 +296,7 @@ namespace osu.Game.Tests.Visual.Settings } [Test] - public void TestBindingConflictResolvedByRollback() + public void TestBindingConflictResolvedByRollbackViaMouse() { AddStep("reset taiko section to default", () => { @@ -315,7 +315,7 @@ namespace osu.Game.Tests.Visual.Settings } [Test] - public void TestBindingConflictResolvedByOverwrite() + public void TestBindingConflictResolvedByOverwriteViaMouse() { AddStep("reset taiko section to default", () => { @@ -333,6 +333,46 @@ namespace osu.Game.Tests.Visual.Settings checkBinding("Left (rim)", "M1"); } + [Test] + public void TestBindingConflictResolvedByRollbackViaKeyboard() + { + AddStep("reset taiko & global sections to default", () => + { + panel.ChildrenOfType().First(section => new TaikoRuleset().RulesetInfo.Equals(section.Ruleset)) + .ChildrenOfType().Single().TriggerClick(); + + panel.ChildrenOfType().First().TriggerClick(); + }); + AddStep("move mouse to centre", () => InputManager.MoveMouseTo(panel.ScreenSpaceDrawQuad.Centre)); + scrollToAndStartBinding("Left (rim)"); + AddStep("attempt to bind M1 to two keys", () => InputManager.Click(MouseButton.Left)); + + AddUntilStep("wait for popover", () => panel.ChildrenOfType().SingleOrDefault(), () => Is.Not.Null); + AddStep("press Esc", () => InputManager.Key(Key.Escape)); + checkBinding("Left (centre)", "M1"); + checkBinding("Left (rim)", "M2"); + } + + [Test] + public void TestBindingConflictResolvedByOverwriteViaKeyboard() + { + AddStep("reset taiko & global sections to default", () => + { + panel.ChildrenOfType().First(section => new TaikoRuleset().RulesetInfo.Equals(section.Ruleset)) + .ChildrenOfType().Single().TriggerClick(); + + panel.ChildrenOfType().First().TriggerClick(); + }); + AddStep("move mouse to centre", () => InputManager.MoveMouseTo(panel.ScreenSpaceDrawQuad.Centre)); + scrollToAndStartBinding("Left (rim)"); + AddStep("attempt to bind M1 to two keys", () => InputManager.Click(MouseButton.Left)); + + AddUntilStep("wait for popover", () => panel.ChildrenOfType().SingleOrDefault(), () => Is.Not.Null); + AddStep("press Enter", () => InputManager.Key(Key.Enter)); + checkBinding("Left (centre)", InputSettingsStrings.ActionHasNoKeyBinding.ToString()); + checkBinding("Left (rim)", "M1"); + } + [Test] public void TestBindingConflictCausedByResetToDefaultOfSingleRow() {