aboutsummaryrefslogtreecommitdiffhomepage
path: root/app/tests
diff options
context:
space:
mode:
Diffstat (limited to 'app/tests')
-rw-r--r--app/tests/keytoggle/kt-off/events.patterns1
-rw-r--r--app/tests/keytoggle/kt-off/keycode_events.snapshot4
-rw-r--r--app/tests/keytoggle/kt-off/native_posix_64.keymap29
-rw-r--r--app/tests/keytoggle/kt-on/events.patterns1
-rw-r--r--app/tests/keytoggle/kt-on/keycode_events.snapshot6
-rw-r--r--app/tests/keytoggle/kt-on/native_posix_64.keymap30
-rw-r--r--app/tests/toggle-layer/behavior_keymap.dtsi2
-rw-r--r--app/tests/toggle-layer/early-key-release/native_posix_64.keymap10
-rw-r--r--app/tests/toggle-layer/normal/keycode_events.snapshot4
-rw-r--r--app/tests/toggle-layer/normal/native_posix_64.keymap11
-rw-r--r--app/tests/toggle-layer/toggle-mode-off/events.patterns4
-rw-r--r--app/tests/toggle-layer/toggle-mode-off/keycode_events.snapshot14
-rw-r--r--app/tests/toggle-layer/toggle-mode-off/native_posix_64.keymap25
-rw-r--r--app/tests/toggle-layer/toggle-mode-on/events.patterns2
-rw-r--r--app/tests/toggle-layer/toggle-mode-on/keycode_events.snapshot8
-rw-r--r--app/tests/toggle-layer/toggle-mode-on/native_posix_64.keymap21
16 files changed, 168 insertions, 4 deletions
diff --git a/app/tests/keytoggle/kt-off/events.patterns b/app/tests/keytoggle/kt-off/events.patterns
new file mode 100644
index 0000000000..833100f6ac
--- /dev/null
+++ b/app/tests/keytoggle/kt-off/events.patterns
@@ -0,0 +1 @@
+s/.*hid_listener_keycode_//p \ No newline at end of file
diff --git a/app/tests/keytoggle/kt-off/keycode_events.snapshot b/app/tests/keytoggle/kt-off/keycode_events.snapshot
new file mode 100644
index 0000000000..2440460586
--- /dev/null
+++ b/app/tests/keytoggle/kt-off/keycode_events.snapshot
@@ -0,0 +1,4 @@
+released: usage_page 0x07 keycode 0x05 implicit_mods 0x00 explicit_mods 0x00
+pressed: usage_page 0x07 keycode 0x05 implicit_mods 0x00 explicit_mods 0x00
+released: usage_page 0x07 keycode 0x05 implicit_mods 0x00 explicit_mods 0x00
+released: usage_page 0x07 keycode 0x05 implicit_mods 0x00 explicit_mods 0x00 \ No newline at end of file
diff --git a/app/tests/keytoggle/kt-off/native_posix_64.keymap b/app/tests/keytoggle/kt-off/native_posix_64.keymap
new file mode 100644
index 0000000000..4abf6ee99d
--- /dev/null
+++ b/app/tests/keytoggle/kt-off/native_posix_64.keymap
@@ -0,0 +1,29 @@
+#include "../behavior_keymap.dtsi"
+
+&kt {
+ toggle-mode = "off";
+};
+
+&kscan {
+ events = <
+ ZMK_MOCK_PRESS(0,0,10)
+ ZMK_MOCK_RELEASE(0,0,10)
+ ZMK_MOCK_PRESS(1,1,10)
+ ZMK_MOCK_PRESS(0,0,10)
+ ZMK_MOCK_RELEASE(1,1,10)
+ ZMK_MOCK_RELEASE(0,0,10)
+ >;
+};
+
+/ {
+ keymap {
+ compatible = "zmk,keymap";
+
+ default_layer {
+ bindings = <
+ &kt B &trans
+ &trans &kp B
+ >;
+ };
+ };
+}; \ No newline at end of file
diff --git a/app/tests/keytoggle/kt-on/events.patterns b/app/tests/keytoggle/kt-on/events.patterns
new file mode 100644
index 0000000000..833100f6ac
--- /dev/null
+++ b/app/tests/keytoggle/kt-on/events.patterns
@@ -0,0 +1 @@
+s/.*hid_listener_keycode_//p \ No newline at end of file
diff --git a/app/tests/keytoggle/kt-on/keycode_events.snapshot b/app/tests/keytoggle/kt-on/keycode_events.snapshot
new file mode 100644
index 0000000000..6954f3daa9
--- /dev/null
+++ b/app/tests/keytoggle/kt-on/keycode_events.snapshot
@@ -0,0 +1,6 @@
+pressed: usage_page 0x07 keycode 0x05 implicit_mods 0x00 explicit_mods 0x00
+pressed: unregistering usage_page 0x07 keycode 0x05 since it was already pressed
+pressed: usage_page 0x07 keycode 0x05 implicit_mods 0x00 explicit_mods 0x00
+pressed: unregistering usage_page 0x07 keycode 0x05 since it was already pressed
+pressed: usage_page 0x07 keycode 0x05 implicit_mods 0x00 explicit_mods 0x00
+released: usage_page 0x07 keycode 0x05 implicit_mods 0x00 explicit_mods 0x00 \ No newline at end of file
diff --git a/app/tests/keytoggle/kt-on/native_posix_64.keymap b/app/tests/keytoggle/kt-on/native_posix_64.keymap
new file mode 100644
index 0000000000..964aa93bb8
--- /dev/null
+++ b/app/tests/keytoggle/kt-on/native_posix_64.keymap
@@ -0,0 +1,30 @@
+#include "../behavior_keymap.dtsi"
+
+&kt {
+ toggle-mode = "on";
+};
+
+
+&kscan {
+ events = <
+ ZMK_MOCK_PRESS(0,0,10)
+ ZMK_MOCK_RELEASE(0,0,10)
+ ZMK_MOCK_PRESS(1,1,10)
+ ZMK_MOCK_PRESS(0,0,10)
+ ZMK_MOCK_RELEASE(1,1,10)
+ ZMK_MOCK_RELEASE(0,0,10)
+ >;
+};
+
+/ {
+ keymap {
+ compatible = "zmk,keymap";
+
+ default_layer {
+ bindings = <
+ &kt B &trans
+ &trans &kp B
+ >;
+ };
+ };
+}; \ No newline at end of file
diff --git a/app/tests/toggle-layer/behavior_keymap.dtsi b/app/tests/toggle-layer/behavior_keymap.dtsi
index 1ff4a81f3e..7c712a874f 100644
--- a/app/tests/toggle-layer/behavior_keymap.dtsi
+++ b/app/tests/toggle-layer/behavior_keymap.dtsi
@@ -9,7 +9,7 @@
default_layer {
bindings = <
&kp B &tog 1
- &kp D &kp G>;
+ &kp D &to 1>;
};
lower_layer {
diff --git a/app/tests/toggle-layer/early-key-release/native_posix_64.keymap b/app/tests/toggle-layer/early-key-release/native_posix_64.keymap
index 0a0c88ea84..dfdbe1724c 100644
--- a/app/tests/toggle-layer/early-key-release/native_posix_64.keymap
+++ b/app/tests/toggle-layer/early-key-release/native_posix_64.keymap
@@ -4,6 +4,12 @@
#include "../behavior_keymap.dtsi"
&kscan {
- events = <ZMK_MOCK_PRESS(0,0,10) ZMK_MOCK_PRESS(0,1,10) ZMK_MOCK_RELEASE(0,0,10) ZMK_MOCK_RELEASE(0,1,10)
- ZMK_MOCK_PRESS(0,0,10) ZMK_MOCK_RELEASE(0,0,10)>;
+ events = <
+ ZMK_MOCK_PRESS(0,0,10)
+ ZMK_MOCK_PRESS(0,1,10)
+ ZMK_MOCK_RELEASE(0,0,10)
+ ZMK_MOCK_RELEASE(0,1,10)
+ ZMK_MOCK_PRESS(0,0,10)
+ ZMK_MOCK_RELEASE(0,0,10)
+ >;
}; \ No newline at end of file
diff --git a/app/tests/toggle-layer/normal/keycode_events.snapshot b/app/tests/toggle-layer/normal/keycode_events.snapshot
index 515772a4d1..1d28c7f98a 100644
--- a/app/tests/toggle-layer/normal/keycode_events.snapshot
+++ b/app/tests/toggle-layer/normal/keycode_events.snapshot
@@ -2,3 +2,7 @@ tog_pressed: position 1 layer 1
tog_released: position 1 layer 1
kp_pressed: usage_page 0x0C keycode 0xB5 implicit_mods 0x00 explicit_mods 0x00
kp_released: usage_page 0x0C keycode 0xB5 implicit_mods 0x00 explicit_mods 0x00
+tog_pressed: position 1 layer 1
+tog_released: position 1 layer 1
+kp_pressed: usage_page 0x07 keycode 0x05 implicit_mods 0x00 explicit_mods 0x00
+kp_released: usage_page 0x07 keycode 0x05 implicit_mods 0x00 explicit_mods 0x00 \ No newline at end of file
diff --git a/app/tests/toggle-layer/normal/native_posix_64.keymap b/app/tests/toggle-layer/normal/native_posix_64.keymap
index 97bdd17993..8f0124db34 100644
--- a/app/tests/toggle-layer/normal/native_posix_64.keymap
+++ b/app/tests/toggle-layer/normal/native_posix_64.keymap
@@ -4,5 +4,14 @@
#include "../behavior_keymap.dtsi"
&kscan {
- events = <ZMK_MOCK_PRESS(0,1,10) ZMK_MOCK_RELEASE(0,1,10) ZMK_MOCK_PRESS(0,0,10) ZMK_MOCK_RELEASE(0,0,10)>;
+ events = <
+ ZMK_MOCK_PRESS(0,1,10)
+ ZMK_MOCK_RELEASE(0,1,10)
+ ZMK_MOCK_PRESS(0,0,10)
+ ZMK_MOCK_RELEASE(0,0,10)
+ ZMK_MOCK_PRESS(0,1,10)
+ ZMK_MOCK_RELEASE(0,1,10)
+ ZMK_MOCK_PRESS(0,0,10)
+ ZMK_MOCK_RELEASE(0,0,10)
+ >;
}; \ No newline at end of file
diff --git a/app/tests/toggle-layer/toggle-mode-off/events.patterns b/app/tests/toggle-layer/toggle-mode-off/events.patterns
new file mode 100644
index 0000000000..30996ad02d
--- /dev/null
+++ b/app/tests/toggle-layer/toggle-mode-off/events.patterns
@@ -0,0 +1,4 @@
+s/.*hid_listener_keycode/kp/p
+s/.*to_keymap_binding/to/p
+s/.*layer_changed/layer_changed/p
+s/.*tog_keymap_binding/tog/p \ No newline at end of file
diff --git a/app/tests/toggle-layer/toggle-mode-off/keycode_events.snapshot b/app/tests/toggle-layer/toggle-mode-off/keycode_events.snapshot
new file mode 100644
index 0000000000..94b7b3607e
--- /dev/null
+++ b/app/tests/toggle-layer/toggle-mode-off/keycode_events.snapshot
@@ -0,0 +1,14 @@
+tog_pressed: position 1 layer 1
+tog_released: position 1 layer 1
+kp_pressed: usage_page 0x07 keycode 0x05 implicit_mods 0x00 explicit_mods 0x00
+kp_released: usage_page 0x07 keycode 0x05 implicit_mods 0x00 explicit_mods 0x00
+to_pressed: position 3 layer 1
+layer_changed: layer 1 state 1
+to_released: position 3 layer 1
+kp_pressed: usage_page 0x0C keycode 0xB5 implicit_mods 0x00 explicit_mods 0x00
+kp_released: usage_page 0x0C keycode 0xB5 implicit_mods 0x00 explicit_mods 0x00
+tog_pressed: position 1 layer 1
+layer_changed: layer 1 state 0
+tog_released: position 1 layer 1
+kp_pressed: usage_page 0x07 keycode 0x05 implicit_mods 0x00 explicit_mods 0x00
+kp_released: usage_page 0x07 keycode 0x05 implicit_mods 0x00 explicit_mods 0x00 \ No newline at end of file
diff --git a/app/tests/toggle-layer/toggle-mode-off/native_posix_64.keymap b/app/tests/toggle-layer/toggle-mode-off/native_posix_64.keymap
new file mode 100644
index 0000000000..a89182fcc2
--- /dev/null
+++ b/app/tests/toggle-layer/toggle-mode-off/native_posix_64.keymap
@@ -0,0 +1,25 @@
+#include <dt-bindings/zmk/keys.h>
+#include <behaviors.dtsi>
+#include <dt-bindings/zmk/kscan_mock.h>
+#include "../behavior_keymap.dtsi"
+
+&tog {
+ toggle-mode = "off";
+};
+
+&kscan {
+ events = <
+ ZMK_MOCK_PRESS(0,1,10)
+ ZMK_MOCK_RELEASE(0,1,10)
+ ZMK_MOCK_PRESS(0,0,10)
+ ZMK_MOCK_RELEASE(0,0,10)
+ ZMK_MOCK_PRESS(1,1,10)
+ ZMK_MOCK_RELEASE(1,1,10)
+ ZMK_MOCK_PRESS(0,0,10)
+ ZMK_MOCK_RELEASE(0,0,10)
+ ZMK_MOCK_PRESS(0,1,10)
+ ZMK_MOCK_RELEASE(0,1,10)
+ ZMK_MOCK_PRESS(0,0,10)
+ ZMK_MOCK_RELEASE(0,0,10)
+ >;
+}; \ No newline at end of file
diff --git a/app/tests/toggle-layer/toggle-mode-on/events.patterns b/app/tests/toggle-layer/toggle-mode-on/events.patterns
new file mode 100644
index 0000000000..397fef4f31
--- /dev/null
+++ b/app/tests/toggle-layer/toggle-mode-on/events.patterns
@@ -0,0 +1,2 @@
+s/.*hid_listener_keycode/kp/p
+s/.*tog_keymap_binding/tog/p \ No newline at end of file
diff --git a/app/tests/toggle-layer/toggle-mode-on/keycode_events.snapshot b/app/tests/toggle-layer/toggle-mode-on/keycode_events.snapshot
new file mode 100644
index 0000000000..3dd5f27e06
--- /dev/null
+++ b/app/tests/toggle-layer/toggle-mode-on/keycode_events.snapshot
@@ -0,0 +1,8 @@
+tog_pressed: position 1 layer 1
+tog_released: position 1 layer 1
+kp_pressed: usage_page 0x0C keycode 0xB5 implicit_mods 0x00 explicit_mods 0x00
+kp_released: usage_page 0x0C keycode 0xB5 implicit_mods 0x00 explicit_mods 0x00
+tog_pressed: position 1 layer 1
+tog_released: position 1 layer 1
+kp_pressed: usage_page 0x0C keycode 0xB5 implicit_mods 0x00 explicit_mods 0x00
+kp_released: usage_page 0x0C keycode 0xB5 implicit_mods 0x00 explicit_mods 0x00 \ No newline at end of file
diff --git a/app/tests/toggle-layer/toggle-mode-on/native_posix_64.keymap b/app/tests/toggle-layer/toggle-mode-on/native_posix_64.keymap
new file mode 100644
index 0000000000..690787eb77
--- /dev/null
+++ b/app/tests/toggle-layer/toggle-mode-on/native_posix_64.keymap
@@ -0,0 +1,21 @@
+#include <dt-bindings/zmk/keys.h>
+#include <behaviors.dtsi>
+#include <dt-bindings/zmk/kscan_mock.h>
+#include "../behavior_keymap.dtsi"
+
+&tog {
+ toggle-mode = "on";
+};
+
+&kscan {
+ events = <
+ ZMK_MOCK_PRESS(0,1,10)
+ ZMK_MOCK_RELEASE(0,1,10)
+ ZMK_MOCK_PRESS(0,0,10)
+ ZMK_MOCK_RELEASE(0,0,10)
+ ZMK_MOCK_PRESS(0,1,10)
+ ZMK_MOCK_RELEASE(0,1,10)
+ ZMK_MOCK_PRESS(0,0,10)
+ ZMK_MOCK_RELEASE(0,0,10)
+ >;
+}; \ No newline at end of file