Commit f956a472 authored by Austin English's avatar Austin English Committed by Alexandre Julliard

user32/tests: Make sure return values are used (LLVM/Clang).

parent c406b888
...@@ -425,7 +425,7 @@ static void test_menu_ownerdraw(void) ...@@ -425,7 +425,7 @@ static void test_menu_ownerdraw(void)
MOD_maxid = k-1; MOD_maxid = k-1;
assert( k <= sizeof(MOD_rc)/sizeof(RECT)); assert( k <= sizeof(MOD_rc)/sizeof(RECT));
/* display the menu */ /* display the menu */
ret = TrackPopupMenu( hmenu, TPM_RETURNCMD, 100,100, 0, hwnd, NULL); TrackPopupMenu( hmenu, TPM_RETURNCMD, 100,100, 0, hwnd, NULL);
/* columns have a 4 pixel gap between them */ /* columns have a 4 pixel gap between them */
ok( MOD_rc[0].right + 4 == MOD_rc[2].left, ok( MOD_rc[0].right + 4 == MOD_rc[2].left,
...@@ -449,7 +449,7 @@ static void test_menu_ownerdraw(void) ...@@ -449,7 +449,7 @@ static void test_menu_ownerdraw(void)
leftcol= MOD_rc[0].left; leftcol= MOD_rc[0].left;
ModifyMenu( hmenu, 0, MF_BYCOMMAND| MF_OWNERDRAW| MF_SEPARATOR, 0, 0); ModifyMenu( hmenu, 0, MF_BYCOMMAND| MF_OWNERDRAW| MF_SEPARATOR, 0, 0);
/* display the menu */ /* display the menu */
ret = TrackPopupMenu( hmenu, TPM_RETURNCMD, 100,100, 0, hwnd, NULL); TrackPopupMenu( hmenu, TPM_RETURNCMD, 100,100, 0, hwnd, NULL);
/* left should be 4 pixels less now */ /* left should be 4 pixels less now */
ok( leftcol == MOD_rc[0].left + 4, ok( leftcol == MOD_rc[0].left + 4,
"columns should be 4 pixels to the left (actual %d).\n", "columns should be 4 pixels to the left (actual %d).\n",
...@@ -562,13 +562,15 @@ static void test_mbs_help( int ispop, int hassub, int mnuopt, ...@@ -562,13 +562,15 @@ static void test_mbs_help( int ispop, int hassub, int mnuopt,
ReleaseDC( hwnd, hdc); ReleaseDC( hwnd, hdc);
} }
if(ispop) if(ispop)
ret = TrackPopupMenu( hmenu, TPM_RETURNCMD, 100,100, 0, hwnd, NULL); TrackPopupMenu( hmenu, TPM_RETURNCMD, 100,100, 0, hwnd, NULL);
else { else {
ret = SetMenu( hwnd, hmenu); ret = SetMenu( hwnd, hmenu);
ok(ret, "SetMenu failed with error %d\n", GetLastError()); ok(ret, "SetMenu failed with error %d\n", GetLastError());
DrawMenuBar( hwnd); DrawMenuBar( hwnd);
} }
ret = GetMenuItemRect( hwnd, hmenu, 0, &rc); ret = GetMenuItemRect( hwnd, hmenu, 0, &rc);
ok(ret, "GetMenuItemRect failed with error %d\n", GetLastError());
if (0) /* comment out menu size checks, behavior is different in almost every Windows version */ if (0) /* comment out menu size checks, behavior is different in almost every Windows version */
/* the tests should however succeed on win2000, XP and Wine (at least up to 1.1.15) */ /* the tests should however succeed on win2000, XP and Wine (at least up to 1.1.15) */
/* with a variety of dpis and desktop font sizes */ /* with a variety of dpis and desktop font sizes */
...@@ -2889,7 +2891,8 @@ static void test_menu_trackpopupmenu(void) ...@@ -2889,7 +2891,8 @@ static void test_menu_trackpopupmenu(void)
} }
/* display the menu */ /* display the menu */
/* start with an invalid menu handle */ /* start with an invalid menu handle */
gle = 0xdeadbeef; SetLastError(0xdeadbeef);
gflag_initmenupopup = gflag_entermenuloop = gflag_initmenu = 0; gflag_initmenupopup = gflag_entermenuloop = gflag_initmenu = 0;
ret = MyTrackPopupMenu( Ex, NULL, TPM_RETURNCMD, 100,100, hwnd, NULL); ret = MyTrackPopupMenu( Ex, NULL, TPM_RETURNCMD, 100,100, hwnd, NULL);
gle = GetLastError(); gle = GetLastError();
...@@ -2905,7 +2908,7 @@ static void test_menu_trackpopupmenu(void) ...@@ -2905,7 +2908,7 @@ static void test_menu_trackpopupmenu(void)
gflag_entermenuloop ? "WM_INITMENULOOP ": "", gflag_entermenuloop ? "WM_INITMENULOOP ": "",
gflag_initmenu ? "WM_INITMENU": ""); gflag_initmenu ? "WM_INITMENU": "");
/* another one but not NULL */ /* another one but not NULL */
gle = 0xdeadbeef; SetLastError(0xdeadbeef);
gflag_initmenupopup = gflag_entermenuloop = gflag_initmenu = 0; gflag_initmenupopup = gflag_entermenuloop = gflag_initmenu = 0;
ret = MyTrackPopupMenu( Ex, (HMENU)hwnd, TPM_RETURNCMD, 100,100, hwnd, NULL); ret = MyTrackPopupMenu( Ex, (HMENU)hwnd, TPM_RETURNCMD, 100,100, hwnd, NULL);
gle = GetLastError(); gle = GetLastError();
...@@ -2921,7 +2924,7 @@ static void test_menu_trackpopupmenu(void) ...@@ -2921,7 +2924,7 @@ static void test_menu_trackpopupmenu(void)
gflag_entermenuloop ? "WM_INITMENULOOP ": "", gflag_entermenuloop ? "WM_INITMENULOOP ": "",
gflag_initmenu ? "WM_INITMENU": ""); gflag_initmenu ? "WM_INITMENU": "");
/* now a somewhat successful call */ /* now a somewhat successful call */
gle = 0xdeadbeef; SetLastError(0xdeadbeef);
gflag_initmenupopup = gflag_entermenuloop = gflag_initmenu = 0; gflag_initmenupopup = gflag_entermenuloop = gflag_initmenu = 0;
ret = MyTrackPopupMenu( Ex, hmenu, TPM_RETURNCMD, 100,100, hwnd, NULL); ret = MyTrackPopupMenu( Ex, hmenu, TPM_RETURNCMD, 100,100, hwnd, NULL);
gle = GetLastError(); gle = GetLastError();
...@@ -2939,7 +2942,7 @@ static void test_menu_trackpopupmenu(void) ...@@ -2939,7 +2942,7 @@ static void test_menu_trackpopupmenu(void)
/* and another */ /* and another */
ret = AppendMenuA( hmenu, MF_STRING, 1, "winetest"); ret = AppendMenuA( hmenu, MF_STRING, 1, "winetest");
ok( ret, "AppendMenA has failed!\n"); ok( ret, "AppendMenA has failed!\n");
gle = 0xdeadbeef; SetLastError(0xdeadbeef);
gflag_initmenupopup = gflag_entermenuloop = gflag_initmenu = 0; gflag_initmenupopup = gflag_entermenuloop = gflag_initmenu = 0;
ret = MyTrackPopupMenu( Ex, hmenu, TPM_RETURNCMD, 100,100, hwnd, NULL); ret = MyTrackPopupMenu( Ex, hmenu, TPM_RETURNCMD, 100,100, hwnd, NULL);
gle = GetLastError(); gle = GetLastError();
...@@ -3067,14 +3070,14 @@ static void test_menu_cancelmode(void) ...@@ -3067,14 +3070,14 @@ static void test_menu_cancelmode(void)
*/ */
/* menu owner is top level window */ /* menu owner is top level window */
g_hwndtosend = hwnd; g_hwndtosend = hwnd;
ret = TrackPopupMenu( menu, TPM_RETURNCMD, 100,100, 0, hwnd, NULL); TrackPopupMenu( menu, TPM_RETURNCMD, 100,100, 0, hwnd, NULL);
todo_wine { todo_wine {
ok( g_got_enteridle == 0, "received %d WM_ENTERIDLE messages, none expected\n", g_got_enteridle); ok( g_got_enteridle == 0, "received %d WM_ENTERIDLE messages, none expected\n", g_got_enteridle);
} }
ok( g_got_enteridle < 2, "received %d WM_ENTERIDLE messages, should be less than 2\n", g_got_enteridle); ok( g_got_enteridle < 2, "received %d WM_ENTERIDLE messages, should be less than 2\n", g_got_enteridle);
/* menu owner is child window */ /* menu owner is child window */
g_hwndtosend = hwndchild; g_hwndtosend = hwndchild;
ret = TrackPopupMenu( menu, TPM_RETURNCMD, 100,100, 0, hwndchild, NULL); TrackPopupMenu( menu, TPM_RETURNCMD, 100,100, 0, hwndchild, NULL);
todo_wine { todo_wine {
ok(g_got_enteridle == 0, "received %d WM_ENTERIDLE messages, none expected\n", g_got_enteridle); ok(g_got_enteridle == 0, "received %d WM_ENTERIDLE messages, none expected\n", g_got_enteridle);
} }
...@@ -3082,7 +3085,7 @@ static void test_menu_cancelmode(void) ...@@ -3082,7 +3085,7 @@ static void test_menu_cancelmode(void)
/* now send the WM_CANCELMODE messages to the WRONG window */ /* now send the WM_CANCELMODE messages to the WRONG window */
/* those should fail ( to have any effect) */ /* those should fail ( to have any effect) */
g_hwndtosend = hwnd; g_hwndtosend = hwnd;
ret = TrackPopupMenu( menu, TPM_RETURNCMD, 100,100, 0, hwndchild, NULL); TrackPopupMenu( menu, TPM_RETURNCMD, 100,100, 0, hwndchild, NULL);
ok( g_got_enteridle == 2, "received %d WM_ENTERIDLE messages, should be 2\n", g_got_enteridle); ok( g_got_enteridle == 2, "received %d WM_ENTERIDLE messages, should be 2\n", g_got_enteridle);
/* cleanup */ /* cleanup */
DestroyMenu( menu); DestroyMenu( menu);
...@@ -3182,6 +3185,7 @@ static void test_menualign(void) ...@@ -3182,6 +3185,7 @@ static void test_menualign(void)
if( pGetMenuInfo) { if( pGetMenuInfo) {
mi.fMask = MIM_STYLE; mi.fMask = MIM_STYLE;
ret = pGetMenuInfo( menu, &mi); ret = pGetMenuInfo( menu, &mi);
ok( ret, "GetMenuInfo failed: %d\n", GetLastError());
ok( menu != NULL, "GetMenuInfo() failed\n"); ok( menu != NULL, "GetMenuInfo() failed\n");
ok( 0 == mi.dwStyle, "menuinfo style is %x\n", mi.dwStyle); ok( 0 == mi.dwStyle, "menuinfo style is %x\n", mi.dwStyle);
} }
......
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