summaryrefslogtreecommitdiff
path: root/app/tests
diff options
context:
space:
mode:
authorOkke Formsma <okke@formsma.nl>2020-11-29 21:25:42 +0100
committerPete Johanson <peter@peterjohanson.com>2020-11-29 20:16:51 -0500
commit3bf770a3648cd8f6e29afba36b861729920e5e40 (patch)
treed074cda16363c73fd9a5a377207f7488968abcea /app/tests
parent7babe7f1856ed0a586d0e1715639de806b28bc48 (diff)
bugfix(sticky keys): release active sticky keys properly
see https://github.com/zmkfirmware/zmk/issues/445
Diffstat (limited to 'app/tests')
-rw-r--r--app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/keycode_events.snapshot4
-rw-r--r--app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/native_posix.keymap6
-rw-r--r--app/tests/sticky-keys/8-lsk-osk-combination/events.patterns1
-rw-r--r--app/tests/sticky-keys/8-lsk-osk-combination/keycode_events.snapshot8
-rw-r--r--app/tests/sticky-keys/8-lsk-osk-combination/native_posix.keymap47
5 files changed, 66 insertions, 0 deletions
diff --git a/app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/keycode_events.snapshot b/app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/keycode_events.snapshot
index 758ed61..dba30cc 100644
--- a/app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/keycode_events.snapshot
+++ b/app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/keycode_events.snapshot
@@ -2,3 +2,7 @@ pressed: usage_page 0x07 keycode 0x08 mods 0x00
pressed: usage_page 0x07 keycode 0x04 mods 0x00
released: usage_page 0x07 keycode 0x08 mods 0x00
released: usage_page 0x07 keycode 0x04 mods 0x00
+pressed: usage_page 0x07 keycode 0x08 mods 0x00
+pressed: usage_page 0x07 keycode 0x04 mods 0x00
+released: usage_page 0x07 keycode 0x08 mods 0x00
+released: usage_page 0x07 keycode 0x04 mods 0x00
diff --git a/app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/native_posix.keymap b/app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/native_posix.keymap
index 588f6a1..c96eb9f 100644
--- a/app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/native_posix.keymap
+++ b/app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/native_posix.keymap
@@ -9,5 +9,11 @@
ZMK_MOCK_RELEASE(0,0,10)
ZMK_MOCK_PRESS(1,0,10)
ZMK_MOCK_RELEASE(1,0,10)
+
+ /* repeat test to check if cleanup is done correctly */
+ ZMK_MOCK_PRESS(0,0,10)
+ ZMK_MOCK_RELEASE(0,0,10)
+ ZMK_MOCK_PRESS(1,0,10)
+ ZMK_MOCK_RELEASE(1,0,10)
>;
}; \ No newline at end of file
diff --git a/app/tests/sticky-keys/8-lsk-osk-combination/events.patterns b/app/tests/sticky-keys/8-lsk-osk-combination/events.patterns
new file mode 100644
index 0000000..833100f
--- /dev/null
+++ b/app/tests/sticky-keys/8-lsk-osk-combination/events.patterns
@@ -0,0 +1 @@
+s/.*hid_listener_keycode_//p \ No newline at end of file
diff --git a/app/tests/sticky-keys/8-lsk-osk-combination/keycode_events.snapshot b/app/tests/sticky-keys/8-lsk-osk-combination/keycode_events.snapshot
new file mode 100644
index 0000000..51660c3
--- /dev/null
+++ b/app/tests/sticky-keys/8-lsk-osk-combination/keycode_events.snapshot
@@ -0,0 +1,8 @@
+pressed: usage_page 0x07 keycode 0xe0 mods 0x00
+pressed: usage_page 0x07 keycode 0x1c mods 0x00
+released: usage_page 0x07 keycode 0xe0 mods 0x00
+released: usage_page 0x07 keycode 0x1c mods 0x00
+pressed: usage_page 0x07 keycode 0xe0 mods 0x00
+pressed: usage_page 0x07 keycode 0x1c mods 0x00
+released: usage_page 0x07 keycode 0xe0 mods 0x00
+released: usage_page 0x07 keycode 0x1c mods 0x00
diff --git a/app/tests/sticky-keys/8-lsk-osk-combination/native_posix.keymap b/app/tests/sticky-keys/8-lsk-osk-combination/native_posix.keymap
new file mode 100644
index 0000000..45cef50
--- /dev/null
+++ b/app/tests/sticky-keys/8-lsk-osk-combination/native_posix.keymap
@@ -0,0 +1,47 @@
+#include <dt-bindings/zmk/keys.h>
+#include <behaviors.dtsi>
+#include <dt-bindings/zmk/kscan-mock.h>
+
+/ {
+ keymap {
+ compatible = "zmk,keymap";
+ label ="Default keymap";
+
+ default_layer {
+ bindings = <
+ &sk E &sl 1
+ &kp A &kp B>;
+ };
+
+ lower_layer {
+ bindings = <
+ &sk LEFT_CONTROL &kp X
+ &kp Y &kp Z>;
+ };
+ };
+};
+
+&kscan {
+ events = <
+ /* tap sl lower_layer */
+ ZMK_MOCK_PRESS(0,1,10)
+ ZMK_MOCK_RELEASE(0,1,10)
+ /* tap sk LEFT_CONTROL */
+ ZMK_MOCK_PRESS(0,0,10)
+ ZMK_MOCK_RELEASE(0,0,10)
+ /* tap Y */
+ ZMK_MOCK_PRESS(1,0,10)
+ ZMK_MOCK_RELEASE(1,0,10)
+
+ /* repeat */
+ /* tap sl */
+ ZMK_MOCK_PRESS(0,1,10)
+ ZMK_MOCK_RELEASE(0,1,10)
+ /* tap sk */
+ ZMK_MOCK_PRESS(0,0,10)
+ ZMK_MOCK_RELEASE(0,0,10)
+ /* tap Y */
+ ZMK_MOCK_PRESS(1,0,10)
+ ZMK_MOCK_RELEASE(1,0,10)
+ >;
+}; \ No newline at end of file