mirror of
https://github.com/godotengine/godot.git
synced 2026-01-06 10:11:57 +03:00
Cleanup and unify keyboard input.
- Unify keycode values (secondary label printed on a key), remove unused hardcoded Latin-1 codes. - Unify IME behaviour, add inline composition string display on Windows and X11. - Add key_label (localized label printed on a key) value to the key events, and allow mapping actions to the unshifted Unicode events. - Add support for physical keyboard (Bluetooth or Sidecar) handling on iOS. - Add support for media key handling on macOS. Co-authored-by: Raul Santos <raulsntos@gmail.com>
This commit is contained in:
@@ -106,11 +106,11 @@ TEST_CASE("[InputEventKey] Key correctly converts itself to text") {
|
||||
|
||||
// Key is None without a physical key.
|
||||
none_key.set_keycode(Key::NONE);
|
||||
CHECK(none_key.as_text() == " (Physical)");
|
||||
CHECK(none_key.as_text() == "(Unset)");
|
||||
|
||||
// Key is none and has modifiers.
|
||||
none_key.set_ctrl_pressed(true);
|
||||
CHECK(none_key.as_text() == "Ctrl+ (Physical)");
|
||||
CHECK(none_key.as_text() == "Ctrl+(Unset)");
|
||||
|
||||
// Key is None WITH a physical key AND modifiers.
|
||||
none_key.set_physical_keycode(Key::ENTER);
|
||||
@@ -144,8 +144,7 @@ TEST_CASE("[InputEventKey] Key correctly converts itself to text") {
|
||||
TEST_CASE("[InputEventKey] Key correctly converts its state to a string representation") {
|
||||
InputEventKey none_key;
|
||||
|
||||
// Set physical to true.
|
||||
CHECK(none_key.to_string() == "InputEventKey: keycode=0 (), mods=none, physical=true, pressed=false, echo=false");
|
||||
CHECK(none_key.to_string() == "InputEventKey: keycode=(Unset), mods=none, physical=false, pressed=false, echo=false");
|
||||
// Set physical key to Escape.
|
||||
none_key.set_physical_keycode(Key::ESCAPE);
|
||||
CHECK(none_key.to_string() == "InputEventKey: keycode=4194305 (Escape), mods=none, physical=true, pressed=false, echo=false");
|
||||
|
||||
Reference in New Issue
Block a user