From d9d8e8bc2144613010f3407a051aaf9768a6de5d Mon Sep 17 00:00:00 2001 From: Michael Richters Date: Tue, 8 Jun 2021 14:06:18 -0500 Subject: [PATCH] Add testcase for issue 984 Closes #984 Signed-off-by: Michael Richters --- tests/issues/984/984.ino | 50 +++++++++++++++++++++++++++++ tests/issues/984/sketch.json | 6 ++++ tests/issues/984/test.ktest | 62 ++++++++++++++++++++++++++++++++++++ 3 files changed, 118 insertions(+) create mode 100644 tests/issues/984/984.ino create mode 100644 tests/issues/984/sketch.json create mode 100644 tests/issues/984/test.ktest diff --git a/tests/issues/984/984.ino b/tests/issues/984/984.ino new file mode 100644 index 00000000..5250d1e5 --- /dev/null +++ b/tests/issues/984/984.ino @@ -0,0 +1,50 @@ +/* -*- 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 +#include + +// *INDENT-OFF* +KEYMAPS( + [0] = KEYMAP_STACKED + ( + OSM(LeftShift), ___, ___, ___, ___, ___, ___, + Key_A, Key_B, ___, ___, ___, ___, ___, + Key_Escape, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, + ___, + + ___, ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, + ___ + ), +) +// *INDENT-ON* + +KALEIDOSCOPE_INIT_PLUGINS(OneShot, EscapeOneShot); + +void setup() { + Kaleidoscope.setup(); +} + +void loop() { + Kaleidoscope.loop(); +} diff --git a/tests/issues/984/sketch.json b/tests/issues/984/sketch.json new file mode 100644 index 00000000..8cc86922 --- /dev/null +++ b/tests/issues/984/sketch.json @@ -0,0 +1,6 @@ +{ + "cpu": { + "fqbn": "keyboardio:virtual:model01", + "port": "" + } +} diff --git a/tests/issues/984/test.ktest b/tests/issues/984/test.ktest new file mode 100644 index 00000000..9231fe6b --- /dev/null +++ b/tests/issues/984/test.ktest @@ -0,0 +1,62 @@ +VERSION 1 + +KEYSWITCH OSM 0 0 +KEYSWITCH A 1 0 +KEYSWITCH B 1 1 +KEYSWITCH ESC 2 0 + +# ============================================================================== +NAME Escape OneShot modifier + +RUN 4 ms +PRESS OSM +RUN 1 cycle +EXPECT keyboard-report Key_LeftShift # report: { e1 } + +RUN 4 ms +RELEASE OSM +RUN 1 cycle + +RUN 4 ms +PRESS ESC +RUN 1 cycle +EXPECT keyboard-report empty # Report should be empty + +RUN 4 ms +RELEASE ESC +RUN 1 cycle + +RUN 5 ms + +# ============================================================================== +NAME Escape sticky OneShot modifier + +RUN 4 ms +PRESS OSM +RUN 1 cycle +EXPECT keyboard-report Key_LeftShift # report: { e1 } + +RUN 4 ms +RELEASE OSM +RUN 1 cycle + +RUN 4 ms +PRESS OSM +RUN 1 cycle + +RUN 4 ms +RELEASE OSM +RUN 1 cycle + +RUN 5000 ms + +RUN 4 ms +PRESS ESC +RUN 1 cycle +EXPECT keyboard-report empty # Report should be empty + +RUN 4 ms +RELEASE ESC +RUN 1 cycle + +RUN 5 ms