diff --git a/common/core/desktop/tests/unit/kmx/kmx_key_list.cpp b/common/core/desktop/tests/unit/kmx/kmx_key_list.cpp index f9e39d86d5..2b518c8603 100644 --- a/common/core/desktop/tests/unit/kmx/kmx_key_list.cpp +++ b/common/core/desktop/tests/unit/kmx/kmx_key_list.cpp @@ -32,16 +32,15 @@ km_kbp_keyboard_key kb_key_expected_list[] = {{49,16384},{50,16384},{66,16416},{ * The purpose of this test is to verify that `km_kbp_keyboard_get_key_list` * returns list of all the keys used for a keyboard that core as loaded. * - * @param source_path Path to kmx keyboard file + * @param source_file Path to kmx keyboard file */ -void test_key_list(const km::kbp::path &source_path){ +void test_key_list(const km::kbp::path &source_file){ km_kbp_keyboard * test_kb = nullptr; km_kbp_state * test_state = nullptr; km_kbp_keyboard_key * kb_key_list; - km::kbp::path const source_keybard = "049 - groups ctrlalt.kmx"; - km::kbp::path full_path = km::kbp::path::join(source_path, source_keybard); + km::kbp::path full_path = source_file; try_status(km_kbp_keyboard_load(full_path.native().c_str(), &test_kb)); diff --git a/common/core/desktop/tests/unit/kmx/049 - groups ctrlalt.kmn b/common/core/desktop/tests/unit/kmx/kmx_key_list.kmn similarity index 74% rename from common/core/desktop/tests/unit/kmx/049 - groups ctrlalt.kmn rename to common/core/desktop/tests/unit/kmx/kmx_key_list.kmn index 8980d06f2b..cd55d2a40d 100644 --- a/common/core/desktop/tests/unit/kmx/049 - groups ctrlalt.kmn +++ b/common/core/desktop/tests/unit/kmx/kmx_key_list.kmn @@ -1,4 +1,4 @@ -c Description: Tests multiple groups. Purpose here is to interleave output and backspaces from kmx processor to consumer +c Description: Tests multiple groups. This keyboard is used to test km_kbp_keyboard_get_key_list API call c keys: [K_1][K_2] c expected: abc c context: diff --git a/common/core/desktop/tests/unit/kmx/kmx_key_list.kmx b/common/core/desktop/tests/unit/kmx/kmx_key_list.kmx new file mode 100644 index 0000000000..68d44f583d Binary files /dev/null and b/common/core/desktop/tests/unit/kmx/kmx_key_list.kmx differ diff --git a/common/core/desktop/tests/unit/kmx/meson.build b/common/core/desktop/tests/unit/kmx/meson.build index 7a57f764ed..c535d1f517 100644 --- a/common/core/desktop/tests/unit/kmx/meson.build +++ b/common/core/desktop/tests/unit/kmx/meson.build @@ -202,13 +202,27 @@ else endforeach endif -# test for key rule keys + +# test for km_kbp_keyboard_get_key_list key_e = executable('key_list', 'kmx_key_list.cpp', cpp_args: defns,include_directories: [inc, libsrc], link_args: links, dependencies: [rust_mock_processor], objects: lib.extract_all_objects()) -test('key_list', key_e, args: [test_path] ) +test_kbd = 'kmx_key_list' +if kmcomp.found() + kbd_src = files(test_kbd + '.kmn') + kbd_obj = join_paths(meson.current_source_dir(), test_kbd) + '.kmx' + kbd_log = custom_target(test_kbd + '.kmx'.underscorify(), + output: test_kbd + '.log', + input: kbd_src, + command: kmcomp_cmd + ['-s', '-d', '@INPUT@', kbd_obj, '@OUTPUT@'] + ) + test('key_list', key_e, depends: kbd_log, args: [kbd_obj] ) +else + kbd_obj = join_paths(meson.current_source_dir(), test_kbd) + '.kmx' + test('key_list', key_e, args: [kbd_obj] ) +endif