aboutsummaryrefslogtreecommitdiffhomepage
path: root/app/tests
diff options
context:
space:
mode:
authorPeter Johanson <[email protected]>2022-06-04 03:27:40 +0000
committerPete Johanson <[email protected]>2022-06-04 01:38:42 -0400
commitb3c9c18feea07646432c0998f767f4cf9b76c399 (patch)
tree038b9157234a0bf451877fe6612cddb422352e1c /app/tests
parentd01bc6afc68390a5a48c51e3f1d9dcbb0d3eb597 (diff)
downloadzmk-b3c9c18feea07646432c0998f767f4cf9b76c399.tar.gz
zmk-b3c9c18feea07646432c0998f767f4cf9b76c399.zip
feat(behaviors): Continue on mods in caps word.
* Continue caps word when mods are changed, and match the continue list on combination of explicit and implicit modifiers.
Diffstat (limited to 'app/tests')
-rw-r--r--app/tests/caps-word/continue-with-modifiers/events.patterns4
-rw-r--r--app/tests/caps-word/continue-with-modifiers/keycode_events.snapshot20
-rw-r--r--app/tests/caps-word/continue-with-modifiers/native_posix_64.keymap33
3 files changed, 57 insertions, 0 deletions
diff --git a/app/tests/caps-word/continue-with-modifiers/events.patterns b/app/tests/caps-word/continue-with-modifiers/events.patterns
new file mode 100644
index 0000000000..dd4d3d3f70
--- /dev/null
+++ b/app/tests/caps-word/continue-with-modifiers/events.patterns
@@ -0,0 +1,4 @@
+s/.*hid_listener_keycode_//p
+s/.*hid_implicit_modifiers_//p
+s/.*caps_word_enhance_usage/enhance_usage/p
+s/.*caps_word_is_caps_includelist/caps_includelist/p \ No newline at end of file
diff --git a/app/tests/caps-word/continue-with-modifiers/keycode_events.snapshot b/app/tests/caps-word/continue-with-modifiers/keycode_events.snapshot
new file mode 100644
index 0000000000..b4752fd416
--- /dev/null
+++ b/app/tests/caps-word/continue-with-modifiers/keycode_events.snapshot
@@ -0,0 +1,20 @@
+enhance_usage: Enhancing usage 0x04 with modifiers: 0x02
+pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x02 explicit_mods 0x00
+press: Modifiers set to 0x02
+released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
+release: Modifiers set to 0x00
+pressed: usage_page 0x07 keycode 0xE1 implicit_mods 0x00 explicit_mods 0x00
+press: Modifiers set to 0x02
+caps_includelist: Comparing with 0x07 - 0x2D (with implicit mods: 0x02)
+caps_includelist: Continuing capsword, found included usage: 0x07 - 0x2D
+pressed: usage_page 0x07 keycode 0x2D implicit_mods 0x00 explicit_mods 0x00
+press: Modifiers set to 0x02
+released: usage_page 0x07 keycode 0x2D implicit_mods 0x00 explicit_mods 0x00
+release: Modifiers set to 0x02
+released: usage_page 0x07 keycode 0xE1 implicit_mods 0x00 explicit_mods 0x00
+release: Modifiers set to 0x00
+enhance_usage: Enhancing usage 0x04 with modifiers: 0x02
+pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x02 explicit_mods 0x00
+press: Modifiers set to 0x02
+released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
+release: Modifiers set to 0x00
diff --git a/app/tests/caps-word/continue-with-modifiers/native_posix_64.keymap b/app/tests/caps-word/continue-with-modifiers/native_posix_64.keymap
new file mode 100644
index 0000000000..3053d5dfca
--- /dev/null
+++ b/app/tests/caps-word/continue-with-modifiers/native_posix_64.keymap
@@ -0,0 +1,33 @@
+#include <dt-bindings/zmk/keys.h>
+#include <behaviors.dtsi>
+#include <dt-bindings/zmk/kscan_mock.h>
+#include "../behavior_keymap.dtsi"
+
+/ {
+ keymap {
+ compatible = "zmk,keymap";
+ label = "Default keymap";
+
+ default_layer {
+ bindings = <
+ &caps_word &kp A
+ &kp LSHFT &kp MINUS
+ >;
+ };
+ };
+};
+
+&kscan {
+ events = <
+ 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(1,0,10)
+ ZMK_MOCK_PRESS(1,1,10)
+ ZMK_MOCK_RELEASE(1,1,10)
+ ZMK_MOCK_RELEASE(1,0,10)
+ ZMK_MOCK_PRESS(0,1,10)
+ ZMK_MOCK_RELEASE(0,1,10)
+ >;
+}; \ No newline at end of file