mirror of
https://github.com/zmkfirmware/zmk.git
synced 2026-03-25 07:25: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:
3
app/tests/studio/move-layer/basic/events.patterns
Normal file
3
app/tests/studio/move-layer/basic/events.patterns
Normal file
@@ -0,0 +1,3 @@
|
||||
s/.*layer_changed/layer_changed/p
|
||||
s/.*hid_listener_keycode_//p
|
||||
s/.*on_move_layer_binding_pressed/move_layer/p
|
||||
5
app/tests/studio/move-layer/basic/extra-cmake-args
Normal file
5
app/tests/studio/move-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
|
||||
@@ -0,0 +1,8 @@
|
||||
move_layer: Moved layer from index 1 to index 2
|
||||
layer_changed: layer 1 state 1 locked 0
|
||||
layer_changed: layer 2 state 1 locked 0
|
||||
pressed: usage_page 0x07 keycode 0x06 implicit_mods 0x00 explicit_mods 0x00
|
||||
released: usage_page 0x07 keycode 0x06 implicit_mods 0x00 explicit_mods 0x00
|
||||
layer_changed: layer 2 state 0 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
|
||||
1
app/tests/studio/move-layer/basic/native_sim.conf
Normal file
1
app/tests/studio/move-layer/basic/native_sim.conf
Normal file
@@ -0,0 +1 @@
|
||||
CONFIG_ZMK_TEST_BEHAVIORS=y
|
||||
26
app/tests/studio/move-layer/basic/native_sim.keymap
Normal file
26
app/tests/studio/move-layer/basic/native_sim.keymap
Normal file
@@ -0,0 +1,26 @@
|
||||
#include <dt-bindings/zmk/keys.h>
|
||||
#include <behaviors.dtsi>
|
||||
#include <dt-bindings/zmk/kscan_mock.h>
|
||||
#include "../behavior_keymap.dtsi"
|
||||
|
||||
// Test moving a layer: swap layers 1 and 2, turn both on,
|
||||
// press transparent on layer 1 at index 2
|
||||
// which should fall through to layer 2 at index 1
|
||||
&kscan {
|
||||
events = <
|
||||
// move layer 1 to position 2 (effectively swapping layers 1 and 2)
|
||||
ZMK_MOCK_PRESS(0,0,10)
|
||||
ZMK_MOCK_RELEASE(0,0,10)
|
||||
// activate layers 1 and 2
|
||||
ZMK_MOCK_PRESS(1,0,10)
|
||||
ZMK_MOCK_PRESS(1,1,10)
|
||||
// press position 0,1 on layer 2 - should output C from layer 2 at index 1
|
||||
ZMK_MOCK_PRESS(0,1,10)
|
||||
ZMK_MOCK_RELEASE(0,1,10)
|
||||
// release layer 2 (at index 1)
|
||||
ZMK_MOCK_RELEASE(1,1,10)
|
||||
// press position 0,1 again - should output A from default layer
|
||||
ZMK_MOCK_PRESS(0,1,10)
|
||||
ZMK_MOCK_RELEASE(0,1,10)
|
||||
>;
|
||||
};
|
||||
Reference in New Issue
Block a user