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

Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Akihiro Sagawa 2016-05-30 01:08:12 +09:00 committed by Alexandre Julliard
parent 451fd162b4
commit da389f5fcc
1 changed files with 47 additions and 14 deletions

View File

@ -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;
}