Skip to content

Commit

Permalink
fix(tests): Fix caps word tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joelspadin committed Apr 11, 2023
1 parent 1ba91ee commit ac5fee7
Show file tree
Hide file tree
Showing 24 changed files with 165 additions and 21 deletions.
6 changes: 6 additions & 0 deletions app/tests/caps-word/behavior_keymap.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,9 @@
};
};
};

&caps_word {
continue-list = <UNDERSCORE BACKSPACE DELETE>;
/delete-property/ shift-list;
idle-timeout-ms = <0>;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
s/.*hid_listener_keycode_//p
s/.*hid_implicit_modifiers_//p
s/.*caps_word_keycode_state_changed_listener/state_changed/p
s/.*caps_word_timeout_handler/timeout/p
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
state_changed: 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
state_changed: 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include <dt-bindings/zmk/keys.h>
#include <behaviors.dtsi>
#include <dt-bindings/zmk/kscan_mock.h>
#include "../behavior_keymap.dtsi"

&caps_word {
idle-timeout-ms = <1000>;
};

&kscan {
events = <
ZMK_MOCK_PRESS(0,0,10)
ZMK_MOCK_RELEASE(0,0,10)
ZMK_MOCK_PRESS(0,1,1500)
ZMK_MOCK_RELEASE(0,1,10)
ZMK_MOCK_PRESS(0,1,10)
ZMK_MOCK_RELEASE(0,1,10)
>;
};
3 changes: 1 addition & 2 deletions app/tests/caps-word/continue-with-modifiers/events.patterns
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
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
s/.*caps_word_keycode_state_changed_listener/state_changed/p
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
enhance_usage: Enhancing usage 0x04 with modifiers: 0x02
state_changed: 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
state_changed: 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
};
};

&caps_word {
continue-list = <UNDERSCORE BACKSPACE DELETE>;
/delete-property/ shift-list;
};

&kscan {
events = <
ZMK_MOCK_PRESS(0,0,10)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
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
s/.*caps_word_keycode_state_changed_listener/state_changed/p
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
enhance_usage: Enhancing usage 0x04 with modifiers: 0x02
state_changed: 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
state_changed: 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
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
s/.*caps_word_keycode_state_changed_listener/state_changed/p
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
enhance_usage: Enhancing usage 0x04 with modifiers: 0x02
state_changed: 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
Expand All @@ -7,7 +7,7 @@ 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
state_changed: 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
Expand Down
3 changes: 3 additions & 0 deletions app/tests/caps-word/continue-with-shifted-key/events.patterns
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
s/.*hid_listener_keycode_//p
s/.*hid_implicit_modifiers_//p
s/.*caps_word_keycode_state_changed_listener/state_changed/p
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
state_changed: 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
state_changed: Enhancing usage 0x2D with modifiers: 0x02
pressed: usage_page 0x07 keycode 0x2D implicit_mods 0x02 explicit_mods 0x00
press: Modifiers set to 0x02
released: usage_page 0x07 keycode 0x2D implicit_mods 0x00 explicit_mods 0x00
release: Modifiers set to 0x00
state_changed: 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include <dt-bindings/zmk/keys.h>
#include <behaviors.dtsi>
#include <dt-bindings/zmk/kscan_mock.h>
#include "../behavior_keymap.dtsi"

&caps_word {
continue-list = <>;
shift-list = <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)
>;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
s/.*hid_listener_keycode_//p
s/.*hid_implicit_modifiers_//p
s/.*caps_word_keycode_state_changed_listener/state_changed/p
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
state_changed: 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
state_changed: Deactivating caps_word for 0x07 - 0x23
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
Original file line number Diff line number Diff line change
@@ -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 = <>;
shift-list = <A>;
no-default-keys;
};

&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)
>;
};
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
s/.*hid_listener_keycode_//p
s/.*hid_implicit_modifiers_//p
s/.*caps_word_enhance_usage/enhance_usage/p
s/.*caps_word_keycode_state_changed_listener/state_changed/p
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
enhance_usage: Enhancing usage 0x04 with modifiers: 0x02
state_changed: 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
state_changed: Deactivating caps_word for 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
s/.*hid_listener_keycode_//p
s/.*hid_implicit_modifiers_//p
s/.*caps_word_enhance_usage/enhance_usage/p
s/.*caps_word_keycode_state_changed_listener/state_changed/p
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
enhance_usage: Enhancing usage 0x04 with modifiers: 0x02
state_changed: 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
Expand Down
4 changes: 4 additions & 0 deletions app/tests/caps-word/deactivate-by-timeout/events.patterns
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
s/.*hid_listener_keycode_//p
s/.*hid_implicit_modifiers_//p
s/.*caps_word_keycode_state_changed_listener/state_changed/p
s/.*caps_word_timeout_handler/timeout/p
10 changes: 10 additions & 0 deletions app/tests/caps-word/deactivate-by-timeout/keycode_events.snapshot
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
state_changed: 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
timeout: Deactivating caps_word for idle timeout
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
19 changes: 19 additions & 0 deletions app/tests/caps-word/deactivate-by-timeout/native_posix_64.keymap
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include <dt-bindings/zmk/keys.h>
#include <behaviors.dtsi>
#include <dt-bindings/zmk/kscan_mock.h>
#include "../behavior_keymap.dtsi"

&caps_word {
idle-timeout-ms = <1000>;
};

&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,1500)
ZMK_MOCK_PRESS(0,1,10)
ZMK_MOCK_RELEASE(0,1,10)
>;
};

0 comments on commit ac5fee7

Please sign in to comment.