diff options
author | QMK Bot <hello@qmk.fm> | 2022-06-05 11:15:11 +0200 |
---|---|---|
committer | QMK Bot <hello@qmk.fm> | 2022-06-05 11:15:11 +0200 |
commit | d6402fe9fb01efae5c4952c1a3c07cd128e81eea (patch) | |
tree | 810fef1fc2ce6c7067d5c0daa0d90a09ef94b223 /tests/test_common/test_fixture.hpp | |
parent | 08c556b78b9dc672a2aa2388bbd3fdf408e3ce98 (diff) | |
parent | 95d20e6d8bb1ffaf3024af793daf789ee0b75727 (diff) |
Merge remote-tracking branch 'origin/master' into develop
Diffstat (limited to 'tests/test_common/test_fixture.hpp')
-rw-r--r-- | tests/test_common/test_fixture.hpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/test_common/test_fixture.hpp b/tests/test_common/test_fixture.hpp index 73b5d8d3e8..81906f76c7 100644 --- a/tests/test_common/test_fixture.hpp +++ b/tests/test_common/test_fixture.hpp @@ -36,7 +36,22 @@ class TestFixture : public testing::Test { void add_key(const KeymapKey key); const KeymapKey* find_key(const layer_t layer_t, const keypos_t position) const; - void get_keycode(const layer_t layer, const keypos_t position, uint16_t* result) const; + void get_keycode(const layer_t layer, const keypos_t position, uint16_t* result) const; + + /** + * @brief Taps `key` with `delay_ms` delay between press and release. + */ + void tap_key(KeymapKey key, unsigned delay_ms = 1); + + /** + * @brief Taps multiple KeymapKey keys in order, e.g. `tap_keys(key_a, key_b)`. + */ + template <typename... Ts> + void tap_keys(Ts... keys) { + for (KeymapKey key : {keys...}) { + tap_key(key); + } + } void run_one_scan_loop(); void idle_for(unsigned ms); |