- 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.
This commit is contained in:
Rein Klazes 2005-03-29 11:29:50 +00:00 committed by Alexandre Julliard
parent 4b5f3c61ad
commit 607bb11a86
2 changed files with 44 additions and 6 deletions

View File

@ -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 TRUE;
}
return SCROLL_GetScrollInfo(hwnd, nBar, info);
}

View File

@ -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);