Add testcase for OneShot/TapDance/Macros compatibility

OneShot keys should apply to all the key events generated by a Macros key, not
just the first one, even if the Macros key is injected by TapDance.

Signed-off-by: Michael Richters <gedankenexperimenter@gmail.com>
pull/1035/head
Michael Richters 4 years ago
parent 1ff881a86b
commit e334be135d
No known key found for this signature in database
GPG Key ID: 1288FD13E4EEF0C0

@ -15,6 +15,7 @@
*/ */
#include <Kaleidoscope.h> #include <Kaleidoscope.h>
#include <Kaleidoscope-Macros.h>
#include <Kaleidoscope-OneShot.h> #include <Kaleidoscope-OneShot.h>
#include <Kaleidoscope-TapDance.h> #include <Kaleidoscope-TapDance.h>
@ -46,13 +47,26 @@ void tapDanceAction(uint8_t tap_dance_index,
switch (tap_dance_index) { switch (tap_dance_index) {
case 0: case 0:
return tapDanceActionKeys(tap_count, tap_dance_action, return tapDanceActionKeys(tap_count, tap_dance_action,
Key_Period, LSHIFT(Key_1)); Key_Period, M(0), LSHIFT(Key_1));
default: default:
break; break;
} }
} }
KALEIDOSCOPE_INIT_PLUGINS(OneShot, TapDance); const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) {
if (keyToggledOn(event.state)) {
switch (macro_id) {
case 0:
Macros.type(PSTR("abc"));
break;
default:
break;
}
}
return MACRO_NONE;
}
KALEIDOSCOPE_INIT_PLUGINS(Macros, OneShot, TapDance);
void setup() { void setup() {
Kaleidoscope.setup(); Kaleidoscope.setup();

@ -122,4 +122,56 @@ RELEASE A
RUN 1 cycle RUN 1 cycle
EXPECT keyboard-report empty EXPECT keyboard-report empty
RUN 5 ms
# ==============================================================================
NAME OSM applies to whole Macro
RUN 4 ms
PRESS OS_SHIFT
RUN 1 cycle
EXPECT keyboard-report Key_LeftShift # report: { e1 }
RUN 4 ms
RELEASE OS_SHIFT
RUN 1 cycle
RUN 4 ms
PRESS TD_0
RUN 1 cycle
RUN 4 ms
RELEASE TD_0
RUN 1 cycle
RUN 4 ms
PRESS TD_0
RUN 1 cycle
RUN 4 ms
RELEASE TD_0
RUN 1 cycle
# ------------------------------------------------------------------------------
# Next, we press `space`, triggering both the resolution of the TapDance key and
# the release of the OneShot key, in that order.
RUN 4 ms
PRESS SPACE
RUN 1 cycle
EXPECT keyboard-report Key_LeftShift Key_A # report: { 4 e1 }
EXPECT keyboard-report Key_LeftShift # report: { e1 }
EXPECT keyboard-report Key_LeftShift Key_B # report: { 5 e1 }
EXPECT keyboard-report Key_LeftShift # report: { e1 }
EXPECT keyboard-report Key_LeftShift Key_C # report: { 6 e1 }
EXPECT keyboard-report Key_LeftShift # report: { e1 }
EXPECT keyboard-report empty # report: { }
EXPECT keyboard-report Key_Spacebar # report: { 2c }
RUN 4 ms
RELEASE SPACE
RUN 1 cycle
EXPECT keyboard-report empty
RUN 5 ms RUN 5 ms

Loading…
Cancel
Save