https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d6a0299eec29024225e99…
commit d6a0299eec29024225e99349cf1a33ecd4580730
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Tue Sep 21 12:26:43 2021 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Tue Sep 21 12:26:43 2021 +0900
[IMM32_APITEST] Add himc testcase (#3965)
Add himc testcase. CORE-11700
---
modules/rostests/apitests/imm32/CMakeLists.txt | 3 +-
modules/rostests/apitests/imm32/himc.c | 112 +++++++++++++++++++++++++
modules/rostests/apitests/imm32/testlist.c | 2 +
3 files changed, 116 insertions(+), 1 deletion(-)
diff --git a/modules/rostests/apitests/imm32/CMakeLists.txt
b/modules/rostests/apitests/imm32/CMakeLists.txt
index 79fbf5840bb..97ca3c4123e 100644
--- a/modules/rostests/apitests/imm32/CMakeLists.txt
+++ b/modules/rostests/apitests/imm32/CMakeLists.txt
@@ -3,6 +3,7 @@ include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine)
list(APPEND SOURCE
clientimc.c
+ himc.c
imcc.c
ImmIsUIMessage.c
testlist.c)
@@ -10,5 +11,5 @@ list(APPEND SOURCE
add_executable(imm32_apitest ${SOURCE})
target_link_libraries(imm32_apitest wine ${PSEH_LIB})
set_module_type(imm32_apitest win32cui)
-add_importlibs(imm32_apitest imm32 msvcrt kernel32 ntdll)
+add_importlibs(imm32_apitest imm32 msvcrt user32 kernel32 ntdll)
add_rostests_file(TARGET imm32_apitest)
diff --git a/modules/rostests/apitests/imm32/himc.c
b/modules/rostests/apitests/imm32/himc.c
new file mode 100644
index 00000000000..8cf4bfd941f
--- /dev/null
+++ b/modules/rostests/apitests/imm32/himc.c
@@ -0,0 +1,112 @@
+/*
+ * PROJECT: ReactOS api tests
+ * LICENSE: GPL-2.0-or-later (
https://spdx.org/licenses/GPL-2.0-or-later)
+ * PURPOSE: Test for imm32 HIMC
+ * COPYRIGHT: Copyright 2021 Katayama Hirofumi MZ (katayama.hirofumi.mz(a)gmail.com)
+ */
+
+#include "precomp.h"
+
+START_TEST(himc)
+{
+ DWORD style;
+ HWND hwndEdit, hwndStatic;
+ HIMC hNewIMC, hOldIMC, hIMC, hIMC1, hIMC2;
+ LPINPUTCONTEXT pIC;
+
+ /* ImmCreateContext/ImmDestroyContext and ImmLockIMC/ImmUnlockIMC */
+ hNewIMC = ImmCreateContext();
+ ok_int(hNewIMC != NULL, TRUE);
+ pIC = ImmLockIMC(hNewIMC);
+ ok_int(pIC == NULL, TRUE);
+ ImmUnlockIMC(hNewIMC);
+ ok_int(ImmDestroyContext(hNewIMC), TRUE);
+
+ /* ImmGetContext against NULL */
+ hIMC = ImmGetContext(NULL);
+ ok_int(hIMC == NULL, TRUE);
+
+ /* Create EDIT control */
+ style = ES_MULTILINE | ES_LEFT;
+ hwndEdit = CreateWindowW(L"EDIT", NULL, style, 0, 0, 100, 20, NULL, NULL,
+ GetModuleHandleW(NULL), NULL);
+ ok_int(hwndEdit != NULL, TRUE);
+
+ /* Create STATIC control */
+ style = SS_LEFT;
+ hwndStatic = CreateWindowW(L"STATIC", NULL, style, 0, 30, 100, 20, NULL,
NULL,
+ GetModuleHandleW(NULL), NULL);
+ ok_int(hwndStatic != NULL, TRUE);
+
+ /* ImmGetContext/ImmReleaseContext and ImmLockIMC/ImmUnlockIMC */
+ hIMC1 = hIMC = ImmGetContext(hwndEdit);
+ ok_int(hIMC != NULL, TRUE);
+ pIC = ImmLockIMC(hIMC);
+ ok_int(pIC != NULL, TRUE);
+ ok_int(pIC->hWnd == NULL, TRUE);
+ ok_int(pIC->fOpen, FALSE);
+ ok_int(ImmGetIMCCSize(pIC->hCompStr) != 0, TRUE);
+ ok_int(ImmGetIMCCSize(pIC->hCandInfo) != 0, TRUE);
+ ok_int(ImmGetIMCCSize(pIC->hGuideLine) != 0, TRUE);
+ ok_int(ImmGetIMCCSize(pIC->hPrivate) != 0, TRUE);
+ ok_int(ImmGetIMCCSize(pIC->hMsgBuf) != 0, TRUE);
+ ImmUnlockIMC(hNewIMC);
+ SetFocus(hwndEdit);
+ pIC = ImmLockIMC(hIMC);
+ ok_int(pIC != NULL, TRUE);
+ ok_int(pIC->hWnd == hwndEdit, TRUE);
+ ok_int(pIC->fOpen, FALSE);
+ ImmUnlockIMC(hNewIMC);
+ SetFocus(NULL);
+ pIC = ImmLockIMC(hIMC);
+ ok_int(pIC != NULL, TRUE);
+ ok_int(pIC->hWnd == hwndEdit, TRUE);
+ ImmUnlockIMC(hNewIMC);
+ ok_int(ImmSetOpenStatus(hIMC, TRUE), TRUE);
+ pIC = ImmLockIMC(hIMC);
+ ok_int(pIC != NULL, TRUE);
+ ok_int(pIC->fOpen, TRUE);
+ ImmUnlockIMC(hNewIMC);
+ ok_int(ImmReleaseContext(hwndEdit, hIMC), TRUE);
+
+ hIMC2 = hIMC = ImmGetContext(hwndStatic);
+ ok_int(hIMC != NULL, TRUE);
+ pIC = ImmLockIMC(hIMC);
+ ok_int(pIC != NULL, TRUE);
+ ok_int(pIC->hWnd == hwndEdit, TRUE);
+ ok_int(ImmGetIMCCSize(pIC->hCompStr) != 0, TRUE);
+ ok_int(ImmGetIMCCSize(pIC->hCandInfo) != 0, TRUE);
+ ok_int(ImmGetIMCCSize(pIC->hGuideLine) != 0, TRUE);
+ ok_int(ImmGetIMCCSize(pIC->hPrivate) != 0, TRUE);
+ ok_int(ImmGetIMCCSize(pIC->hMsgBuf) != 0, TRUE);
+ ImmUnlockIMC(hNewIMC);
+ ok_int(ImmReleaseContext(hwndEdit, hIMC), TRUE);
+
+ ok_int(hIMC1 == hIMC2, TRUE);
+
+ /* ImmAssociateContext */
+ hNewIMC = ImmCreateContext();
+ ok_int(hNewIMC != NULL, TRUE);
+ pIC = ImmLockIMC(hNewIMC);
+ ok_int(pIC != NULL, TRUE);
+ ImmUnlockIMC(hNewIMC);
+ hOldIMC = ImmAssociateContext(hwndEdit, hNewIMC);
+ ok_int(hNewIMC != hOldIMC, TRUE);
+ hIMC = ImmGetContext(hwndEdit);
+ ok_int(hIMC == hNewIMC, TRUE);
+ ok_int(hIMC != hOldIMC, TRUE);
+ pIC = ImmLockIMC(hNewIMC);
+ ok_int(pIC != NULL, TRUE);
+ ok_int(pIC->hWnd == NULL, TRUE);
+ ok_int(ImmGetIMCCSize(pIC->hCompStr) != 0, TRUE);
+ ok_int(ImmGetIMCCSize(pIC->hCandInfo) != 0, TRUE);
+ ok_int(ImmGetIMCCSize(pIC->hGuideLine) != 0, TRUE);
+ ok_int(ImmGetIMCCSize(pIC->hPrivate) != 0, TRUE);
+ ok_int(ImmGetIMCCSize(pIC->hMsgBuf) != 0, TRUE);
+ ImmUnlockIMC(hNewIMC);
+ ok_int(ImmReleaseContext(hwndEdit, hIMC), TRUE);
+ ok_int(ImmDestroyContext(hNewIMC), TRUE);
+
+ DestroyWindow(hwndEdit);
+ DestroyWindow(hwndStatic);
+}
diff --git a/modules/rostests/apitests/imm32/testlist.c
b/modules/rostests/apitests/imm32/testlist.c
index 73597d5f204..fa243280dec 100644
--- a/modules/rostests/apitests/imm32/testlist.c
+++ b/modules/rostests/apitests/imm32/testlist.c
@@ -3,12 +3,14 @@
#include <wine/test.h>
extern void func_clientimc(void);
+extern void func_himc(void);
extern void func_imcc(void);
extern void func_ImmIsUIMessage(void);
const struct test winetest_testlist[] =
{
{ "clientimc", func_clientimc },
+ { "himc", func_himc },
{ "imcc", func_imcc },
{ "ImmIsUIMessage", func_ImmIsUIMessage },
{ 0, 0 }