Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use SDL_Keycodes instead of SDL_Scancodes to map the keys #5774

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion osu.Framework.Tests/Visual/Input/TestSceneKeyBindingsGrid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,33 @@ public void BothSideModifierKeys()
});
}

[Test]
public void SpecialKeys()
{
wrapTest(() =>
{
toggleKey(Key.NonUSBackSlash);
checkPressed(TestAction.NonUSBackSlash, 1, 1, 1, 1, 1);
toggleKey(Key.NonUSBackSlash);
checkReleased(TestAction.NonUSBackSlash, 1, 1, 1, 1, 1);

toggleKey(Key.Minus);
checkPressed(TestAction.Minus, 1, 1, 1, 1, 1);
toggleKey(Key.Minus);
checkReleased(TestAction.Minus, 1, 1, 1, 1, 1);

toggleKey(Key.Tilde);
checkPressed(TestAction.Tilde, 1, 1, 1, 1, 1);
toggleKey(Key.Tilde);
checkReleased(TestAction.Tilde, 1, 1, 1, 1, 1);

toggleKey(Key.Quote);
checkPressed(TestAction.Quote, 1, 1, 1, 1, 1);
toggleKey(Key.Quote);
checkReleased(TestAction.Quote, 1, 1, 1, 1, 1);
});
}

[Test]
public void MouseScrollAndButtons()
{
Expand Down Expand Up @@ -395,7 +422,11 @@ private enum TestAction
WheelRight,
Ctrl_and_WheelUp,
AnyShift_A,
AnyShift
AnyShift,
NonUSBackSlash,
Minus,
Tilde,
Quote
}

private partial class TestInputManager : KeyBindingContainer<TestAction>
Expand All @@ -411,6 +442,10 @@ public TestInputManager(SimultaneousBindingMode concurrencyMode = SimultaneousBi
new KeyBinding(InputKey.S, TestAction.S),
new KeyBinding(InputKey.D, TestAction.D_or_F),
new KeyBinding(InputKey.F, TestAction.D_or_F),
new KeyBinding(InputKey.NonUSBackSlash, TestAction.NonUSBackSlash),
new KeyBinding(InputKey.Minus, TestAction.Minus),
new KeyBinding(InputKey.Tilde, TestAction.Tilde),
new KeyBinding(InputKey.Quote, TestAction.Quote),

new KeyBinding(new[] { InputKey.Control, InputKey.A }, TestAction.Ctrl_A),
new KeyBinding(new[] { InputKey.Control, InputKey.S }, TestAction.Ctrl_S),
Expand Down
Loading