summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2021-11-04 16:22:17 +1100
committerGitHub <noreply@github.com>2021-11-03 22:22:17 -0700
commitf529580860cf5a1de4afc10432f218a45daae17a (patch)
tree1d2fa041174f2586230ab831c05e5b56d8ba4f92 /tests
parentb06d9d822cfb72e0728b11711a333f2f5d3c631e (diff)
Basic keycode overhaul (#14726)
Diffstat (limited to 'tests')
-rw-r--r--tests/basic/test_keypress.cpp72
-rw-r--r--tests/basic/test_macro.cpp18
-rw-r--r--tests/basic/test_tapping.cpp4
3 files changed, 47 insertions, 47 deletions
diff --git a/tests/basic/test_keypress.cpp b/tests/basic/test_keypress.cpp
index ecd6e98e44..cf839f8c16 100644
--- a/tests/basic/test_keypress.cpp
+++ b/tests/basic/test_keypress.cpp
@@ -73,10 +73,10 @@ TEST_F(KeyPress, LeftShiftIsReportedCorrectly) {
// See issue #1476 for more information
EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_A)));
keyboard_task();
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_A, KC_LSFT)));
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_A, KC_LEFT_SHIFT)));
keyboard_task();
release_key(0, 0);
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT)));
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT)));
keyboard_task();
release_key(3, 0);
EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport()));
@@ -89,9 +89,9 @@ TEST_F(KeyPress, PressLeftShiftAndControl) {
press_key(5, 0);
// Unfortunately modifiers are also processed in the wrong order
// See issue #1476 for more information
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT)));
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT)));
keyboard_task();
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT, KC_LCTRL)));
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT, KC_LEFT_CTRL)));
keyboard_task();
}
@@ -101,9 +101,9 @@ TEST_F(KeyPress, LeftAndRightShiftCanBePressedAtTheSameTime) {
press_key(4, 0);
// Unfortunately modifiers are also processed in the wrong order
// See issue #1476 for more information
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT)));
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT)));
keyboard_task();
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT, KC_RSFT)));
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT, KC_RIGHT_SHIFT)));
keyboard_task();
}
@@ -115,11 +115,11 @@ TEST_F(KeyPress, RightShiftLeftControlAndCharWithTheSameKey) {
// See issue #524 for more information
// The underlying cause is that we use only one bit to represent the right hand
// modifiers.
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_RSFT, KC_RCTRL)));
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_RSFT, KC_RCTRL, KC_O)));
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_RIGHT_SHIFT, KC_RIGHT_CTRL)));
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_RIGHT_SHIFT, KC_RIGHT_CTRL, KC_O)));
keyboard_task();
release_key(6, 0);
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_RSFT, KC_RCTRL)));
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_RIGHT_SHIFT, KC_RIGHT_CTRL)));
EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport()));
keyboard_task();
}
@@ -129,23 +129,23 @@ TEST_F(KeyPress, PressPlusEqualReleaseBeforePress) {
InSequence s;
press_key(1, 1); // KC_PLUS
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT)));
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT, KC_EQL)));
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT)));
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT, KC_EQUAL)));
run_one_scan_loop();
testing::Mock::VerifyAndClearExpectations(&driver);
release_key(1, 1); // KC_PLUS
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT)));
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT)));
EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport()));
run_one_scan_loop();
testing::Mock::VerifyAndClearExpectations(&driver);
- press_key(0, 1); // KC_EQL
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_EQL)));
+ press_key(0, 1); // KC_EQUAL
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_EQUAL)));
run_one_scan_loop();
testing::Mock::VerifyAndClearExpectations(&driver);
- release_key(0, 1); // KC_EQL
+ release_key(0, 1); // KC_EQUAL
EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport()));
run_one_scan_loop();
testing::Mock::VerifyAndClearExpectations(&driver);
@@ -156,25 +156,25 @@ TEST_F(KeyPress, PressPlusEqualDontReleaseBeforePress) {
InSequence s;
press_key(1, 1); // KC_PLUS
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT)));
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT, KC_EQL)));
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT)));
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT, KC_EQUAL)));
run_one_scan_loop();
testing::Mock::VerifyAndClearExpectations(&driver);
- press_key(0, 1); // KC_EQL
+ press_key(0, 1); // KC_EQUAL
EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport()));
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_EQL)));
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_EQUAL)));
run_one_scan_loop();
testing::Mock::VerifyAndClearExpectations(&driver);
- release_key(1, 1); // KC_PLS
- // BUG: Should really still return KC_EQL, but this is fine too
+ release_key(1, 1); // KC_PLUS
+ // BUG: Should really still return KC_EQUAL, but this is fine too
// It's also called twice for some reason
EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).Times(2);
run_one_scan_loop();
testing::Mock::VerifyAndClearExpectations(&driver);
- release_key(0, 1); // KC_EQL
+ release_key(0, 1); // KC_EQUAL
EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport()));
run_one_scan_loop();
testing::Mock::VerifyAndClearExpectations(&driver);
@@ -184,24 +184,24 @@ TEST_F(KeyPress, PressEqualPlusReleaseBeforePress) {
TestDriver driver;
InSequence s;
- press_key(0, 1); // KC_EQL
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_EQL)));
+ press_key(0, 1); // KC_EQUAL
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_EQUAL)));
run_one_scan_loop();
testing::Mock::VerifyAndClearExpectations(&driver);
- release_key(0, 1); // KQ_EQL
+ release_key(0, 1); // KC_EQUAL
EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport()));
run_one_scan_loop();
testing::Mock::VerifyAndClearExpectations(&driver);
press_key(1, 1); // KC_PLUS
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT)));
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT, KC_EQL)));
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT)));
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT, KC_EQUAL)));
run_one_scan_loop();
testing::Mock::VerifyAndClearExpectations(&driver);
release_key(1, 1); // KC_PLUS
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT)));
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT)));
EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport()));
run_one_scan_loop();
testing::Mock::VerifyAndClearExpectations(&driver);
@@ -211,29 +211,29 @@ TEST_F(KeyPress, PressEqualPlusDontReleaseBeforePress) {
TestDriver driver;
InSequence s;
- press_key(0, 1); // KC_EQL
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_EQL)));
+ press_key(0, 1); // KC_EQUAL
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_EQUAL)));
run_one_scan_loop();
testing::Mock::VerifyAndClearExpectations(&driver);
press_key(1, 1); // KC_PLUS
// BUG: The sequence is a bit strange, but it works, the end result is that
// KC_PLUS is sent
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT, KC_EQL)));
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT)));
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT, KC_EQL)));
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT, KC_EQUAL)));
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT)));
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT, KC_EQUAL)));
run_one_scan_loop();
testing::Mock::VerifyAndClearExpectations(&driver);
- release_key(0, 1); // KC_EQL
+ release_key(0, 1); // KC_EQUAL
// I guess it's fine to still report shift here
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT)));
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT)));
run_one_scan_loop();
testing::Mock::VerifyAndClearExpectations(&driver);
release_key(1, 1); // KC_PLUS
// This report is not needed
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT)));
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT)));
EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport()));
run_one_scan_loop();
testing::Mock::VerifyAndClearExpectations(&driver);
diff --git a/tests/basic/test_macro.cpp b/tests/basic/test_macro.cpp
index dc4a77796a..1ac6f473fc 100644
--- a/tests/basic/test_macro.cpp
+++ b/tests/basic/test_macro.cpp
@@ -29,9 +29,9 @@ TEST_F(Macro, PlayASimpleMacro) {
InSequence s;
press_key(8, 0);
uint32_t current_time = timer_read32();
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT))).AT_TIME(0);
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT, KC_H))).AT_TIME(0);
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT))).AT_TIME(0);
+ 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
@@ -45,9 +45,9 @@ TEST_F(Macro, PlayASimpleMacro) {
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_LSFT))).AT_TIME(100);
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT, KC_W))).AT_TIME(100);
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT))).AT_TIME(100);
+ 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
@@ -63,9 +63,9 @@ TEST_F(Macro, PlayASimpleMacro) {
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_LSFT))).AT_TIME(190);
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT, KC_1))).AT_TIME(200);
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT))).AT_TIME(210);
+ 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();
}
diff --git a/tests/basic/test_tapping.cpp b/tests/basic/test_tapping.cpp
index 30d032e9fd..88ab97eb6e 100644
--- a/tests/basic/test_tapping.cpp
+++ b/tests/basic/test_tapping.cpp
@@ -46,7 +46,7 @@ TEST_F(Tapping, HoldA_SHFT_T_KeyReportsShift) {
// Tapping keys does nothing on press
EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0);
idle_for(TAPPING_TERM);
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT)));
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT)));
run_one_scan_loop();
}
@@ -92,6 +92,6 @@ TEST_F(Tapping, ANewTapWithinTappingTermIsBuggy) {
// If TAPPING_TERM + 1 above is changed to TAPPING_TERM or TAPPING_TERM + 2 it doesn't
press_key(7, 0);
// Shouldn't be called here really
- EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT))).Times(1);
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT))).Times(1);
idle_for(TAPPING_TERM);
}