Commit 7d867897 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

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

pass under Wine.
parent fbfb9716
......@@ -571,6 +571,7 @@ BOOL WINAPI LockWindowUpdate( HWND hwnd )
*/
BOOL WINAPI RedrawWindow( HWND hwnd, const RECT *rect, HRGN hrgn, UINT flags )
{
static const RECT empty;
BOOL ret;
if (!hwnd) hwnd = GetDesktopWindow();
......@@ -596,6 +597,7 @@ BOOL WINAPI RedrawWindow( HWND hwnd, const RECT *rect, HRGN hrgn, UINT flags )
if (rect && !hrgn)
{
if (IsRectEmpty( rect )) rect = ∅
ret = redraw_window_rects( hwnd, flags, rect, 1 );
}
else if (!hrgn)
......@@ -606,7 +608,6 @@ BOOL WINAPI RedrawWindow( HWND hwnd, const RECT *rect, HRGN hrgn, UINT flags )
{
DWORD size;
RGNDATA *data = NULL;
static const RECT empty;
if (!(size = GetRegionData( hrgn, 0, NULL ))) return FALSE;
if (!(data = HeapAlloc( GetProcessHeap(), 0, size ))) return FALSE;
......
......@@ -3925,6 +3925,7 @@ static const struct message WmSetParentStyle[] = {
static void test_paint_messages(void)
{
BOOL ret;
RECT rect;
POINT pt;
MSG msg;
......@@ -3944,14 +3945,28 @@ static void test_paint_messages(void)
check_update_rgn( hwnd, 0 );
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 );
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 );
check_update_rgn( hwnd, hrgn );
/* 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 );
/* flush pending messages */
......
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