Add Leader testcases, including for issue #407

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

@ -23,7 +23,7 @@ KEYMAPS(
[0] = KEYMAP_STACKED
(
LEAD(0), ___, ___, ___, ___, ___, ___,
Key_A, Key_B, Key_C, Key_D, ___, ___, ___,
Key_A, Key_B, Key_C, Key_D, Key_C, ___, ___,
___, ___, ___, ___, ___, ___,
___, ___, ___, ___, ___, ___, ___,
___, ___, ___, ___,
@ -41,18 +41,33 @@ KEYMAPS(
KALEIDOSCOPE_INIT_PLUGINS(Leader);
static void leaderBC(uint8_t id) {
Macros.type(PSTR("x"));
static void leaderAB(uint8_t id) {
Macros.type(PSTR("z"));
}
static void leaderAC(uint8_t id) {
Macros.type(PSTR("xyz"));
}
static void leaderBA(uint8_t id) {
Macros.type(PSTR("y"));
}
static void leaderBC(uint8_t id) {
Macros.type(PSTR("x"));
}
static void leaderC(uint8_t id) {
Macros.type(PSTR("q"));
}
// *INDENT-OFF*
static const kaleidoscope::plugin::Leader::dictionary_t leader_dictionary[] PROGMEM =
LEADER_DICT( {LEADER_SEQ(LEAD(0), Key_B, Key_C), leaderBC},
{LEADER_SEQ(LEAD(0), Key_A, Key_C), leaderAC} );
LEADER_DICT( {LEADER_SEQ(LEAD(0), Key_A, Key_B), leaderAB},
{LEADER_SEQ(LEAD(0), Key_A, Key_C), leaderAC},
{LEADER_SEQ(LEAD(0), Key_B, Key_A), leaderBA},
{LEADER_SEQ(LEAD(0), Key_B, Key_C), leaderBC},
{LEADER_SEQ(LEAD(0), Key_C), leaderC } );
// *INDENT-ON*
void setup() {

@ -5,6 +5,70 @@ KEYSWITCH A 1 0
KEYSWITCH B 1 1
KEYSWITCH C 1 2
KEYSWITCH D 1 3
KEYSWITCH C2 1 4
# ==============================================================================
NAME Leader sequence abort
RUN 4 ms
PRESS LEAD_0
RUN 1 cycle
RUN 4 ms
RELEASE LEAD_0
RUN 1 cycle
RUN 4 ms
PRESS A
RUN 1 cycle
RUN 4 ms
RELEASE A
RUN 1 cycle
RUN 4 ms
PRESS D
RUN 1 cycle
EXPECT keyboard-report Key_D # report: { 7 }
RUN 4 ms
RELEASE D
RUN 1 cycle
EXPECT keyboard-report empty # report: { }
RUN 5 ms
# ==============================================================================
NAME Leader sequence AB
RUN 4 ms
PRESS LEAD_0
RUN 1 cycle
RUN 4 ms
RELEASE LEAD_0
RUN 1 cycle
RUN 4 ms
PRESS A
RUN 1 cycle
RUN 4 ms
RELEASE A
RUN 1 cycle
RUN 4 ms
PRESS B
RUN 1 cycle
EXPECT keyboard-report Key_Z # report should contain `Z` (0x1d)
EXPECT keyboard-report empty # report should be empty
RUN 4 ms
RELEASE B
RUN 1 cycle
RUN 5 ms
EXPECT no keyboard-report # expect no more reports
# ==============================================================================
NAME Leader sequence AC
@ -42,6 +106,38 @@ RUN 1 cycle
RUN 5 ms
EXPECT no keyboard-report # expect no more reports
# ==============================================================================
NAME Leader sequence BA
RUN 4 ms
PRESS LEAD_0
RUN 1 cycle
RUN 4 ms
RELEASE LEAD_0
RUN 1 cycle
RUN 4 ms
PRESS B
RUN 1 cycle
RUN 4 ms
RELEASE B
RUN 1 cycle
RUN 4 ms
PRESS A
RUN 1 cycle
EXPECT keyboard-report Key_Y # report should contain `Y` (0x1c)
EXPECT keyboard-report empty # report should be empty
RUN 4 ms
RELEASE A
RUN 1 cycle
RUN 5 ms
EXPECT no keyboard-report # expect no more reports
# ==============================================================================
NAME Leader sequence BC
@ -74,6 +170,172 @@ RUN 1 cycle
RUN 5 ms
EXPECT no keyboard-report # expect no more reports
# ==============================================================================
NAME Leader sequence C
RUN 4 ms
PRESS LEAD_0
RUN 1 cycle
RUN 4 ms
RELEASE LEAD_0
RUN 1 cycle
RUN 4 ms
PRESS C
RUN 1 cycle
EXPECT keyboard-report Key_Q # report should contain `Q` (0x13)
EXPECT keyboard-report empty # report should be empty
RUN 4 ms
RELEASE C
RUN 1 cycle
RUN 5 ms
EXPECT no keyboard-report # expect no more reports
# ==============================================================================
NAME Leader sequence BA rollover
RUN 4 ms
PRESS LEAD_0
RUN 1 cycle
RUN 4 ms
RELEASE LEAD_0
RUN 1 cycle
RUN 4 ms
PRESS B
RUN 1 cycle
RUN 4 ms
PRESS A
RUN 1 cycle
EXPECT keyboard-report Key_Y # report should contain `Y` (0x1c)
EXPECT keyboard-report empty # report should be empty
RUN 4 ms
RELEASE B
RUN 1 cycle
RUN 4 ms
RELEASE A
RUN 1 cycle
RUN 5 ms
EXPECT no keyboard-report # expect no more reports
# ==============================================================================
NAME Leader sequence C rollover
RUN 4 ms
PRESS LEAD_0
RUN 1 cycle
RUN 4 ms
RELEASE LEAD_0
RUN 1 cycle
RUN 4 ms
PRESS C
RUN 1 cycle
EXPECT keyboard-report Key_Q # report should contain `Q` (0x13)
EXPECT keyboard-report empty # report should be empty
RUN 4 ms
PRESS D
RUN 1 cycle
EXPECT keyboard-report Key_D # report should contain `D` (0x07)
RUN 4 ms
RELEASE C
RUN 1 cycle
RUN 4 ms
RELEASE D
RUN 1 cycle
EXPECT keyboard-report empty # report should be empty
RUN 5 ms
EXPECT no keyboard-report # expect no more reports
# ==============================================================================
NAME Leader sequence C2 rollover
RUN 4 ms
PRESS LEAD_0
RUN 1 cycle
RUN 4 ms
RELEASE LEAD_0
RUN 1 cycle
RUN 4 ms
PRESS C2
RUN 1 cycle
EXPECT keyboard-report Key_Q # report should contain `Q` (0x13)
EXPECT keyboard-report empty # report should be empty
RUN 4 ms
PRESS D
RUN 1 cycle
EXPECT keyboard-report Key_D # report should contain `D` (0x07)
RUN 4 ms
RELEASE C2
RUN 1 cycle
RUN 4 ms
RELEASE D
RUN 1 cycle
EXPECT keyboard-report empty # report should be empty
RUN 5 ms
EXPECT no keyboard-report # expect no more reports
# ==============================================================================
NAME Leader sequence ABD rollover
RUN 4 ms
PRESS LEAD_0
RUN 1 cycle
RUN 4 ms
RELEASE LEAD_0
RUN 1 cycle
RUN 4 ms
PRESS A
RUN 1 cycle
RUN 4 ms
RELEASE A
RUN 1 cycle
RUN 4 ms
PRESS B
RUN 1 cycle
EXPECT keyboard-report Key_Z # report should contain `Z` (0x1d)
EXPECT keyboard-report empty # report should be empty
RUN 4 ms
PRESS D
RUN 1 cycle
EXPECT keyboard-report Key_D # report should contain `D` (0x07)
RUN 4 ms
RELEASE B
RUN 1 cycle
RUN 4 ms
RELEASE D
RUN 1 cycle
EXPECT keyboard-report empty # report should be empty
RUN 5 ms
EXPECT no keyboard-report # expect no more reports
# ==============================================================================
NAME Leader sequence timeout

Loading…
Cancel
Save