summaryrefslogtreecommitdiff
path: root/app/tests
diff options
context:
space:
mode:
authorOkke Formsma <okke@formsma.nl>2020-11-11 22:09:08 +0100
committerPete Johanson <peter@peterjohanson.com>2020-11-28 00:58:24 -0500
commit76a6d7b4c5c18b64f36a421f3faca81f311ed465 (patch)
treec3486cfd24a48cd78bbe1d3153a939e2c319b9dc /app/tests
parentbee45f9b3a2217dd5df4ee940becb951e3e1e13a (diff)
feat(sticky keys): initial implementation
Diffstat (limited to 'app/tests')
-rw-r--r--app/tests/sticky-keys/1-os-dn-up/events.patterns1
-rw-r--r--app/tests/sticky-keys/1-os-dn-up/keycode_events.snapshot4
-rw-r--r--app/tests/sticky-keys/1-os-dn-up/native_posix.keymap13
-rw-r--r--app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/events.patterns1
-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.keymap13
-rw-r--r--app/tests/sticky-keys/3a-os-dn-kcdn-kcup-up/events.patterns1
-rw-r--r--app/tests/sticky-keys/3a-os-dn-kcdn-kcup-up/keycode_events.snapshot4
-rw-r--r--app/tests/sticky-keys/3a-os-dn-kcdn-kcup-up/native_posix.keymap13
-rw-r--r--app/tests/sticky-keys/3b-os-dn-kcdn-up-kcup/events.patterns1
-rw-r--r--app/tests/sticky-keys/3b-os-dn-kcdn-up-kcup/keycode_events.snapshot4
-rw-r--r--app/tests/sticky-keys/3b-os-dn-kcdn-up-kcup/native_posix.keymap13
-rw-r--r--app/tests/sticky-keys/4-os-dn-up-kcdn-timer-kcup/events.patterns1
-rw-r--r--app/tests/sticky-keys/4-os-dn-up-kcdn-timer-kcup/keycode_events.snapshot4
-rw-r--r--app/tests/sticky-keys/4-os-dn-up-kcdn-timer-kcup/native_posix.keymap13
-rw-r--r--app/tests/sticky-keys/5-os-kcdn-dn-kcup-up/events.patterns1
-rw-r--r--app/tests/sticky-keys/5-os-kcdn-dn-kcup-up/keycode_events.snapshot4
-rw-r--r--app/tests/sticky-keys/5-os-kcdn-dn-kcup-up/native_posix.keymap13
-rw-r--r--app/tests/sticky-keys/7-os-dn-up-kc1dn-kc2dn-kc1up-kc2up/events.patterns1
-rw-r--r--app/tests/sticky-keys/7-os-dn-up-kc1dn-kc2dn-kc1up-kc2up/keycode_events.snapshot6
-rw-r--r--app/tests/sticky-keys/7-os-dn-up-kc1dn-kc2dn-kc1up-kc2up/native_posix.keymap15
-rw-r--r--app/tests/sticky-keys/behavior_keymap.dtsi22
22 files changed, 152 insertions, 0 deletions
diff --git a/app/tests/sticky-keys/1-os-dn-up/events.patterns b/app/tests/sticky-keys/1-os-dn-up/events.patterns
new file mode 100644
index 0000000..833100f
--- /dev/null
+++ b/app/tests/sticky-keys/1-os-dn-up/events.patterns
@@ -0,0 +1 @@
+s/.*hid_listener_keycode_//p \ No newline at end of file
diff --git a/app/tests/sticky-keys/1-os-dn-up/keycode_events.snapshot b/app/tests/sticky-keys/1-os-dn-up/keycode_events.snapshot
new file mode 100644
index 0000000..5280f5c
--- /dev/null
+++ b/app/tests/sticky-keys/1-os-dn-up/keycode_events.snapshot
@@ -0,0 +1,4 @@
+pressed: usage_page 0x07 keycode 0x08 mods 0x00
+released: usage_page 0x07 keycode 0x08 mods 0x00
+pressed: usage_page 0x07 keycode 0x04 mods 0x00
+released: usage_page 0x07 keycode 0x04 mods 0x00
diff --git a/app/tests/sticky-keys/1-os-dn-up/native_posix.keymap b/app/tests/sticky-keys/1-os-dn-up/native_posix.keymap
new file mode 100644
index 0000000..dd2e6ea
--- /dev/null
+++ b/app/tests/sticky-keys/1-os-dn-up/native_posix.keymap
@@ -0,0 +1,13 @@
+#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(0,0,10)
+ ZMK_MOCK_RELEASE(0,0,1200)
+ 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/2-os-dn-up-kcdn-kcup/events.patterns b/app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/events.patterns
new file mode 100644
index 0000000..833100f
--- /dev/null
+++ b/app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/events.patterns
@@ -0,0 +1 @@
+s/.*hid_listener_keycode_//p \ No newline at end of file
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
new file mode 100644
index 0000000..758ed61
--- /dev/null
+++ b/app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/keycode_events.snapshot
@@ -0,0 +1,4 @@
+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
new file mode 100644
index 0000000..588f6a1
--- /dev/null
+++ b/app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/native_posix.keymap
@@ -0,0 +1,13 @@
+#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(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/3a-os-dn-kcdn-kcup-up/events.patterns b/app/tests/sticky-keys/3a-os-dn-kcdn-kcup-up/events.patterns
new file mode 100644
index 0000000..833100f
--- /dev/null
+++ b/app/tests/sticky-keys/3a-os-dn-kcdn-kcup-up/events.patterns
@@ -0,0 +1 @@
+s/.*hid_listener_keycode_//p \ No newline at end of file
diff --git a/app/tests/sticky-keys/3a-os-dn-kcdn-kcup-up/keycode_events.snapshot b/app/tests/sticky-keys/3a-os-dn-kcdn-kcup-up/keycode_events.snapshot
new file mode 100644
index 0000000..ee8aee0
--- /dev/null
+++ b/app/tests/sticky-keys/3a-os-dn-kcdn-kcup-up/keycode_events.snapshot
@@ -0,0 +1,4 @@
+pressed: usage_page 0x07 keycode 0x08 mods 0x00
+pressed: usage_page 0x07 keycode 0x04 mods 0x00
+released: usage_page 0x07 keycode 0x04 mods 0x00
+released: usage_page 0x07 keycode 0x08 mods 0x00
diff --git a/app/tests/sticky-keys/3a-os-dn-kcdn-kcup-up/native_posix.keymap b/app/tests/sticky-keys/3a-os-dn-kcdn-kcup-up/native_posix.keymap
new file mode 100644
index 0000000..3c33908
--- /dev/null
+++ b/app/tests/sticky-keys/3a-os-dn-kcdn-kcup-up/native_posix.keymap
@@ -0,0 +1,13 @@
+#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(0,0,10)
+ ZMK_MOCK_PRESS(1,0,10)
+ ZMK_MOCK_RELEASE(1,0,10)
+ ZMK_MOCK_RELEASE(0,0,10)
+ >;
+}; \ No newline at end of file
diff --git a/app/tests/sticky-keys/3b-os-dn-kcdn-up-kcup/events.patterns b/app/tests/sticky-keys/3b-os-dn-kcdn-up-kcup/events.patterns
new file mode 100644
index 0000000..833100f
--- /dev/null
+++ b/app/tests/sticky-keys/3b-os-dn-kcdn-up-kcup/events.patterns
@@ -0,0 +1 @@
+s/.*hid_listener_keycode_//p \ No newline at end of file
diff --git a/app/tests/sticky-keys/3b-os-dn-kcdn-up-kcup/keycode_events.snapshot b/app/tests/sticky-keys/3b-os-dn-kcdn-up-kcup/keycode_events.snapshot
new file mode 100644
index 0000000..758ed61
--- /dev/null
+++ b/app/tests/sticky-keys/3b-os-dn-kcdn-up-kcup/keycode_events.snapshot
@@ -0,0 +1,4 @@
+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/3b-os-dn-kcdn-up-kcup/native_posix.keymap b/app/tests/sticky-keys/3b-os-dn-kcdn-up-kcup/native_posix.keymap
new file mode 100644
index 0000000..e9290a3
--- /dev/null
+++ b/app/tests/sticky-keys/3b-os-dn-kcdn-up-kcup/native_posix.keymap
@@ -0,0 +1,13 @@
+#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(0,0,10)
+ ZMK_MOCK_PRESS(1,0,10)
+ ZMK_MOCK_RELEASE(0,0,10)
+ ZMK_MOCK_RELEASE(1,0,10)
+ >;
+}; \ No newline at end of file
diff --git a/app/tests/sticky-keys/4-os-dn-up-kcdn-timer-kcup/events.patterns b/app/tests/sticky-keys/4-os-dn-up-kcdn-timer-kcup/events.patterns
new file mode 100644
index 0000000..833100f
--- /dev/null
+++ b/app/tests/sticky-keys/4-os-dn-up-kcdn-timer-kcup/events.patterns
@@ -0,0 +1 @@
+s/.*hid_listener_keycode_//p \ No newline at end of file
diff --git a/app/tests/sticky-keys/4-os-dn-up-kcdn-timer-kcup/keycode_events.snapshot b/app/tests/sticky-keys/4-os-dn-up-kcdn-timer-kcup/keycode_events.snapshot
new file mode 100644
index 0000000..758ed61
--- /dev/null
+++ b/app/tests/sticky-keys/4-os-dn-up-kcdn-timer-kcup/keycode_events.snapshot
@@ -0,0 +1,4 @@
+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/4-os-dn-up-kcdn-timer-kcup/native_posix.keymap b/app/tests/sticky-keys/4-os-dn-up-kcdn-timer-kcup/native_posix.keymap
new file mode 100644
index 0000000..84daad6
--- /dev/null
+++ b/app/tests/sticky-keys/4-os-dn-up-kcdn-timer-kcup/native_posix.keymap
@@ -0,0 +1,13 @@
+#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(0,0,10)
+ ZMK_MOCK_RELEASE(0,0,800)
+ ZMK_MOCK_PRESS(1,0,400)
+ ZMK_MOCK_RELEASE(1,0,10)
+ >;
+}; \ No newline at end of file
diff --git a/app/tests/sticky-keys/5-os-kcdn-dn-kcup-up/events.patterns b/app/tests/sticky-keys/5-os-kcdn-dn-kcup-up/events.patterns
new file mode 100644
index 0000000..833100f
--- /dev/null
+++ b/app/tests/sticky-keys/5-os-kcdn-dn-kcup-up/events.patterns
@@ -0,0 +1 @@
+s/.*hid_listener_keycode_//p \ No newline at end of file
diff --git a/app/tests/sticky-keys/5-os-kcdn-dn-kcup-up/keycode_events.snapshot b/app/tests/sticky-keys/5-os-kcdn-dn-kcup-up/keycode_events.snapshot
new file mode 100644
index 0000000..99bac8d
--- /dev/null
+++ b/app/tests/sticky-keys/5-os-kcdn-dn-kcup-up/keycode_events.snapshot
@@ -0,0 +1,4 @@
+pressed: usage_page 0x07 keycode 0x04 mods 0x00
+pressed: usage_page 0x07 keycode 0x08 mods 0x00
+released: usage_page 0x07 keycode 0x04 mods 0x00
+released: usage_page 0x07 keycode 0x08 mods 0x00
diff --git a/app/tests/sticky-keys/5-os-kcdn-dn-kcup-up/native_posix.keymap b/app/tests/sticky-keys/5-os-kcdn-dn-kcup-up/native_posix.keymap
new file mode 100644
index 0000000..71a0a1b
--- /dev/null
+++ b/app/tests/sticky-keys/5-os-kcdn-dn-kcup-up/native_posix.keymap
@@ -0,0 +1,13 @@
+#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,0,10)
+ ZMK_MOCK_RELEASE(1,0,10)
+ ZMK_MOCK_RELEASE(0,0,1100)
+ >;
+}; \ No newline at end of file
diff --git a/app/tests/sticky-keys/7-os-dn-up-kc1dn-kc2dn-kc1up-kc2up/events.patterns b/app/tests/sticky-keys/7-os-dn-up-kc1dn-kc2dn-kc1up-kc2up/events.patterns
new file mode 100644
index 0000000..833100f
--- /dev/null
+++ b/app/tests/sticky-keys/7-os-dn-up-kc1dn-kc2dn-kc1up-kc2up/events.patterns
@@ -0,0 +1 @@
+s/.*hid_listener_keycode_//p \ No newline at end of file
diff --git a/app/tests/sticky-keys/7-os-dn-up-kc1dn-kc2dn-kc1up-kc2up/keycode_events.snapshot b/app/tests/sticky-keys/7-os-dn-up-kc1dn-kc2dn-kc1up-kc2up/keycode_events.snapshot
new file mode 100644
index 0000000..a9de7e1
--- /dev/null
+++ b/app/tests/sticky-keys/7-os-dn-up-kc1dn-kc2dn-kc1up-kc2up/keycode_events.snapshot
@@ -0,0 +1,6 @@
+pressed: usage_page 0x07 keycode 0x08 mods 0x00
+pressed: usage_page 0x07 keycode 0x04 mods 0x00
+pressed: usage_page 0x07 keycode 0x05 mods 0x00
+released: usage_page 0x07 keycode 0x08 mods 0x00
+released: usage_page 0x07 keycode 0x04 mods 0x00
+released: usage_page 0x07 keycode 0x05 mods 0x00
diff --git a/app/tests/sticky-keys/7-os-dn-up-kc1dn-kc2dn-kc1up-kc2up/native_posix.keymap b/app/tests/sticky-keys/7-os-dn-up-kc1dn-kc2dn-kc1up-kc2up/native_posix.keymap
new file mode 100644
index 0000000..7a9901b
--- /dev/null
+++ b/app/tests/sticky-keys/7-os-dn-up-kc1dn-kc2dn-kc1up-kc2up/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(0,0,10)
+ ZMK_MOCK_RELEASE(0,0,10)
+ ZMK_MOCK_PRESS(1,0,10)
+ ZMK_MOCK_PRESS(1,1,10)
+ ZMK_MOCK_RELEASE(1,0,100)
+ ZMK_MOCK_RELEASE(1,1,100)
+ >;
+}; \ No newline at end of file
diff --git a/app/tests/sticky-keys/behavior_keymap.dtsi b/app/tests/sticky-keys/behavior_keymap.dtsi
new file mode 100644
index 0000000..ae46396
--- /dev/null
+++ b/app/tests/sticky-keys/behavior_keymap.dtsi
@@ -0,0 +1,22 @@
+#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 &mo 1
+ &kp A &kp B>;
+ };
+
+ lower_layer {
+ bindings = <
+ &sk LEFT_CONTROL &kp X
+ &kp Y &kp Z>;
+ };
+ };
+};