summaryrefslogtreecommitdiff
path: root/app/tests
diff options
context:
space:
mode:
authorPeter Johanson <peter@peterjohanson.com>2021-11-29 15:41:22 +0000
committerPete Johanson <peter@peterjohanson.com>2022-01-30 22:47:34 -0500
commit52b1fd5dd3f1cb260cd0fba28c4b5aa23dd3d0f0 (patch)
treeec134dd3f0ddc8ea31846df110f795a8d566484b /app/tests
parent70bb7c93349344e0990f12282abfcd8d00ba7208 (diff)
fix(behaviors): Capture mods for `&key_repeat`
* When tracking the last keycode, also capture the currently held explicit modifiers to use when replaying the key later.
Diffstat (limited to 'app/tests')
-rw-r--r--app/tests/key-repeat/behavior_keymap.dtsi2
-rw-r--r--app/tests/key-repeat/press-and-release-with-explicit-modifiers/events.patterns2
-rw-r--r--app/tests/key-repeat/press-and-release-with-explicit-modifiers/keycode_events.snapshot12
-rw-r--r--app/tests/key-repeat/press-and-release-with-explicit-modifiers/native_posix.keymap15
4 files changed, 30 insertions, 1 deletions
diff --git a/app/tests/key-repeat/behavior_keymap.dtsi b/app/tests/key-repeat/behavior_keymap.dtsi
index 93b6d06..24902fc 100644
--- a/app/tests/key-repeat/behavior_keymap.dtsi
+++ b/app/tests/key-repeat/behavior_keymap.dtsi
@@ -10,7 +10,7 @@
default_layer {
bindings = <
&key_repeat &kp A
- &kp B &kp C_VOL_UP
+ &kp LCTRL &kp C_VOL_UP
>;
};
};
diff --git a/app/tests/key-repeat/press-and-release-with-explicit-modifiers/events.patterns b/app/tests/key-repeat/press-and-release-with-explicit-modifiers/events.patterns
new file mode 100644
index 0000000..7947192
--- /dev/null
+++ b/app/tests/key-repeat/press-and-release-with-explicit-modifiers/events.patterns
@@ -0,0 +1,2 @@
+s/.*hid_listener_keycode_//p
+s/.*hid_implicit_modifiers_//p \ No newline at end of file
diff --git a/app/tests/key-repeat/press-and-release-with-explicit-modifiers/keycode_events.snapshot b/app/tests/key-repeat/press-and-release-with-explicit-modifiers/keycode_events.snapshot
new file mode 100644
index 0000000..628214a
--- /dev/null
+++ b/app/tests/key-repeat/press-and-release-with-explicit-modifiers/keycode_events.snapshot
@@ -0,0 +1,12 @@
+pressed: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x00
+press: Modifiers set to 0x01
+pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
+press: Modifiers set to 0x01
+released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
+release: Modifiers set to 0x01
+released: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x00
+release: Modifiers set to 0x00
+pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x01 explicit_mods 0x00
+press: Modifiers set to 0x01
+released: usage_page 0x07 keycode 0x04 implicit_mods 0x01 explicit_mods 0x00
+release: Modifiers set to 0x00
diff --git a/app/tests/key-repeat/press-and-release-with-explicit-modifiers/native_posix.keymap b/app/tests/key-repeat/press-and-release-with-explicit-modifiers/native_posix.keymap
new file mode 100644
index 0000000..ab9622e
--- /dev/null
+++ b/app/tests/key-repeat/press-and-release-with-explicit-modifiers/native_posix.keymap
@@ -0,0 +1,15 @@
+#include <dt-bindings/zmk/keys.h>
+#include <behaviors.dtsi>
+#include <dt-bindings/zmk/kscan_mock.h>
+#include "../behavior_keymap.dtsi"
+
+&kscan {
+ events = <
+ ZMK_MOCK_PRESS(1,0,10)
+ ZMK_MOCK_PRESS(0,1,10)
+ ZMK_MOCK_RELEASE(0,1,10)
+ ZMK_MOCK_RELEASE(1,0,10)
+ ZMK_MOCK_PRESS(0,0,10)
+ ZMK_MOCK_RELEASE(0,0,10)
+ >;
+}; \ No newline at end of file