summaryrefslogtreecommitdiff
path: root/tests/caps_word
diff options
context:
space:
mode:
authorPascal Getreuer <50221757+getreuer@users.noreply.github.com>2022-05-19 17:39:00 -0700
committerGitHub <noreply@github.com>2022-05-20 01:39:00 +0100
commitb5608cbb6d8a5a24d9c3b928521acbc57726831f (patch)
treef163727a32169ca6a1093f83fdcc0ca0d0dfaa83 /tests/caps_word
parent36c8462f0a64e64a6ad832053368109f7c1ebf67 (diff)
downloadqmk_firmware-b5608cbb6d8a5a24d9c3b928521acbc57726831f.tar.gz
qmk_firmware-b5608cbb6d8a5a24d9c3b928521acbc57726831f.zip
Continue Caps Word when AltGr (right Alt) is held. (#17156)
This is a minor bug fix for Caps Word. Currently, Caps Word turns off whenever a non-shift mod becomes active. This is done to avoid interfering with hotkeys. This commit makes an exception to continue Caps Word when AltGr (right Alt) is held. Outside the US, the AltGr key is used to type additional symbols (https://en.wikipedia.org/wiki/AltGr_key). Depending on the language, these may include symbols used within words like accented letters where it would be desirable to continue Caps Word.
Diffstat (limited to 'tests/caps_word')
-rw-r--r--tests/caps_word/test_caps_word.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/caps_word/test_caps_word.cpp b/tests/caps_word/test_caps_word.cpp
index bcc8c53326..f611d4c104 100644
--- a/tests/caps_word/test_caps_word.cpp
+++ b/tests/caps_word/test_caps_word.cpp
@@ -212,6 +212,36 @@ TEST_F(CapsWord, SpaceTurnsOffCapsWord) {
testing::Mock::VerifyAndClearExpectations(&driver);
}
+// Tests that typing "AltGr + A" produces "Shift + AltGr + A".
+TEST_F(CapsWord, ShiftsAltGrSymbols) {
+ TestDriver driver;
+ KeymapKey key_a(0, 0, 0, KC_A);
+ KeymapKey key_altgr(0, 1, 0, KC_RALT);
+ set_keymap({key_a, key_altgr});
+
+ // Allow any number of reports with no keys or only modifiers.
+ // clang-format off
+ EXPECT_CALL(driver, send_keyboard_mock(AnyOf(
+ KeyboardReport(),
+ KeyboardReport(KC_RALT),
+ KeyboardReport(KC_LSFT, KC_RALT))))
+ .Times(AnyNumber());
+ // Expect "Shift + AltGr + A, Space".
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT, KC_RALT, KC_A)));
+ // clang-format on
+
+ // Turn on Caps Word and type "AltGr + A".
+ caps_word_on();
+
+ key_altgr.press();
+ run_one_scan_loop();
+ TapKeys(key_a);
+ run_one_scan_loop();
+ key_altgr.release();
+
+ testing::Mock::VerifyAndClearExpectations(&driver);
+}
+
struct CapsWordBothShiftsParams {
std::string name;
uint16_t left_shift_keycode;