Author: akhaldi
Date: Wed Mar 9 08:32:48 2016
New Revision: 70975
URL:
http://svn.reactos.org/svn/reactos?rev=70975&view=rev
Log:
[IMM32_WINETEST] Sync with Wine Staging 1.9.4. CORE-10912
Modified:
trunk/rostests/winetests/imm32/imm32.c
Modified: trunk/rostests/winetests/imm32/imm32.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/imm32/imm32.c?r…
==============================================================================
--- trunk/rostests/winetests/imm32/imm32.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/imm32/imm32.c [iso-8859-1] Wed Mar 9 08:32:48 2016
@@ -416,6 +416,7 @@
HWND hwnd;
HANDLE event;
HIMC himc;
+ HIMC u_himc;
} igc_threadinfo;
@@ -424,16 +425,19 @@
HIMC h1,h2;
HWND hwnd2;
COMPOSITIONFORM cf;
+ CANDIDATEFORM cdf;
POINT pt;
+ MSG msg;
+
igc_threadinfo *info= (igc_threadinfo*)lpParam;
info->hwnd = CreateWindowExA(WS_EX_CLIENTEDGE, wndcls, "Wine imm32.dll
test",
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
240, 120, NULL, NULL, GetModuleHandleW(NULL), NULL);
h1 = ImmGetContext(hwnd);
- todo_wine ok(info->himc == h1, "hwnd context changed in new thread\n");
+ ok(info->himc == h1, "hwnd context changed in new thread\n");
h2 = ImmGetContext(info->hwnd);
- todo_wine ok(h2 != h1, "new hwnd in new thread should have different
context\n");
+ ok(h2 != h1, "new hwnd in new thread should have different context\n");
info->himc = h2;
ImmReleaseContext(hwnd,h1);
@@ -450,9 +454,21 @@
/* priming for later tests */
ImmSetCompositionWindow(h1, &cf);
ImmSetStatusWindowPos(h1, &pt);
+ info->u_himc = ImmCreateContext();
+ ImmSetOpenStatus(info->u_himc, TRUE);
+ cdf.dwIndex = 0;
+ cdf.dwStyle = CFS_CANDIDATEPOS;
+ cdf.ptCurrentPos.x = 0;
+ cdf.ptCurrentPos.y = 0;
+ ImmSetCandidateWindow(info->u_himc, &cdf);
SetEvent(info->event);
- Sleep(INFINITE);
+
+ while(GetMessageW(&msg, 0, 0, 0))
+ {
+ TranslateMessage(&msg);
+ DispatchMessageW(&msg);
+ }
return 1;
}
@@ -477,18 +493,26 @@
otherHimc = ImmGetContext(threadinfo.hwnd);
- todo_wine ok(himc != otherHimc, "Windows from other threads should have
different himc\n");
- todo_wine ok(otherHimc == threadinfo.himc, "Context from other thread should not
change in main thread\n");
-
- if (0) /* FIXME: Causes wine to hang */
- {
+ ok(himc != otherHimc, "Windows from other threads should have different
himc\n");
+ ok(otherHimc == threadinfo.himc, "Context from other thread should not change in
main thread\n");
+
h1 = ImmAssociateContext(hwnd,otherHimc);
ok(h1 == NULL, "Should fail to be able to Associate a default context from a
different thread\n");
h1 = ImmGetContext(hwnd);
ok(h1 == himc, "Context for window should remain unchanged\n");
ImmReleaseContext(hwnd,h1);
- }
-
+
+ h1 = ImmAssociateContext(hwnd, threadinfo.u_himc);
+ ok (h1 == NULL, "Should fail to associate a context from a different
thread\n");
+ h1 = ImmGetContext(hwnd);
+ ok(h1 == himc, "Context for window should remain unchanged\n");
+ ImmReleaseContext(hwnd,h1);
+
+ h1 = ImmAssociateContext(threadinfo.hwnd, threadinfo.u_himc);
+ ok (h1 == NULL, "Should fail to associate a context from a different thread into
a window from that thread.\n");
+ h1 = ImmGetContext(threadinfo.hwnd);
+ ok(h1 == threadinfo.himc, "Context for window should remain unchanged\n");
+ ImmReleaseContext(threadinfo.hwnd,h1);
/* OpenStatus */
rc = ImmSetOpenStatus(himc, TRUE);
@@ -501,11 +525,15 @@
ok(rc == 0, "ImmGetOpenStatus failed\n");
rc = ImmSetOpenStatus(otherHimc, TRUE);
- todo_wine ok(rc == 0, "ImmSetOpenStatus should fail\n");
+ ok(rc == 0, "ImmSetOpenStatus should fail\n");
+ rc = ImmSetOpenStatus(threadinfo.u_himc, TRUE);
+ ok(rc == 0, "ImmSetOpenStatus should fail\n");
rc = ImmGetOpenStatus(otherHimc);
- todo_wine ok(rc == 0, "ImmGetOpenStatus failed\n");
+ ok(rc == 0, "ImmGetOpenStatus failed\n");
+ rc = ImmGetOpenStatus(threadinfo.u_himc);
+ ok (rc == 1 || broken(rc == 0), "ImmGetOpenStatus should return 1\n");
rc = ImmSetOpenStatus(otherHimc, FALSE);
- todo_wine ok(rc == 0, "ImmSetOpenStatus should fail\n");
+ ok(rc == 0, "ImmSetOpenStatus should fail\n");
rc = ImmGetOpenStatus(otherHimc);
ok(rc == 0, "ImmGetOpenStatus failed\n");
@@ -517,8 +545,12 @@
rc = ImmGetCompositionFontA(otherHimc, &lf);
ok(rc != 0 || broken(rc == 0), "ImmGetCompositionFont failed\n");
+ rc = ImmGetCompositionFontA(threadinfo.u_himc, &lf);
+ ok(rc != 0 || broken(rc == 0), "ImmGetCompositionFont user himc
failed\n");
rc = ImmSetCompositionFontA(otherHimc, &lf);
- todo_wine ok(rc == 0, "ImmSetCompositionFont should fail\n");
+ ok(rc == 0, "ImmSetCompositionFont should fail\n");
+ rc = ImmSetCompositionFontA(threadinfo.u_himc, &lf);
+ ok(rc == 0, "ImmSetCompositionFont should fail\n");
/* CompositionWindow */
rc = ImmSetCompositionWindow(himc, &cf);
@@ -527,8 +559,12 @@
ok(rc != 0, "ImmGetCompositionWindow failed\n");
rc = ImmSetCompositionWindow(otherHimc, &cf);
- todo_wine ok(rc == 0, "ImmSetCompositionWindow should fail\n");
+ ok(rc == 0, "ImmSetCompositionWindow should fail\n");
+ rc = ImmSetCompositionWindow(threadinfo.u_himc, &cf);
+ ok(rc == 0, "ImmSetCompositionWindow should fail\n");
rc = ImmGetCompositionWindow(otherHimc, &cf);
+ ok(rc != 0 || broken(rc == 0), "ImmGetCompositionWindow failed\n");
+ rc = ImmGetCompositionWindow(threadinfo.u_himc, &cf);
ok(rc != 0 || broken(rc == 0), "ImmGetCompositionWindow failed\n");
/* ConversionStatus */
@@ -539,8 +575,12 @@
rc = ImmGetConversionStatus(otherHimc, &status, &sentence);
ok(rc != 0 || broken(rc == 0), "ImmGetConversionStatus failed\n");
+ rc = ImmGetConversionStatus(threadinfo.u_himc, &status, &sentence);
+ ok(rc != 0 || broken(rc == 0), "ImmGetConversionStatus failed\n");
rc = ImmSetConversionStatus(otherHimc, status, sentence);
- todo_wine ok(rc == 0, "ImmSetConversionStatus should fail\n");
+ ok(rc == 0, "ImmSetConversionStatus should fail\n");
+ rc = ImmSetConversionStatus(threadinfo.u_himc, status, sentence);
+ ok(rc == 0, "ImmSetConversionStatus should fail\n");
/* StatusWindowPos */
rc = ImmSetStatusWindowPos(himc, &pt);
@@ -549,9 +589,25 @@
ok(rc != 0, "ImmGetStatusWindowPos failed\n");
rc = ImmSetStatusWindowPos(otherHimc, &pt);
- todo_wine ok(rc == 0, "ImmSetStatusWindowPos should fail\n");
+ ok(rc == 0, "ImmSetStatusWindowPos should fail\n");
+ rc = ImmSetStatusWindowPos(threadinfo.u_himc, &pt);
+ ok(rc == 0, "ImmSetStatusWindowPos should fail\n");
rc = ImmGetStatusWindowPos(otherHimc, &pt);
ok(rc != 0 || broken(rc == 0), "ImmGetStatusWindowPos failed\n");
+ rc = ImmGetStatusWindowPos(threadinfo.u_himc, &pt);
+ ok(rc != 0 || broken(rc == 0), "ImmGetStatusWindowPos failed\n");
+
+ h1 = ImmAssociateContext(threadinfo.hwnd, NULL);
+ ok (h1 == otherHimc, "ImmAssociateContext cross thread with NULL should
work\n");
+ h1 = ImmGetContext(threadinfo.hwnd);
+ ok (h1 == NULL, "CrossThread window context should be NULL\n");
+ h1 = ImmAssociateContext(threadinfo.hwnd, h1);
+ ok (h1 == NULL, "Resetting cross thread context should fail\n");
+ h1 = ImmGetContext(threadinfo.hwnd);
+ ok (h1 == NULL, "CrossThread window context should still be NULL\n");
+
+ rc = ImmDestroyContext(threadinfo.u_himc);
+ ok (rc == 0, "ImmDestroyContext Cross Thread should fail\n");
/* Candidate Window */
rc = ImmGetCandidateWindow(himc, 0, &cdf);
@@ -566,9 +622,13 @@
ok (rc == 1, "ImmGetCandidateWindow should succeed\n");
rc = ImmGetCandidateWindow(otherHimc, 0, &cdf);
- todo_wine ok (rc == 0, "ImmGetCandidateWindow should fail\n");
+ ok (rc == 0, "ImmGetCandidateWindow should fail\n");
rc = ImmSetCandidateWindow(otherHimc, &cdf);
- todo_wine ok (rc == 0, "ImmSetCandidateWindow should fail\n");
+ ok (rc == 0, "ImmSetCandidateWindow should fail\n");
+ rc = ImmGetCandidateWindow(threadinfo.u_himc, 0, &cdf);
+ ok (rc == 1 || broken( rc == 0), "ImmGetCandidateWindow should
succeed\n");
+ rc = ImmSetCandidateWindow(threadinfo.u_himc, &cdf);
+ ok (rc == 0, "ImmSetCandidateWindow should fail\n");
ImmReleaseContext(threadinfo.hwnd,otherHimc);
ImmReleaseContext(hwnd,himc);
@@ -577,7 +637,7 @@
TerminateThread(hThread, 1);
himc = ImmGetContext(GetDesktopWindow());
- todo_wine ok(himc == NULL, "Should not be able to get himc from other process
window\n");
+ ok(himc == NULL, "Should not be able to get himc from other process
window\n");
}
static void test_ImmIsUIMessage(void)
@@ -607,6 +667,14 @@
{ 0, FALSE } /* mark the end */
};
+ UINT WM_MSIME_SERVICE = RegisterWindowMessageA("MSIMEService");
+ UINT WM_MSIME_RECONVERTOPTIONS =
RegisterWindowMessageA("MSIMEReconvertOptions");
+ UINT WM_MSIME_MOUSE = RegisterWindowMessageA("MSIMEMouseOperation");
+ UINT WM_MSIME_RECONVERTREQUEST =
RegisterWindowMessageA("MSIMEReconvertRequest");
+ UINT WM_MSIME_RECONVERT = RegisterWindowMessageA("MSIMEReconvert");
+ UINT WM_MSIME_QUERYPOSITION =
RegisterWindowMessageA("MSIMEQueryPosition");
+ UINT WM_MSIME_DOCUMENTFEED = RegisterWindowMessageA("MSIMEDocumentFeed");
+
const struct test *test;
BOOL ret;
@@ -626,6 +694,21 @@
else
ok(!msg_spy_find_msg(test->msg), "Windows does not send 0x%x\n",
test->msg);
}
+
+ ret = pImmIsUIMessageA(NULL, WM_MSIME_SERVICE, 0, 0);
+ ok(!ret, "ImmIsUIMessageA returned TRUE for WM_MSIME_SERVICE\n");
+ ret = pImmIsUIMessageA(NULL, WM_MSIME_RECONVERTOPTIONS, 0, 0);
+ ok(!ret, "ImmIsUIMessageA returned TRUE for WM_MSIME_RECONVERTOPTIONS\n");
+ ret = pImmIsUIMessageA(NULL, WM_MSIME_MOUSE, 0, 0);
+ ok(!ret, "ImmIsUIMessageA returned TRUE for WM_MSIME_MOUSE\n");
+ ret = pImmIsUIMessageA(NULL, WM_MSIME_RECONVERTREQUEST, 0, 0);
+ ok(!ret, "ImmIsUIMessageA returned TRUE for WM_MSIME_RECONVERTREQUEST\n");
+ ret = pImmIsUIMessageA(NULL, WM_MSIME_RECONVERT, 0, 0);
+ ok(!ret, "ImmIsUIMessageA returned TRUE for WM_MSIME_RECONVERT\n");
+ ret = pImmIsUIMessageA(NULL, WM_MSIME_QUERYPOSITION, 0, 0);
+ ok(!ret, "ImmIsUIMessageA returned TRUE for WM_MSIME_QUERYPOSITION\n");
+ ret = pImmIsUIMessageA(NULL, WM_MSIME_DOCUMENTFEED, 0, 0);
+ ok(!ret, "ImmIsUIMessageA returned TRUE for WM_MSIME_DOCUMENTFEED\n");
}
static void test_ImmGetContext(void)
@@ -699,10 +782,29 @@
UnloadKeyboardLayout(hkl);
}
+static LRESULT (WINAPI *old_imm_wnd_proc)(HWND, UINT, WPARAM, LPARAM);
+static LRESULT WINAPI imm_wnd_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
+{
+ ok(msg != WM_DESTROY, "got WM_DESTROY message\n");
+ return old_imm_wnd_proc(hwnd, msg, wparam, lparam);
+}
+
+static HWND thread_ime_wnd;
+static DWORD WINAPI test_ImmGetDefaultIMEWnd_thread(void *arg)
+{
+ CreateWindowA("static", "static", WS_POPUP, 0, 0, 1, 1, NULL,
NULL, NULL, NULL);
+
+ thread_ime_wnd = ImmGetDefaultIMEWnd(0);
+ ok(thread_ime_wnd != 0, "ImmGetDefaultIMEWnd returned NULL\n");
+ old_imm_wnd_proc = (void*)SetWindowLongPtrW(thread_ime_wnd, GWLP_WNDPROC,
(LONG_PTR)imm_wnd_proc);
+ return 0;
+}
+
static void test_ImmDefaultHwnd(void)
{
HIMC imc1, imc2, imc3;
HWND def1, def3;
+ HANDLE thread;
HWND hwnd;
hwnd = CreateWindowExA(WS_EX_CLIENTEDGE, "EDIT", "Wine imm32.dll
test",
@@ -729,6 +831,11 @@
ok(def3 == def1, "Default IME window should not change\n");
ok(imc1 == imc3, "IME context should not change\n");
ImmSetOpenStatus(imc2, FALSE);
+
+ thread = CreateThread(NULL, 0, test_ImmGetDefaultIMEWnd_thread, NULL, 0, NULL);
+ WaitForSingleObject(thread, INFINITE);
+ ok(thread_ime_wnd != def1, "thread_ime_wnd == def1\n");
+ ok(!IsWindow(thread_ime_wnd), "thread_ime_wnd was not destroyed\n");
ImmReleaseContext(hwnd, imc1);
ImmReleaseContext(hwnd, imc3);