user32: In ScrollWindowEx do not clip the clipping rectangle with the scrolling rectangle.

This commit is contained in:
Rein Klazes 2009-09-24 11:17:26 +02:00 committed by Alexandre Julliard
parent e430838e29
commit 1775ab4a11
2 changed files with 53 additions and 1 deletions

View File

@ -1404,11 +1404,12 @@ INT WINAPI ScrollWindowEx( HWND hwnd, INT dx, INT dy,
hwnd = WIN_GetFullHandle( hwnd );
GetClientRect(hwnd, &rc);
if (rect) IntersectRect(&rc, &rc, rect);
if (clipRect) IntersectRect(&cliprc,&rc,clipRect);
else cliprc = rc;
if (rect) IntersectRect(&rc, &rc, rect);
if( hrgnUpdate ) bOwnRgn = FALSE;
else if( bUpdate ) hrgnUpdate = CreateRectRgn( 0, 0, 0, 0 );

View File

@ -3218,6 +3218,56 @@ static void test_window_styles(void)
check_window_style(0, WS_EX_APPWINDOW, WS_CLIPSIBLINGS|WS_CAPTION, WS_EX_APPWINDOW|WS_EX_WINDOWEDGE);
}
static void test_scrollwindow( HWND hwnd)
{
HDC hdc;
RECT rc, rc2, rc3;
COLORREF colr;
ShowWindow( hwnd, SW_SHOW);
UpdateWindow( hwnd);
GetClientRect( hwnd, &rc);
hdc = GetDC( hwnd);
/* test ScrollWindow(Ex) with no clip rectangle */
/* paint the lower half of the window black */
rc2 = rc;
rc2.top = ( rc2.top + rc2.bottom) / 2;
FillRect( hdc, &rc2, GetStockObject(BLACK_BRUSH));
/* paint the upper half of the window white */
rc2.bottom = rc2.top;
rc2.top =0;
FillRect( hdc, &rc2, GetStockObject(WHITE_BRUSH));
/* scroll lower half up */
rc2 = rc;
rc2.top = ( rc2.top + rc2.bottom) / 2;
ScrollWindowEx( hwnd, 0, - rc2.top, &rc2, NULL, NULL, NULL, SW_ERASE);
/* expected: black should have scrolled to the upper half */
colr = GetPixel( hdc, (rc2.left+rc2.right)/ 2, rc2.bottom / 4 );
ok ( colr == 0, "pixel should be black, color is %08x\n", colr);
/* Repeat that test of ScrollWindow(Ex) now with clip rectangle */
/* paint the lower half of the window black */
rc2 = rc;
rc2.top = ( rc2.top + rc2.bottom) / 2;
FillRect( hdc, &rc2, GetStockObject(BLACK_BRUSH));
/* paint the upper half of the window white */
rc2.bottom = rc2.top;
rc2.top =0;
FillRect( hdc, &rc2, GetStockObject(WHITE_BRUSH));
/* scroll lower half up */
rc2 = rc;
rc2.top = ( rc2.top + rc2.bottom) / 2;
rc3 = rc;
rc3.left = rc3.right / 4;
rc3.right -= rc3.right / 4;
ScrollWindowEx( hwnd, 0, - rc2.top, &rc2, &rc3, NULL, NULL, SW_ERASE);
/* expected: black should have scrolled to the upper half */
colr = GetPixel( hdc, (rc2.left+rc2.right)/ 2, rc2.bottom / 4 );
ok ( colr == 0, "pixel should be black, color is %08x\n", colr);
/* clean up */
ReleaseDC( hwnd, hdc);
}
static void test_scrollvalidate( HWND parent)
{
HDC hdc;
@ -5724,6 +5774,7 @@ START_TEST(win)
test_mouse_input(hwndMain);
test_validatergn(hwndMain);
test_nccalcscroll( hwndMain);
test_scrollwindow( hwndMain);
test_scrollvalidate( hwndMain);
test_scrolldc( hwndMain);
test_scroll();