From 78ec964b09513971c5e1a24ad779472d7139bdd5 Mon Sep 17 00:00:00 2001 From: Michael Richters Date: Tue, 6 Apr 2021 19:06:32 -0500 Subject: [PATCH] Update testcases: events/keyboard-state/macros Signed-off-by: Michael Richters --- .../events/keyboard-state/macros/macros.ino | 13 +++----- .../events/keyboard-state/macros/test.ktest | 32 ++++++++----------- 2 files changed, 19 insertions(+), 26 deletions(-) diff --git a/tests/features/events/keyboard-state/macros/macros.ino b/tests/features/events/keyboard-state/macros/macros.ino index 5f98bf6b..ca67cb94 100644 --- a/tests/features/events/keyboard-state/macros/macros.ino +++ b/tests/features/events/keyboard-state/macros/macros.ino @@ -19,10 +19,6 @@ #include "./common.h" -#undef min -#undef max -#include - // *INDENT-OFF* KEYMAPS( [0] = KEYMAP_STACKED @@ -60,12 +56,13 @@ KEYMAPS( ) // *INDENT-ON* -const macro_t *macroAction(uint8_t index, uint8_t key_state) { - if (keyToggledOn(key_state)) { +const macro_t *macroAction(uint8_t index, KeyEvent &event) { + if (keyToggledOn(event.state)) { switch (index) { case 0: - Kaleidoscope.hid().keyboard().pressKey(Key_Y); - break; + return MACRO(D(Y)); + //event.key = Key_Y; + //break; } } return MACRO_NONE; diff --git a/tests/features/events/keyboard-state/macros/test.ktest b/tests/features/events/keyboard-state/macros/test.ktest index 2a8754e7..30a190b1 100644 --- a/tests/features/events/keyboard-state/macros/test.ktest +++ b/tests/features/events/keyboard-state/macros/test.ktest @@ -1,51 +1,47 @@ VERSION 1 -KEYSWITCH A 0 0 -KEYSWITCH LAYER_SHIFT 1 0 +KEYSWITCH A 0 0 +KEYSWITCH L_1 1 0 # ============================================================================== # Keyboard state array NAME Keyboard state array cleared -RUN 10 ms - +RUN 4 ms PRESS A RUN 1 cycle EXPECT keyboard-report Key_A # Report should contain only `A` -RUN 5 ms - +RUN 4 ms RELEASE A RUN 1 cycle EXPECT keyboard-report empty # Report should be empty RUN 5 ms - # Press and hold `ShiftToLayer(1)`, changing the `A` key to `X` -PRESS LAYER_SHIFT -RUN 5 ms +PRESS L_1 +RUN 4 ms PRESS A RUN 1 cycle EXPECT keyboard-report Key_Y # Report should contain only `Y` -RUN 1 cycle -EXPECT keyboard-report empty # Report should be empty RUN 5 ms +RELEASE L_1 +RUN 4 ms RELEASE A +RUN 1 cycle +EXPECT keyboard-report empty # Report should be empty -RUN 5 ms - -RELEASE LAYER_SHIFT -RUN 5 ms - +RUN 4 ms PRESS A RUN 1 cycle EXPECT keyboard-report Key_A # Report should contain only `A` -RUN 5 ms - +RUN 4 ms RELEASE A RUN 1 cycle EXPECT keyboard-report empty # Report should be empty + +RUN 5 ms