wine/dlls/user painting.c tests/msg.c

Alexandre Julliard julliard at wine.codeweavers.com
Wed Nov 30 14:56:45 CST 2005


ChangeSet ID:	21579
CVSROOT:	/opt/cvs-commit
Module name:	wine
Changes by:	julliard at winehq.org	2005/11/30 14:56:45

Modified files:
	dlls/user      : painting.c 
	dlls/user/tests: msg.c 

Log message:
	Dmitry Timoshkov <dmitry at codeweavers.com>
	Add a test for RedrawWindow with an empty region/rectangle, make it
	pass under Wine.

Patch: http://cvs.winehq.org/patch.py?id=21579

Old revision  New revision  Changes     Path
 1.36          1.37          +2 -1       wine/dlls/user/painting.c
 1.107         1.108         +18 -3      wine/dlls/user/tests/msg.c

Index: wine/dlls/user/painting.c
diff -u -p wine/dlls/user/painting.c:1.36 wine/dlls/user/painting.c:1.37
--- wine/dlls/user/painting.c:1.36	30 Nov 2005 20:56:45 -0000
+++ wine/dlls/user/painting.c	30 Nov 2005 20:56:45 -0000
@@ -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, con
 
     if (rect && !hrgn)
     {
+        if (IsRectEmpty( rect )) rect = &empty;
         ret = redraw_window_rects( hwnd, flags, rect, 1 );
     }
     else if (!hrgn)
@@ -606,7 +608,6 @@ BOOL WINAPI RedrawWindow( HWND hwnd, con
     {
         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;
Index: wine/dlls/user/tests/msg.c
diff -u -p wine/dlls/user/tests/msg.c:1.107 wine/dlls/user/tests/msg.c:1.108
--- wine/dlls/user/tests/msg.c:1.107	30 Nov 2005 20:56:45 -0000
+++ wine/dlls/user/tests/msg.c	30 Nov 2005 20:56:45 -0000
@@ -3925,6 +3925,7 @@ static const struct message WmSetParentS
 
 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 */



More information about the wine-cvs mailing list