Add testcases for issue #423
Signed-off-by: Michael Richters <gedankenexperimenter@gmail.com>pull/1035/head
parent
1296e3ee66
commit
c9a98ecb26
@ -0,0 +1,64 @@
|
||||
/* -*- mode: c++ -*-
|
||||
* Copyright (C) 2021 Keyboard.io, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <Kaleidoscope.h>
|
||||
#include <Kaleidoscope-OneShot.h>
|
||||
#include <Kaleidoscope-TapDance.h>
|
||||
|
||||
// *INDENT-OFF*
|
||||
KEYMAPS(
|
||||
[0] = KEYMAP_STACKED
|
||||
(
|
||||
Key_Spacebar, Key_A, ___, ___, ___, ___, ___,
|
||||
TD(0), OSM(LeftShift), ___, ___, ___, ___, ___,
|
||||
___, ___, ___, ___, ___, ___,
|
||||
___, ___, ___, ___, ___, ___, ___,
|
||||
___, ___, ___, ___,
|
||||
___,
|
||||
|
||||
___, ___, ___, ___, ___, ___, ___,
|
||||
___, ___, ___, ___, ___, ___, ___,
|
||||
___, ___, ___, ___, ___, ___,
|
||||
___, ___, ___, ___, ___, ___, ___,
|
||||
___, ___, ___, ___,
|
||||
___
|
||||
),
|
||||
)
|
||||
// *INDENT-ON*
|
||||
|
||||
void tapDanceAction(uint8_t tap_dance_index,
|
||||
KeyAddr key_addr,
|
||||
uint8_t tap_count,
|
||||
kaleidoscope::plugin::TapDance::ActionType tap_dance_action) {
|
||||
switch (tap_dance_index) {
|
||||
case 0:
|
||||
return tapDanceActionKeys(tap_count, tap_dance_action,
|
||||
Key_Period, LSHIFT(Key_1));
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
KALEIDOSCOPE_INIT_PLUGINS(OneShot, TapDance);
|
||||
|
||||
void setup() {
|
||||
Kaleidoscope.setup();
|
||||
TapDance.time_out = 25;
|
||||
}
|
||||
|
||||
void loop() {
|
||||
Kaleidoscope.loop();
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"cpu": {
|
||||
"fqbn": "keyboardio:virtual:model01",
|
||||
"port": ""
|
||||
}
|
||||
}
|
@ -0,0 +1,125 @@
|
||||
VERSION 1
|
||||
|
||||
KEYSWITCH SPACE 0 0
|
||||
KEYSWITCH A 0 1
|
||||
KEYSWITCH TD_0 1 0
|
||||
KEYSWITCH OS_SHIFT 1 1
|
||||
|
||||
# ==============================================================================
|
||||
NAME Back and forth
|
||||
|
||||
RUN 4 ms
|
||||
PRESS TD_0
|
||||
RUN 1 cycle
|
||||
|
||||
RUN 4 ms
|
||||
RELEASE TD_0
|
||||
RUN 1 cycle
|
||||
|
||||
RUN 4 ms
|
||||
PRESS OS_SHIFT
|
||||
RUN 1 cycle
|
||||
EXPECT keyboard-report Key_Period # report: { 37 }
|
||||
EXPECT keyboard-report empty
|
||||
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
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# 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
|
||||
# First, the TapDance key is resolved, adding `.` to the report. This event also
|
||||
# triggers the release of the OneShot key, which shouldn't happen until after
|
||||
# the `.` press is processed.
|
||||
EXPECT keyboard-report Key_LeftShift Key_Period # report: { 37 e1 }
|
||||
# Now the OneShot key is released, removing `shift` from the report.
|
||||
EXPECT keyboard-report Key_Period # report: { 37 }
|
||||
# The TapDance `.` key has been released, so its release comes next.
|
||||
EXPECT keyboard-report empty # report: { }
|
||||
# Finally, we get the report for the press of the `space` key.
|
||||
EXPECT keyboard-report Key_Spacebar # report: { 2c }
|
||||
|
||||
RUN 4 ms
|
||||
RELEASE SPACE
|
||||
RUN 1 cycle
|
||||
EXPECT keyboard-report empty
|
||||
|
||||
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 A
|
||||
RUN 1 cycle
|
||||
EXPECT keyboard-report Key_LeftShift Key_A # report: { 4 e1 }
|
||||
EXPECT keyboard-report Key_A # report: { 4 }
|
||||
|
||||
RUN 4 ms
|
||||
RELEASE A
|
||||
RUN 1 cycle
|
||||
EXPECT keyboard-report empty
|
||||
|
||||
RUN 5 ms
|
||||
|
||||
# ==============================================================================
|
||||
NAME Single rollover
|
||||
|
||||
RUN 4 ms
|
||||
PRESS TD_0
|
||||
RUN 1 cycle
|
||||
|
||||
RUN 4 ms
|
||||
PRESS SPACE
|
||||
RUN 1 cycle
|
||||
EXPECT keyboard-report Key_Period # report: { 37 }
|
||||
EXPECT keyboard-report Key_Period Key_Spacebar # report: { 37 2c }
|
||||
|
||||
RUN 4 ms
|
||||
PRESS OS_SHIFT
|
||||
RUN 1 cycle
|
||||
EXPECT keyboard-report Key_Period Key_Spacebar Key_LeftShift # report: { 2c 37 e1 }
|
||||
|
||||
RUN 4 ms
|
||||
RELEASE TD_0
|
||||
RUN 1 cycle
|
||||
EXPECT keyboard-report Key_Spacebar Key_LeftShift # report: { 2c e1 }
|
||||
|
||||
RUN 4 ms
|
||||
RELEASE SPACE
|
||||
RUN 1 cycle
|
||||
EXPECT keyboard-report Key_LeftShift # report: { e1 }
|
||||
|
||||
RUN 4 ms
|
||||
PRESS A
|
||||
RUN 1 cycle
|
||||
EXPECT keyboard-report Key_LeftShift Key_A # report: { 4 e1 }
|
||||
|
||||
RUN 4 ms
|
||||
RELEASE OS_SHIFT
|
||||
RUN 1 cycle
|
||||
EXPECT keyboard-report Key_A # report: { 4 }
|
||||
|
||||
RUN 4 ms
|
||||
RELEASE A
|
||||
RUN 1 cycle
|
||||
EXPECT keyboard-report empty
|
||||
|
||||
RUN 5 ms
|
Loading…
Reference in new issue