Akihiro Sagawa : imm32/tests: Add tests showing the IME window is created if the first window is a child.

Alexandre Julliard julliard at winehq.org
Mon May 30 09:43:41 CDT 2016


Module: wine
Branch: master
Commit: da389f5fccf682be379a3721add799b2a2394429
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=da389f5fccf682be379a3721add799b2a2394429

Author: Akihiro Sagawa <sagawa.aki at gmail.com>
Date:   Mon May 30 01:08:12 2016 +0900

imm32/tests: Add tests showing the IME window is created if the first window is a child.

Signed-off-by: Akihiro Sagawa <sagawa.aki at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/imm32/tests/imm32.c | 61 +++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 47 insertions(+), 14 deletions(-)

diff --git a/dlls/imm32/tests/imm32.c b/dlls/imm32/tests/imm32.c
index 1cd7c05..7bc0a9a 100644
--- a/dlls/imm32/tests/imm32.c
+++ b/dlls/imm32/tests/imm32.c
@@ -912,17 +912,31 @@ static HWND get_ime_window(void)
     return ime_window;
 }
 
+struct testcase_ime_window {
+    BOOL visible;
+    BOOL top_level_window;
+};
+
 static DWORD WINAPI test_default_ime_window_cb(void *arg)
 {
-    DWORD visible = arg ? WS_VISIBLE : 0;
+    struct testcase_ime_window *testcase = (struct testcase_ime_window *)arg;
+    DWORD visible = testcase->visible ? WS_VISIBLE : 0;
     HWND hwnd1, hwnd2, default_ime_wnd, ime_wnd;
 
     ok(!get_ime_window(), "Expected no IME windows\n");
-    test_phase = FIRST_WINDOW;
-    hwnd1 = CreateWindowExA(WS_EX_CLIENTEDGE, wndcls, "Wine imm32.dll test",
-                            WS_OVERLAPPEDWINDOW | visible,
-                            CW_USEDEFAULT, CW_USEDEFAULT,
-                            240, 120, NULL, NULL, GetModuleHandleW(NULL), NULL);
+    if (testcase->top_level_window) {
+        test_phase = FIRST_WINDOW;
+        hwnd1 = CreateWindowExA(WS_EX_CLIENTEDGE, wndcls, "Wine imm32.dll test",
+                                WS_OVERLAPPEDWINDOW | visible,
+                                CW_USEDEFAULT, CW_USEDEFAULT,
+                                240, 120, NULL, NULL, GetModuleHandleW(NULL), NULL);
+    }
+    else {
+        hwnd1 = CreateWindowExA(WS_EX_CLIENTEDGE, "EDIT", "Wine imm32.dll test",
+                                WS_CHILD | visible,
+                                CW_USEDEFAULT, CW_USEDEFAULT,
+                                240, 24, hwnd, NULL, GetModuleHandleW(NULL), NULL);
+    }
     ime_wnd = get_ime_window();
     todo_wine ok(ime_wnd != NULL, "Expected IME window existence\n");
     default_ime_wnd = ImmGetDefaultIMEWnd(hwnd1);
@@ -934,7 +948,10 @@ static DWORD WINAPI test_default_ime_window_cb(void *arg)
                             CW_USEDEFAULT, CW_USEDEFAULT,
                             240, 120, NULL, NULL, GetModuleHandleW(NULL), NULL);
     DestroyWindow(hwnd2);
-    todo_wine ok(IsWindow(ime_wnd) || broken(/* Vista */ !visible), "Expected IME window existence\n");
+    todo_wine ok(IsWindow(ime_wnd) ||
+       broken(!testcase->visible /* Vista */)  ||
+       broken(!testcase->top_level_window /* Vista */) ,
+       "Expected IME window existence\n");
     DestroyWindow(hwnd1);
     ok(!IsWindow(ime_wnd), "Expected no IME windows\n");
     return 1;
@@ -943,14 +960,30 @@ static DWORD WINAPI test_default_ime_window_cb(void *arg)
 static void test_default_ime_window_creation(void)
 {
     HANDLE thread;
+    size_t i;
+    struct testcase_ime_window testcases[] = {
+        /* visible, top-level window */
+        { TRUE,  TRUE  },
+        { FALSE, TRUE  },
+        { TRUE,  FALSE },
+        { FALSE, FALSE }
+    };
 
-    thread = CreateThread(NULL, 0, test_default_ime_window_cb, (LPVOID)FALSE, 0, NULL);
-    WaitForSingleObject(thread, INFINITE);
-    CloseHandle(thread);
-
-    thread = CreateThread(NULL, 0, test_default_ime_window_cb, (LPVOID)TRUE, 0, NULL);
-    WaitForSingleObject(thread, INFINITE);
-    CloseHandle(thread);
+    for (i = 0; i < sizeof(testcases)/sizeof(testcases[0]); i++)
+    {
+        thread = CreateThread(NULL, 0, test_default_ime_window_cb, &testcases[i], 0, NULL);
+        ok(thread != NULL, "CreateThread failed with error %u\n", GetLastError());
+        while (MsgWaitForMultipleObjects(1, &thread, FALSE, INFINITE, QS_ALLINPUT) == WAIT_OBJECT_0 + 1)
+        {
+            MSG msg;
+            while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE))
+            {
+                TranslateMessage(&msg);
+                DispatchMessageA(&msg);
+            }
+        }
+        CloseHandle(thread);
+    }
 
     test_phase = PHASE_UNKNOWN;
 }




More information about the wine-cvs mailing list