diff options
Diffstat (limited to 'tests/basic')
-rw-r--r-- | tests/basic/config.h | 2 | ||||
-rw-r--r-- | tests/basic/test.mk | 2 | ||||
-rw-r--r-- | tests/basic/test_one_shot_keys.cpp | 46 |
3 files changed, 48 insertions, 2 deletions
diff --git a/tests/basic/config.h b/tests/basic/config.h index 85fa9d691d..7fc76d7c2e 100644 --- a/tests/basic/config.h +++ b/tests/basic/config.h @@ -16,4 +16,4 @@ #pragma once -#include "test_common.h"
\ No newline at end of file +#include "test_common.h" diff --git a/tests/basic/test.mk b/tests/basic/test.mk index 29690d1adf..6ec384609c 100644 --- a/tests/basic/test.mk +++ b/tests/basic/test.mk @@ -15,4 +15,4 @@ # -------------------------------------------------------------------------------- # Keep this file, even if it is empty, as a marker that this folder contains tests -# --------------------------------------------------------------------------------
\ No newline at end of file +# -------------------------------------------------------------------------------- diff --git a/tests/basic/test_one_shot_keys.cpp b/tests/basic/test_one_shot_keys.cpp index 2a3434bf16..9748dad7da 100644 --- a/tests/basic/test_one_shot_keys.cpp +++ b/tests/basic/test_one_shot_keys.cpp @@ -337,3 +337,49 @@ TEST_F(OneShot, OSLWithAdditionalKeypress) { run_one_scan_loop(); VERIFY_AND_CLEAR(driver); } + +TEST_F(OneShot, OSLWithOsmAndAdditionalKeypress) { + TestDriver driver; + InSequence s; + KeymapKey osl_key = KeymapKey{0, 0, 0, OSL(1)}; + KeymapKey osm_key = KeymapKey{1, 1, 0, OSM(MOD_LSFT), KC_LSFT}; + KeymapKey regular_key = KeymapKey{1, 1, 1, KC_A}; + + set_keymap({osl_key, osm_key, regular_key}); + + /* Press OSL key */ + EXPECT_NO_REPORT(driver); + osl_key.press(); + run_one_scan_loop(); + VERIFY_AND_CLEAR(driver); + + /* Release OSL key */ + EXPECT_NO_REPORT(driver); + osl_key.release(); + run_one_scan_loop(); + EXPECT_TRUE(layer_state_is(1)); + VERIFY_AND_CLEAR(driver); + + /* Press and release OSM */ + EXPECT_NO_REPORT(driver); + osm_key.press(); + run_one_scan_loop(); + osm_key.release(); + run_one_scan_loop(); + EXPECT_TRUE(layer_state_is(1)); + VERIFY_AND_CLEAR(driver); + + /* Press regular key */ + EXPECT_REPORT(driver, (osm_key.report_code, regular_key.report_code)).Times(1); + EXPECT_EMPTY_REPORT(driver); + regular_key.press(); + run_one_scan_loop(); + EXPECT_FALSE(layer_state_is(1)); + VERIFY_AND_CLEAR(driver); + + /* Release regular key */ + EXPECT_NO_REPORT(driver); + regular_key.release(); + run_one_scan_loop(); + VERIFY_AND_CLEAR(driver); +} |