imm32/tests: Add tests for life cycle of default IME window.
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com> Signed-off-by: Aric Stewart <aric@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
632266e5b5
commit
5152f4141a
|
@ -853,6 +853,64 @@ static void test_ImmDefaultHwnd(void)
|
|||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
static BOOL CALLBACK is_ime_window_proc(HWND hWnd, LPARAM param)
|
||||
{
|
||||
static const WCHAR imeW[] = {'I','M','E',0};
|
||||
WCHAR class_nameW[16];
|
||||
HWND *ime_window = (HWND *)param;
|
||||
if (GetClassNameW(hWnd, class_nameW, sizeof(class_nameW)/sizeof(class_nameW[0])) &&
|
||||
!lstrcmpW(class_nameW, imeW)) {
|
||||
*ime_window = hWnd;
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static HWND get_ime_window(void)
|
||||
{
|
||||
HWND ime_window = NULL;
|
||||
EnumThreadWindows(GetCurrentThreadId(), is_ime_window_proc, (LPARAM)&ime_window);
|
||||
return ime_window;
|
||||
}
|
||||
|
||||
static DWORD WINAPI test_default_ime_window_cb(void *arg)
|
||||
{
|
||||
DWORD visible = arg ? WS_VISIBLE : 0;
|
||||
HWND hwnd1, hwnd2, default_ime_wnd, ime_wnd;
|
||||
|
||||
ok(!get_ime_window(), "Expected no IME windows\n");
|
||||
hwnd1 = CreateWindowExA(WS_EX_CLIENTEDGE, wndcls, "Wine imm32.dll test",
|
||||
WS_OVERLAPPEDWINDOW | visible,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT,
|
||||
240, 120, NULL, 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);
|
||||
todo_wine ok(ime_wnd == default_ime_wnd, "Expected %p, got %p\n", ime_wnd, default_ime_wnd);
|
||||
hwnd2 = CreateWindowExA(WS_EX_CLIENTEDGE, wndcls, "Wine imm32.dll test",
|
||||
WS_OVERLAPPEDWINDOW | visible,
|
||||
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");
|
||||
DestroyWindow(hwnd1);
|
||||
ok(!IsWindow(ime_wnd), "Expected no IME windows\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void test_default_ime_window_creation(void)
|
||||
{
|
||||
HANDLE thread;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
static void test_ImmGetIMCLockCount(void)
|
||||
{
|
||||
HIMC imc;
|
||||
|
@ -1594,6 +1652,7 @@ START_TEST(imm32) {
|
|||
test_ImmGetContext();
|
||||
test_ImmGetDescription();
|
||||
test_ImmDefaultHwnd();
|
||||
test_default_ime_window_creation();
|
||||
test_ImmGetIMCLockCount();
|
||||
test_ImmGetIMCCLockCount();
|
||||
test_ImmDestroyContext();
|
||||
|
|
Loading…
Reference in New Issue