From 537f73792fa51da2b0bcd363c23d1d0e010e00e5 Mon Sep 17 00:00:00 2001 From: Michael Richters Date: Sun, 30 May 2021 21:46:28 -0500 Subject: [PATCH] Add testcases for CharShift plugin Signed-off-by: Michael Richters --- tests/plugins/CharShift/basic/basic.ino | 55 ++++++ tests/plugins/CharShift/basic/sketch.json | 6 + tests/plugins/CharShift/basic/test.ktest | 212 ++++++++++++++++++++++ 3 files changed, 273 insertions(+) create mode 100644 tests/plugins/CharShift/basic/basic.ino create mode 100644 tests/plugins/CharShift/basic/sketch.json create mode 100644 tests/plugins/CharShift/basic/test.ktest diff --git a/tests/plugins/CharShift/basic/basic.ino b/tests/plugins/CharShift/basic/basic.ino new file mode 100644 index 00000000..05929f4e --- /dev/null +++ b/tests/plugins/CharShift/basic/basic.ino @@ -0,0 +1,55 @@ +/* -*- 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 . + */ + +#include +#include + +// *INDENT-OFF* +KEYMAPS( + [0] = KEYMAP_STACKED + ( + Key_LeftShift, Key_RightShift, ___, ___, ___, ___, ___, + Key_X, LSHIFT(Key_Y), ___, ___, ___, ___, ___, + CS(0), CS(1), CS(2), CS(3), ___, ___, + ___, ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, + ___, + + ___, ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, + ___ + ), +) +// *INDENT-ON* + +KALEIDOSCOPE_INIT_PLUGINS(CharShift); + +void setup() { + Kaleidoscope.setup(); + CS_KEYS( + kaleidoscope::plugin::CharShift::KeyPair(Key_A, Key_B), + kaleidoscope::plugin::CharShift::KeyPair(Key_C, LSHIFT(Key_D)), + kaleidoscope::plugin::CharShift::KeyPair(LSHIFT(Key_E), Key_F), + kaleidoscope::plugin::CharShift::KeyPair(LSHIFT(Key_G), LSHIFT(Key_H)), + ); +} + +void loop() { + Kaleidoscope.loop(); +} diff --git a/tests/plugins/CharShift/basic/sketch.json b/tests/plugins/CharShift/basic/sketch.json new file mode 100644 index 00000000..8cc86922 --- /dev/null +++ b/tests/plugins/CharShift/basic/sketch.json @@ -0,0 +1,6 @@ +{ + "cpu": { + "fqbn": "keyboardio:virtual:model01", + "port": "" + } +} diff --git a/tests/plugins/CharShift/basic/test.ktest b/tests/plugins/CharShift/basic/test.ktest new file mode 100644 index 00000000..d8088620 --- /dev/null +++ b/tests/plugins/CharShift/basic/test.ktest @@ -0,0 +1,212 @@ +VERSION 1 + +KEYSWITCH LSHIFT 0 0 +KEYSWITCH RSHIFT 0 1 +KEYSWITCH x 1 0 +KEYSWITCH Y 1 1 +KEYSWITCH CS_ab 2 0 +KEYSWITCH CS_cD 2 1 +KEYSWITCH CS_Ef 2 2 +KEYSWITCH CS_GH 2 3 + +# ============================================================================== +NAME CharShift lower lower + +RUN 4 ms +PRESS CS_ab +RUN 1 cycle +EXPECT keyboard-report Key_A # report: { 4 } + +RUN 4 ms +RELEASE CS_ab +RUN 1 cycle +EXPECT keyboard-report empty + +RUN 4 ms +PRESS LSHIFT +RUN 1 cycle +EXPECT keyboard-report Key_LeftShift # report: { e1 } + +RUN 4 ms +PRESS CS_ab +RUN 1 cycle +EXPECT keyboard-report empty +EXPECT keyboard-report Key_B # report: { 5 } + +RUN 4 ms +RELEASE CS_ab +RUN 1 cycle +EXPECT keyboard-report empty +EXPECT keyboard-report Key_LeftShift # report: { e1 } + +RUN 4 ms +RELEASE LSHIFT +RUN 1 cycle +EXPECT keyboard-report empty + +RUN 5 ms + +# ============================================================================== +NAME CharShift lower upper + +RUN 4 ms +PRESS CS_cD +RUN 1 cycle +EXPECT keyboard-report Key_C # report: { 6 } + +RUN 4 ms +RELEASE CS_cD +RUN 1 cycle +EXPECT keyboard-report empty + +RUN 4 ms +PRESS LSHIFT +RUN 1 cycle +EXPECT keyboard-report Key_LeftShift # report: { e1 } + +RUN 4 ms +PRESS CS_cD +RUN 1 cycle +EXPECT keyboard-report Key_LeftShift Key_D # report: { e1 7 } + +RUN 4 ms +RELEASE CS_cD +RUN 1 cycle +EXPECT keyboard-report Key_LeftShift # report: { e1 } + +RUN 4 ms +RELEASE LSHIFT +RUN 1 cycle +EXPECT keyboard-report empty + +RUN 5 ms + +# ============================================================================== +NAME CharShift upper lower + +RUN 4 ms +PRESS CS_Ef +RUN 1 cycle +EXPECT keyboard-report Key_LeftShift # report: { e1 } +EXPECT keyboard-report Key_LeftShift Key_E # report: { e1 8 } + +RUN 4 ms +RELEASE CS_Ef +RUN 1 cycle +EXPECT keyboard-report Key_LeftShift # report: { e1 } +EXPECT keyboard-report empty + +RUN 4 ms +PRESS LSHIFT +RUN 1 cycle +EXPECT keyboard-report Key_LeftShift # report: { e1 } + +RUN 4 ms +PRESS CS_Ef +RUN 1 cycle +EXPECT keyboard-report empty +EXPECT keyboard-report Key_F # report: { 9 } + +RUN 4 ms +RELEASE CS_Ef +RUN 1 cycle +EXPECT keyboard-report empty +EXPECT keyboard-report Key_LeftShift # report: { e1 } + +RUN 4 ms +RELEASE LSHIFT +RUN 1 cycle +EXPECT keyboard-report empty + +RUN 5 ms + +# ============================================================================== +NAME CharShift upper upper + +RUN 4 ms +PRESS CS_GH +RUN 1 cycle +EXPECT keyboard-report Key_LeftShift # report: { e1 } +EXPECT keyboard-report Key_LeftShift Key_G # report: { e1 10 } + +RUN 4 ms +RELEASE CS_GH +RUN 1 cycle +EXPECT keyboard-report Key_LeftShift # report: { e1 } +EXPECT keyboard-report empty + +RUN 4 ms +PRESS LSHIFT +RUN 1 cycle +EXPECT keyboard-report Key_LeftShift # report: { e1 } + +RUN 4 ms +PRESS CS_GH +RUN 1 cycle +EXPECT keyboard-report Key_LeftShift Key_H # report: { e1 11 } + +RUN 4 ms +RELEASE CS_GH +RUN 1 cycle +EXPECT keyboard-report Key_LeftShift # report: { e1 } + +RUN 4 ms +RELEASE LSHIFT +RUN 1 cycle +EXPECT keyboard-report empty + +RUN 5 ms + +# ============================================================================== +NAME Rollover from normal to CharShift upper + +RUN 4 ms +PRESS x +RUN 1 cycle +EXPECT keyboard-report Key_X + +RUN 4 ms +PRESS CS_GH +RUN 1 cycle +EXPECT keyboard-report Key_X Key_LeftShift # report: { e1 } +EXPECT keyboard-report Key_X Key_LeftShift Key_G # report: { e1 10 } + +RUN 4 ms +RELEASE x +RUN 1 cycle +EXPECT keyboard-report Key_LeftShift Key_G # report: { e1 10 } + +RUN 4 ms +RELEASE CS_GH +RUN 1 cycle +EXPECT keyboard-report Key_LeftShift # report: { e1 } +EXPECT keyboard-report empty + +RUN 5 ms + +# ============================================================================== +NAME Rollover from shifted to CharShift lower + +RUN 4 ms +PRESS Y +RUN 1 cycle +EXPECT keyboard-report Key_LeftShift # report: { e1 } +EXPECT keyboard-report Key_LeftShift Key_Y + +RUN 4 ms +PRESS CS_ab +RUN 1 cycle +EXPECT keyboard-report Key_Y +EXPECT keyboard-report Key_Y Key_A + +RUN 4 ms +RELEASE Y +RUN 1 cycle +EXPECT keyboard-report Key_A + +RUN 4 ms +RELEASE CS_ab +RUN 1 cycle +EXPECT keyboard-report empty + +RUN 5 ms