mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
Merge pull request #108260 from Silver1063/master
Fix modifier order in keycode string generation
This commit is contained in:
commit
1e84bc4d9c
3 changed files with 46 additions and 30 deletions
|
|
@ -125,6 +125,17 @@ TEST_CASE("[InputEventKey] Key correctly converts itself to text") {
|
|||
none_key.set_physical_keycode(Key::ENTER);
|
||||
CHECK(none_key.as_text() == "Ctrl+Enter (Physical)");
|
||||
|
||||
// Key is None WITH a physical key AND multiple modifiers, checks for correct ordering.
|
||||
none_key.set_alt_pressed(true);
|
||||
none_key.set_shift_pressed(true);
|
||||
#ifdef MACOS_ENABLED
|
||||
CHECK(none_key.as_text() != "Ctrl+Shift+Option+Enter (Physical)");
|
||||
CHECK(none_key.as_text() == "Ctrl+Option+Shift+Enter (Physical)");
|
||||
#else
|
||||
CHECK(none_key.as_text() != "Ctrl+Shift+Alt+Enter (Physical)");
|
||||
CHECK(none_key.as_text() == "Ctrl+Alt+Shift+Enter (Physical)");
|
||||
#endif
|
||||
|
||||
InputEventKey none_key2;
|
||||
|
||||
// Key is None without modifiers with a physical key.
|
||||
|
|
@ -145,6 +156,17 @@ TEST_CASE("[InputEventKey] Key correctly converts itself to text") {
|
|||
CHECK(key.as_text() != "Space");
|
||||
CHECK(key.as_text() == "Ctrl+Space");
|
||||
|
||||
// Key has keycode and multiple modifiers, checks for correct ordering.
|
||||
key.set_alt_pressed(true);
|
||||
key.set_shift_pressed(true);
|
||||
#ifdef MACOS_ENABLED
|
||||
CHECK(key.as_text() != "Ctrl+Shift+Option+Space");
|
||||
CHECK(key.as_text() == "Ctrl+Option+Shift+Space");
|
||||
#else
|
||||
CHECK(key.as_text() != "Ctrl+Shift+Alt+Space");
|
||||
CHECK(key.as_text() == "Ctrl+Alt+Shift+Space");
|
||||
#endif
|
||||
|
||||
// Since the keycode is set to Key::NONE upon initialization of the
|
||||
// InputEventKey and you can only update it with another Key, the keycode
|
||||
// cannot be empty, so the kc.is_empty() case cannot be tested.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue