imm32/tests: Fix tests compilation with __WINESRC__ defined.

This commit is contained in:
André Hentschel 2013-10-24 00:29:35 +02:00 committed by Alexandre Julliard
parent 0a9531f9b8
commit 33018d393a
2 changed files with 39 additions and 40 deletions

View File

@ -1,6 +1,5 @@
TESTDLL = imm32.dll TESTDLL = imm32.dll
IMPORTS = imm32 user32 IMPORTS = imm32 user32
EXTRADEFS = -U__WINESRC__ -DWINE_STRICT_PROTOTYPES -DWINE_NO_NAMELESS_EXTENSION -DWIDL_C_INLINE_WRAPPERS
C_SRCS = \ C_SRCS = \
imm32.c imm32.c

View File

@ -102,9 +102,9 @@ static LRESULT CALLBACK call_wnd_proc_filter(int nCode, WPARAM wParam,
static void msg_spy_pump_msg_queue(void) { static void msg_spy_pump_msg_queue(void) {
MSG msg; MSG msg;
while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { while(PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE)) {
TranslateMessage(&msg); TranslateMessage(&msg);
DispatchMessage(&msg); DispatchMessageW(&msg);
} }
return; return;
@ -143,11 +143,11 @@ static imm_msgs* msg_spy_find_msg(UINT message) {
static void msg_spy_init(HWND hwnd) { static void msg_spy_init(HWND hwnd) {
msg_spy.hwnd = hwnd; msg_spy.hwnd = hwnd;
msg_spy.get_msg_hook = msg_spy.get_msg_hook =
SetWindowsHookEx(WH_GETMESSAGE, get_msg_filter, GetModuleHandle(0), SetWindowsHookExW(WH_GETMESSAGE, get_msg_filter, GetModuleHandleW(NULL),
GetCurrentThreadId()); GetCurrentThreadId());
msg_spy.call_wnd_proc_hook = msg_spy.call_wnd_proc_hook =
SetWindowsHookEx(WH_CALLWNDPROC, call_wnd_proc_filter, SetWindowsHookExW(WH_CALLWNDPROC, call_wnd_proc_filter,
GetModuleHandle(0), GetCurrentThreadId()); GetModuleHandleW(NULL), GetCurrentThreadId());
msg_spy.i_msg = 0; msg_spy.i_msg = 0;
msg_spy_flush_msgs(); msg_spy_flush_msgs();
@ -182,7 +182,7 @@ static LRESULT WINAPI wndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
} }
static BOOL init(void) { static BOOL init(void) {
WNDCLASSEX wc; WNDCLASSEXA wc;
HIMC imc; HIMC imc;
HMODULE hmod,huser; HMODULE hmod,huser;
@ -192,25 +192,25 @@ static BOOL init(void) {
pImmIsUIMessageA = (void*)GetProcAddress(hmod, "ImmIsUIMessageA"); pImmIsUIMessageA = (void*)GetProcAddress(hmod, "ImmIsUIMessageA");
pSendInput = (void*)GetProcAddress(huser, "SendInput"); pSendInput = (void*)GetProcAddress(huser, "SendInput");
wc.cbSize = sizeof(WNDCLASSEX); wc.cbSize = sizeof(WNDCLASSEXA);
wc.style = 0; wc.style = 0;
wc.lpfnWndProc = wndProc; wc.lpfnWndProc = wndProc;
wc.cbClsExtra = 0; wc.cbClsExtra = 0;
wc.cbWndExtra = 0; wc.cbWndExtra = 0;
wc.hInstance = GetModuleHandle(0); wc.hInstance = GetModuleHandleA(NULL);
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); wc.hIcon = LoadIconA(NULL, (LPCSTR)IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hCursor = LoadCursorA(NULL, (LPCSTR)IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wc.lpszMenuName = NULL; wc.lpszMenuName = NULL;
wc.lpszClassName = wndcls; wc.lpszClassName = wndcls;
wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION); wc.hIconSm = LoadIconA(NULL, (LPCSTR)IDI_APPLICATION);
if (!RegisterClassExA(&wc)) if (!RegisterClassExA(&wc))
return FALSE; return FALSE;
hwnd = CreateWindowEx(WS_EX_CLIENTEDGE, wndcls, "Wine imm32.dll test", hwnd = CreateWindowExA(WS_EX_CLIENTEDGE, wndcls, "Wine imm32.dll test",
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
240, 120, NULL, NULL, GetModuleHandle(0), NULL); 240, 120, NULL, NULL, GetModuleHandleW(NULL), NULL);
if (!hwnd) if (!hwnd)
return FALSE; return FALSE;
@ -234,7 +234,7 @@ static void cleanup(void) {
msg_spy_cleanup(); msg_spy_cleanup();
if (hwnd) if (hwnd)
DestroyWindow(hwnd); DestroyWindow(hwnd);
UnregisterClass(wndcls, GetModuleHandle(0)); UnregisterClassA(wndcls, GetModuleHandleW(NULL));
} }
static void test_ImmNotifyIME(void) { static void test_ImmNotifyIME(void) {
@ -254,14 +254,14 @@ static void test_ImmNotifyIME(void) {
"WM_IME_COMPOSITION in response to NI_COMPOSITIONSTR / CPS_CANCEL, if " "WM_IME_COMPOSITION in response to NI_COMPOSITIONSTR / CPS_CANCEL, if "
"the composition string being canceled is empty.\n"); "the composition string being canceled is empty.\n");
ImmSetCompositionString(imc, SCS_SETSTR, string, sizeof(string), NULL, 0); ImmSetCompositionStringA(imc, SCS_SETSTR, string, sizeof(string), NULL, 0);
msg_spy_flush_msgs(); msg_spy_flush_msgs();
ImmNotifyIME(imc, NI_COMPOSITIONSTR, CPS_CANCEL, 0); ImmNotifyIME(imc, NI_COMPOSITIONSTR, CPS_CANCEL, 0);
msg_spy_flush_msgs(); msg_spy_flush_msgs();
/* behavior differs between win9x and NT */ /* behavior differs between win9x and NT */
ret = ImmGetCompositionString(imc, GCS_COMPSTR, resstr, sizeof(resstr)); ret = ImmGetCompositionStringA(imc, GCS_COMPSTR, resstr, sizeof(resstr));
ok(!ret, "After being cancelled the composition string is empty.\n"); ok(!ret, "After being cancelled the composition string is empty.\n");
msg_spy_flush_msgs(); msg_spy_flush_msgs();
@ -426,9 +426,9 @@ static DWORD WINAPI ImmGetContextThreadFunc( LPVOID lpParam)
COMPOSITIONFORM cf; COMPOSITIONFORM cf;
POINT pt; POINT pt;
igc_threadinfo *info= (igc_threadinfo*)lpParam; igc_threadinfo *info= (igc_threadinfo*)lpParam;
info->hwnd = CreateWindowEx(WS_EX_CLIENTEDGE, wndcls, "Wine imm32.dll test", info->hwnd = CreateWindowExA(WS_EX_CLIENTEDGE, wndcls, "Wine imm32.dll test",
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
240, 120, NULL, NULL, GetModuleHandle(0), NULL); 240, 120, NULL, NULL, GetModuleHandleW(NULL), NULL);
h1 = ImmGetContext(hwnd); h1 = ImmGetContext(hwnd);
todo_wine ok(info->himc == h1, "hwnd context changed in new thread\n"); todo_wine ok(info->himc == h1, "hwnd context changed in new thread\n");
@ -437,9 +437,9 @@ static DWORD WINAPI ImmGetContextThreadFunc( LPVOID lpParam)
info->himc = h2; info->himc = h2;
ImmReleaseContext(hwnd,h1); ImmReleaseContext(hwnd,h1);
hwnd2 = CreateWindowEx(WS_EX_CLIENTEDGE, wndcls, "Wine imm32.dll test", hwnd2 = CreateWindowExA(WS_EX_CLIENTEDGE, wndcls, "Wine imm32.dll test",
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
240, 120, NULL, NULL, GetModuleHandle(0), NULL); 240, 120, NULL, NULL, GetModuleHandleW(NULL), NULL);
h1 = ImmGetContext(hwnd2); h1 = ImmGetContext(hwnd2);
ok(h1 == h2, "Windows in same thread should have same default context\n"); ok(h1 == h2, "Windows in same thread should have same default context\n");
@ -463,14 +463,14 @@ static void test_ImmThreads(void)
HANDLE hThread; HANDLE hThread;
DWORD dwThreadId; DWORD dwThreadId;
BOOL rc; BOOL rc;
LOGFONT lf; LOGFONTA lf;
COMPOSITIONFORM cf; COMPOSITIONFORM cf;
CANDIDATEFORM cdf; CANDIDATEFORM cdf;
DWORD status, sentence; DWORD status, sentence;
POINT pt; POINT pt;
himc = ImmGetContext(hwnd); himc = ImmGetContext(hwnd);
threadinfo.event = CreateEvent(NULL, TRUE, FALSE, NULL); threadinfo.event = CreateEventA(NULL, TRUE, FALSE, NULL);
threadinfo.himc = himc; threadinfo.himc = himc;
hThread = CreateThread(NULL, 0, ImmGetContextThreadFunc, &threadinfo, 0, &dwThreadId ); hThread = CreateThread(NULL, 0, ImmGetContextThreadFunc, &threadinfo, 0, &dwThreadId );
WaitForSingleObject(threadinfo.event, INFINITE); WaitForSingleObject(threadinfo.event, INFINITE);
@ -510,14 +510,14 @@ static void test_ImmThreads(void)
ok(rc == 0, "ImmGetOpenStatus failed\n"); ok(rc == 0, "ImmGetOpenStatus failed\n");
/* CompositionFont */ /* CompositionFont */
rc = ImmGetCompositionFont(himc, &lf); rc = ImmGetCompositionFontA(himc, &lf);
ok(rc != 0, "ImmGetCompositionFont failed\n"); ok(rc != 0, "ImmGetCompositionFont failed\n");
rc = ImmSetCompositionFont(himc, &lf); rc = ImmSetCompositionFontA(himc, &lf);
ok(rc != 0, "ImmSetCompositionFont failed\n"); ok(rc != 0, "ImmSetCompositionFont failed\n");
rc = ImmGetCompositionFont(otherHimc, &lf); rc = ImmGetCompositionFontA(otherHimc, &lf);
ok(rc != 0 || broken(rc == 0), "ImmGetCompositionFont failed\n"); ok(rc != 0 || broken(rc == 0), "ImmGetCompositionFont failed\n");
rc = ImmSetCompositionFont(otherHimc, &lf); rc = ImmSetCompositionFontA(otherHimc, &lf);
todo_wine ok(rc == 0, "ImmSetCompositionFont should fail\n"); todo_wine ok(rc == 0, "ImmSetCompositionFont should fail\n");
/* CompositionWindow */ /* CompositionWindow */
@ -705,9 +705,9 @@ static void test_ImmDefaultHwnd(void)
HWND def1, def3; HWND def1, def3;
HWND hwnd; HWND hwnd;
hwnd = CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", "Wine imm32.dll test", hwnd = CreateWindowExA(WS_EX_CLIENTEDGE, "EDIT", "Wine imm32.dll test",
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
240, 120, NULL, NULL, GetModuleHandle(0), NULL); 240, 120, NULL, NULL, GetModuleHandleW(NULL), NULL);
ShowWindow(hwnd, SW_SHOWNORMAL); ShowWindow(hwnd, SW_SHOWNORMAL);
@ -907,9 +907,9 @@ static void test_ImmMessages(void)
HIMC imc; HIMC imc;
UINT idx = 0; UINT idx = 0;
HWND hwnd = CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", "Wine imm32.dll test", HWND hwnd = CreateWindowExA(WS_EX_CLIENTEDGE, "EDIT", "Wine imm32.dll test",
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
240, 120, NULL, NULL, GetModuleHandle(0), NULL); 240, 120, NULL, NULL, GetModuleHandleA(NULL), NULL);
ShowWindow(hwnd, SW_SHOWNORMAL); ShowWindow(hwnd, SW_SHOWNORMAL);
defwnd = ImmGetDefaultIMEWnd(hwnd); defwnd = ImmGetDefaultIMEWnd(hwnd);
@ -917,7 +917,7 @@ static void test_ImmMessages(void)
ImmSetOpenStatus(imc, TRUE); ImmSetOpenStatus(imc, TRUE);
msg_spy_flush_msgs(); msg_spy_flush_msgs();
SendMessage(defwnd, WM_IME_CONTROL, IMC_GETCANDIDATEPOS, (LPARAM)&cf ); SendMessageA(defwnd, WM_IME_CONTROL, IMC_GETCANDIDATEPOS, (LPARAM)&cf );
do do
{ {
msg = msg_spy_find_next_msg(WM_IME_CONTROL,&idx); msg = msg_spy_find_next_msg(WM_IME_CONTROL,&idx);
@ -952,8 +952,8 @@ static void test_ime_processkey(void)
wclass.style = CS_HREDRAW | CS_VREDRAW; wclass.style = CS_HREDRAW | CS_VREDRAW;
wclass.lpfnWndProc = processkey_wnd_proc; wclass.lpfnWndProc = processkey_wnd_proc;
wclass.hInstance = hInstance; wclass.hInstance = hInstance;
wclass.hIcon = LoadIcon(0, IDI_APPLICATION); wclass.hIcon = LoadIconW(0, (LPCWSTR)IDI_APPLICATION);
wclass.hCursor = LoadCursor( NULL, IDC_ARROW); wclass.hCursor = LoadCursorW( NULL, (LPCWSTR)IDC_ARROW);
wclass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); wclass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wclass.lpszMenuName = 0; wclass.lpszMenuName = 0;
wclass.cbClsExtra = 0; wclass.cbClsExtra = 0;