aboutsummaryrefslogtreecommitdiffstats
path: root/tests/basic
diff options
context:
space:
mode:
authorFred Sundvik <fsundvik@gmail.com>2017-07-01 02:43:32 +0300
committerJack Humbert <jack.humb@gmail.com>2017-07-08 21:59:51 -0400
commita62f4496599d4a1880adc5f272f97f81be0586cb (patch)
treeef1c67247498eef912c23e097f24230498ab4861 /tests/basic
parentcae7a9c3ec3834f08dfd56b0f094dc6afaf2ccaa (diff)
downloadfirmware-a62f4496599d4a1880adc5f272f97f81be0586cb.tar.gz
firmware-a62f4496599d4a1880adc5f272f97f81be0586cb.tar.bz2
firmware-a62f4496599d4a1880adc5f272f97f81be0586cb.zip
Add test for a combo key
Diffstat (limited to 'tests/basic')
-rw-r--r--tests/basic/keymap.c13
-rw-r--r--tests/basic/keypress.cpp36
2 files changed, 44 insertions, 5 deletions
diff --git a/tests/basic/keymap.c b/tests/basic/keymap.c
index a3e1aaf66..e3a60ccc4 100644
--- a/tests/basic/keymap.c
+++ b/tests/basic/keymap.c
@@ -18,12 +18,15 @@
// Don't rearrange keys as existing tests might rely on the order
// Col2, Row 0 has to be KC_NO, because tests rely on it
+
+#define COMBO1 RSFT(LCTL(KC_O))
+
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = {
- // 0 1 2 3 4 5 6 7 8 9
- {KC_A, KC_B, KC_NO, KC_LSFT, KC_RSFT, KC_LCTL, KC_NO, KC_NO, KC_NO, KC_NO},
- {KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO},
- {KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO},
- {KC_C, KC_D, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO},
+ // 0 1 2 3 4 5 6 7 8 9
+ {KC_A, KC_B, KC_NO, KC_LSFT, KC_RSFT, KC_LCTL, COMBO1, KC_NO, KC_NO, KC_NO},
+ {KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO},
+ {KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO},
+ {KC_C, KC_D, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO},
},
};
diff --git a/tests/basic/keypress.cpp b/tests/basic/keypress.cpp
index 4424e8696..2bb029d88 100644
--- a/tests/basic/keypress.cpp
+++ b/tests/basic/keypress.cpp
@@ -85,4 +85,40 @@ TEST_F(KeyPress, LeftShiftIsReportedCorrectly) {
release_key(3, 0);
EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport()));
keyboard_task();
+}
+
+TEST_F(KeyPress, PressLeftShiftAndControl) {
+ TestDriver driver;
+ press_key(3, 0);
+ press_key(5, 0);
+ // Unfortunately modifiers are also processed in the wrong order
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT)));
+ keyboard_task();
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT, KC_LCTRL)));
+ keyboard_task();
+}
+
+TEST_F(KeyPress, LeftAndRightShiftCanBePressedAtTheSameTime) {
+ TestDriver driver;
+ press_key(3, 0);
+ press_key(4, 0);
+ // Unfortunately modifiers are also processed in the wrong order
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT)));
+ keyboard_task();
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT, KC_RSFT)));
+ keyboard_task();
+}
+
+TEST_F(KeyPress, RightShiftLeftControlAndCharWithTheSameKey) {
+ TestDriver driver;
+ press_key(6, 0);
+ // BUG: The press is split into two reports
+ // BUG: It reports RSFT instead of LSFT
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_RSFT, KC_RCTRL)));
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_RSFT, KC_RCTRL, 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()));
+ keyboard_task();
} \ No newline at end of file