summaryrefslogtreecommitdiff
path: root/tests/basic
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2022-01-25 08:22:20 +1100
committerGitHub <noreply@github.com>2022-01-24 21:22:20 +0000
commit1d11ae3087f583c4f4756169802b33adea71ed94 (patch)
tree6a9deedeecec0220c2dccd10e90941956c4d27b7 /tests/basic
parent3340ca46e82c8b348d9131de53b73e83d1f2c285 (diff)
downloadqmk_firmware-1d11ae3087f583c4f4756169802b33adea71ed94.tar.gz
qmk_firmware-1d11ae3087f583c4f4756169802b33adea71ed94.zip
Rip out old macro and action_function system (#16025)
* Rip out old macro and action_function system * Update quantum/action_util.c Co-authored-by: Joel Challis <git@zvecr.com>
Diffstat (limited to 'tests/basic')
-rw-r--r--tests/basic/test_macro.cpp88
1 files changed, 0 insertions, 88 deletions
diff --git a/tests/basic/test_macro.cpp b/tests/basic/test_macro.cpp
deleted file mode 100644
index ae2f3b32e3..0000000000
--- a/tests/basic/test_macro.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/* Copyright 2017 Fred Sundvik
- *
- * 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, either version 2 of the License, or
- * (at your option) any later version.
- *
- * 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 "test_common.hpp"
-#include "time.h"
-
-using testing::InSequence;
-using testing::InvokeWithoutArgs;
-
-class Macro : public TestFixture {};
-
-#define AT_TIME(t) WillOnce(InvokeWithoutArgs([current_time]() { EXPECT_EQ(timer_elapsed32(current_time), t); }))
-
-extern "C" const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
- if (record->event.pressed) {
- switch (id) {
- case 0:
- return MACRO(D(LSFT), T(H), U(LSFT), T(E), T(L), T(L), T(O), T(SPACE), W(100), D(LSFT), T(W), U(LSFT), I(10), T(O), T(R), T(L), T(D), D(LSFT), T(1), U(LSFT), END);
- }
- }
- return MACRO_NONE;
-};
-
-TEST_F(Macro, PlayASimpleMacro) {
- TestDriver driver;
- InSequence s;
- auto key_macro = KeymapKey(0, 8, 0, M(0));
-
- set_keymap({key_macro});
-
- key_macro.press();
-
- uint32_t current_time = timer_read32();
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT))).AT_TIME(0);
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT, KC_H))).AT_TIME(0);
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT))).AT_TIME(0);
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).AT_TIME(0);
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_E))).AT_TIME(0);
- // The macro system could actually skip these empty keyboard reports
- // it should be enough to just send a report with the next key down
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).AT_TIME(0);
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_L))).AT_TIME(0);
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).AT_TIME(0);
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_L))).AT_TIME(0);
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).AT_TIME(0);
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_O))).AT_TIME(0);
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).AT_TIME(0);
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_SPACE))).AT_TIME(0);
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).AT_TIME(0);
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT))).AT_TIME(100);
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT, KC_W))).AT_TIME(100);
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT))).AT_TIME(100);
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).AT_TIME(100);
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_O)))
- // BUG: The timer should not really have advanced 10 ms here
- // See issue #1477
- .AT_TIME(110);
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport()))
- // BUG: The timer should not advance on both keydown and key-up
- // See issue #1477
- .AT_TIME(120);
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_R))).AT_TIME(130);
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).AT_TIME(140);
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_L))).AT_TIME(150);
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).AT_TIME(160);
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_D))).AT_TIME(170);
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).AT_TIME(180);
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT))).AT_TIME(190);
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT, KC_1))).AT_TIME(200);
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT))).AT_TIME(210);
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).AT_TIME(220);
- run_one_scan_loop();
-
- key_macro.release();
-}