Commit 1d4aeae7 authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

user32/tests: Replace some '#if 0's with 'if (0)'s.

Fix the code so it compiles without warnings.
parent 65921ad1
......@@ -90,7 +90,8 @@ static void ClassTest(HINSTANCE hInstance, BOOL global)
"GetClassLongW failed!\n");
}
#if 0
if (0)
{
/*
* GetClassLongW(hTestWnd, NUMCLASSWORDS*sizeof(DWORD))
* does not fail on Win 98, though MSDN says it should
......@@ -99,7 +100,7 @@ static void ClassTest(HINSTANCE hInstance, BOOL global)
GetClassLongW(hTestWnd, NUMCLASSWORDS*sizeof(DWORD));
ok(GetLastError(),
"GetClassLongW() with invalid offset did not fail\n");
#endif
}
/* set values of valid class words */
for(i=0; i<NUMCLASSWORDS; i++)
......
......@@ -129,7 +129,8 @@ todo_wine
ok(atom_id == 0, "FindAtomA should fail\n");
test_last_error(ERROR_FILE_NOT_FOUND);
#if 0
if (0)
{
/* this relies on the clipboard and global atom table being different */
SetLastError(0xdeadbeef);
atom_id = GlobalFindAtomA("my_cool_clipboard_format");
......@@ -154,7 +155,7 @@ todo_wine
test_last_error(ERROR_INVALID_HANDLE);
}
}
#endif
}
ret = OpenClipboard(0);
ok( ret, "OpenClipboard error %d\n", GetLastError());
......
......@@ -6545,15 +6545,17 @@ static void test_winevents(void)
flush_sequence();
#if 0 /* this test doesn't pass under Win9x */
if (0)
{
/* this test doesn't pass under Win9x */
/* win2k ignores events with hwnd == 0 */
SetLastError(0xdeadbeef);
pNotifyWinEvent(events[0].message, 0, events[0].wParam, events[0].lParam);
ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE || /* Win2k */
GetLastError() == 0xdeadbeef, /* Win9x */
"unexpected error %ld\n", GetLastError());
"unexpected error %d\n", GetLastError());
ok_sequence(WmEmptySeq, "empty notify winevents", FALSE);
#endif
}
for (i = 0; i < sizeof(WmWinEventsSeq)/sizeof(WmWinEventsSeq[0]); i++)
pNotifyWinEvent(events[i].message, hwnd, events[i].wParam, events[i].lParam);
......@@ -6700,12 +6702,14 @@ static void test_set_hook(void)
ok(hhook != 0, "local hook does not require hModule set to 0\n");
UnhookWindowsHookEx(hhook);
#if 0 /* this test doesn't pass under Win9x: BUG! */
if (0)
{
/* this test doesn't pass under Win9x: BUG! */
SetLastError(0xdeadbeef);
hhook = SetWindowsHookExA(WH_CBT, cbt_hook_proc, 0, 0);
ok(!hhook, "global hook requires hModule != 0\n");
ok(GetLastError() == ERROR_HOOK_NEEDS_HMOD, "unexpected error %ld\n", GetLastError());
#endif
ok(GetLastError() == ERROR_HOOK_NEEDS_HMOD, "unexpected error %d\n", GetLastError());
}
SetLastError(0xdeadbeef);
hhook = SetWindowsHookExA(WH_CBT, 0, GetModuleHandleA(0), GetCurrentThreadId());
......@@ -6740,25 +6744,27 @@ static void test_set_hook(void)
GetLastError() == 0xdeadbeef, /* Win9x */
"unexpected error %d\n", GetLastError());
#if 0 /* these 3 tests don't pass under Win9x */
if (0)
{
/* these 3 tests don't pass under Win9x */
SetLastError(0xdeadbeef);
hwinevent_hook = (HWINEVENTHOOK)pSetWinEventHook(1, 0,
0, win_event_proc, GetCurrentProcessId(), 0, WINEVENT_OUTOFCONTEXT);
ok(!hwinevent_hook, "SetWinEventHook with invalid event range should fail\n");
ok(GetLastError() == ERROR_INVALID_HOOK_FILTER, "unexpected error %ld\n", GetLastError());
ok(GetLastError() == ERROR_INVALID_HOOK_FILTER, "unexpected error %d\n", GetLastError());
SetLastError(0xdeadbeef);
hwinevent_hook = (HWINEVENTHOOK)pSetWinEventHook(-1, 1,
0, win_event_proc, GetCurrentProcessId(), 0, WINEVENT_OUTOFCONTEXT);
ok(!hwinevent_hook, "SetWinEventHook with invalid event range should fail\n");
ok(GetLastError() == ERROR_INVALID_HOOK_FILTER, "unexpected error %ld\n", GetLastError());
ok(GetLastError() == ERROR_INVALID_HOOK_FILTER, "unexpected error %d\n", GetLastError());
SetLastError(0xdeadbeef);
hwinevent_hook = (HWINEVENTHOOK)pSetWinEventHook(EVENT_MIN, EVENT_MAX,
0, win_event_proc, 0, 0xdeadbeef, WINEVENT_OUTOFCONTEXT);
ok(!hwinevent_hook, "SetWinEventHook with invalid tid should fail\n");
ok(GetLastError() == ERROR_INVALID_THREAD_ID, "unexpected error %ld\n", GetLastError());
#endif
ok(GetLastError() == ERROR_INVALID_THREAD_ID, "unexpected error %d\n", GetLastError());
}
SetLastError(0xdeadbeef);
hwinevent_hook = (HWINEVENTHOOK)pSetWinEventHook(0, 0,
......
......@@ -552,7 +552,9 @@ static void run_spi_setmouse_test( int curr_val[], POINT *req_change, POINT *pro
}
}
#if 0 /* FIXME: this always fails for me - AJ */
if (0)
{
/* FIXME: this always fails for me - AJ */
for (i = 0; i < nchange; i++)
{
POINT mv;
......@@ -562,7 +564,7 @@ static void run_spi_setmouse_test( int curr_val[], POINT *req_change, POINT *pro
ok( proj_change[i].x == mv.x, "Projected dx and real dx comparison. May fail under high load.\n" );
ok( proj_change[i].y == mv.y, "Projected dy equals real dy. May fail under high load.\n" );
}
#endif
}
}
static void test_SPI_SETMOUSE( void ) /* 4 */
......@@ -1536,7 +1538,9 @@ static void test_SPI_SETMINIMIZEDMETRICS( void ) /* 44 */
eq( lpMm_new.iVertGap, 0, "iVertGap", "%d" );
eq( lpMm_new.iArrange, 0xf & lpMm_cur.iArrange, "iArrange", "%d" );
/* test registry */
#if 0 /* FIXME: cannot understand the results of this (11, 11, 11, 0) */
if (0)
{
/* FIXME: cannot understand the results of this (11, 11, 11, 0) */
regval = metricfromreg( SPI_MINIMIZEDMETRICS_REGKEY, SPI_MINWIDTH_VALNAME, dpi);
ok( regval == lpMm_new.iWidth, "wrong value in registry %d, expected %d\n",
regval, lpMm_new.iWidth);
......@@ -1549,7 +1553,7 @@ static void test_SPI_SETMINIMIZEDMETRICS( void ) /* 44 */
regval = metricfromreg( SPI_MINIMIZEDMETRICS_REGKEY, SPI_MINARRANGE_VALNAME, dpi);
ok( regval == lpMm_new.iArrange, "wrong value in registry %d, expected %d\n",
regval, lpMm_new.iArrange);
#endif
}
/* test some system metrics */
eq( GetSystemMetrics( SM_CXMINIMIZED ) - 6,
lpMm_new.iWidth, "iWidth", "%d" );
......
......@@ -319,13 +319,15 @@ static void test_parent_owner(void)
/* desktop window */
check_parents( desktop, 0, 0, 0, 0, 0, 0 );
#if 0 /* this test succeeds on NT but crashes on win9x systems */
if (0)
{
/* this test succeeds on NT but crashes on win9x systems */
ret = (HWND)SetWindowLongA( test, GWL_HWNDPARENT, (LONG_PTR)hwndMain2 );
ok( !ret, "Set GWL_HWNDPARENT succeeded on desktop\n" );
check_parents( desktop, 0, 0, 0, 0, 0, 0 );
ok( !SetParent( desktop, hwndMain ), "SetParent succeeded on desktop\n" );
check_parents( desktop, 0, 0, 0, 0, 0, 0 );
#endif
}
/* normal child window */
test = create_tool_window( WS_CHILD, hwndMain );
trace( "created child %p\n", test );
......@@ -596,9 +598,11 @@ static LRESULT WINAPI main_window_procA(HWND hwnd, UINT msg, WPARAM wparam, LPAR
/* note: winpos coordinates are relative to parent */
MapWindowPoints(GetParent(hwnd), 0, (LPPOINT)&rc2, 2);
trace("pos: (%d,%d)-(%d,%d)\n", rc2.left, rc2.top, rc2.right, rc2.bottom);
#if 0 /* Uncomment this once the test succeeds in all cases */
if (0)
{
/* Uncomment this once the test succeeds in all cases */
ok(EqualRect(&rc1, &rc2), "rects do not match\n");
#endif
}
GetClientRect(hwnd, &rc2);
DefWindowProcA(hwnd, WM_NCCALCSIZE, 0, (LPARAM)&rc1);
......@@ -855,10 +859,8 @@ static LRESULT CALLBACK cbt_hook_proc(int nCode, WPARAM wParam, LPARAM lParam)
{
case HCBT_CREATEWND:
{
#if 0 /* Uncomment this once the test succeeds in all cases */
static const RECT rc_null;
RECT rc;
#endif
LONG style;
CBT_CREATEWNDA *createwnd = (CBT_CREATEWNDA *)lParam;
trace("HCBT_CREATEWND: hwnd %p, parent %p, style %08x\n",
......@@ -871,7 +873,9 @@ static LRESULT CALLBACK cbt_hook_proc(int nCode, WPARAM wParam, LPARAM lParam)
"style of hwnd and style in the CREATESTRUCT do not match: %08x != %08x\n",
GetWindowLongA((HWND)wParam, GWL_STYLE), style);
#if 0 /* Uncomment this once the test succeeds in all cases */
if (0)
{
/* Uncomment this once the test succeeds in all cases */
if ((style & (WS_CHILD|WS_POPUP)) == WS_CHILD)
{
ok(GetParent((HWND)wParam) == hwndMessage,
......@@ -882,17 +886,21 @@ static LRESULT CALLBACK cbt_hook_proc(int nCode, WPARAM wParam, LPARAM lParam)
ok(!GetParent((HWND)wParam), "GetParent should return 0 at this point\n");
ok(!GetWindow((HWND)wParam, GW_OWNER), "GW_OWNER should be set to 0 at this point\n");
#endif
#if 0 /* while NT assigns GW_HWNDFIRST/LAST some values at this point,
}
if (0)
{
/* while NT assigns GW_HWNDFIRST/LAST some values at this point,
* Win9x still has them set to 0.
*/
ok(GetWindow((HWND)wParam, GW_HWNDFIRST) != 0, "GW_HWNDFIRST should not be set to 0 at this point\n");
ok(GetWindow((HWND)wParam, GW_HWNDLAST) != 0, "GW_HWNDLAST should not be set to 0 at this point\n");
#endif
}
ok(!GetWindow((HWND)wParam, GW_HWNDPREV), "GW_HWNDPREV should be set to 0 at this point\n");
ok(!GetWindow((HWND)wParam, GW_HWNDNEXT), "GW_HWNDNEXT should be set to 0 at this point\n");
#if 0 /* Uncomment this once the test succeeds in all cases */
if (0)
{
/* Uncomment this once the test succeeds in all cases */
if (pGetAncestor)
{
ok(pGetAncestor((HWND)wParam, GA_PARENT) == hwndMessage, "GA_PARENT should be set to hwndMessage at this point\n");
......@@ -911,7 +919,7 @@ static LRESULT CALLBACK cbt_hook_proc(int nCode, WPARAM wParam, LPARAM lParam)
ok(EqualRect(&rc, &rc_null), "window rect should be set to 0 HCBT_CREATEWND\n");
ok(GetClientRect((HWND)wParam, &rc), "GetClientRect failed\n");
ok(EqualRect(&rc, &rc_null), "client rect should be set to 0 on HCBT_CREATEWND\n");
#endif
}
break;
}
}
......@@ -1866,10 +1874,11 @@ static void test_SetMenu(HWND parent)
assert(hMenu);
ok(SetMenu(parent, hMenu), "SetMenu on a top level window should not fail\n");
#if 0
if (0)
{
/* fails on (at least) Wine, NT4, XP SP2 */
test_nonclient_area(parent);
#endif
}
ret = GetMenu(parent);
ok(ret == hMenu, "unexpected menu id %p\n", ret);
/* test whether we can destroy a menu assigned to a window */
......@@ -1896,10 +1905,11 @@ static void test_SetMenu(HWND parent)
ok(ret == 0, "unexpected menu id %p\n", ret);
ok(SetMenu(parent, hMenu), "SetMenu on a top level window should not fail\n");
#if 0
if (0)
{
/* fails on (at least) Wine, NT4, XP SP2 */
test_nonclient_area(parent);
#endif
}
ret = GetMenu(parent);
ok(ret == hMenu, "unexpected menu id %p\n", ret);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment