Skip to content

Commit

Permalink
Add test for ignore-keys
Browse files Browse the repository at this point in the history
  • Loading branch information
urob committed Dec 12, 2024
1 parent 3483445 commit 14d29e4
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/behavior_keymap.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
leader: leader {
compatible = "zmk,behavior-leader-key";
#binding-cells = <0>;
ignore-keys = <LSHFT>;

leader_seq_one {
sequence = <N0 N1>;
Expand All @@ -30,7 +31,7 @@
default_layer {
bindings = <
&kp N0 &kp N1
&kp N2 &leader
&kp LSHFT &leader
>;
};
};
Expand Down
3 changes: 3 additions & 0 deletions tests/ignore-keys/events.patterns
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
s/.*hid_listener_keycode/kp/p
s/.*hid_\(un\)\?register_mod: //p
s/.*leader[a-z_]*: //p
16 changes: 16 additions & 0 deletions tests/ignore-keys/keycode_events.snapshot
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Activating leader key
Ignoring key press 0x07 - 0xE1
kp_pressed: usage_page 0x07 keycode 0xE1 implicit_mods 0x00 explicit_mods 0x00
Modifier 1 count 1
Modifiers set to 0x02
Sequence completed by 0x07 - 0x1E
Deactivating leader key
Pressing leader binding
kp_pressed: usage_page 0x07 keycode 0x06 implicit_mods 0x00 explicit_mods 0x00
Released usage_page 0x07 keycode 0x1E implicit_mods 0x00, 0 pressed keys remaining
Releasing leader binding
kp_released: usage_page 0x07 keycode 0x06 implicit_mods 0x00 explicit_mods 0x00
kp_released: usage_page 0x07 keycode 0xE1 implicit_mods 0x00 explicit_mods 0x00
Modifier 1 count: 0
Modifier 1 released
Modifiers set to 0x00
12 changes: 12 additions & 0 deletions tests/ignore-keys/native_posix_64.keymap
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include "../behavior_keymap.dtsi"

&kscan {
events = <
ZMK_MOCK_PRESS(1,1,10)
ZMK_MOCK_RELEASE(1,1,10)
ZMK_MOCK_PRESS(1,0,10)
ZMK_MOCK_PRESS(0,1,10)
ZMK_MOCK_RELEASE(0,1,10)
ZMK_MOCK_RELEASE(1,0,10)
>;
};

0 comments on commit 14d29e4

Please sign in to comment.