spiegel-keyman/core/tests/unit/kmnkbd/keyboard_api.tests.cpp
Eberhard Beilharz 3dc3f040de
feat(core): implement loading KMX from blob
- split keyboard loading into loading KMX file into blob and then
  loading the keyboard processor from the blob.
- deprecate `km_core_keyboard_load`
- move file access next to deprecated method. This is now the only place
  that loads a file in Core; unit tests have some more places that
  load files.
- introduce GTest and add unit tests for loading from blob

Cherry-picked from `epic/web-core` branch.

Cherry-Pick-Commit: 1deaa323ad
Cherry-Pick-Commit: 59019cc8b7
Cherry-Pick-Commit: bc46458368
Cherry-Pick-Commit: d06aa29956
Cherry-Pick-Commit: 1c88166f6e
Cherry-Pick-Commit: 069cd21ecd
Cherry-Pick-Commit: 052ae2ec35
Cherry-Pick-Commit: 11a2a3ba3a

Part-of: #11293
Part-of: #8093
2024-11-27 15:30:05 +01:00

38 lines
1.1 KiB
C++

/*
Copyright: © 2018 SIL International.
Description: Tests for the Keyboard API family of functions.
Create Date: 30 Oct 2018
Authors: Tim Eves (TSE)
*/
#include <string>
#include "keyman_core.h"
#include "path.hpp"
#include "mock/mock_processor.hpp"
namespace
{
km::core::path const test_kb_path = "/a/dummy/keyboard.mock";
}
#define try_status(expr) \
{auto __s = (expr); if (__s != KM_CORE_STATUS_OK) return 100*__LINE__+__s;}
int main(int, char *[])
{
km_core_keyboard * test_kb = nullptr;
km_core_keyboard_attrs const * kb_attrs = nullptr;
km_core_keyboard_key * kb_key_list = nullptr;
km_core_keyboard_imx * kb_imx_list = nullptr;
test_kb = (km_core_keyboard *)new km::core::mock_processor(test_kb_path);
try_status(km_core_keyboard_get_attrs(test_kb, &kb_attrs));
try_status(km_core_keyboard_get_key_list(test_kb,&kb_key_list));
try_status(km_core_keyboard_get_imx_list(test_kb,&kb_imx_list));
km_core_keyboard_dispose(test_kb);
km_core_keyboard_key_list_dispose(kb_key_list);
km_core_keyboard_imx_list_dispose(kb_imx_list);
return 0;
}