summaryrefslogtreecommitdiff
path: root/app/tests
diff options
context:
space:
mode:
Diffstat (limited to 'app/tests')
-rw-r--r--app/tests/caps-word/behavior_keymap.dtsi17
-rw-r--r--app/tests/caps-word/continue-with-non-alpha-continue-list-item/events.patterns4
-rw-r--r--app/tests/caps-word/continue-with-non-alpha-continue-list-item/keycode_events.snapshot17
-rw-r--r--app/tests/caps-word/continue-with-non-alpha-continue-list-item/native_posix.keymap21
-rw-r--r--app/tests/caps-word/continue-with-non-modified-numeric-usage-id/events.patterns4
-rw-r--r--app/tests/caps-word/continue-with-non-modified-numeric-usage-id/keycode_events.snapshot14
-rw-r--r--app/tests/caps-word/continue-with-non-modified-numeric-usage-id/native_posix.keymap21
-rw-r--r--app/tests/caps-word/deactivate-by-non-alpha-non-continuation/events.patterns3
-rw-r--r--app/tests/caps-word/deactivate-by-non-alpha-non-continuation/keycode_events.snapshot13
-rw-r--r--app/tests/caps-word/deactivate-by-non-alpha-non-continuation/native_posix.keymap17
-rw-r--r--app/tests/caps-word/deactivate-by-second-press/events.patterns3
-rw-r--r--app/tests/caps-word/deactivate-by-second-press/keycode_events.snapshot9
-rw-r--r--app/tests/caps-word/deactivate-by-second-press/native_posix.keymap17
13 files changed, 160 insertions, 0 deletions
diff --git a/app/tests/caps-word/behavior_keymap.dtsi b/app/tests/caps-word/behavior_keymap.dtsi
new file mode 100644
index 0000000..04653be
--- /dev/null
+++ b/app/tests/caps-word/behavior_keymap.dtsi
@@ -0,0 +1,17 @@
+#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 = <
+ &caps_word &kp A
+ &kp N6 &kp MINUS
+ >;
+ };
+ };
+};
diff --git a/app/tests/caps-word/continue-with-non-alpha-continue-list-item/events.patterns b/app/tests/caps-word/continue-with-non-alpha-continue-list-item/events.patterns
new file mode 100644
index 0000000..dd4d3d3
--- /dev/null
+++ b/app/tests/caps-word/continue-with-non-alpha-continue-list-item/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-non-alpha-continue-list-item/keycode_events.snapshot b/app/tests/caps-word/continue-with-non-alpha-continue-list-item/keycode_events.snapshot
new file mode 100644
index 0000000..fe705ba
--- /dev/null
+++ b/app/tests/caps-word/continue-with-non-alpha-continue-list-item/keycode_events.snapshot
@@ -0,0 +1,17 @@
+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
+caps_includelist: Comparing with 0x07 - 0x2d (with implicit mods: 0x02)
+caps_includelist: Comparing with 0x07 - 0x2d (with implicit mods: 0x00)
+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 0x00
+released: usage_page 0x07 keycode 0x2d 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-non-alpha-continue-list-item/native_posix.keymap b/app/tests/caps-word/continue-with-non-alpha-continue-list-item/native_posix.keymap
new file mode 100644
index 0000000..68c3249
--- /dev/null
+++ b/app/tests/caps-word/continue-with-non-alpha-continue-list-item/native_posix.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"
+
+&caps_word {
+ continue-list = <UNDERSCORE 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,1,10)
+ ZMK_MOCK_RELEASE(1,1,10)
+ ZMK_MOCK_PRESS(0,1,10)
+ ZMK_MOCK_RELEASE(0,1,10)
+ >;
+}; \ No newline at end of file
diff --git a/app/tests/caps-word/continue-with-non-modified-numeric-usage-id/events.patterns b/app/tests/caps-word/continue-with-non-modified-numeric-usage-id/events.patterns
new file mode 100644
index 0000000..dd4d3d3
--- /dev/null
+++ b/app/tests/caps-word/continue-with-non-modified-numeric-usage-id/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-non-modified-numeric-usage-id/keycode_events.snapshot b/app/tests/caps-word/continue-with-non-modified-numeric-usage-id/keycode_events.snapshot
new file mode 100644
index 0000000..23ddbe1
--- /dev/null
+++ b/app/tests/caps-word/continue-with-non-modified-numeric-usage-id/keycode_events.snapshot
@@ -0,0 +1,14 @@
+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 0x23 implicit_mods 0x00 explicit_mods 0x00
+press: Modifiers set to 0x00
+released: usage_page 0x07 keycode 0x23 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-non-modified-numeric-usage-id/native_posix.keymap b/app/tests/caps-word/continue-with-non-modified-numeric-usage-id/native_posix.keymap
new file mode 100644
index 0000000..40a4d4a
--- /dev/null
+++ b/app/tests/caps-word/continue-with-non-modified-numeric-usage-id/native_posix.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"
+
+&caps_word {
+ continue-list = <UNDERSCORE 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_RELEASE(1,0,10)
+ ZMK_MOCK_PRESS(0,1,10)
+ ZMK_MOCK_RELEASE(0,1,10)
+ >;
+}; \ No newline at end of file
diff --git a/app/tests/caps-word/deactivate-by-non-alpha-non-continuation/events.patterns b/app/tests/caps-word/deactivate-by-non-alpha-non-continuation/events.patterns
new file mode 100644
index 0000000..fa75ab0
--- /dev/null
+++ b/app/tests/caps-word/deactivate-by-non-alpha-non-continuation/events.patterns
@@ -0,0 +1,3 @@
+s/.*hid_listener_keycode_//p
+s/.*hid_implicit_modifiers_//p
+s/.*caps_word_enhance_usage/enhance_usage/p \ No newline at end of file
diff --git a/app/tests/caps-word/deactivate-by-non-alpha-non-continuation/keycode_events.snapshot b/app/tests/caps-word/deactivate-by-non-alpha-non-continuation/keycode_events.snapshot
new file mode 100644
index 0000000..eb24c4b
--- /dev/null
+++ b/app/tests/caps-word/deactivate-by-non-alpha-non-continuation/keycode_events.snapshot
@@ -0,0 +1,13 @@
+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 0x2d implicit_mods 0x00 explicit_mods 0x00
+press: Modifiers set to 0x00
+released: usage_page 0x07 keycode 0x2d implicit_mods 0x00 explicit_mods 0x00
+release: Modifiers set to 0x00
+pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
+press: Modifiers set to 0x00
+released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
+release: Modifiers set to 0x00
diff --git a/app/tests/caps-word/deactivate-by-non-alpha-non-continuation/native_posix.keymap b/app/tests/caps-word/deactivate-by-non-alpha-non-continuation/native_posix.keymap
new file mode 100644
index 0000000..4219e35
--- /dev/null
+++ b/app/tests/caps-word/deactivate-by-non-alpha-non-continuation/native_posix.keymap
@@ -0,0 +1,17 @@
+#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(0,1,10)
+ ZMK_MOCK_RELEASE(0,1,10)
+ ZMK_MOCK_PRESS(1,1,10)
+ ZMK_MOCK_RELEASE(1,1,10)
+ ZMK_MOCK_PRESS(0,1,10)
+ ZMK_MOCK_RELEASE(0,1,10)
+ >;
+}; \ No newline at end of file
diff --git a/app/tests/caps-word/deactivate-by-second-press/events.patterns b/app/tests/caps-word/deactivate-by-second-press/events.patterns
new file mode 100644
index 0000000..fa75ab0
--- /dev/null
+++ b/app/tests/caps-word/deactivate-by-second-press/events.patterns
@@ -0,0 +1,3 @@
+s/.*hid_listener_keycode_//p
+s/.*hid_implicit_modifiers_//p
+s/.*caps_word_enhance_usage/enhance_usage/p \ No newline at end of file
diff --git a/app/tests/caps-word/deactivate-by-second-press/keycode_events.snapshot b/app/tests/caps-word/deactivate-by-second-press/keycode_events.snapshot
new file mode 100644
index 0000000..5181f75
--- /dev/null
+++ b/app/tests/caps-word/deactivate-by-second-press/keycode_events.snapshot
@@ -0,0 +1,9 @@
+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 0x04 implicit_mods 0x00 explicit_mods 0x00
+press: Modifiers set to 0x00
+released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
+release: Modifiers set to 0x00
diff --git a/app/tests/caps-word/deactivate-by-second-press/native_posix.keymap b/app/tests/caps-word/deactivate-by-second-press/native_posix.keymap
new file mode 100644
index 0000000..05f13fe
--- /dev/null
+++ b/app/tests/caps-word/deactivate-by-second-press/native_posix.keymap
@@ -0,0 +1,17 @@
+#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(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)
+ >;
+}; \ No newline at end of file