From 1985f43bad9fd51101467bea994e000c6c295f00 Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Sat, 1 Jul 2017 01:25:30 +0300 Subject: Improve the tests a bit --- tests/basic/keypress.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'tests/basic') diff --git a/tests/basic/keypress.cpp b/tests/basic/keypress.cpp index 2b8b96b22..e2cc7279f 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(); -- cgit v1.2.3-24-g4f1b