Add unit test for single key combo pressed twice

This commit is contained in:
Julian Schuler 2025-04-24 21:11:31 +02:00
parent 5ea7283159
commit 089910ceef
No known key found for this signature in database
2 changed files with 19 additions and 2 deletions

View File

@ -54,3 +54,18 @@ TEST_F(Combo, combo_osmshift_tapped) {
tap_key(key_i);
VERIFY_AND_CLEAR(driver);
}
TEST_F(Combo, combo_single_key_twice) {
TestDriver driver;
KeymapKey key_a(0, 0, 1, KC_A);
set_keymap({key_a});
EXPECT_REPORT(driver, (KC_B));
tap_combo({key_a});
VERIFY_AND_CLEAR(driver);
EXPECT_REPORT(driver, (KC_B));
EXPECT_EMPTY_REPORT(driver);
tap_combo({key_a});
VERIFY_AND_CLEAR(driver);
}

View File

@ -4,14 +4,16 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include "quantum.h"
enum combos { modtest, osmshift };
enum combos { modtest, osmshift, single_key };
uint16_t const modtest_combo[] = {KC_Y, KC_U, COMBO_END};
uint16_t const osmshift_combo[] = {KC_Z, KC_X, COMBO_END};
uint16_t const single_key_combo[] = {KC_A, COMBO_END};
// clang-format off
combo_t key_combos[] = {
[modtest] = COMBO(modtest_combo, RSFT_T(KC_SPACE)),
[osmshift] = COMBO(osmshift_combo, OSM(MOD_LSFT))
[osmshift] = COMBO(osmshift_combo, OSM(MOD_LSFT)),
[single_key] = COMBO(single_key_combo, KC_B),
};
// clang-format on