summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFred Sundvik <fsundvik@gmail.com>2017-06-27 00:13:21 +0300
committerJack Humbert <jack.humb@gmail.com>2017-07-08 21:59:51 -0400
commit72c8df1f190d34d4eb48e9f06d13c9a4de566716 (patch)
tree2f8599a7aeff25d90be729159d556622d9a373d8
parent1e4cc36e14d711d2fc755354f9b6fd80c9728882 (diff)
downloadqmk_firmware-72c8df1f190d34d4eb48e9f06d13c9a4de566716.tar.gz
qmk_firmware-72c8df1f190d34d4eb48e9f06d13c9a4de566716.zip
A bigger test matrix, and test for unmapped keys
-rw-r--r--tests/basic/config.h4
-rw-r--r--tests/basic/keymap.c8
-rw-r--r--tests/basic/keypress.cpp11
3 files changed, 18 insertions, 5 deletions
diff --git a/tests/basic/config.h b/tests/basic/config.h
index 4da8d04253..a52d8a4fa0 100644
--- a/tests/basic/config.h
+++ b/tests/basic/config.h
@@ -17,8 +17,8 @@
#ifndef TESTS_BASIC_CONFIG_H_
#define TESTS_BASIC_CONFIG_H_
-#define MATRIX_ROWS 2
-#define MATRIX_COLS 2
+#define MATRIX_ROWS 4
+#define MATRIX_COLS 10
#endif /* TESTS_BASIC_CONFIG_H_ */
diff --git a/tests/basic/keymap.c b/tests/basic/keymap.c
index 2afb4d6a96..c0e0dfb499 100644
--- a/tests/basic/keymap.c
+++ b/tests/basic/keymap.c
@@ -16,9 +16,13 @@
#include "quantum.h"
+// 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
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = {
- {KC_A, KC_B},
- {KC_C, KC_D}
+ {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},
},
};
diff --git a/tests/basic/keypress.cpp b/tests/basic/keypress.cpp
index f574481f24..2b8b96b228 100644
--- a/tests/basic/keypress.cpp
+++ b/tests/basic/keypress.cpp
@@ -44,10 +44,19 @@ TEST_F(KeyPress, CorrectKeyIsReportedWhenPressed) {
TEST_F(KeyPress, CorrectKeysAreReportedWhenTwoKeysArePressed) {
TestDriver driver;
press_key(1, 0);
- press_key(0, 1);
+ press_key(0, 3);
//Note that QMK only processes one key at a time
EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_B)));
keyboard_task();
EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_B, KC_C)));
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();
+} \ No newline at end of file