Add a test for RedrawWindow with an empty region/rectangle, make it

pass under Wine.
This commit is contained in:
Dmitry Timoshkov 2005-11-30 19:46:00 +01:00 committed by Alexandre Julliard
parent fbfb971646
commit 7d86789758
2 changed files with 20 additions and 4 deletions

View File

@ -571,6 +571,7 @@ BOOL WINAPI LockWindowUpdate( HWND hwnd )
*/ */
BOOL WINAPI RedrawWindow( HWND hwnd, const RECT *rect, HRGN hrgn, UINT flags ) BOOL WINAPI RedrawWindow( HWND hwnd, const RECT *rect, HRGN hrgn, UINT flags )
{ {
static const RECT empty;
BOOL ret; BOOL ret;
if (!hwnd) hwnd = GetDesktopWindow(); if (!hwnd) hwnd = GetDesktopWindow();
@ -596,6 +597,7 @@ BOOL WINAPI RedrawWindow( HWND hwnd, const RECT *rect, HRGN hrgn, UINT flags )
if (rect && !hrgn) if (rect && !hrgn)
{ {
if (IsRectEmpty( rect )) rect = ∅
ret = redraw_window_rects( hwnd, flags, rect, 1 ); ret = redraw_window_rects( hwnd, flags, rect, 1 );
} }
else if (!hrgn) else if (!hrgn)
@ -606,7 +608,6 @@ BOOL WINAPI RedrawWindow( HWND hwnd, const RECT *rect, HRGN hrgn, UINT flags )
{ {
DWORD size; DWORD size;
RGNDATA *data = NULL; RGNDATA *data = NULL;
static const RECT empty;
if (!(size = GetRegionData( hrgn, 0, NULL ))) return FALSE; if (!(size = GetRegionData( hrgn, 0, NULL ))) return FALSE;
if (!(data = HeapAlloc( GetProcessHeap(), 0, size ))) return FALSE; if (!(data = HeapAlloc( GetProcessHeap(), 0, size ))) return FALSE;

View File

@ -3925,6 +3925,7 @@ static const struct message WmSetParentStyle[] = {
static void test_paint_messages(void) static void test_paint_messages(void)
{ {
BOOL ret;
RECT rect; RECT rect;
POINT pt; POINT pt;
MSG msg; MSG msg;
@ -3944,14 +3945,28 @@ static void test_paint_messages(void)
check_update_rgn( hwnd, 0 ); check_update_rgn( hwnd, 0 );
SetRectRgn( hrgn, 10, 10, 20, 20 ); SetRectRgn( hrgn, 10, 10, 20, 20 );
RedrawWindow( hwnd, NULL, hrgn, RDW_INVALIDATE ); ret = RedrawWindow( hwnd, NULL, hrgn, RDW_INVALIDATE );
ok(ret, "RedrawWindow returned %d instead of TRUE\n", ret);
check_update_rgn( hwnd, hrgn ); check_update_rgn( hwnd, hrgn );
SetRectRgn( hrgn2, 20, 20, 30, 30 ); SetRectRgn( hrgn2, 20, 20, 30, 30 );
RedrawWindow( hwnd, NULL, hrgn2, RDW_INVALIDATE ); ret = RedrawWindow( hwnd, NULL, hrgn2, RDW_INVALIDATE );
ok(ret, "RedrawWindow returned %d instead of TRUE\n", ret);
CombineRgn( hrgn, hrgn, hrgn2, RGN_OR ); CombineRgn( hrgn, hrgn, hrgn2, RGN_OR );
check_update_rgn( hwnd, hrgn ); check_update_rgn( hwnd, hrgn );
/* validate everything */ /* validate everything */
RedrawWindow( hwnd, NULL, NULL, RDW_VALIDATE ); ret = RedrawWindow( hwnd, NULL, NULL, RDW_VALIDATE );
ok(ret, "RedrawWindow returned %d instead of TRUE\n", ret);
check_update_rgn( hwnd, 0 );
/* test empty region */
SetRectRgn( hrgn, 10, 10, 10, 15 );
ret = RedrawWindow( hwnd, NULL, hrgn, RDW_INVALIDATE );
ok(ret, "RedrawWindow returned %d instead of TRUE\n", ret);
check_update_rgn( hwnd, 0 );
/* test empty rect */
SetRect( &rect, 10, 10, 10, 15 );
ret = RedrawWindow( hwnd, &rect, NULL, RDW_INVALIDATE );
ok(ret, "RedrawWindow returned %d instead of TRUE\n", ret);
check_update_rgn( hwnd, 0 ); check_update_rgn( hwnd, 0 );
/* flush pending messages */ /* flush pending messages */