https://git.reactos.org/?p=reactos.git;a=commitdiff;h=afec737142b50eef2be09…
commit afec737142b50eef2be0952616658592918a1061
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Mon Oct 4 07:35:00 2021 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Mon Oct 4 07:35:00 2021 +0900
[IMM32_APITEST] Add ImmGetImeInfoEx testcase (#3988)
CORE-11700
---
modules/rostests/apitests/imm32/CMakeLists.txt | 1 +
modules/rostests/apitests/imm32/ImmGetImeInfoEx.c | 123 ++++++++++++++++++++++
modules/rostests/apitests/imm32/testlist.c | 2 +
3 files changed, 126 insertions(+)
diff --git a/modules/rostests/apitests/imm32/CMakeLists.txt
b/modules/rostests/apitests/imm32/CMakeLists.txt
index 97ca3c4123e..30b7dd66a8e 100644
--- a/modules/rostests/apitests/imm32/CMakeLists.txt
+++ b/modules/rostests/apitests/imm32/CMakeLists.txt
@@ -5,6 +5,7 @@ list(APPEND SOURCE
clientimc.c
himc.c
imcc.c
+ ImmGetImeInfoEx.c
ImmIsUIMessage.c
testlist.c)
diff --git a/modules/rostests/apitests/imm32/ImmGetImeInfoEx.c
b/modules/rostests/apitests/imm32/ImmGetImeInfoEx.c
new file mode 100644
index 00000000000..3a7451e00ab
--- /dev/null
+++ b/modules/rostests/apitests/imm32/ImmGetImeInfoEx.c
@@ -0,0 +1,123 @@
+/*
+ * PROJECT: ReactOS api tests
+ * LICENSE: GPL-2.0-or-later (
https://spdx.org/licenses/GPL-2.0-or-later)
+ * PURPOSE: Test for ImmGetImeInfoEx
+ * COPYRIGHT: Copyright 2021 Katayama Hirofumi MZ (katayama.hirofumi.mz(a)gmail.com)
+ */
+
+#include "precomp.h"
+
+//#define DO_PRINT
+
+static VOID PrintInfoEx(PIMEINFOEX pInfoEx)
+{
+#ifdef DO_PRINT
+ trace("---\n");
+ trace("hkl: %p\n", pInfoEx->hkl);
+ trace("ImeInfo.dwPrivateDataSize: 0x%lX\n",
pInfoEx->ImeInfo.dwPrivateDataSize);
+ trace("ImeInfo.fdwProperty: 0x%lX\n", pInfoEx->ImeInfo.fdwProperty);
+ trace("ImeInfo.fdwConversionCaps: 0x%lX\n",
pInfoEx->ImeInfo.fdwConversionCaps);
+ trace("ImeInfo.fdwSentenceCaps: 0x%lX\n",
pInfoEx->ImeInfo.fdwSentenceCaps);
+ trace("ImeInfo.fdwUICaps: 0x%lX\n", pInfoEx->ImeInfo.fdwUICaps);
+ trace("ImeInfo.fdwSCSCaps: 0x%lX\n", pInfoEx->ImeInfo.fdwSCSCaps);
+ trace("ImeInfo.fdwSelectCaps: 0x%lX\n",
pInfoEx->ImeInfo.fdwSelectCaps);
+ trace("wszUIClass: '%ls'\n", pInfoEx->wszUIClass);
+ trace("fdwInitConvMode: 0x%lX\n", pInfoEx->fdwInitConvMode);
+ trace("fInitOpen: %d\n", pInfoEx->fInitOpen);
+ trace("fLoadFlag: %d\n", pInfoEx->fLoadFlag);
+ trace("dwProdVersion: 0x%lX\n", pInfoEx->dwProdVersion);
+ trace("dwImeWinVersion: 0x%lX\n", pInfoEx->dwImeWinVersion);
+ trace("wszImeDescription: '%ls'\n",
pInfoEx->wszImeDescription);
+ trace("wszImeFile: '%ls'\n", pInfoEx->wszImeFile);
+ trace("fInitOpen: %d\n", pInfoEx->fInitOpen);
+#endif
+}
+
+typedef BOOL (WINAPI *FN_ImmGetImeInfoEx)(PIMEINFOEX, IMEINFOEXCLASS, PVOID);
+
+START_TEST(ImmGetImeInfoEx)
+{
+ IMEINFOEX InfoEx;
+ BOOL ret, bMatch;
+ size_t ib;
+ LANGID LangID = GetSystemDefaultLangID();
+ HKL hKL = GetKeyboardLayout(0), hOldKL;
+
+ HMODULE hImm32 = GetModuleHandleA("imm32");
+ FN_ImmGetImeInfoEx fnImmGetImeInfoEx =
+ (FN_ImmGetImeInfoEx)GetProcAddress(hImm32, "ImmGetImeInfoEx");
+ if (!fnImmGetImeInfoEx)
+ {
+ skip("ImmGetImeInfoEx not found\n");
+ return;
+ }
+
+ if (!GetSystemMetrics(SM_IMMENABLED))
+ {
+ skip("IME is not available\n");
+ return;
+ }
+
+ // ImeInfoExKeyboardLayout
+ hOldKL = hKL;
+ FillMemory(&InfoEx, sizeof(InfoEx), 0xCC);
+ InfoEx.wszUIClass[0] = InfoEx.wszImeFile[0] = 0;
+ ret = fnImmGetImeInfoEx(&InfoEx, ImeInfoExKeyboardLayout, &hKL);
+ PrintInfoEx(&InfoEx);
+ ok_int(ret, TRUE);
+ ok_long((DWORD)(DWORD_PTR)hOldKL, (DWORD)(DWORD_PTR)hKL);
+ if (IS_IME_HKL(InfoEx.hkl))
+ {
+ ok_long(LOWORD(InfoEx.hkl), LangID);
+ }
+ else
+ {
+ ok_int(LOWORD(InfoEx.hkl), LangID);
+ ok_int(HIWORD(InfoEx.hkl), LangID);
+ }
+ ok(InfoEx.ImeInfo.dwPrivateDataSize >= 4, "\n");
+ ok(InfoEx.wszUIClass[0] != 0, "wszUIClass was empty\n");
+ ok_long(InfoEx.dwImeWinVersion, 0x40000);
+ ok(InfoEx.wszImeFile[0] != 0, "wszImeFile was empty\n");
+ hKL = hOldKL;
+
+ // ImeInfoExImeWindow
+ hOldKL = hKL;
+ FillMemory(&InfoEx, sizeof(InfoEx), 0xCC);
+ InfoEx.wszUIClass[0] = InfoEx.wszImeFile[0] = 0;
+ ret = fnImmGetImeInfoEx(&InfoEx, ImeInfoExImeWindow, &hKL);
+ PrintInfoEx(&InfoEx);
+ ok_int(ret, TRUE);
+ if (IS_IME_HKL(InfoEx.hkl))
+ {
+ ok_long(LOWORD(InfoEx.hkl), LangID);
+ }
+ else
+ {
+ ok_int(LOWORD(InfoEx.hkl), LangID);
+ ok_int(HIWORD(InfoEx.hkl), LangID);
+ }
+ ok(InfoEx.ImeInfo.dwPrivateDataSize >= 4, "\n");
+ ok(InfoEx.wszUIClass[0] != 0, "wszUIClass was empty\n");
+ ok_long(InfoEx.dwImeWinVersion, 0x40000);
+ ok(InfoEx.wszImeFile[0] != 0, "wszImeFile was empty\n");
+ hKL = hOldKL;
+
+ // TODO: ImeInfoExImeFileName
+
+ // 4
+ hOldKL = hKL;
+ FillMemory(&InfoEx, sizeof(InfoEx), 0xCC);
+ ret = fnImmGetImeInfoEx(&InfoEx, 4, &hKL);
+ ok_int(ret, FALSE);
+ bMatch = TRUE;
+ for (ib = 0; ib < sizeof(InfoEx); ++ib)
+ {
+ if (((LPBYTE)&InfoEx)[ib] != 0xCC)
+ {
+ bMatch = FALSE;
+ break;
+ }
+ }
+ ok_int(bMatch, TRUE);
+}
diff --git a/modules/rostests/apitests/imm32/testlist.c
b/modules/rostests/apitests/imm32/testlist.c
index fa243280dec..d73e9878113 100644
--- a/modules/rostests/apitests/imm32/testlist.c
+++ b/modules/rostests/apitests/imm32/testlist.c
@@ -5,6 +5,7 @@
extern void func_clientimc(void);
extern void func_himc(void);
extern void func_imcc(void);
+extern void func_ImmGetImeInfoEx(void);
extern void func_ImmIsUIMessage(void);
const struct test winetest_testlist[] =
@@ -12,6 +13,7 @@ const struct test winetest_testlist[] =
{ "clientimc", func_clientimc },
{ "himc", func_himc },
{ "imcc", func_imcc },
+ { "ImmGetImeInfoEx", func_ImmGetImeInfoEx },
{ "ImmIsUIMessage", func_ImmIsUIMessage },
{ 0, 0 }
};