Tighten tests.

This commit is contained in:
Pascal Getreuer 2024-11-10 21:01:06 -08:00
parent 1606d67f51
commit bd7e54a31d
2 changed files with 40 additions and 20 deletions

View File

@ -107,12 +107,15 @@ TEST_F(ChordalHoldHoldOnOtherKeyPress, chord_rolled_press_settled_as_hold) {
run_one_scan_loop(); run_one_scan_loop();
VERIFY_AND_CLEAR(driver); VERIFY_AND_CLEAR(driver);
// Press regular key and release mod-tap key. // Press regular key.
EXPECT_REPORT(driver, (KC_LEFT_SHIFT)); EXPECT_REPORT(driver, (KC_LEFT_SHIFT));
EXPECT_REPORT(driver, (KC_LEFT_SHIFT, KC_A)); EXPECT_REPORT(driver, (KC_LEFT_SHIFT, KC_A));
EXPECT_REPORT(driver, (KC_A));
regular_key.press(); regular_key.press();
run_one_scan_loop(); run_one_scan_loop();
VERIFY_AND_CLEAR(driver);
// Release mod-tap key.
EXPECT_REPORT(driver, (KC_A));
mod_tap_key.release(); mod_tap_key.release();
run_one_scan_loop(); run_one_scan_loop();
VERIFY_AND_CLEAR(driver); VERIFY_AND_CLEAR(driver);
@ -210,16 +213,21 @@ TEST_F(ChordalHoldHoldOnOtherKeyPress, two_mod_taps_nested_press_opposite_hands)
run_one_scan_loop(); run_one_scan_loop();
VERIFY_AND_CLEAR(driver); VERIFY_AND_CLEAR(driver);
// Tap second mod-tap key. // Press second mod-tap key.
EXPECT_REPORT(driver, (KC_LEFT_SHIFT)); EXPECT_REPORT(driver, (KC_LEFT_SHIFT));
EXPECT_REPORT(driver, (KC_LEFT_SHIFT, KC_B));
EXPECT_REPORT(driver, (KC_LEFT_SHIFT));
EXPECT_EMPTY_REPORT(driver);
mod_tap_key2.press(); mod_tap_key2.press();
run_one_scan_loop(); run_one_scan_loop();
VERIFY_AND_CLEAR(driver);
// Release second mod-tap key.
EXPECT_REPORT(driver, (KC_LEFT_SHIFT, KC_B));
EXPECT_REPORT(driver, (KC_LEFT_SHIFT));
mod_tap_key2.release(); mod_tap_key2.release();
run_one_scan_loop(); run_one_scan_loop();
VERIFY_AND_CLEAR(driver);
// Release first mod-tap key. // Release first mod-tap key.
EXPECT_EMPTY_REPORT(driver);
mod_tap_key1.release(); mod_tap_key1.release();
run_one_scan_loop(); run_one_scan_loop();
VERIFY_AND_CLEAR(driver); VERIFY_AND_CLEAR(driver);
@ -237,6 +245,8 @@ TEST_F(ChordalHoldHoldOnOtherKeyPress, two_mod_taps_nested_press_same_hand) {
EXPECT_NO_REPORT(driver); EXPECT_NO_REPORT(driver);
mod_tap_key1.press(); mod_tap_key1.press();
run_one_scan_loop(); run_one_scan_loop();
mod_tap_key2.press();
run_one_scan_loop();
VERIFY_AND_CLEAR(driver); VERIFY_AND_CLEAR(driver);
// Release mod-tap keys. // Release mod-tap keys.
@ -244,8 +254,6 @@ TEST_F(ChordalHoldHoldOnOtherKeyPress, two_mod_taps_nested_press_same_hand) {
EXPECT_REPORT(driver, (KC_A, KC_B)); EXPECT_REPORT(driver, (KC_A, KC_B));
EXPECT_REPORT(driver, (KC_A)); EXPECT_REPORT(driver, (KC_A));
EXPECT_EMPTY_REPORT(driver); EXPECT_EMPTY_REPORT(driver);
mod_tap_key2.press();
run_one_scan_loop();
mod_tap_key2.release(); mod_tap_key2.release();
run_one_scan_loop(); run_one_scan_loop();
mod_tap_key1.release(); mod_tap_key1.release();

View File

@ -109,18 +109,18 @@ TEST_F(ChordalHoldPermissiveHold, chord_rolled_press_settled_as_tap) {
set_keymap({mod_tap_key, regular_key}); set_keymap({mod_tap_key, regular_key});
// Press mod-tap key. // Press mod-tap key and regular key.
EXPECT_NO_REPORT(driver); EXPECT_NO_REPORT(driver);
mod_tap_key.press(); mod_tap_key.press();
run_one_scan_loop(); run_one_scan_loop();
regular_key.press();
run_one_scan_loop();
VERIFY_AND_CLEAR(driver); VERIFY_AND_CLEAR(driver);
// Press regular key and release mod-tap key. // Release mod-tap key.
EXPECT_REPORT(driver, (KC_P)); EXPECT_REPORT(driver, (KC_P));
EXPECT_REPORT(driver, (KC_P, KC_A)); EXPECT_REPORT(driver, (KC_P, KC_A));
EXPECT_REPORT(driver, (KC_A)); EXPECT_REPORT(driver, (KC_A));
regular_key.press();
run_one_scan_loop();
mod_tap_key.release(); mod_tap_key.release();
run_one_scan_loop(); run_one_scan_loop();
VERIFY_AND_CLEAR(driver); VERIFY_AND_CLEAR(driver);
@ -147,11 +147,16 @@ TEST_F(ChordalHoldPermissiveHold, non_chord_with_mod_tap_settled_as_tap) {
run_one_scan_loop(); run_one_scan_loop();
VERIFY_AND_CLEAR(driver); VERIFY_AND_CLEAR(driver);
// Tap regular key. // Press regular key.
EXPECT_REPORT(driver, (KC_P)); EXPECT_REPORT(driver, (KC_P));
EXPECT_REPORT(driver, (KC_P, KC_A)); EXPECT_REPORT(driver, (KC_P, KC_A));
regular_key.press();
run_one_scan_loop();
VERIFY_AND_CLEAR(driver);
// Release regular key.
EXPECT_REPORT(driver, (KC_P)); EXPECT_REPORT(driver, (KC_P));
tap_key(regular_key); regular_key.release();
run_one_scan_loop(); run_one_scan_loop();
VERIFY_AND_CLEAR(driver); VERIFY_AND_CLEAR(driver);
@ -611,12 +616,7 @@ TEST_F(ChordalHoldPermissiveHold, two_mod_taps_one_regular_key) {
VERIFY_AND_CLEAR(driver); VERIFY_AND_CLEAR(driver);
// Press mod-tap keys. // Press mod-tap keys.
EXPECT_REPORT(driver, (KC_LEFT_SHIFT)); EXPECT_NO_REPORT(driver);
EXPECT_REPORT(driver, (KC_LEFT_SHIFT, KC_B));
EXPECT_REPORT(driver, (KC_LEFT_SHIFT, KC_B, KC_C));
EXPECT_REPORT(driver, (KC_LEFT_SHIFT, KC_B));
EXPECT_REPORT(driver, (KC_B));
EXPECT_EMPTY_REPORT(driver);
idle_for(TAPPING_TERM); idle_for(TAPPING_TERM);
mod_tap_key1.press(); mod_tap_key1.press();
run_one_scan_loop(); run_one_scan_loop();
@ -624,11 +624,23 @@ TEST_F(ChordalHoldPermissiveHold, two_mod_taps_one_regular_key) {
run_one_scan_loop(); run_one_scan_loop();
regular_key.press(); regular_key.press();
run_one_scan_loop(); run_one_scan_loop();
VERIFY_AND_CLEAR(driver);
// Release keys. // Release keys.
EXPECT_REPORT(driver, (KC_LEFT_SHIFT));
EXPECT_REPORT(driver, (KC_LEFT_SHIFT, KC_B));
EXPECT_REPORT(driver, (KC_LEFT_SHIFT, KC_B, KC_C));
EXPECT_REPORT(driver, (KC_LEFT_SHIFT, KC_B));
regular_key.release(); regular_key.release();
run_one_scan_loop(); run_one_scan_loop();
VERIFY_AND_CLEAR(driver);
EXPECT_REPORT(driver, (KC_B));
mod_tap_key1.release(); mod_tap_key1.release();
run_one_scan_loop(); run_one_scan_loop();
VERIFY_AND_CLEAR(driver);
EXPECT_EMPTY_REPORT(driver);
mod_tap_key2.release(); mod_tap_key2.release();
run_one_scan_loop(); run_one_scan_loop();
VERIFY_AND_CLEAR(driver); VERIFY_AND_CLEAR(driver);