diff options
author | Fred Sundvik <fsundvik@gmail.com> | 2017-07-01 02:00:30 +0300 |
---|---|---|
committer | Jack Humbert <jack.humb@gmail.com> | 2017-07-08 21:59:51 -0400 |
commit | cae7a9c3ec3834f08dfd56b0f094dc6afaf2ccaa (patch) | |
tree | c4249ba5748420175cc02d4b56ac45c5e74789d9 /tests/basic | |
parent | 1985f43bad9fd51101467bea994e000c6c295f00 (diff) |
Add simple modifier test
Diffstat (limited to 'tests/basic')
-rw-r--r-- | tests/basic/keymap.c | 9 | ||||
-rw-r--r-- | tests/basic/keypress.cpp | 17 |
2 files changed, 22 insertions, 4 deletions
diff --git a/tests/basic/keymap.c b/tests/basic/keymap.c index c0e0dfb499..a3e1aaf669 100644 --- a/tests/basic/keymap.c +++ b/tests/basic/keymap.c @@ -20,9 +20,10 @@ // Col2, Row 0 has to be KC_NO, because tests rely on it const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [0] = { - {KC_A, KC_B, 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_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, 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}, }, }; diff --git a/tests/basic/keypress.cpp b/tests/basic/keypress.cpp index e2cc7279fb..4424e86965 100644 --- a/tests/basic/keypress.cpp +++ b/tests/basic/keypress.cpp @@ -68,4 +68,21 @@ TEST_F(KeyPress, ANonMappedKeyDoesNothing) { EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0); keyboard_task(); keyboard_task(); +} + +TEST_F(KeyPress, LeftShiftIsReportedCorrectly) { + TestDriver driver; + press_key(3, 0); + press_key(0, 0); + // Unfortunately modifiers are also processed in the wrong order + EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_A))); + keyboard_task(); + EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_A, KC_LSFT))); + keyboard_task(); + release_key(0, 0); + EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT))); + keyboard_task(); + release_key(3, 0); + EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); + keyboard_task(); }
\ No newline at end of file |