mirror of
https://github.com/zmkfirmware/zmk.git
synced 2026-03-26 07:55:17 -05:00
chore: Add basic tests for Studio's layer manipulation (#3164)
chore: Add test behaviors for Studio testing chore: Add basic tests for studio layer adjustment chore: Fixes from code review
This commit is contained in:
4
app/tests/studio/add-layer/basic/events.patterns
Normal file
4
app/tests/studio/add-layer/basic/events.patterns
Normal file
@@ -0,0 +1,4 @@
|
||||
s/.*on_add_layer_binding_pressed/add_layer/p
|
||||
s/.*on_set_layer_binding_at_idx_binding_pressed/set_layer_binding/p
|
||||
s/.*layer_changed/layer_changed/p
|
||||
s/.*hid_listener_keycode_//p
|
||||
5
app/tests/studio/add-layer/basic/extra-cmake-args
Normal file
5
app/tests/studio/add-layer/basic/extra-cmake-args
Normal file
@@ -0,0 +1,5 @@
|
||||
-DCONFIG_ZMK_BEHAVIOR_METADATA=y
|
||||
-DCONFIG_ZMK_BEHAVIOR_LOCAL_IDS=y
|
||||
-DCONFIG_ZMK_KEYMAP_LAYER_REORDERING=y
|
||||
-DCONFIG_ZMK_KEYMAP_SETTINGS_STORAGE=y
|
||||
-DCONFIG_SETTINGS=y
|
||||
6
app/tests/studio/add-layer/basic/keycode_events.snapshot
Normal file
6
app/tests/studio/add-layer/basic/keycode_events.snapshot
Normal file
@@ -0,0 +1,6 @@
|
||||
add_layer: Added layer 1
|
||||
set_layer_binding: Set binding at layer 1, index 0 to binding 1/2
|
||||
layer_changed: layer 1 state 1 locked 0
|
||||
pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
|
||||
released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
|
||||
layer_changed: layer 1 state 0 locked 0
|
||||
1
app/tests/studio/add-layer/basic/native_sim.conf
Normal file
1
app/tests/studio/add-layer/basic/native_sim.conf
Normal file
@@ -0,0 +1 @@
|
||||
CONFIG_ZMK_TEST_BEHAVIORS=y
|
||||
23
app/tests/studio/add-layer/basic/native_sim.keymap
Normal file
23
app/tests/studio/add-layer/basic/native_sim.keymap
Normal file
@@ -0,0 +1,23 @@
|
||||
#include <dt-bindings/zmk/keys.h>
|
||||
#include <behaviors.dtsi>
|
||||
#include <dt-bindings/zmk/kscan_mock.h>
|
||||
#include "../behavior_keymap.dtsi"
|
||||
|
||||
// Test adding a layer, setting a binding, activating it, and pressing the binding
|
||||
&kscan {
|
||||
events = <
|
||||
// add a new layer
|
||||
ZMK_MOCK_PRESS(0,0,10)
|
||||
ZMK_MOCK_RELEASE(0,0,10)
|
||||
// set binding A at layer 1, position 0
|
||||
ZMK_MOCK_PRESS(0,1,10)
|
||||
ZMK_MOCK_RELEASE(0,1,10)
|
||||
// activate layer 1 with momentary
|
||||
ZMK_MOCK_PRESS(1,0,10)
|
||||
// press position 0 on new layer (should be A)
|
||||
ZMK_MOCK_PRESS(0,0,10)
|
||||
ZMK_MOCK_RELEASE(0,0,10)
|
||||
// release momentary layer 1
|
||||
ZMK_MOCK_RELEASE(1,0,10)
|
||||
>;
|
||||
};
|
||||
Reference in New Issue
Block a user