Two small scrollbar fixes
Rein Klazes
wijn at wanadoo.nl
Sun Mar 27 13:05:47 CST 2005
Hi,
Changelog:
dlls/user : scroll.c
dlls/user/tests : win.c
- GetScrollRange should return an empty range, both upper and lower
limit zero, if the window has no scrollbars (msdn);
- GetScrollInfo's return value is FALSE if the window has no scrollbars;
- add some conformance test cases.
Rein.
-------------- next part --------------
--- wine/dlls/user/scroll.c 2005-03-25 20:52:36.000000000 +0100
+++ mywine/dlls/user/scroll.c 2005-03-27 18:57:32.000000000 +0200
@@ -1330,8 +1330,6 @@ static INT SCROLL_GetScrollPos(HWND hwnd
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;
@@ -1748,11 +1746,10 @@ BOOL WINAPI GetScrollInfo(HWND hwnd, INT
/* Refer SB_CTL requests to the window */
if (nBar == SB_CTL)
- SendMessageW(hwnd, SBM_GETSCROLLINFO, (WPARAM)0, (LPARAM)info);
+ return SendMessageW(hwnd, SBM_GETSCROLLINFO, (WPARAM)0, (LPARAM)info);
else
- SCROLL_GetScrollInfo(hwnd, nBar, info);
+ return SCROLL_GetScrollInfo(hwnd, nBar, info);
- return TRUE;
}
--- wine/dlls/user/tests/win.c 2005-03-26 08:11:50.000000000 +0100
+++ mywine/dlls/user/tests/win.c 2005-03-27 18:59:14.000000000 +0200
@@ -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);
More information about the wine-patches
mailing list