user32/tests: Enable compilation with long types.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
3d39354998
commit
4607d822d9
|
@ -17,6 +17,7 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
#undef WINE_NO_LONG_TYPES /* temporary for migration */
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdarg.h>
|
||||
|
@ -120,7 +121,7 @@ static void test_EnableScrollBar(void)
|
|||
todo_wine
|
||||
ok( GetLastError() == ERROR_INVALID_PARAMETER
|
||||
|| broken(GetLastError() == 0xdeadbeef), /* winxp */
|
||||
"GetLastError() = %u\n", GetLastError() );
|
||||
"GetLastError() = %lu\n", GetLastError() );
|
||||
|
||||
/* disable window, try to re-enable */
|
||||
ret = EnableWindow( hScroll, FALSE );
|
||||
|
@ -181,12 +182,12 @@ static void test_SetScrollPos(void)
|
|||
SetLastError( 0xdeadbeef );
|
||||
ret = SetScrollPos( mainwnd, SB_CTL, 30, TRUE );
|
||||
ok( !ret, "The position should not be set.\n" );
|
||||
ok( GetLastError() == 0xdeadbeef, "GetLastError() = %u\n", GetLastError() );
|
||||
ok( GetLastError() == 0xdeadbeef, "GetLastError() = %lu\n", GetLastError() );
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
ret = GetScrollPos( mainwnd, SB_CTL );
|
||||
ok( !ret, "The position should be equal to zero\n");
|
||||
ok( GetLastError() == 0xdeadbeef, "GetLastError() = %u\n", GetLastError() );
|
||||
ok( GetLastError() == 0xdeadbeef, "GetLastError() = %lu\n", GetLastError() );
|
||||
|
||||
DestroyWindow(hScroll);
|
||||
DestroyWindow(mainwnd);
|
||||
|
@ -242,7 +243,7 @@ static void test_GetScrollBarInfo(void)
|
|||
GetWindowRect( hScroll, &rect );
|
||||
ok( ret, "The GetWindowRect() call should not fail.\n" );
|
||||
ok( !(sbi.rgstate[0] & (STATE_SYSTEM_INVISIBLE|STATE_SYSTEM_OFFSCREEN)),
|
||||
"unexpected rgstate(0x%x)\n", sbi.rgstate[0]);
|
||||
"unexpected rgstate(0x%lx)\n", sbi.rgstate[0]);
|
||||
ok(EqualRect(&rect, &sbi.rcScrollBar), "WindowRect %s != rcScrollBar %s\n",
|
||||
wine_dbgstr_rect(&rect), wine_dbgstr_rect(&sbi.rcScrollBar));
|
||||
|
||||
|
@ -301,40 +302,40 @@ static void scrollbar_test_default( DWORD style)
|
|||
/* range is 0,0 if there are no H or V scroll bars. 0,100 otherwise */
|
||||
if( !( style & ( WS_VSCROLL | WS_HSCROLL)))
|
||||
ok( min == 0 && max == 0,
|
||||
"Scroll bar range is %d,%d. Expected 0,0. Style %08x\n", min, max, style);
|
||||
"Scroll bar range is %d,%d. Expected 0,0. Style %08lx\n", min, max, style);
|
||||
else
|
||||
ok(( min == 0 && max == 100) ||
|
||||
broken( min == 0 && max == 0), /* Win 9x/ME */
|
||||
"Scroll bar range is %d,%d. Expected 0,100. Style %08x\n", min, max, style);
|
||||
"Scroll bar range is %d,%d. Expected 0,100. Style %08lx\n", min, max, style);
|
||||
ret = GetScrollRange( hwnd, SB_HORZ, &min, &max);
|
||||
ok( ret ||
|
||||
broken( !ret) /* Win 9x/ME */ , "GetScrollRange failed.\n");
|
||||
/* range is 0,0 if there are no H or V scroll bars. 0,100 otherwise */
|
||||
if( !( style & ( WS_VSCROLL | WS_HSCROLL)))
|
||||
ok( min == 0 && max == 0,
|
||||
"Scroll bar range is %d,%d. Expected 0,0. Style %08x\n", min, max, style);
|
||||
"Scroll bar range is %d,%d. Expected 0,0. Style %08lx\n", min, max, style);
|
||||
else
|
||||
ok(( min == 0 && max == 100) ||
|
||||
broken( min == 0 && max == 0), /* Win 9x/ME */
|
||||
"Scroll bar range is %d,%d. Expected 0,100. Style %08x\n", min, max, style);
|
||||
"Scroll bar range is %d,%d. Expected 0,100. Style %08lx\n", min, max, style);
|
||||
/* test GetScrollInfo, vist for vertical SB */
|
||||
ret = GetScrollInfo( hwnd, SB_VERT, &si);
|
||||
/* should fail if no H or V scroll bar styles are present. Succeed otherwise */
|
||||
if( !( style & ( WS_VSCROLL | WS_HSCROLL)))
|
||||
ok( !ret, "GetScrollInfo succeeded unexpectedly. Style is %08x\n", style);
|
||||
ok( !ret, "GetScrollInfo succeeded unexpectedly. Style is %08lx\n", style);
|
||||
else
|
||||
ok( ret ||
|
||||
broken( !ret), /* Win 9x/ME */
|
||||
"GetScrollInfo failed unexpectedly. Style is %08x\n", style);
|
||||
"GetScrollInfo failed unexpectedly. Style is %08lx\n", style);
|
||||
/* Same for Horizontal SB */
|
||||
ret = GetScrollInfo( hwnd, SB_HORZ, &si);
|
||||
/* should fail if no H or V scroll bar styles are present. Succeed otherwise */
|
||||
if( !( style & ( WS_VSCROLL | WS_HSCROLL)))
|
||||
ok( !ret, "GetScrollInfo succeeded unexpectedly. Style is %08x\n", style);
|
||||
ok( !ret, "GetScrollInfo succeeded unexpectedly. Style is %08lx\n", style);
|
||||
else
|
||||
ok( ret ||
|
||||
broken( !ret), /* Win 9x/ME */
|
||||
"GetScrollInfo failed unexpectedly. Style is %08x\n", style);
|
||||
"GetScrollInfo failed unexpectedly. Style is %08lx\n", style);
|
||||
/* now set the Vertical Scroll range to something that could be the default value it
|
||||
* already has */;
|
||||
ret = SetScrollRange( hwnd, SB_VERT, 0, 100, FALSE);
|
||||
|
@ -344,14 +345,14 @@ static void scrollbar_test_default( DWORD style)
|
|||
ok( ret, "GetScrollRange failed.\n");
|
||||
/* now the range should be 0,100 in ALL cases */
|
||||
ok( min == 0 && max == 100,
|
||||
"Scroll bar range is %d,%d. Expected 0,100. Style %08x\n", min, max, style);
|
||||
"Scroll bar range is %d,%d. Expected 0,100. Style %08lx\n", min, max, style);
|
||||
/* See what is different now for GetScrollRange */
|
||||
ret = GetScrollInfo( hwnd, SB_HORZ, &si);
|
||||
/* should succeed in ALL cases */
|
||||
ok( ret, "GetScrollInfo failed unexpectedly. Style is %08x\n", style);
|
||||
ok( ret, "GetScrollInfo failed unexpectedly. Style is %08lx\n", style);
|
||||
ret = GetScrollInfo( hwnd, SB_VERT, &si);
|
||||
/* should succeed in ALL cases */
|
||||
ok( ret, "GetScrollInfo failed unexpectedly. Style is %08x\n", style);
|
||||
ok( ret, "GetScrollInfo failed unexpectedly. Style is %08lx\n", style);
|
||||
/* report the windows style */
|
||||
winstyle = GetWindowLongA( hwnd, GWL_STYLE );
|
||||
/* WS_VSCROLL added to the window style */
|
||||
|
@ -360,10 +361,10 @@ static void scrollbar_test_default( DWORD style)
|
|||
if (bThemeActive || style != WS_HSCROLL)
|
||||
todo_wine
|
||||
ok( (winstyle & (WS_HSCROLL|WS_VSCROLL)) == ( style | WS_VSCROLL),
|
||||
"unexpected style change %08x/%08x\n", winstyle, style);
|
||||
"unexpected style change %08lx/%08lx\n", winstyle, style);
|
||||
else
|
||||
ok( (winstyle & (WS_HSCROLL|WS_VSCROLL)) == style,
|
||||
"unexpected style change %08x/%08x\n", winstyle, style);
|
||||
"unexpected style change %08lx/%08lx\n", winstyle, style);
|
||||
}
|
||||
/* do the test again with H and V reversed.
|
||||
* Start with a clean window */
|
||||
|
@ -380,14 +381,14 @@ static void scrollbar_test_default( DWORD style)
|
|||
ok( ret, "GetScrollRange failed.\n");
|
||||
/* now the range should be 0,100 in ALL cases */
|
||||
ok( min == 0 && max == 100,
|
||||
"Scroll bar range is %d,%d. Expected 0,100. Style %08x\n", min, max, style);
|
||||
"Scroll bar range is %d,%d. Expected 0,100. Style %08lx\n", min, max, style);
|
||||
/* See what is different now for GetScrollRange */
|
||||
ret = GetScrollInfo( hwnd, SB_HORZ, &si);
|
||||
/* should succeed in ALL cases */
|
||||
ok( ret, "GetScrollInfo failed unexpectedly. Style is %08x\n", style);
|
||||
ok( ret, "GetScrollInfo failed unexpectedly. Style is %08lx\n", style);
|
||||
ret = GetScrollInfo( hwnd, SB_VERT, &si);
|
||||
/* should succeed in ALL cases */
|
||||
ok( ret, "GetScrollInfo failed unexpectedly. Style is %08x\n", style);
|
||||
ok( ret, "GetScrollInfo failed unexpectedly. Style is %08lx\n", style);
|
||||
/* report the windows style */
|
||||
winstyle = GetWindowLongA( hwnd, GWL_STYLE );
|
||||
/* WS_HSCROLL added to the window style */
|
||||
|
@ -396,10 +397,10 @@ static void scrollbar_test_default( DWORD style)
|
|||
if (bThemeActive || style != WS_VSCROLL)
|
||||
todo_wine
|
||||
ok( (winstyle & (WS_HSCROLL|WS_VSCROLL)) == ( style | WS_HSCROLL),
|
||||
"unexpected style change %08x/%08x\n", winstyle, style);
|
||||
"unexpected style change %08lx/%08lx\n", winstyle, style);
|
||||
else
|
||||
ok( (winstyle & (WS_HSCROLL|WS_VSCROLL)) == style,
|
||||
"unexpected style change %08x/%08x\n", winstyle, style);
|
||||
"unexpected style change %08lx/%08lx\n", winstyle, style);
|
||||
}
|
||||
/* Slightly change the test to use SetScrollInfo
|
||||
* Start with a clean window */
|
||||
|
@ -413,20 +414,20 @@ static void scrollbar_test_default( DWORD style)
|
|||
si.nMax = 22;
|
||||
si.fMask |= SIF_RANGE;
|
||||
ret = SetScrollInfo( hwnd, SB_HORZ, &si, FALSE);
|
||||
ok( ret, "SetScrollInfo failed. Style is %08x\n", style);
|
||||
ok( ret, "SetScrollInfo failed. Style is %08lx\n", style);
|
||||
/* and request the Vertical range */
|
||||
ret = GetScrollRange( hwnd, SB_VERT, &min, &max);
|
||||
ok( ret, "GetScrollRange failed.\n");
|
||||
/* now the range should be 0,100 in ALL cases */
|
||||
ok( min == 0 && max == 100,
|
||||
"Scroll bar range is %d,%d. Expected 0,100. Style %08x\n", min, max, style);
|
||||
"Scroll bar range is %d,%d. Expected 0,100. Style %08lx\n", min, max, style);
|
||||
/* See what is different now for GetScrollRange */
|
||||
ret = GetScrollInfo( hwnd, SB_HORZ, &si);
|
||||
/* should succeed in ALL cases */
|
||||
ok( ret, "GetScrollInfo failed unexpectedly. Style is %08x\n", style);
|
||||
ok( ret, "GetScrollInfo failed unexpectedly. Style is %08lx\n", style);
|
||||
ret = GetScrollInfo( hwnd, SB_VERT, &si);
|
||||
/* should succeed in ALL cases */
|
||||
ok( ret, "GetScrollInfo failed unexpectedly. Style is %08x\n", style);
|
||||
ok( ret, "GetScrollInfo failed unexpectedly. Style is %08lx\n", style);
|
||||
/* also test if the window scroll bars are enabled */
|
||||
ret = EnableScrollBar( hwnd, SB_VERT, ESB_ENABLE_BOTH);
|
||||
ok( !ret, "Vertical window scroll bar was not enabled\n");
|
||||
|
@ -443,13 +444,13 @@ static void scrollbar_test_default( DWORD style)
|
|||
assert( hwnd != 0);
|
||||
ret = GetScrollInfo( hwnd, SB_VERT, &si);
|
||||
/* should fail */
|
||||
ok( !ret, "GetScrollInfo succeeded unexpectedly. Style is %08x\n", style);
|
||||
ok( !ret, "GetScrollInfo succeeded unexpectedly. Style is %08lx\n", style);
|
||||
/* add scroll styles */
|
||||
winstyle = GetWindowLongA( hwnd, GWL_STYLE );
|
||||
SetWindowLongW( hwnd, GWL_STYLE, winstyle | WS_VSCROLL | WS_HSCROLL);
|
||||
ret = GetScrollInfo( hwnd, SB_VERT, &si);
|
||||
/* should still fail */
|
||||
ok( !ret, "GetScrollInfo succeeded unexpectedly. Style is %08x\n", style);
|
||||
ok( !ret, "GetScrollInfo succeeded unexpectedly. Style is %08lx\n", style);
|
||||
/* clean up */
|
||||
DestroyWindow( hwnd);
|
||||
}
|
||||
|
@ -700,7 +701,7 @@ static void test_subclass(void)
|
|||
BOOL r;
|
||||
|
||||
r = GetClassInfoExA(GetModuleHandleA(NULL), "SCROLLBAR", &class_info);
|
||||
ok(r, "GetClassInfoEx failed: %u\n", GetLastError());
|
||||
ok(r, "GetClassInfoEx failed: %lu\n", GetLastError());
|
||||
scrollbar_wndproc = class_info.lpfnWndProc;
|
||||
|
||||
memset(&wc, 0, sizeof(wc));
|
||||
|
@ -709,21 +710,21 @@ static void test_subclass(void)
|
|||
wc.lpszClassName = "MyTestSubclass";
|
||||
wc.lpfnWndProc = subclass_proc;
|
||||
r = RegisterClassA(&wc);
|
||||
ok(r, "RegisterClass failed: %u\n", GetLastError());
|
||||
ok(r, "RegisterClass failed: %lu\n", GetLastError());
|
||||
|
||||
hwnd = CreateWindowExA( 0, "MyTestSubclass", "Scroll", WS_OVERLAPPEDWINDOW,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, 100, 100, NULL, NULL, GetModuleHandleA(NULL), 0 );
|
||||
ok(hwnd != NULL, "Failed to create window: %u\n", GetLastError());
|
||||
ok(hwnd != NULL, "Failed to create window: %lu\n", GetLastError());
|
||||
|
||||
r = SetScrollRange(hwnd, SB_CTL, 0, 100, TRUE);
|
||||
ok(r, "SetScrollRange failed: %u\n", GetLastError());
|
||||
ok(r, "SetScrollRange failed: %lu\n", GetLastError());
|
||||
|
||||
res = SetScrollPos(hwnd, SB_CTL, 2, FALSE);
|
||||
ok(!res, "SetScrollPos returned %lu\n", res);
|
||||
ok(!res, "SetScrollPos returned %Iu\n", res);
|
||||
|
||||
memset(&set_scrollinfo, 0xcc, sizeof(set_scrollinfo));
|
||||
res = SetScrollPos(hwnd, SB_CTL, 1, FALSE);
|
||||
ok(res == 2, "SetScrollPos returned %lu\n", res);
|
||||
ok(res == 2, "SetScrollPos returned %Iu\n", res);
|
||||
ok(set_scrollinfo.cbSize == sizeof(SCROLLINFO), "cbSize = %u\n", set_scrollinfo.cbSize);
|
||||
todo_wine
|
||||
ok(set_scrollinfo.fMask == (0x1000 | SIF_POS), "fMask = %x\n", set_scrollinfo.fMask);
|
||||
|
@ -732,19 +733,19 @@ static void test_subclass(void)
|
|||
memset(&scroll_info, 0xcc, sizeof(scroll_info));
|
||||
scroll_info.cbSize = sizeof(scroll_info);
|
||||
res = SendMessageA(hwnd, SBM_GETSCROLLBARINFO, 0, (LPARAM)&scroll_info);
|
||||
ok(res == 1, "SBM_GETSCROLLBARINFO returned %lu\n", res);
|
||||
ok(res == 1, "SBM_GETSCROLLBARINFO returned %Iu\n", res);
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
|
||||
/* if we skip calling wndproc for WM_CREATE, window is not considered a scrollbar */
|
||||
hwnd = CreateWindowExA( 0, "MyTestSubclass", "Scroll", WS_OVERLAPPEDWINDOW,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, 100, 100, NULL, NULL, GetModuleHandleA(NULL), (void *)1 );
|
||||
ok(hwnd != NULL, "Failed to create window: %u\n", GetLastError());
|
||||
ok(hwnd != NULL, "Failed to create window: %lu\n", GetLastError());
|
||||
|
||||
memset(&scroll_info, 0xcc, sizeof(scroll_info));
|
||||
scroll_info.cbSize = sizeof(scroll_info);
|
||||
res = SendMessageA(hwnd, SBM_GETSCROLLBARINFO, 0, (LPARAM)&scroll_info);
|
||||
ok(!res, "SBM_GETSCROLLBARINFO returned %lu\n", res);
|
||||
ok(!res, "SBM_GETSCROLLBARINFO returned %Iu\n", res);
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
|
||||
|
@ -752,20 +753,20 @@ static void test_subclass(void)
|
|||
wc.cbWndExtra = class_info.cbWndExtra - 1;
|
||||
wc.lpszClassName = "MyTestSubclass2";
|
||||
r = RegisterClassA(&wc);
|
||||
ok(r, "RegisterClass failed: %u\n", GetLastError());
|
||||
ok(r, "RegisterClass failed: %lu\n", GetLastError());
|
||||
|
||||
hwnd = CreateWindowExA( 0, "MyTestSubclass2", "Scroll", WS_OVERLAPPEDWINDOW,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, 100, 100, NULL, NULL, GetModuleHandleA(NULL), 0 );
|
||||
ok(hwnd != NULL, "Failed to create window: %u\n", GetLastError());
|
||||
ok(hwnd != NULL, "Failed to create window: %lu\n", GetLastError());
|
||||
|
||||
memset(&scroll_info, 0xcc, sizeof(scroll_info));
|
||||
scroll_info.cbSize = sizeof(scroll_info);
|
||||
res = SendMessageA(hwnd, SBM_GETSCROLLBARINFO, 0, (LPARAM)&scroll_info);
|
||||
ok(!res, "SBM_GETSCROLLBARINFO returned %lu\n", res);
|
||||
ok(!res, "SBM_GETSCROLLBARINFO returned %Iu\n", res);
|
||||
|
||||
memset(&set_scrollinfo, 0xcc, sizeof(set_scrollinfo));
|
||||
res = SetScrollPos(hwnd, SB_CTL, 1, FALSE);
|
||||
ok(res == 0, "SetScrollPos returned %lu\n", res);
|
||||
ok(res == 0, "SetScrollPos returned %Iu\n", res);
|
||||
ok(set_scrollinfo.cbSize == sizeof(SCROLLINFO), "cbSize = %u\n", set_scrollinfo.cbSize);
|
||||
todo_wine
|
||||
ok(set_scrollinfo.fMask == (0x1000 | SIF_POS), "fMask = %x\n", set_scrollinfo.fMask);
|
||||
|
@ -789,20 +790,20 @@ static void test_visual(void)
|
|||
colors[0] = RGB(0x11, 0x22, 0x33);
|
||||
colors[1] = RGB(0xaa, 0xbb, 0xcc);
|
||||
ret = SetSysColors(ARRAY_SIZE(color_indices), color_indices, colors);
|
||||
ok(ret, "SetSysColors failed, error %u.\n", GetLastError());
|
||||
ok(ret, "SetSysColors failed, error %lu.\n", GetLastError());
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(styles); ++i)
|
||||
{
|
||||
winetest_push_context("style %#x", styles[i]);
|
||||
winetest_push_context("style %#lx", styles[i]);
|
||||
|
||||
hwnd = CreateWindowA("ScrollBar", "", WS_POPUP | WS_VISIBLE | styles[i], 0, 0, 20, 20, 0, 0,
|
||||
0, 0);
|
||||
ok(hwnd != NULL, "CreateWindowA failed, error %u.\n", GetLastError());
|
||||
ok(hwnd != NULL, "CreateWindowA failed, error %lu.\n", GetLastError());
|
||||
RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ERASENOW | RDW_FRAME);
|
||||
|
||||
hdc = GetDC(hwnd);
|
||||
color = GetPixel(hdc, 5, 5);
|
||||
ok(color == colors[1], "Expected color %#x, got %#x.\n", colors[1], color);
|
||||
ok(color == colors[1], "Expected color %#lx, got %#lx.\n", colors[1], color);
|
||||
|
||||
ReleaseDC(hwnd, hdc);
|
||||
DestroyWindow(hwnd);
|
||||
|
@ -810,7 +811,7 @@ static void test_visual(void)
|
|||
}
|
||||
|
||||
ret = SetSysColors(ARRAY_SIZE(color_indices), color_indices, old_colors);
|
||||
ok(ret, "SetSysColors failed, error %u.\n", GetLastError());
|
||||
ok(ret, "SetSysColors failed, error %lu.\n", GetLastError());
|
||||
}
|
||||
|
||||
START_TEST ( scroll )
|
||||
|
|
Loading…
Reference in New Issue