opensteno_qmk/quantum/process_keycode
Pascal Getreuer 95d20e6d8b
Fix and add unit tests for Caps Word to work with Unicode Map, Auto Shift, Retro Shift. (#17284)
* Fix Caps Word and Unicode Map

* Tests for Caps Word + Auto Shift and Unicode Map.

* Fix formatting

* Add additional keyboard report expectation macros

This commit defines five test utilities, EXPECT_REPORT, EXPECT_UNICODE,
EXPECT_EMPTY_REPORT, EXPECT_ANY_REPORT and EXPECT_NO_REPORT for use with
TestDriver.

EXPECT_REPORT sets a gmock expectation that a given keyboard report will
be sent. For instance,

  EXPECT_REPORT(driver, (KC_LSFT, KC_A));

is shorthand for

  EXPECT_CALL(driver,
      send_keyboard_mock(KeyboardReport(KC_LSFT, KC_A)));

EXPECT_UNICODE sets a gmock expectation that a given Unicode code point
will be sent using UC_LNX input mode. For instance for U+2013,

  EXPECT_UNICODE(driver, 0x2013);

expects the sequence of keys:

  "Ctrl+Shift+U, 2, 0, 1, 3, space".

EXPECT_EMPTY_REPORT sets a gmock expectation that a given keyboard
report will be sent. For instance

  EXPECT_EMPTY_REPORT(driver);

expects a single report without keypresses or modifiers.

EXPECT_ANY_REPORT sets a gmock expectation that a arbitrary keyboard
report will be sent, without matching its contents. For instance

  EXPECT_ANY_REPORT(driver).Times(1);

expects a single arbitrary keyboard report will be sent.

EXPECT_NO_REPORT sets a gmock expectation that no keyboard report will
be sent at all.

* Add tap_key() and tap_keys() to TestFixture.

This commit adds a `tap_key(key)` method to TestFixture that taps a
given KeymapKey, optionally with a specified delay between press and
release.

Similarly, the method `tap_keys(key_a, key_b, key_c)` taps a sequence of
KeymapKeys.

* Use EXPECT_REPORT, tap_keys, etc. in most tests.

This commit uses EXPECT_REPORT, EXPECT_UNICODE, EXPECT_EMPTY_REPORT,
EXPECT_NO_REPORT, tap_key() and tap_keys() test utilities from the
previous two commits in most tests. Particularly the EXPECT_REPORT
macro is frequently useful and makes a nice reduction in boilerplate
needed to express many tests.

Co-authored-by: David Kosorin <david@kosorin.net>
2022-06-05 09:14:02 +02:00
..
process_audio.c Format code according to conventions (#16322) 2022-02-12 18:29:31 +00:00
process_audio.h added missing audio_off_user() callback (#15457) 2021-12-11 16:58:25 -08:00
process_auto_shift.c Add GET_TAPPING_TERM macro to reduce duplicate code (#16681) 2022-04-16 11:24:09 -07:00
process_auto_shift.h Add Retro Shift (Auto Shift for Tap Hold via Retro Tapping) and Custom Auto Shifts (#11059) 2021-11-25 23:12:14 +11:00
process_backlight.c LED Matrix: decouple from Backlight (#12054) 2021-03-08 16:55:00 +11:00
process_backlight.h 2020 February 29 Breaking Changes Update (#8064) 2020-02-29 11:59:30 -08:00
process_caps_word.c Continue Caps Word when AltGr (right Alt) is held. (#17156) 2022-05-20 01:39:00 +01:00
process_caps_word.h [Core] Add Caps Word feature to core (#16588) 2022-05-14 16:00:32 +10:00
process_clicky.c Format code according to conventions (#16322) 2022-02-12 18:29:31 +00:00
process_clicky.h Change include guards in quantum/ to pragma once (#11239) 2020-12-26 15:53:12 +11:00
process_combo.c Add support for encoder mapping. (#13286) 2022-03-09 19:29:00 +11:00
process_combo.h Manually format develop (#15003) 2021-11-01 19:18:33 +00:00
process_dynamic_macro.c Format code according to conventions (#16322) 2022-02-12 18:29:31 +00:00
process_dynamic_macro.h [Core] Convert Dynamic Macro to a Core Feature (#5948) 2019-11-04 22:59:13 -08:00
process_dynamic_tapping_term.c New feature: DYNAMIC_TAPPING_TERM_ENABLE (#11036) 2021-11-26 07:06:50 +11:00
process_dynamic_tapping_term.h New feature: DYNAMIC_TAPPING_TERM_ENABLE (#11036) 2021-11-26 07:06:50 +11:00
process_grave_esc.c Rename some Quantum keycodes (#15968) 2022-01-22 03:34:15 +00:00
process_grave_esc.h Relocate grave keycode processing (#8082) 2020-02-04 18:49:10 -08:00
process_haptic.c Rip out old macro and action_function system (#16025) 2022-01-24 21:22:20 +00:00
process_haptic.h Haptic: driver-> feature (#13713) 2021-07-25 19:14:58 -07:00
process_joystick.c Joystick feature updates (#16732) 2022-03-26 18:38:09 +00:00
process_joystick.h Hid joystick interface (#4226) 2020-08-29 14:30:02 -07:00
process_key_lock.c Added cancel_key_lock function (#15321) 2021-11-29 00:17:07 -08:00
process_key_lock.h Added cancel_key_lock function (#15321) 2021-11-29 00:17:07 -08:00
process_key_override.c Format code according to conventions (#16322) 2022-02-12 18:29:31 +00:00
process_key_override.h Minor tidy up of key overrides (#13747) 2021-07-28 12:01:49 +01:00
process_leader.c Format code according to conventions (#16322) 2022-02-12 18:29:31 +00:00
process_leader.h Fix bad PR merge for #6580. (#12721) 2021-04-28 11:42:53 +01:00
process_magic.c Format code according to conventions (#16322) 2022-02-12 18:29:31 +00:00
process_magic.h Relocate magic keycode processing (#7512) 2019-12-03 19:48:55 +00:00
process_midi.c Format code according to conventions (#16322) 2022-02-12 18:29:31 +00:00
process_midi.h Format code according to conventions (#16322) 2022-02-12 18:29:31 +00:00
process_music.c Format code according to conventions (#16322) 2022-02-12 18:29:31 +00:00
process_music.h Format code according to conventions (#16322) 2022-02-12 18:29:31 +00:00
process_printer.c Format code according to conventions (#16322) 2022-02-12 18:29:31 +00:00
process_printer.h Migrate serial_uart usages to UART driver (#15479) 2021-12-15 11:00:39 +00:00
process_printer_bb.c Format code according to conventions (#16322) 2022-02-12 18:29:31 +00:00
process_programmable_button.c Add Support for USB programmable buttons (#12950) 2021-09-15 08:40:22 -07:00
process_programmable_button.h Add Support for USB programmable buttons (#12950) 2021-09-15 08:40:22 -07:00
process_rgb.c Unify the key up/down behaviour of RGB keycodes (#15730) 2022-01-06 18:52:32 +11:00
process_rgb.h Relocate RGB keycode processing (#7508) 2019-12-16 12:27:53 -08:00
process_secure.c Enhancement and fixes of "Secure" feature (#16958) 2022-05-14 23:07:08 +01:00
process_secure.h Implement XAP 'secure' core requirements (#16843) 2022-04-16 11:13:05 -07:00
process_sequencer.c 2020 November 28 Breaking Changes Update (#11053) 2020-11-28 12:02:18 -08:00
process_sequencer.h 2020 November 28 Breaking Changes Update (#11053) 2020-11-28 12:02:18 -08:00
process_space_cadet.c Add GET_TAPPING_TERM macro to reduce duplicate code (#16681) 2022-04-16 11:24:09 -07:00
process_space_cadet.h Fix Tap-Hold Configs (#11127) 2021-01-04 16:37:20 -08:00
process_steno.c Format code according to conventions (#16322) 2022-02-12 18:29:31 +00:00
process_steno.h Change include guards in quantum/ to pragma once (#11239) 2020-12-26 15:53:12 +11:00
process_tap_dance.c Add GET_TAPPING_TERM macro to reduce duplicate code (#16681) 2022-04-16 11:24:09 -07:00
process_tap_dance.h matrix_scan_x -> x_task (#13748) 2021-07-28 12:01:23 +01:00
process_terminal.c Format code according to conventions (#16322) 2022-02-12 18:29:31 +00:00
process_terminal.h Change include guards in quantum/ to pragma once (#11239) 2020-12-26 15:53:12 +11:00
process_terminal_nop.h Change include guards in quantum/ to pragma once (#11239) 2020-12-26 15:53:12 +11:00
process_ucis.c Format code according to conventions (#16322) 2022-02-12 18:29:31 +00:00
process_ucis.h Standardize how unicode is processed (fixes #8768) (#8770) 2020-06-18 08:07:34 +01:00
process_unicode.c clang-format changes 2019-08-30 15:01:52 -07:00
process_unicode.h New keycode macro (XP) for shifted character pairs using UNICODEMAP + bug fixes and improvements (#4803) 2019-05-03 09:33:00 -07:00
process_unicode_common.c Fix and add unit tests for Caps Word to work with Unicode Map, Auto Shift, Retro Shift. (#17284) 2022-06-05 09:14:02 +02:00
process_unicode_common.h Remove send_unicode_hex_string() (#16518) 2022-03-04 11:04:45 +00:00
process_unicodemap.c Fix Issue #9533 - Delayed shift state handling (#11220) 2020-12-22 18:23:09 +01:00
process_unicodemap.h send_unicode_string(): Add support for code points > 0xFFFF (#8236) 2020-02-25 12:54:51 +11:00