summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFred Sundvik <fsundvik@gmail.com>2017-07-01 01:25:30 +0300
committerJack Humbert <jack.humb@gmail.com>2017-07-08 21:59:51 -0400
commit1985f43bad9fd51101467bea994e000c6c295f00 (patch)
tree0a8cc6293cba13f5c4cca4d5a710027590fab680
parent72c8df1f190d34d4eb48e9f06d13c9a4de566716 (diff)
downloadqmk_firmware-1985f43bad9fd51101467bea994e000c6c295f00.tar.gz
qmk_firmware-1985f43bad9fd51101467bea994e000c6c295f00.zip
Improve the tests a bit
-rw-r--r--tests/basic/keypress.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/basic/keypress.cpp b/tests/basic/keypress.cpp
index 2b8b96b228..e2cc7279fb 100644
--- a/tests/basic/keypress.cpp
+++ b/tests/basic/keypress.cpp
@@ -39,6 +39,9 @@ TEST_F(KeyPress, CorrectKeyIsReportedWhenPressed) {
press_key(0, 0);
EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_A)));
keyboard_task();
+ release_key(0, 0);
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport()));
+ keyboard_task();
}
TEST_F(KeyPress, CorrectKeysAreReportedWhenTwoKeysArePressed) {
@@ -50,12 +53,18 @@ TEST_F(KeyPress, CorrectKeysAreReportedWhenTwoKeysArePressed) {
keyboard_task();
EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_B, KC_C)));
keyboard_task();
+ release_key(1, 0);
+ release_key(0, 3);
+ //Note that the first key released is the first one in the matrix order
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_C)));
+ keyboard_task();
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport()));
+ keyboard_task();
}
TEST_F(KeyPress, ANonMappedKeyDoesNothing) {
TestDriver driver;
press_key(2, 0);
- //Note that QMK only processes one key at a time
EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0);
keyboard_task();
keyboard_task();