Commit 607bb11a authored by Rein Klazes's avatar Rein Klazes Committed by Alexandre Julliard

- GetScrollRange should return an empty range, both upper and lower

limit zero, if the window has no scrollbars (msdn). - GetScrollInfo's return value is TRUE is nBar is SB_CTL or if anything is filled in the SCROLLINFO structure, otherwise the return value is FALSE.
parent 4b5f3c61
......@@ -1330,8 +1330,6 @@ static INT SCROLL_GetScrollPos(HWND hwnd, INT nBar)
static BOOL SCROLL_GetScrollRange(HWND hwnd, INT nBar, LPINT lpMin, LPINT lpMax)
{
LPSCROLLBAR_INFO infoPtr = SCROLL_GetInternalInfo(hwnd, nBar, FALSE);
if (!infoPtr)
return FALSE;
if (lpMin) *lpMin = infoPtr ? infoPtr->minVal : 0;
if (lpMax) *lpMax = infoPtr ? infoPtr->maxVal : 0;
......@@ -1741,6 +1739,8 @@ done:
*
* RETURNS
* TRUE if SCROLLINFO is filled
* ( if nBar is SB_CTL, GetScrollInfo returns TRUE even if nothing
* is filled)
*/
BOOL WINAPI GetScrollInfo(HWND hwnd, INT nBar, LPSCROLLINFO info)
{
......@@ -1748,11 +1748,11 @@ BOOL WINAPI GetScrollInfo(HWND hwnd, INT nBar, LPSCROLLINFO info)
/* Refer SB_CTL requests to the window */
if (nBar == SB_CTL)
{
SendMessageW(hwnd, SBM_GETSCROLLINFO, (WPARAM)0, (LPARAM)info);
else
SCROLL_GetScrollInfo(hwnd, nBar, info);
return TRUE;
}
return SCROLL_GetScrollInfo(hwnd, nBar, info);
}
......
......@@ -2650,6 +2650,43 @@ void test_scrollvalidate( HWND parent)
DestroyWindow( hwnd2);
}
/* couple of tests of return values of scrollbar functions
* called on a scrollbarless window */
void test_scroll()
{
BOOL ret;
INT min, max;
SCROLLINFO si;
HWND hwnd = CreateWindowExA(0, "Static", "Wine test window",
WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP,
100, 100, 200, 200, 0, 0, 0, NULL);
/* horizontal */
ret = GetScrollRange( hwnd, SB_HORZ, &min, &max);
ok( ret, "GetScrollRange returns FALSE\n");
ok( min == 0, "minimum scroll pos is %d (should be zero)\n", min);
ok( max == 0, "maximum scroll pos is %d (should be zero)\n", min);
si.cbSize = sizeof( si);
si.fMask = SIF_PAGE;
si.nPage = 0xdeadbeef;
ret = GetScrollInfo( hwnd, SB_HORZ, &si);
ok( !ret, "GetScrollInfo returns %d (should be zero)\n", ret);
ok( si.nPage == 0xdeadbeef, "unexpected value for nPage is %d\n", si.nPage);
/* vertical */
ret = GetScrollRange( hwnd, SB_VERT, &min, &max);
ok( ret, "GetScrollRange returns FALSE\n");
ok( min == 0, "minimum scroll pos is %d (should be zero)\n", min);
ok( max == 0, "maximum scroll pos is %d (should be zero)\n", min);
si.cbSize = sizeof( si);
si.fMask = SIF_PAGE;
si.nPage = 0xdeadbeef;
ret = GetScrollInfo( hwnd, SB_VERT, &si);
ok( !ret, "GetScrollInfo returns %d (should be zero)\n", ret);
ok( si.nPage == 0xdeadbeef, "unexpected value for nPage is %d\n", si.nPage);
/* clean up */
DestroyWindow( hwnd);
}
START_TEST(win)
{
pGetAncestor = (void *)GetProcAddress( GetModuleHandleA("user32.dll"), "GetAncestor" );
......@@ -2709,6 +2746,7 @@ START_TEST(win)
test_validatergn(hwndMain);
test_nccalcscroll( hwndMain);
test_scrollvalidate( hwndMain);
test_scroll();
UnhookWindowsHookEx(hhook);
......
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