diff --git a/tests/features/rollover/common.h b/tests/features/rollover/common.h new file mode 100644 index 00000000..dcfcc35b --- /dev/null +++ b/tests/features/rollover/common.h @@ -0,0 +1,27 @@ +// -*- mode: c++ -*- + +/* Kaleidoscope - Firmware for computer input devices + * Copyright (C) 2020 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 . + */ + +#pragma once + +#include + +namespace kaleidoscope { +namespace testing { + +} // namespace testing +} // namespace kaleidoscope diff --git a/tests/features/rollover/rollover.ino b/tests/features/rollover/rollover.ino new file mode 100644 index 00000000..e474f49c --- /dev/null +++ b/tests/features/rollover/rollover.ino @@ -0,0 +1,48 @@ +/* -*- mode: c++ -*- + * Copyright (C) 2020 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 "./common.h" + +// *INDENT-OFF* +KEYMAPS( + [0] = KEYMAP_STACKED + ( + LSHIFT(Key_A), LSHIFT(Key_B), LSHIFT(LCTRL(LALT(Key_X))), ___, ___, ___, ___, + Key_A, Key_B, ___, ___, ___, ___, ___, + Key_LeftShift, Key_RightShift, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, + ___, + + ___, ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, + ___ + ), +) +// *INDENT-ON* + +void setup() { + Kaleidoscope.setup(); +} + +void loop() { + Kaleidoscope.loop(); +} diff --git a/tests/features/rollover/sketch.json b/tests/features/rollover/sketch.json new file mode 100644 index 00000000..43dc4c7e --- /dev/null +++ b/tests/features/rollover/sketch.json @@ -0,0 +1,6 @@ +{ + "cpu": { + "fqbn": "keyboardio:virtual:model01", + "port": "" + } +} \ No newline at end of file diff --git a/tests/features/rollover/test.ktest b/tests/features/rollover/test.ktest new file mode 100644 index 00000000..43f911ba --- /dev/null +++ b/tests/features/rollover/test.ktest @@ -0,0 +1,70 @@ +VERSION 1 + +KEYSWITCH SFT_A 0 0 +KEYSWITCH SFT_B 0 1 +KEYSWITCH MEH_X 0 2 +KEYSWITCH A 1 0 +KEYSWITCH B 1 1 +KEYSWITCH LSFT 2 0 +KEYSWITCH RSFT 2 1 + +# ============================================================================== +NAME Key with modifier flag alone + +RUN 4 ms +PRESS SFT_A +RUN 1 cycle +EXPECT keyboard-report Key_LeftShift # The report should contain `shift` +EXPECT keyboard-report Key_LeftShift Key_A # The report should contain `shift` + `A` + +RUN 4 ms +RELEASE SFT_A +RUN 1 cycle +EXPECT keyboard-report Key_LeftShift # The report should contain `shift` +EXPECT keyboard-report empty # Report should be empty + +RUN 5 ms + +# ============================================================================== +NAME Key with multiple modifier flags alone + +RUN 4 ms +PRESS MEH_X +RUN 1 cycle +EXPECT keyboard-report Key_LeftShift Key_LeftControl Key_LeftAlt # The report should contain three modifiers +EXPECT keyboard-report Key_LeftShift Key_LeftControl Key_LeftAlt Key_X # The report should add `X` + +RUN 4 ms +RELEASE MEH_X +RUN 1 cycle +EXPECT keyboard-report Key_LeftShift Key_LeftControl Key_LeftAlt # The report should contain three modifiers +EXPECT keyboard-report empty # Report should be empty + +RUN 5 ms + +# ============================================================================== +NAME No mod flags to mod flags + +RUN 4 ms +PRESS A +RUN 1 cycle +EXPECT keyboard-report Key_A # The report should contain `A` + +RUN 4 ms +PRESS SFT_B +RUN 1 cycle +EXPECT keyboard-report Key_LeftShift Key_A # The report should contain `shift` + `A` +EXPECT keyboard-report Key_LeftShift Key_A Key_B # The report should contain `shift`, `A` & `B` + +RUN 4 ms +RELEASE A +RUN 1 cycle +EXPECT keyboard-report Key_LeftShift Key_B # The report should contain `shift` + `B` + +RUN 4 ms +RELEASE SFT_B +RUN 1 cycle +EXPECT keyboard-report Key_LeftShift # The report should contain `shift` +EXPECT keyboard-report empty # Report should be empty + +RUN 5 ms