diff --git a/tests/plugins/TopsyTurvy/basic/common.h b/tests/plugins/TopsyTurvy/basic/common.h new file mode 100644 index 00000000..dcfcc35b --- /dev/null +++ b/tests/plugins/TopsyTurvy/basic/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/plugins/TopsyTurvy/basic/sketch.ino b/tests/plugins/TopsyTurvy/basic/sketch.ino new file mode 100644 index 00000000..ad1cb607 --- /dev/null +++ b/tests/plugins/TopsyTurvy/basic/sketch.ino @@ -0,0 +1,51 @@ +/* -*- 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 + +#include "./common.h" + +// *INDENT-OFF* +KEYMAPS( + [0] = KEYMAP_STACKED + ( + TOPSY(1), TOPSY(2), ___, ___, ___, ___, ___, + Key_A, Key_B, ___, ___, ___, ___, ___, + Key_LeftShift, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, + ___, + + ___, ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, + ___ + ), +) +// *INDENT-ON* + +KALEIDOSCOPE_INIT_PLUGINS(TopsyTurvy); + +void setup() { + Kaleidoscope.setup(); +} + +void loop() { + Kaleidoscope.loop(); +} diff --git a/tests/plugins/TopsyTurvy/basic/test.ktest b/tests/plugins/TopsyTurvy/basic/test.ktest new file mode 100644 index 00000000..b2ca7b89 --- /dev/null +++ b/tests/plugins/TopsyTurvy/basic/test.ktest @@ -0,0 +1,47 @@ +VERSION 1 + +KEYSWITCH TOPSY_1 0 0 +KEYSWITCH TOPSY_2 0 1 +KEYSWITCH A 1 0 +KEYSWITCH B 1 1 +KEYSWITCH LSHIFT 2 0 + +# ============================================================================== +NAME TopsyTurvy without shift + +RUN 5 ms +PRESS TOPSY_1 +RUN 1 cycle +EXPECT keyboard-report Key_LeftShift # The report should contain `shift` +EXPECT keyboard-report Key_LeftShift Key_1 # The report should contain `shift` + `1` +RUN 5 ms +RELEASE TOPSY_1 +RUN 1 cycle +EXPECT keyboard-report Key_LeftShift # The report should contain `shift` +EXPECT keyboard-report empty # Report should be empty + +# ============================================================================== +NAME TopsyTurvy with shift + +RUN 5 ms +PRESS LSHIFT +RUN 1 cycle +EXPECT keyboard-report Key_LeftShift # The report should contain `shift` +RUN 5 ms +PRESS TOPSY_1 +RUN 1 cycle +EXPECT keyboard-report empty # Report should be empty +EXPECT keyboard-report Key_1 # The report should contain only `1` +RUN 5 ms +RELEASE TOPSY_1 +RUN 1 cycle +EXPECT keyboard-report Key_LeftShift Key_1 # The report should contain `shift` + `1` +# Really the report above should be empty, but it seems to work okay in master +# like this, and it will get fixed if and when Kaleidoscope becomes +# event-driven. +# EXPECT keyboard-report empty # Report should be empty +EXPECT keyboard-report Key_LeftShift # The report should contain `shift` +RUN 5 ms +RELEASE LSHIFT +RUN 1 cycle +EXPECT keyboard-report empty # Report should be empty