Browse Source

test(behavior): Add alt-tab test and modded alpha test for toggle key

Uses multiple toggles of modifier keys overlapping each other.
xmkb
Caleb Goates 3 years ago committed by Pete Johanson
parent
commit
6dc436cb23
  1. 1
      app/tests/keytoggle/kt-alt-tab/events.patterns
  2. 28
      app/tests/keytoggle/kt-alt-tab/keycode_events.snapshot
  3. 48
      app/tests/keytoggle/kt-alt-tab/native_posix_64.keymap
  4. 1
      app/tests/keytoggle/kt-modded-alpha/events.patterns
  5. 12
      app/tests/keytoggle/kt-modded-alpha/keycode_events.snapshot
  6. 38
      app/tests/keytoggle/kt-modded-alpha/native_posix_64.keymap
  7. 1
      app/tests/keytoggle/kt-press-release-nkro/events.patterns
  8. 2
      app/tests/keytoggle/kt-press-release-nkro/keycode_events.snapshot
  9. 7
      app/tests/keytoggle/kt-press-release-nkro/native_posix_64.conf
  10. 10
      app/tests/keytoggle/kt-press-release-nkro/native_posix_64.keymap

1
app/tests/keytoggle/kt-alt-tab/events.patterns

@ -0,0 +1 @@
s/.*\(hid_listener_keycode_\|hid_implicit_modifiers_\)//p

28
app/tests/keytoggle/kt-alt-tab/keycode_events.snapshot

@ -0,0 +1,28 @@
pressed: usage_page 0x07 keycode 0xE2 implicit_mods 0x00 explicit_mods 0x00
press: Modifiers set to 0x04
pressed: usage_page 0x07 keycode 0x2B implicit_mods 0x00 explicit_mods 0x00
press: Modifiers set to 0x04
released: usage_page 0x07 keycode 0x2B implicit_mods 0x00 explicit_mods 0x00
release: Modifiers set to 0x04
pressed: usage_page 0x07 keycode 0x2B implicit_mods 0x00 explicit_mods 0x00
press: Modifiers set to 0x04
released: usage_page 0x07 keycode 0x2B implicit_mods 0x00 explicit_mods 0x00
release: Modifiers set to 0x04
pressed: usage_page 0x07 keycode 0xE1 implicit_mods 0x00 explicit_mods 0x00
press: Modifiers set to 0x06
pressed: usage_page 0x07 keycode 0x2B implicit_mods 0x00 explicit_mods 0x00
press: Modifiers set to 0x06
released: usage_page 0x07 keycode 0x2B implicit_mods 0x00 explicit_mods 0x00
release: Modifiers set to 0x06
released: usage_page 0x07 keycode 0xE2 implicit_mods 0x00 explicit_mods 0x00
release: Modifiers set to 0x02
pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
press: Modifiers set to 0x02
released: usage_page 0x07 keycode 0x04 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
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

48
app/tests/keytoggle/kt-alt-tab/native_posix_64.keymap

@ -0,0 +1,48 @@
#include <dt-bindings/zmk/keys.h>
#include <behaviors.dtsi>
#include <dt-bindings/zmk/kscan_mock.h>
&kscan {
events = <
/* Toggle LALT on */
ZMK_MOCK_PRESS(0,0,10)
ZMK_MOCK_RELEASE(0,0,10)
/* Tap TAB twice */
ZMK_MOCK_PRESS(0,1,10)
ZMK_MOCK_RELEASE(0,1,10)
ZMK_MOCK_PRESS(0,1,10)
ZMK_MOCK_RELEASE(0,1,10)
/* Toggle LSHFT on */
ZMK_MOCK_PRESS(1,0,10)
ZMK_MOCK_RELEASE(1,0,10)
/* Tap TAB once */
ZMK_MOCK_PRESS(0,1,10)
ZMK_MOCK_RELEASE(0,1,10)
/* Toggle LALT off */
ZMK_MOCK_PRESS(0,0,10)
ZMK_MOCK_RELEASE(0,0,10)
/* Tap A */
ZMK_MOCK_PRESS(1,1,10)
ZMK_MOCK_RELEASE(1,1,10)
/* Toggle LSHFT off */
ZMK_MOCK_PRESS(1,0,10)
ZMK_MOCK_RELEASE(1,0,10)
/* Tap A */
ZMK_MOCK_PRESS(1,1,10)
ZMK_MOCK_RELEASE(1,1,10)
>;
};
/ {
keymap {
compatible = "zmk,keymap";
label ="Default keymap";
default_layer {
bindings = <
&kt LALT &kp TAB
&kt LSHFT &kp A
>;
};
};
};

1
app/tests/keytoggle/kt-modded-alpha/events.patterns

@ -0,0 +1 @@
s/.*\(hid_listener_keycode_\|hid_implicit_modifiers_\)//p

12
app/tests/keytoggle/kt-modded-alpha/keycode_events.snapshot

@ -0,0 +1,12 @@
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 0x02 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 0x02 explicit_mods 0x00
release: Modifiers set to 0x00
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

38
app/tests/keytoggle/kt-modded-alpha/native_posix_64.keymap

@ -0,0 +1,38 @@
#include <dt-bindings/zmk/keys.h>
#include <behaviors.dtsi>
#include <dt-bindings/zmk/kscan_mock.h>
&kscan {
events = <
/* Toggle LS(A) on */
ZMK_MOCK_PRESS(0,0,10)
ZMK_MOCK_RELEASE(0,0,10)
/* Toggle LS(A) off */
ZMK_MOCK_PRESS(0,0,10)
ZMK_MOCK_RELEASE(0,0,10)
/* Press A */
ZMK_MOCK_PRESS(1,0,10)
/* Toggle LS(A) on */
ZMK_MOCK_PRESS(0,0,10)
ZMK_MOCK_RELEASE(0,0,10)
/* Toggle LS(A) off */
ZMK_MOCK_PRESS(0,0,10)
ZMK_MOCK_RELEASE(0,0,10)
/* Release A */
ZMK_MOCK_RELEASE(1,0,10)
>;
};
/ {
keymap {
compatible = "zmk,keymap";
label ="Default keymap";
default_layer {
bindings = <
&kt LS(A) &trans
&kp A &trans
>;
};
};
};

1
app/tests/keytoggle/kt-press-release-nkro/events.patterns

@ -0,0 +1 @@
s/.*hid_listener_keycode_//p

2
app/tests/keytoggle/kt-press-release-nkro/keycode_events.snapshot

@ -0,0 +1,2 @@
pressed: usage_page 0x07 keycode 0x05 implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x05 implicit_mods 0x00 explicit_mods 0x00

7
app/tests/keytoggle/kt-press-release-nkro/native_posix_64.conf

@ -0,0 +1,7 @@
CONFIG_GPIO=n
CONFIG_LOG=y
CONFIG_LOG_BACKEND_SHOW_COLOR=n
CONFIG_ZMK_LOG_LEVEL_DBG=y
CONFIG_DEBUG=y
CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000
CONFIG_ZMK_HID_REPORT_TYPE_NKRO=y

10
app/tests/keytoggle/kt-press-release-nkro/native_posix_64.keymap

@ -0,0 +1,10 @@
#include "../behavior_keymap.dtsi"
&kscan {
events = <
ZMK_MOCK_PRESS(0,0,10)
ZMK_MOCK_RELEASE(0,0,10)
ZMK_MOCK_PRESS(0,0,10)
ZMK_MOCK_RELEASE(0,0,10)
>;
};
Loading…
Cancel
Save