diff options
author | Cody McGinnis <brainwart@gmail.com> | 2020-08-28 16:21:31 -0400 |
---|---|---|
committer | Cody McGinnis <brainwart@gmail.com> | 2020-08-28 16:21:31 -0400 |
commit | 5f56266a6953dd1ebeb95ded4213e74f9572ae4d (patch) | |
tree | 1b2fd7a89ea6b72cb33df3e0b2b2adb4db176c1e /app/tests | |
parent | 5b21f15a0a3e2d27d57b7a657d031a66d1124701 (diff) |
feat(test): add tests for momentary layers
Diffstat (limited to 'app/tests')
7 files changed, 56 insertions, 0 deletions
diff --git a/app/tests/momentary-layer/behavior_keymap.dtsi b/app/tests/momentary-layer/behavior_keymap.dtsi new file mode 100644 index 0000000..34c445c --- /dev/null +++ b/app/tests/momentary-layer/behavior_keymap.dtsi @@ -0,0 +1,28 @@ +#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 = < + &kp B &mo 1 + &kp D &kp G>; + }; + + lower_layer { + bindings = < + &cp M_NEXT &trans + &kp L &kp J>; + }; + + raise_layer { + bindings = < + &kp W &kp U + &kp X &kp M>; + }; + }; +}; diff --git a/app/tests/momentary-layer/early-key-release/events.patterns b/app/tests/momentary-layer/early-key-release/events.patterns new file mode 100644 index 0000000..bd7b488 --- /dev/null +++ b/app/tests/momentary-layer/early-key-release/events.patterns @@ -0,0 +1,2 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p
\ No newline at end of file diff --git a/app/tests/momentary-layer/early-key-release/keycode_events.snapshot b/app/tests/momentary-layer/early-key-release/keycode_events.snapshot new file mode 100644 index 0000000..474eef7 --- /dev/null +++ b/app/tests/momentary-layer/early-key-release/keycode_events.snapshot @@ -0,0 +1,4 @@ +kp_pressed: usage_page 0x07 keycode 0x05 +mo_pressed: position 1 layer 1 +kp_released: usage_page 0x07 keycode 0x05 +mo_released: position 1 layer 1 diff --git a/app/tests/momentary-layer/early-key-release/native_posix.keymap b/app/tests/momentary-layer/early-key-release/native_posix.keymap new file mode 100644 index 0000000..a58ad26 --- /dev/null +++ b/app/tests/momentary-layer/early-key-release/native_posix.keymap @@ -0,0 +1,8 @@ +#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,0) ZMK_MOCK_PRESS(0,1,100) ZMK_MOCK_RELEASE(0,0,200) ZMK_MOCK_RELEASE(0,1,300)>; +};
\ No newline at end of file diff --git a/app/tests/momentary-layer/normal/events.patterns b/app/tests/momentary-layer/normal/events.patterns new file mode 100644 index 0000000..bd7b488 --- /dev/null +++ b/app/tests/momentary-layer/normal/events.patterns @@ -0,0 +1,2 @@ +s/.*hid_listener_keycode/kp/p +s/.*mo_keymap_binding/mo/p
\ No newline at end of file diff --git a/app/tests/momentary-layer/normal/keycode_events.snapshot b/app/tests/momentary-layer/normal/keycode_events.snapshot new file mode 100644 index 0000000..f3fca66 --- /dev/null +++ b/app/tests/momentary-layer/normal/keycode_events.snapshot @@ -0,0 +1,4 @@ +mo_pressed: position 1 layer 1 +kp_pressed: usage_page 0x0c keycode 0xb5 +kp_released: usage_page 0x0c keycode 0xb5 +mo_released: position 1 layer 1
\ No newline at end of file diff --git a/app/tests/momentary-layer/normal/native_posix.keymap b/app/tests/momentary-layer/normal/native_posix.keymap new file mode 100644 index 0000000..1b67858 --- /dev/null +++ b/app/tests/momentary-layer/normal/native_posix.keymap @@ -0,0 +1,8 @@ +#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,1,0) ZMK_MOCK_PRESS(0,0,100) ZMK_MOCK_RELEASE(0,0,200) ZMK_MOCK_RELEASE(0,1,300)>; +};
\ No newline at end of file |