A bigger test matrix, and test for unmapped keys
This commit is contained in:
parent
1e4cc36e14
commit
72c8df1f19
3 changed files with 18 additions and 5 deletions
|
@ -17,8 +17,8 @@
|
||||||
#ifndef TESTS_BASIC_CONFIG_H_
|
#ifndef TESTS_BASIC_CONFIG_H_
|
||||||
#define TESTS_BASIC_CONFIG_H_
|
#define TESTS_BASIC_CONFIG_H_
|
||||||
|
|
||||||
#define MATRIX_ROWS 2
|
#define MATRIX_ROWS 4
|
||||||
#define MATRIX_COLS 2
|
#define MATRIX_COLS 10
|
||||||
|
|
||||||
|
|
||||||
#endif /* TESTS_BASIC_CONFIG_H_ */
|
#endif /* TESTS_BASIC_CONFIG_H_ */
|
||||||
|
|
|
@ -16,9 +16,13 @@
|
||||||
|
|
||||||
#include "quantum.h"
|
#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] = {
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
[0] = {
|
[0] = {
|
||||||
{KC_A, KC_B},
|
{KC_A, KC_B, 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, 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},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -44,10 +44,19 @@ TEST_F(KeyPress, CorrectKeyIsReportedWhenPressed) {
|
||||||
TEST_F(KeyPress, CorrectKeysAreReportedWhenTwoKeysArePressed) {
|
TEST_F(KeyPress, CorrectKeysAreReportedWhenTwoKeysArePressed) {
|
||||||
TestDriver driver;
|
TestDriver driver;
|
||||||
press_key(1, 0);
|
press_key(1, 0);
|
||||||
press_key(0, 1);
|
press_key(0, 3);
|
||||||
//Note that QMK only processes one key at a time
|
//Note that QMK only processes one key at a time
|
||||||
EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_B)));
|
EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_B)));
|
||||||
keyboard_task();
|
keyboard_task();
|
||||||
EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_B, KC_C)));
|
EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_B, KC_C)));
|
||||||
keyboard_task();
|
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();
|
||||||
|
}
|
Loading…
Reference in a new issue