diff options
author | Ryan <fauxpark@gmail.com> | 2023-08-27 13:30:19 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-27 13:30:19 +1000 |
commit | 70e34e491c297231a3f987fd69760d38e79dbfa4 (patch) | |
tree | a3fe26ea27c9d020142f4c248fa0bab5d32c1f9c /tests/unicode/unicode_map | |
parent | 95681b8ff4a92aacd0249e124d34cf16e510175e (diff) |
Unicode, Unicodemap and UCIS refactor (#21659)
Diffstat (limited to 'tests/unicode/unicode_map')
-rw-r--r-- | tests/unicode/unicode_map/config.h | 8 | ||||
-rw-r--r-- | tests/unicode/unicode_map/test.mk | 5 | ||||
-rw-r--r-- | tests/unicode/unicode_map/test_unicode_map.cpp | 54 |
3 files changed, 67 insertions, 0 deletions
diff --git a/tests/unicode/unicode_map/config.h b/tests/unicode/unicode_map/config.h new file mode 100644 index 0000000000..0d86922f0d --- /dev/null +++ b/tests/unicode/unicode_map/config.h @@ -0,0 +1,8 @@ +// Copyright 2023 QMK +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "test_common.h" + +#define UNICODE_SELECTED_MODES UNICODE_MODE_LINUX diff --git a/tests/unicode/unicode_map/test.mk b/tests/unicode/unicode_map/test.mk new file mode 100644 index 0000000000..e6d0034799 --- /dev/null +++ b/tests/unicode/unicode_map/test.mk @@ -0,0 +1,5 @@ +# -------------------------------------------------------------------------------- +# Keep this file, even if it is empty, as a marker that this folder contains tests +# -------------------------------------------------------------------------------- + +UNICODEMAP_ENABLE = yes diff --git a/tests/unicode/unicode_map/test_unicode_map.cpp b/tests/unicode/unicode_map/test_unicode_map.cpp new file mode 100644 index 0000000000..cacd8f3c75 --- /dev/null +++ b/tests/unicode/unicode_map/test_unicode_map.cpp @@ -0,0 +1,54 @@ +// Copyright 2023 QMK +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "keyboard_report_util.hpp" +#include "keycode.h" +#include "test_common.hpp" +#include "test_keymap_key.hpp" + +using testing::_; + +const uint32_t PROGMEM unicode_map[] = { + 0x03A8, // Ψ + 0x2318 // ⌘ +}; + +class UnicodeMap : public TestFixture {}; + +TEST_F(UnicodeMap, sends_unicodemap_code_point_from_keycode) { + TestDriver driver; + + auto key_um = KeymapKey(0, 0, 0, UM(0)); + + set_keymap({key_um}); + + EXPECT_UNICODE(driver, 0x03A8); + tap_key(key_um); + + VERIFY_AND_CLEAR(driver); +} + +TEST_F(UnicodeMap, sends_unicodemap_pair_from_keycode) { + TestDriver driver; + + auto key_shift = KeymapKey(0, 0, 0, KC_LEFT_SHIFT); + auto key_up = KeymapKey(0, 1, 0, UP(0, 1)); + + set_keymap({key_shift, key_up}); + + EXPECT_UNICODE(driver, 0x03A8); + tap_key(key_up); + + EXPECT_REPORT(driver, (KC_LEFT_SHIFT)); + key_shift.press(); + run_one_scan_loop(); + + EXPECT_UNICODE(driver, 0x2318); + tap_key(key_up); + + EXPECT_NO_REPORT(driver); + key_shift.release(); + run_one_scan_loop(); + + VERIFY_AND_CLEAR(driver); +} |