1 /*
2  * PROJECT:     ReactOS API tests
3  * LICENSE:     LGPL-2.1+ (https://spdx.org/licenses/LGPL-2.1+)
4  * PURPOSE:     Test for RedrawWindow
5  * COPYRIGHT:   Copyright 2018 Thomas Faber <thomas.faber@reactos.org>
6  *              Copyright 2024 Tomáš Veselý <turican0@gmail.com>
7  */
8 
9 #include "precomp.h"
10 
11 static DWORD dwThreadId;
12 static BOOL got_paint;
13 
14 BOOL resultWmEraseGnd = FALSE;
15 BOOL resultWmNcPaint = FALSE;
16 int paintIndex = 0;
17 const wchar_t CHILD_CLASS_NAME[] = L"ChildWindowClass";
18 
19 static
20 LRESULT
21 CALLBACK
WndProc(_In_ HWND hWnd,_In_ UINT message,_In_ WPARAM wParam,_In_ LPARAM lParam)22 WndProc(
23     _In_ HWND hWnd,
24     _In_ UINT message,
25     _In_ WPARAM wParam,
26     _In_ LPARAM lParam)
27 {
28     disable_success_count
29     ok(GetCurrentThreadId() == dwThreadId, "Thread 0x%lx instead of 0x%lx\n", GetCurrentThreadId(), dwThreadId);
30     if (message == WM_PAINT)
31     {
32         got_paint = TRUE;
33     }
34     return DefWindowProcW(hWnd, message, wParam, lParam);
35 }
36 
GetMessageRedrawWindowTest(void)37 void GetMessageRedrawWindowTest(void)
38 {
39     HWND hWnd;
40     MSG msg;
41     HRGN hRgn;
42     BOOL ret;
43     int i;
44 
45     SetCursorPos(0,0);
46 
47     dwThreadId = GetCurrentThreadId();
48     RegisterSimpleClass(WndProc, L"CreateTest");
49 
50     hWnd = CreateWindowExW(0, L"CreateTest", NULL, 0,  10, 10, 20, 20,  NULL, NULL, 0, NULL);
51     ok(hWnd != NULL, "CreateWindow failed\n");
52 
53     ShowWindow(hWnd, SW_SHOW);
54 
55     while (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE))
56     {
57         DispatchMessageW(&msg);
58     }
59 
60     ok(got_paint == TRUE, "Did not process WM_PAINT message\n");
61     got_paint = FALSE;
62 
63     hRgn = CreateRectRgn(0, 0, 1, 1);
64     ok(hRgn != NULL, "CreateRectRgn failed\n");
65     ret = RedrawWindow(hWnd, NULL, hRgn, RDW_INTERNALPAINT | RDW_INVALIDATE);
66     ok(ret == TRUE, "RedrawWindow failed\n");
67 
68     i = 0;
69     while (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE))
70     {
71         RECORD_MESSAGE(1, msg.message, POST, 0, 0);
72         if (msg.message == WM_PAINT)
73         {
74             i++;
75             if (i == 10)
76             {
77                 ok(got_paint == FALSE, "Received unexpected WM_PAINT message\n");
78             }
79         }
80         if (msg.message != WM_PAINT || i >= 10)
81         {
82             DispatchMessageW(&msg);
83         }
84     }
85 
86     ok(i == 10, "Received %d WM_PAINT messages\n", i);
87     ok(got_paint == TRUE, "Did not process WM_PAINT message\n");
88 
89     TRACE_CACHE();
90 
91     DeleteObject(hRgn);
92     DestroyWindow(hWnd);
93 }
94 
DrawContent(HDC hdc,RECT * rect,COLORREF color)95 void DrawContent(HDC hdc, RECT* rect, COLORREF color)
96 {
97     HBRUSH hBrush = CreateSolidBrush(color);
98     FillRect(hdc, rect, hBrush);
99     DeleteObject(hBrush);
100 
101     SetBkMode(hdc, TRANSPARENT);
102     SetTextColor(hdc, RGB(255, 255, 255));
103     DrawTextW(hdc, L"Test RedrawWindow", -1, rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
104 }
105 
WindowProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam)106 LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
107 {
108     switch (uMsg)
109     {
110         case WM_DESTROY:
111         {
112             PostQuitMessage(0);
113             return 0;
114         }
115         case WM_PAINT:
116         {
117             PAINTSTRUCT ps;
118             HDC hdc = BeginPaint(hwnd, &ps);
119             RECT rect;
120             GetClientRect(hwnd, &rect);
121             DrawContent(hdc, &rect, RGB(0, 255, 0));
122             EndPaint(hwnd, &ps);
123             paintIndex++;
124             return 0;
125         }
126         case WM_ERASEBKGND:
127         {
128             if(paintIndex != 0)
129                 resultWmEraseGnd = TRUE;
130             return 0;
131         }
132         case WM_NCPAINT:
133         {
134             if (paintIndex != 0)
135                 resultWmNcPaint = TRUE;
136             return 0;
137         }
138     }
139     return DefWindowProcW(hwnd, uMsg, wParam, lParam);
140 }
141 
ChildWindowProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam)142 LRESULT CALLBACK ChildWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
143 {
144     switch (uMsg)
145     {
146         case WM_SYNCPAINT:
147         {
148             PAINTSTRUCT ps;
149             HDC hdc = BeginPaint(hwnd, &ps);
150             HBRUSH brush = CreateSolidBrush(RGB(0, 0, 255));
151             FillRect(hdc, &ps.rcPaint, brush);
152             DeleteObject(brush);
153             EndPaint(hwnd, &ps);
154             break;
155         }
156         case WM_PAINT:
157         {
158             PAINTSTRUCT ps;
159             HDC hdc = BeginPaint(hwnd, &ps);
160             HBRUSH brush = CreateSolidBrush(RGB(0, 0, 255));
161             FillRect(hdc, &ps.rcPaint, brush);
162             DeleteObject(brush);
163             EndPaint(hwnd, &ps);
164             break;
165         }
166         case WM_DESTROY:
167         {
168             PostQuitMessage(0);
169             return 0;
170         }
171     }
172     return DefWindowProcW(hwnd, uMsg, wParam, lParam);
173 }
174 
175 typedef struct STRUCT_TestRedrawWindow
176 {
177     const wchar_t* testName;
178     DWORD flags;
179     BOOL useRegion;
180     RECT regRect;
181     BOOL useRect;
182     RECT rectRect;
183     BOOL forcePaint;
184     BOOL redrawResult;
185     int testPixelPre1x;
186     int testPixelPre1y;
187     int testPixelPre2x;
188     int testPixelPre2y;
189     int testPixelPost1x;
190     int testPixelPost1y;
191     int testPixelPost2x;
192     int testPixelPost2y;
193     int testChild;
194     COLORREF resultColorPre1;
195     COLORREF resultColorPre2;
196     COLORREF resultColorPost1;
197     COLORREF resultColorPost2;
198     RECT resultUpdateRect;
199     BOOL resultNeedsUpdate;
200     BOOL resultRedraw;
201     BOOL resultWmEraseGnd;
202     BOOL resultWmNcPaint;
203     int resultPaintIndex;
204 } STRUCT_TestRedrawWindow;
205 
206 typedef struct STRUCT_TestRedrawWindowCompare
207 {
208     COLORREF resultColorPre1;
209     COLORREF resultColorPre2;
210     COLORREF resultColorPost1;
211     COLORREF resultColorPost2;
212     RECT resultUpdateRect;
213     BOOL resultNeedsUpdate;
214     BOOL resultWmEraseGnd;
215     BOOL resultWmNcPaint;
216     int resultPaintIndex;
217 } STRUCT_TestRedrawWindowCompare;
218 
ServeSomeMessages(int messageTime,int messageCount)219 void ServeSomeMessages(int messageTime, int messageCount)
220 {
221     DWORD startTime;
222 
223     MSG msg = { 0 };
224     startTime = GetTickCount();
225     while (GetTickCount() - startTime < messageTime * messageCount)
226     {
227         if (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE))
228         {
229             TranslateMessage(&msg);
230             DispatchMessageW(&msg);
231         }
232         else
233         {
234             Sleep(messageTime);
235         }
236     }
237 }
238 
TestRedrawWindow(STRUCT_TestRedrawWindow * ptestRW)239 void TestRedrawWindow(STRUCT_TestRedrawWindow* ptestRW)
240 {
241     DWORD style;
242     int width;
243     int height;
244     HWND hChildWnd = NULL;
245     HRGN RgnUpdate;
246     RECT* prect;
247 
248     resultWmEraseGnd = FALSE;
249     resultWmNcPaint = FALSE;
250     paintIndex = 0;
251 
252     WNDCLASSW wc = { 0 };
253     wc.lpfnWndProc = WindowProc;
254     wc.hInstance = GetModuleHandle(NULL);
255     wc.lpszClassName = ptestRW->testName;
256     RegisterClassW(&wc);
257     RECT rectWin = { 0, 0, 700, 500 };
258     style = WS_OVERLAPPEDWINDOW;
259     AdjustWindowRectEx(&rectWin, style, FALSE, 0);
260     width = rectWin.right - rectWin.left;
261     height = rectWin.bottom - rectWin.top;
262     HWND hwnd = CreateWindowExW(0, wc.lpszClassName, wc.lpszClassName, WS_OVERLAPPEDWINDOW,
263         CW_USEDEFAULT, CW_USEDEFAULT, width, height, NULL, NULL, GetModuleHandle(NULL), NULL);
264     if (hwnd == NULL)
265         return;
266     MoveWindow(hwnd, 10, 10, width, height, TRUE);
267 
268     ShowWindow(hwnd, SW_SHOW);
269     if(!ptestRW->testChild)
270         UpdateWindow(hwnd);
271 
272     if (ptestRW->testChild)
273     {
274         WNDCLASSW wcChild = { 0 };
275         wcChild.lpfnWndProc = ChildWindowProc;
276         wcChild.hInstance = GetModuleHandle(NULL);
277         wcChild.lpszClassName = CHILD_CLASS_NAME;
278         RegisterClassW(&wcChild);
279 
280         hChildWnd = CreateWindowExW(
281             0,
282             CHILD_CLASS_NAME,
283             L"Child Window",
284             WS_CHILD | WS_VISIBLE,
285             10, 10, 200, 200,
286             hwnd,
287             NULL,
288             GetModuleHandle(NULL),
289             NULL
290         );
291         if (hChildWnd == NULL)
292             return;
293     }
294 
295     HDC hdc = GetDC(hwnd);
296     RECT drect = { 0, 0, 700, 500 };
297     DrawContent(hdc, &drect, RGB(255, 0, 0));
298     ReleaseDC(hwnd, hdc);
299 
300     RgnUpdate = NULL;
301     if (ptestRW->useRegion)
302     {
303         RgnUpdate = CreateRectRgn(ptestRW->regRect.left, ptestRW->regRect.top, ptestRW->regRect.right, ptestRW->regRect.bottom);
304     }
305 
306     prect = NULL;
307     if (ptestRW->useRect)
308     {
309         prect = &ptestRW->rectRect;
310     }
311 
312     if (ptestRW->testChild)
313     {
314         ServeSomeMessages(10, 10);
315     }
316 
317     ptestRW->resultRedraw = RedrawWindow(hwnd, prect, RgnUpdate, ptestRW->flags);
318 
319     if (ptestRW->testChild)
320     {
321         ServeSomeMessages(10, 10);
322     }
323 
324     hdc = GetDC(hwnd);
325     ptestRW->resultColorPre1 = GetPixel(hdc, ptestRW->testPixelPre1x, ptestRW->testPixelPre1y);
326     ptestRW->resultColorPre2 = GetPixel(hdc, ptestRW->testPixelPre2x, ptestRW->testPixelPre2y);
327     ReleaseDC(hwnd, hdc);
328 
329     ptestRW->resultNeedsUpdate = GetUpdateRect(hwnd, &ptestRW->resultUpdateRect, FALSE);
330 
331     if (ptestRW->forcePaint)
332     {
333         UpdateWindow(hwnd);
334     }
335 
336     hdc = GetDC(hwnd);
337     ptestRW->resultColorPost1 = GetPixel(hdc, ptestRW->testPixelPost1x, ptestRW->testPixelPost1y);
338     ptestRW->resultColorPost2 = GetPixel(hdc, ptestRW->testPixelPost2x, ptestRW->testPixelPost2y);
339     ReleaseDC(hwnd, hdc);
340 
341     ptestRW->resultWmEraseGnd = resultWmEraseGnd;
342     ptestRW->resultWmNcPaint = resultWmNcPaint;
343     ptestRW->resultPaintIndex = paintIndex;
344 
345     if (RgnUpdate)
346         DeleteObject(RgnUpdate);
347 
348     if (hChildWnd != NULL)
349         DestroyWindow(hChildWnd);
350     if (hwnd != NULL)
351         DestroyWindow(hwnd);
352 }
353 
TestRedrawWindow2(STRUCT_TestRedrawWindow * ptestRW,STRUCT_TestRedrawWindowCompare * ptestRWcompare)354 UINT TestRedrawWindow2(STRUCT_TestRedrawWindow* ptestRW, STRUCT_TestRedrawWindowCompare* ptestRWcompare)
355 {
356     UINT countErrors = 0;
357 
358     TestRedrawWindow(ptestRW);
359 
360     if (ptestRW->resultRedraw)
361     {
362         if (ptestRWcompare->resultColorPre1 != ptestRW->resultColorPre1)
363         {
364             trace("DIFFERENCE-resultColorPre1 0x%06x 0x%06x\n", (int)ptestRW->resultColorPre1, (int)ptestRWcompare->resultColorPre1);
365             countErrors++;
366         }
367         if (ptestRWcompare->resultColorPre2 != ptestRW->resultColorPre2)
368         {
369             trace("DIFFERENCE-resultColorPre2 0x%06x 0x%06x\n", (int)ptestRW->resultColorPre2, (int)ptestRWcompare->resultColorPre2);
370             countErrors++;
371         }
372         if (ptestRWcompare->resultColorPost1 != ptestRW->resultColorPost1)
373         {
374             trace("DIFFERENCE-resultColorPost1 0x%06x 0x%06x\n", (int)ptestRW->resultColorPost1, (int)ptestRWcompare->resultColorPost1);
375             countErrors++;
376         }
377         if (ptestRWcompare->resultColorPost2 != ptestRW->resultColorPost2)
378         {
379             trace("DIFFERENCE-resultColorPost2 0x%06x 0x%06x\n", (int)ptestRW->resultColorPost2, (int)ptestRWcompare->resultColorPost2);
380             countErrors++;
381         }
382         if (ptestRWcompare->resultNeedsUpdate != ptestRW->resultNeedsUpdate)
383         {
384             trace("DIFFERENCE-resultNeedsUpdate %d %d\n", ptestRW->resultNeedsUpdate, ptestRWcompare->resultNeedsUpdate);
385             countErrors++;
386         }
387         if (ptestRW->resultNeedsUpdate)
388         {
389             if (ptestRWcompare->resultUpdateRect.left != ptestRW->resultUpdateRect.left)
390             {
391                 trace("DIFFERENCE-resultUpdateRect.left %d %d\n", (int)ptestRW->resultUpdateRect.left, (int)ptestRWcompare->resultUpdateRect.left);
392                 countErrors++;
393             }
394             if (ptestRWcompare->resultUpdateRect.top != ptestRW->resultUpdateRect.top)
395             {
396                 trace("DIFFERENCE-resultUpdateRect.top %d %d\n", (int)ptestRW->resultUpdateRect.top, (int)ptestRWcompare->resultUpdateRect.top);
397                 countErrors++;
398             }
399             if (ptestRWcompare->resultUpdateRect.right != ptestRW->resultUpdateRect.right)
400             {
401                 trace("DIFFERENCE-resultUpdateRect.right %d %d\n", (int)ptestRW->resultUpdateRect.right, (int)ptestRWcompare->resultUpdateRect.right);
402                 countErrors++;
403             }
404             if (ptestRWcompare->resultUpdateRect.bottom != ptestRW->resultUpdateRect.bottom)
405             {
406                 trace("DIFFERENCE-resultUpdateRect.bottom %d %d\n", (int)ptestRW->resultUpdateRect.bottom, (int)ptestRWcompare->resultUpdateRect.bottom);
407                 countErrors++;
408             }
409         }
410         if (ptestRWcompare->resultWmEraseGnd != ptestRW->resultWmEraseGnd)
411         {
412             trace("DIFFERENCE-resultWmEraseGnd %d %d\n", ptestRW->resultWmEraseGnd, ptestRWcompare->resultWmEraseGnd);
413             countErrors++;
414         }
415         if (ptestRWcompare->resultWmNcPaint != ptestRW->resultWmNcPaint)
416         {
417             trace("DIFFERENCE-resultWmNcPaint %d %d\n", ptestRW->resultWmNcPaint, ptestRWcompare->resultWmNcPaint);
418             countErrors++;
419         }
420         if (ptestRWcompare->resultPaintIndex != ptestRW->resultPaintIndex)
421         {
422             trace("DIFFERENCE-resultPaintIndex %d %d\n", ptestRW->resultPaintIndex, ptestRWcompare->resultPaintIndex);
423             countErrors++;
424         }
425     }
426     if (countErrors > 0)
427     {
428         trace("COUNT OF DIFFERENCES - %d\n", countErrors);
429     }
430 
431     return countErrors;
432 }
433 
FlagsRedrawWindowTest(void)434 void FlagsRedrawWindowTest(void)
435 {
436     STRUCT_TestRedrawWindow testRW;
437     STRUCT_TestRedrawWindowCompare testRWcompare;
438 
439     testRW.testPixelPre1x = 50;
440     testRW.testPixelPre1y = 50;
441     testRW.testPixelPre2x = 50;
442     testRW.testPixelPre2y = 400;
443     testRW.testPixelPost1x = 50;
444     testRW.testPixelPost1y = 50;
445     testRW.testPixelPost2x = 50;
446     testRW.testPixelPost2y = 400;
447 
448     trace("Screen Width/Height (%dx%d)\n",
449           GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
450 
451     // RDW_ERASE tests
452     testRW.testName = L"Test1";
453     testRW.flags = 0;
454     testRW.useRegion = TRUE;
455     SetRect(&testRW.regRect, 0, 300, 700, 500);
456     testRW.useRect = FALSE;
457     SetRect(&testRW.rectRect, 0, 0, 200, 200);
458     testRW.forcePaint = TRUE;
459     testRW.testChild = FALSE;
460 
461     testRWcompare.resultColorPre1 = 0x000000FF;
462     testRWcompare.resultColorPre2 = 0x000000FF;
463     testRWcompare.resultColorPost1 = 0x000000FF;
464     testRWcompare.resultColorPost2 = 0x000000FF;
465     SetRect(&testRWcompare.resultUpdateRect, 0, 0, 200, 200);
466     testRWcompare.resultNeedsUpdate = FALSE;
467     testRWcompare.resultWmEraseGnd = FALSE;
468     testRWcompare.resultWmNcPaint = FALSE;
469     testRWcompare.resultPaintIndex = 1;
470     ok(0 == TestRedrawWindow2(&testRW, &testRWcompare),"Test1 fail\n");
471 
472     testRW.testName = L"Test2";
473     testRW.flags = RDW_ERASE;
474     testRW.useRegion = TRUE;
475     SetRect(&testRW.regRect, 0, 300, 700, 500);
476     testRW.useRect = FALSE;
477     SetRect(&testRW.rectRect, 0, 0, 200, 200);
478     testRW.forcePaint = TRUE;
479     testRW.testChild = FALSE;
480 
481     testRWcompare.resultColorPre1 = 0x000000FF;
482     testRWcompare.resultColorPre2 = 0x000000FF;
483     testRWcompare.resultColorPost1 = 0x000000FF;
484     testRWcompare.resultColorPost2 = 0x000000FF;
485     SetRect(&testRWcompare.resultUpdateRect, 0, 0, 200, 200);
486     testRWcompare.resultNeedsUpdate = FALSE;
487     testRWcompare.resultWmEraseGnd = FALSE;
488     testRWcompare.resultWmNcPaint = FALSE;
489     testRWcompare.resultPaintIndex = 1;
490     ok(0 == TestRedrawWindow2(&testRW, &testRWcompare),"Test2 fail\n");
491 
492     testRW.testName = L"Test3";
493     testRW.flags = RDW_INVALIDATE;
494     testRW.useRegion = TRUE;
495     SetRect(&testRW.regRect, 0, 300, 700, 500);
496     testRW.useRect = FALSE;
497     SetRect(&testRW.rectRect, 0, 0, 200, 200);
498     testRW.forcePaint = TRUE;
499     testRW.testChild = FALSE;
500 
501     testRWcompare.resultColorPre1 = 0x000000FF;
502     testRWcompare.resultColorPre2 = 0x000000FF;
503     testRWcompare.resultColorPost1 = 0x000000FF;
504     testRWcompare.resultColorPost2 = 0x0000FF00;
505     SetRect(&testRWcompare.resultUpdateRect, 0, 300, 700, 500);
506     testRWcompare.resultNeedsUpdate = TRUE;
507     testRWcompare.resultWmEraseGnd = FALSE;
508     testRWcompare.resultWmNcPaint = FALSE;
509     testRWcompare.resultPaintIndex = 2;
510     ok(0 == TestRedrawWindow2(&testRW, &testRWcompare),"Test3 fail\n");
511 
512     testRW.testName = L"Test4";
513     testRW.flags = RDW_INVALIDATE | RDW_ERASE;
514     testRW.useRegion = TRUE;
515     SetRect(&testRW.regRect, 0, 300, 700, 500);
516     testRW.useRect = FALSE;
517     SetRect(&testRW.rectRect, 0, 0, 200, 200);
518     testRW.forcePaint = TRUE;
519     testRW.testChild = FALSE;
520 
521     testRWcompare.resultColorPre1 = 0x000000FF;
522     testRWcompare.resultColorPre2 = 0x000000FF;
523     testRWcompare.resultColorPost1 = 0x000000FF;
524     testRWcompare.resultColorPost2 = 0x0000FF00;
525     SetRect(&testRWcompare.resultUpdateRect, 0, 300, 700, 500);
526     testRWcompare.resultNeedsUpdate = TRUE;
527     testRWcompare.resultWmEraseGnd = TRUE;
528     testRWcompare.resultWmNcPaint = FALSE;
529     testRWcompare.resultPaintIndex = 2;
530     ok(0 == TestRedrawWindow2(&testRW, &testRWcompare),"Test4 fail\n");
531 
532     // RDW_FRAME tests
533     testRW.testName = L"Test5";
534     testRW.flags = RDW_FRAME;
535     testRW.useRegion = TRUE;
536     SetRect(&testRW.regRect, 0, 300, 700, 500);
537     testRW.useRect = FALSE;
538     SetRect(&testRW.rectRect, 0, 0, 200, 200);
539     testRW.forcePaint = TRUE;
540     testRW.testChild = FALSE;
541 
542     testRWcompare.resultColorPre1 = 0x000000FF;
543     testRWcompare.resultColorPre2 = 0x000000FF;
544     testRWcompare.resultColorPost1 = 0x000000FF;
545     testRWcompare.resultColorPost2 = 0x000000FF;
546     SetRect(&testRWcompare.resultUpdateRect, 0, 300, 700, 500);
547     testRWcompare.resultNeedsUpdate = FALSE;
548     testRWcompare.resultWmEraseGnd = FALSE;
549     testRWcompare.resultWmNcPaint = FALSE;
550     testRWcompare.resultPaintIndex = 1;
551     ok(0 == TestRedrawWindow2(&testRW, &testRWcompare),"Test5 fail\n");
552 
553     testRW.testName = L"Test6";
554     testRW.flags = RDW_INVALIDATE | RDW_FRAME;
555     testRW.useRegion = TRUE;
556     SetRect(&testRW.regRect, 0, 300, 700, 500);
557     testRW.useRect = FALSE;
558     SetRect(&testRW.rectRect, 0, 0, 200, 200);
559     testRW.forcePaint = TRUE;
560     testRW.testChild = FALSE;
561 
562     testRWcompare.resultColorPre1 = 0x000000FF;
563     testRWcompare.resultColorPre2 = 0x000000FF;
564     testRWcompare.resultColorPost1 = 0x000000FF;
565     testRWcompare.resultColorPost2 = 0x0000FF00;
566     SetRect(&testRWcompare.resultUpdateRect, 0, 300, 700, 500);
567     testRWcompare.resultNeedsUpdate = TRUE;
568     testRWcompare.resultWmEraseGnd = FALSE;
569     testRWcompare.resultWmNcPaint = TRUE;
570     testRWcompare.resultPaintIndex = 2;
571     ok(0 == TestRedrawWindow2(&testRW, &testRWcompare),"Test6 fail\n");
572 
573     // RDW_INTERNALPAINT tests
574     testRW.testName = L"Test7";
575     testRW.flags = RDW_INTERNALPAINT;
576     testRW.useRegion = TRUE;
577     SetRect(&testRW.regRect, 0, 300, 700, 500);
578     testRW.useRect = FALSE;
579     SetRect(&testRW.rectRect, 0, 0, 200, 200);
580     testRW.forcePaint = TRUE;
581     testRW.testChild = FALSE;
582 
583     testRWcompare.resultColorPre1 = 0x000000FF;
584     testRWcompare.resultColorPre2 = 0x000000FF;
585     testRWcompare.resultColorPost1 = 0x000000FF;
586     testRWcompare.resultColorPost2 = 0x000000FF;
587     SetRect(&testRWcompare.resultUpdateRect, 0, 300, 700, 500);
588     testRWcompare.resultNeedsUpdate = FALSE;
589     testRWcompare.resultWmEraseGnd = FALSE;
590     testRWcompare.resultWmNcPaint = FALSE;
591     testRWcompare.resultPaintIndex = 2;
592     ok(0 == TestRedrawWindow2(&testRW, &testRWcompare),"Test7 fail\n");
593 
594     testRW.testName = L"Test8";
595     testRW.flags = RDW_INVALIDATE | RDW_INTERNALPAINT;
596     testRW.useRegion = TRUE;
597     SetRect(&testRW.regRect, 0, 300, 700, 500);
598     testRW.useRect = FALSE;
599     SetRect(&testRW.rectRect, 0, 0, 200, 200);
600     testRW.forcePaint = TRUE;
601     testRW.testChild = FALSE;
602 
603     testRWcompare.resultColorPre1 = 0x000000FF;
604     testRWcompare.resultColorPre2 = 0x000000FF;
605     testRWcompare.resultColorPost1 = 0x000000FF;
606     testRWcompare.resultColorPost2 = 0x0000FF00;
607     SetRect(&testRWcompare.resultUpdateRect, 0, 300, 700, 500);
608     testRWcompare.resultNeedsUpdate = TRUE;
609     testRWcompare.resultWmEraseGnd = FALSE;
610     testRWcompare.resultWmNcPaint = FALSE;
611     testRWcompare.resultPaintIndex = 2;
612     ok(0 == TestRedrawWindow2(&testRW, &testRWcompare),"Test8 fail\n");
613 
614     // RDW_NOERASE tests
615     testRW.testName = L"Test9";
616     testRW.flags = RDW_NOERASE;
617     testRW.useRegion = TRUE;
618     SetRect(&testRW.regRect, 0, 300, 700, 500);
619     testRW.useRect = FALSE;
620     SetRect(&testRW.rectRect, 0, 0, 200, 200);
621     testRW.forcePaint = TRUE;
622     testRW.testChild = FALSE;
623 
624     testRWcompare.resultColorPre1 = 0x000000FF;
625     testRWcompare.resultColorPre2 = 0x000000FF;
626     testRWcompare.resultColorPost1 = 0x000000FF;
627     testRWcompare.resultColorPost2 = 0x000000FF;
628     SetRect(&testRWcompare.resultUpdateRect, 0, 300, 700, 500);
629     testRWcompare.resultNeedsUpdate = FALSE;
630     testRWcompare.resultWmEraseGnd = FALSE;
631     testRWcompare.resultWmNcPaint = FALSE;
632     testRWcompare.resultPaintIndex = 1;
633     ok(0 == TestRedrawWindow2(&testRW, &testRWcompare),"Test9 fail\n");
634 
635     testRW.testName = L"Test10";
636     testRW.flags = RDW_INVALIDATE | RDW_NOERASE;
637     testRW.useRegion = TRUE;
638     SetRect(&testRW.regRect, 0, 300, 700, 500);
639     testRW.useRect = FALSE;
640     SetRect(&testRW.rectRect, 0, 0, 200, 200);
641     testRW.forcePaint = TRUE;
642     testRW.testChild = FALSE;
643 
644     testRWcompare.resultColorPre1 = 0x000000FF;
645     testRWcompare.resultColorPre2 = 0x000000FF;
646     testRWcompare.resultColorPost1 = 0x000000FF;
647     testRWcompare.resultColorPost2 = 0x0000FF00;
648     SetRect(&testRWcompare.resultUpdateRect, 0, 300, 700, 500);
649     testRWcompare.resultNeedsUpdate = TRUE;
650     testRWcompare.resultWmEraseGnd = FALSE;
651     testRWcompare.resultWmNcPaint = FALSE;
652     testRWcompare.resultPaintIndex = 2;
653     ok(0 == TestRedrawWindow2(&testRW, &testRWcompare),"Test10 fail\n");
654 
655     testRW.testName = L"Test11";
656     testRW.flags = RDW_NOERASE | RDW_ERASE;
657     testRW.useRegion = TRUE;
658     SetRect(&testRW.regRect, 0, 300, 700, 500);
659     testRW.useRect = FALSE;
660     SetRect(&testRW.rectRect, 0, 0, 200, 200);
661     testRW.forcePaint = TRUE;
662     testRW.testChild = FALSE;
663 
664     testRWcompare.resultColorPre1 = 0x000000FF;
665     testRWcompare.resultColorPre2 = 0x000000FF;
666     testRWcompare.resultColorPost1 = 0x000000FF;
667     testRWcompare.resultColorPost2 = 0x000000FF;
668     SetRect(&testRWcompare.resultUpdateRect, 0, 300, 700, 500);
669     testRWcompare.resultNeedsUpdate = FALSE;
670     testRWcompare.resultWmEraseGnd = FALSE;
671     testRWcompare.resultWmNcPaint = FALSE;
672     testRWcompare.resultPaintIndex = 1;
673     ok(0 == TestRedrawWindow2(&testRW, &testRWcompare),"Test11 fail\n");
674 
675     testRW.testName = L"Test12";
676     testRW.flags = RDW_INVALIDATE | RDW_NOERASE | RDW_ERASE;
677     testRW.useRegion = TRUE;
678     SetRect(&testRW.regRect, 0, 300, 700, 500);
679     testRW.useRect = FALSE;
680     SetRect(&testRW.rectRect, 0, 0, 200, 200);
681     testRW.forcePaint = TRUE;
682     testRW.testChild = FALSE;
683 
684     testRWcompare.resultColorPre1 = 0x000000FF;
685     testRWcompare.resultColorPre2 = 0x000000FF;
686     testRWcompare.resultColorPost1 = 0x000000FF;
687     testRWcompare.resultColorPost2 = 0x0000FF00;
688     SetRect(&testRWcompare.resultUpdateRect, 0, 300, 700, 500);
689     testRWcompare.resultNeedsUpdate = TRUE;
690     testRWcompare.resultWmEraseGnd = TRUE;
691     testRWcompare.resultWmNcPaint = FALSE;
692     testRWcompare.resultPaintIndex = 2;
693     ok(0 == TestRedrawWindow2(&testRW, &testRWcompare),"Test12 fail\n");
694 
695     // RDW_NOFRAME tests
696     testRW.testName = L"Test13";
697     testRW.flags = RDW_NOFRAME;
698     testRW.useRegion = TRUE;
699     SetRect(&testRW.regRect, 0, 300, 700, 500);
700     testRW.useRect = FALSE;
701     SetRect(&testRW.rectRect, 0, 0, 200, 200);
702     testRW.forcePaint = TRUE;
703     testRW.testChild = FALSE;
704 
705     testRWcompare.resultColorPre1 = 0x000000FF;
706     testRWcompare.resultColorPre2 = 0x000000FF;
707     testRWcompare.resultColorPost1 = 0x000000FF;
708     testRWcompare.resultColorPost2 = 0x000000FF;
709     SetRect(&testRWcompare.resultUpdateRect, 0, 300, 700, 500);
710     testRWcompare.resultNeedsUpdate = FALSE;
711     testRWcompare.resultWmEraseGnd = FALSE;
712     testRWcompare.resultWmNcPaint = FALSE;
713     testRWcompare.resultPaintIndex = 1;
714     ok(0 == TestRedrawWindow2(&testRW, &testRWcompare),"Test13 fail\n");
715 
716     testRW.testName = L"Test14";
717     testRW.flags = RDW_INVALIDATE | RDW_NOFRAME;
718     testRW.useRegion = TRUE;
719     SetRect(&testRW.regRect, 0, 300, 700, 500);
720     testRW.useRect = FALSE;
721     SetRect(&testRW.rectRect, 0, 0, 200, 200);
722     testRW.forcePaint = TRUE;
723     testRW.testChild = FALSE;
724 
725     testRWcompare.resultColorPre1 = 0x000000FF;
726     testRWcompare.resultColorPre2 = 0x000000FF;
727     testRWcompare.resultColorPost1 = 0x000000FF;
728     testRWcompare.resultColorPost2 = 0x0000FF00;
729     SetRect(&testRWcompare.resultUpdateRect, 0, 300, 700, 500);
730     testRWcompare.resultNeedsUpdate = TRUE;
731     testRWcompare.resultWmEraseGnd = FALSE;
732     testRWcompare.resultWmNcPaint = FALSE;
733     testRWcompare.resultPaintIndex = 2;
734     ok(0 == TestRedrawWindow2(&testRW, &testRWcompare),"Test14 fail\n");
735 
736     testRW.testName = L"Test15";
737     testRW.flags = RDW_INVALIDATE | RDW_VALIDATE | RDW_NOFRAME;
738     testRW.useRegion = TRUE;
739     SetRect(&testRW.regRect, 0, 300, 700, 500);
740     testRW.useRect = FALSE;
741     SetRect(&testRW.rectRect, 0, 0, 200, 200);
742     testRW.forcePaint = TRUE;
743     testRW.testChild = FALSE;
744 
745     testRWcompare.resultColorPre1 = 0x000000FF;
746     testRWcompare.resultColorPre2 = 0x000000FF;
747     testRWcompare.resultColorPost1 = 0x000000FF;
748     testRWcompare.resultColorPost2 = 0x0000FF00;
749     SetRect(&testRWcompare.resultUpdateRect, 0, 300, 700, 500);
750     testRWcompare.resultNeedsUpdate = TRUE;
751     testRWcompare.resultWmEraseGnd = FALSE;
752     testRWcompare.resultWmNcPaint = FALSE;
753     testRWcompare.resultPaintIndex = 2;
754     ok(0 == TestRedrawWindow2(&testRW, &testRWcompare),"Test15 fail\n");
755 
756     testRW.testName = L"Test16";
757     testRW.flags = RDW_VALIDATE | RDW_NOFRAME;
758     testRW.useRegion = TRUE;
759     SetRect(&testRW.regRect, 0, 300, 700, 500);
760     testRW.useRect = FALSE;
761     SetRect(&testRW.rectRect, 0, 0, 200, 200);
762     testRW.forcePaint = TRUE;
763     testRW.testChild = FALSE;
764 
765     testRWcompare.resultColorPre1 = 0x000000FF;
766     testRWcompare.resultColorPre2 = 0x000000FF;
767     testRWcompare.resultColorPost1 = 0x000000FF;
768     testRWcompare.resultColorPost2 = 0x000000FF;
769     SetRect(&testRWcompare.resultUpdateRect, 0, 300, 700, 500);
770     testRWcompare.resultNeedsUpdate = FALSE;
771     testRWcompare.resultWmEraseGnd = FALSE;
772     testRWcompare.resultWmNcPaint = FALSE;
773     testRWcompare.resultPaintIndex = 1;
774     ok(0 == TestRedrawWindow2(&testRW, &testRWcompare),"Test16 fail\n");
775 
776     // RDW_NOINTERNALPAINT tests
777     testRW.testName = L"Test17";
778     testRW.flags = RDW_NOINTERNALPAINT;
779     testRW.useRegion = TRUE;
780     SetRect(&testRW.regRect, 0, 300, 700, 500);
781     testRW.useRect = FALSE;
782     SetRect(&testRW.rectRect, 0, 0, 200, 200);
783     testRW.forcePaint = TRUE;
784     testRW.testChild = FALSE;
785 
786     testRWcompare.resultColorPre1 = 0x000000FF;
787     testRWcompare.resultColorPre2 = 0x000000FF;
788     testRWcompare.resultColorPost1 = 0x000000FF;
789     testRWcompare.resultColorPost2 = 0x000000FF;
790     SetRect(&testRWcompare.resultUpdateRect, 0, 300, 700, 500);
791     testRWcompare.resultNeedsUpdate = FALSE;
792     testRWcompare.resultWmEraseGnd = FALSE;
793     testRWcompare.resultWmNcPaint = FALSE;
794     testRWcompare.resultPaintIndex = 1;
795     ok(0 == TestRedrawWindow2(&testRW, &testRWcompare),"Test17 fail\n");
796 
797     testRW.testName = L"Test18";
798     testRW.flags = RDW_INVALIDATE | RDW_NOINTERNALPAINT;
799     testRW.useRegion = TRUE;
800     SetRect(&testRW.regRect, 0, 300, 700, 500);
801     testRW.useRect = FALSE;
802     SetRect(&testRW.rectRect, 0, 0, 200, 200);
803     testRW.forcePaint = TRUE;
804     testRW.testChild = FALSE;
805 
806     testRWcompare.resultColorPre1 = 0x000000FF;
807     testRWcompare.resultColorPre2 = 0x000000FF;
808     testRWcompare.resultColorPost1 = 0x000000FF;
809     testRWcompare.resultColorPost2 = 0x0000FF00;
810     SetRect(&testRWcompare.resultUpdateRect, 0, 300, 700, 500);
811     testRWcompare.resultNeedsUpdate = TRUE;
812     testRWcompare.resultWmEraseGnd = FALSE;
813     testRWcompare.resultWmNcPaint = FALSE;
814     testRWcompare.resultPaintIndex = 2;
815     ok(0 == TestRedrawWindow2(&testRW, &testRWcompare),"Test18 fail\n");
816 
817     testRW.testName = L"Test19";
818     testRW.flags = RDW_VALIDATE | RDW_NOINTERNALPAINT;
819     testRW.useRegion = TRUE;
820     SetRect(&testRW.regRect, 0, 300, 700, 500);
821     testRW.useRect = FALSE;
822     SetRect(&testRW.rectRect, 0, 0, 200, 200);
823     testRW.forcePaint = TRUE;
824     testRW.testChild = FALSE;
825 
826     testRWcompare.resultColorPre1 = 0x000000FF;
827     testRWcompare.resultColorPre2 = 0x000000FF;
828     testRWcompare.resultColorPost1 = 0x000000FF;
829     testRWcompare.resultColorPost2 = 0x000000FF;
830     SetRect(&testRWcompare.resultUpdateRect, 0, 300, 700, 500);
831     testRWcompare.resultNeedsUpdate = FALSE;
832     testRWcompare.resultWmEraseGnd = FALSE;
833     testRWcompare.resultWmNcPaint = FALSE;
834     testRWcompare.resultPaintIndex = 1;
835     ok(0 == TestRedrawWindow2(&testRW, &testRWcompare),"Test19 fail\n");
836 
837     // RDW_ERASENOW tests
838     testRW.testName = L"Test20";
839     testRW.flags = RDW_ERASENOW;
840     testRW.useRegion = TRUE;
841     SetRect(&testRW.regRect, 0, 300, 700, 500);
842     testRW.useRect = FALSE;
843     SetRect(&testRW.rectRect, 0, 0, 200, 200);
844     testRW.forcePaint = TRUE;
845     testRW.testChild = FALSE;
846 
847     testRWcompare.resultColorPre1 = 0x000000FF;
848     testRWcompare.resultColorPre2 = 0x000000FF;
849     testRWcompare.resultColorPost1 = 0x000000FF;
850     testRWcompare.resultColorPost2 = 0x000000FF;
851     SetRect(&testRWcompare.resultUpdateRect, 0, 300, 700, 500);
852     testRWcompare.resultNeedsUpdate = FALSE;
853     testRWcompare.resultWmEraseGnd = FALSE;
854     testRWcompare.resultWmNcPaint = FALSE;
855     testRWcompare.resultPaintIndex = 1;
856     ok(0 == TestRedrawWindow2(&testRW, &testRWcompare),"Test20 fail\n");
857 
858     testRW.testName = L"Test21";
859     testRW.flags = RDW_INVALIDATE | RDW_ERASENOW;
860     testRW.useRegion = TRUE;
861     SetRect(&testRW.regRect, 0, 300, 700, 500);
862     testRW.useRect = FALSE;
863     SetRect(&testRW.rectRect, 0, 0, 200, 200);
864     testRW.forcePaint = TRUE;
865     testRW.testChild = FALSE;
866 
867     testRWcompare.resultColorPre1 = 0x000000FF;
868     testRWcompare.resultColorPre2 = 0x000000FF;
869     testRWcompare.resultColorPost1 = 0x000000FF;
870     testRWcompare.resultColorPost2 = 0x0000FF00;
871     SetRect(&testRWcompare.resultUpdateRect, 0, 300, 700, 500);
872     testRWcompare.resultNeedsUpdate = TRUE;
873     testRWcompare.resultWmEraseGnd = FALSE;
874     testRWcompare.resultWmNcPaint = FALSE;
875     testRWcompare.resultPaintIndex = 2;
876     ok(0 == TestRedrawWindow2(&testRW, &testRWcompare),"Test21 fail\n");
877 
878     testRW.testName = L"Test22";
879     testRW.flags = RDW_VALIDATE | RDW_ERASENOW;
880     testRW.useRegion = TRUE;
881     SetRect(&testRW.regRect, 0, 300, 700, 500);
882     testRW.useRect = FALSE;
883     SetRect(&testRW.rectRect, 0, 0, 200, 200);
884     testRW.forcePaint = TRUE;
885     testRW.testChild = FALSE;
886 
887     testRWcompare.resultColorPre1 = 0x000000FF;
888     testRWcompare.resultColorPre2 = 0x000000FF;
889     testRWcompare.resultColorPost1 = 0x000000FF;
890     testRWcompare.resultColorPost2 = 0x000000FF;
891     SetRect(&testRWcompare.resultUpdateRect, 0, 300, 700, 500);
892     testRWcompare.resultNeedsUpdate = FALSE;
893     testRWcompare.resultWmEraseGnd = FALSE;
894     testRWcompare.resultWmNcPaint = FALSE;
895     testRWcompare.resultPaintIndex = 1;
896     ok(0 == TestRedrawWindow2(&testRW, &testRWcompare),"Test22 fail\n");
897 
898     // RDW_UPDATENOW tests
899     testRW.testName = L"Test23";
900     testRW.flags = RDW_UPDATENOW;
901     testRW.useRegion = TRUE;
902     SetRect(&testRW.regRect, 0, 300, 700, 500);
903     testRW.useRect = FALSE;
904     SetRect(&testRW.rectRect, 0, 0, 200, 200);
905     testRW.forcePaint = TRUE;
906     testRW.testChild = FALSE;
907 
908     testRWcompare.resultColorPre1 = 0x000000FF;
909     testRWcompare.resultColorPre2 = 0x000000FF;
910     testRWcompare.resultColorPost1 = 0x000000FF;
911     testRWcompare.resultColorPost2 = 0x000000FF;
912     SetRect(&testRWcompare.resultUpdateRect, 0, 300, 700, 500);
913     testRWcompare.resultNeedsUpdate = FALSE;
914     testRWcompare.resultWmEraseGnd = FALSE;
915     testRWcompare.resultWmNcPaint = FALSE;
916     testRWcompare.resultPaintIndex = 1;
917     ok(0 == TestRedrawWindow2(&testRW, &testRWcompare),"Test23 fail\n");
918 
919     testRW.testName = L"Test24";
920     testRW.flags = RDW_INVALIDATE | RDW_UPDATENOW;
921     testRW.useRegion = TRUE;
922     SetRect(&testRW.regRect, 0, 300, 700, 500);
923     testRW.useRect = FALSE;
924     SetRect(&testRW.rectRect, 0, 0, 200, 200);
925     testRW.forcePaint = TRUE;
926     testRW.testChild = FALSE;
927 
928     testRWcompare.resultColorPre1 = 0x000000FF;
929     testRWcompare.resultColorPre2 = 0x0000FF00;
930     testRWcompare.resultColorPost1 = 0x000000FF;
931     testRWcompare.resultColorPost2 = 0x0000FF00;
932     SetRect(&testRWcompare.resultUpdateRect, 0, 300, 700, 500);
933     testRWcompare.resultNeedsUpdate = FALSE;
934     testRWcompare.resultWmEraseGnd = FALSE;
935     testRWcompare.resultWmNcPaint = FALSE;
936     testRWcompare.resultPaintIndex = 2;
937     ok(0 == TestRedrawWindow2(&testRW, &testRWcompare),"Test24 fail\n");
938 
939     testRW.testName = L"Test25";
940     testRW.flags = RDW_VALIDATE | RDW_UPDATENOW;
941     testRW.useRegion = TRUE;
942     SetRect(&testRW.regRect, 0, 300, 700, 500);
943     testRW.useRect = FALSE;
944     SetRect(&testRW.rectRect, 0, 0, 200, 200);
945     testRW.forcePaint = TRUE;
946     testRW.testChild = FALSE;
947 
948     testRWcompare.resultColorPre1 = 0x000000FF;
949     testRWcompare.resultColorPre2 = 0x000000FF;
950     testRWcompare.resultColorPost1 = 0x000000FF;
951     testRWcompare.resultColorPost2 = 0x000000FF;
952     SetRect(&testRWcompare.resultUpdateRect, 0, 300, 700, 500);
953     testRWcompare.resultNeedsUpdate = FALSE;
954     testRWcompare.resultWmEraseGnd = FALSE;
955     testRWcompare.resultWmNcPaint = FALSE;
956     testRWcompare.resultPaintIndex = 1;
957     ok(0 == TestRedrawWindow2(&testRW, &testRWcompare),"Test25 fail\n");
958 
959     // RDW_ALLCHILDREN/RDW_NOCHILDREN tests
960     testRW.testName = L"Test26";
961     testRW.flags = RDW_NOCHILDREN;
962     testRW.useRegion = FALSE;
963     SetRect(&testRW.regRect, 0, 300, 700, 500);
964     testRW.useRect = FALSE;
965     SetRect(&testRW.rectRect, 0, 0, 200, 200);
966     testRW.forcePaint = TRUE;
967     testRW.testChild = TRUE;
968 
969     testRWcompare.resultColorPre1 = 0x00FF0000;
970     testRWcompare.resultColorPre2 = 0x0000FF00;
971     testRWcompare.resultColorPost1 = 0x00FF0000;
972     testRWcompare.resultColorPost2 = 0x0000FF00;
973     SetRect(&testRWcompare.resultUpdateRect, 0, 300, 700, 500);
974     testRWcompare.resultNeedsUpdate = FALSE;
975     testRWcompare.resultWmEraseGnd = FALSE;
976     testRWcompare.resultWmNcPaint = FALSE;
977     testRWcompare.resultPaintIndex = 1;
978     ok(0 == TestRedrawWindow2(&testRW, &testRWcompare),"Test26 fail\n");
979 
980     testRW.testName = L"Test27";
981     testRW.flags = RDW_INVALIDATE | RDW_NOCHILDREN;
982     testRW.useRegion = FALSE;
983     SetRect(&testRW.regRect, 0, 300, 700, 500);
984     testRW.useRect = FALSE;
985     SetRect(&testRW.rectRect, 0, 0, 200, 200);
986     testRW.forcePaint = TRUE;
987     testRW.testChild = TRUE;
988 
989     testRWcompare.resultColorPre1 = 0x0000FF00;
990     testRWcompare.resultColorPre2 = 0x0000FF00;
991     testRWcompare.resultColorPost1 = 0x0000FF00;
992     testRWcompare.resultColorPost2 = 0x0000FF00;
993     SetRect(&testRWcompare.resultUpdateRect, 0, 300, 700, 500);
994     testRWcompare.resultNeedsUpdate = FALSE;
995     testRWcompare.resultWmEraseGnd = FALSE;
996     testRWcompare.resultWmNcPaint = FALSE;
997     testRWcompare.resultPaintIndex = 2;
998     ok(0 == TestRedrawWindow2(&testRW, &testRWcompare),"Test27 fail\n");
999 
1000     testRW.testName = L"Test28";
1001     testRW.flags = RDW_VALIDATE | RDW_NOCHILDREN;
1002     testRW.useRegion = FALSE;
1003     SetRect(&testRW.regRect, 0, 300, 700, 500);
1004     testRW.useRect = FALSE;
1005     SetRect(&testRW.rectRect, 0, 0, 200, 200);
1006     testRW.forcePaint = TRUE;
1007     testRW.testChild = TRUE;
1008 
1009     testRWcompare.resultColorPre1 = 0x00FF0000;
1010     testRWcompare.resultColorPre2 = 0x0000FF00;
1011     testRWcompare.resultColorPost1 = 0x00FF0000;
1012     testRWcompare.resultColorPost2 = 0x0000FF00;
1013     SetRect(&testRWcompare.resultUpdateRect, 0, 300, 700, 500);
1014     testRWcompare.resultNeedsUpdate = FALSE;
1015     testRWcompare.resultWmEraseGnd = FALSE;
1016     testRWcompare.resultWmNcPaint = FALSE;
1017     testRWcompare.resultPaintIndex = 1;
1018     ok(0 == TestRedrawWindow2(&testRW, &testRWcompare),"Test28 fail\n");
1019 
1020     testRW.testName = L"Test29";
1021     testRW.flags = RDW_ALLCHILDREN;
1022     testRW.useRegion = FALSE;
1023     SetRect(&testRW.regRect, 0, 300, 700, 500);
1024     testRW.useRect = FALSE;
1025     SetRect(&testRW.rectRect, 0, 0, 200, 200);
1026     testRW.forcePaint = TRUE;
1027     testRW.testChild = TRUE;
1028 
1029     testRWcompare.resultColorPre1 = 0x00FF0000;
1030     testRWcompare.resultColorPre2 = 0x0000FF00;
1031     testRWcompare.resultColorPost1 = 0x00FF0000;
1032     testRWcompare.resultColorPost2 = 0x0000FF00;
1033     SetRect(&testRWcompare.resultUpdateRect, 0, 300, 700, 500);
1034     testRWcompare.resultNeedsUpdate = FALSE;
1035     testRWcompare.resultWmEraseGnd = FALSE;
1036     testRWcompare.resultWmNcPaint = FALSE;
1037     testRWcompare.resultPaintIndex = 1;
1038     ok(0 == TestRedrawWindow2(&testRW, &testRWcompare),"Test29 fail\n");
1039 
1040     testRW.testName = L"Test30";
1041     testRW.flags = RDW_INVALIDATE | RDW_ALLCHILDREN;
1042     testRW.useRegion = FALSE;
1043     SetRect(&testRW.regRect, 0, 300, 700, 500);
1044     testRW.useRect = FALSE;
1045     SetRect(&testRW.rectRect, 0, 0, 200, 200);
1046     testRW.forcePaint = TRUE;
1047     testRW.testChild = TRUE;
1048 
1049     testRWcompare.resultColorPre1 = 0x00FF0000;
1050     testRWcompare.resultColorPre2 = 0x0000FF00;
1051     testRWcompare.resultColorPre1 = 0x00FF0000;
1052     testRWcompare.resultColorPost2 = 0x0000FF00;
1053     SetRect(&testRWcompare.resultUpdateRect, 0, 300, 700, 500);
1054     testRWcompare.resultNeedsUpdate = FALSE;
1055     testRWcompare.resultWmEraseGnd = FALSE;
1056     testRWcompare.resultWmNcPaint = FALSE;
1057     testRWcompare.resultPaintIndex = 2;
1058     ok(0 == TestRedrawWindow2(&testRW, &testRWcompare),"Test30 fail\n");
1059 
1060     testRW.testName = L"Test31";
1061     testRW.flags = RDW_VALIDATE | RDW_ALLCHILDREN;
1062     testRW.useRegion = FALSE;
1063     SetRect(&testRW.regRect, 0, 300, 700, 500);
1064     testRW.useRect = FALSE;
1065     SetRect(&testRW.rectRect, 0, 0, 200, 200);
1066     testRW.forcePaint = TRUE;
1067     testRW.testChild = TRUE;
1068 
1069     testRWcompare.resultColorPre1 = 0x00FF0000;
1070     testRWcompare.resultColorPre2 = 0x0000FF00;
1071     testRWcompare.resultColorPost1 = 0x00FF0000;
1072     testRWcompare.resultColorPost2 = 0x0000FF00;
1073     SetRect(&testRWcompare.resultUpdateRect, 0, 300, 700, 500);
1074     testRWcompare.resultNeedsUpdate = FALSE;
1075     testRWcompare.resultWmEraseGnd = FALSE;
1076     testRWcompare.resultWmNcPaint = FALSE;
1077     testRWcompare.resultPaintIndex = 1;
1078     ok(0 == TestRedrawWindow2(&testRW, &testRWcompare),"Test31 fail\n");
1079 
1080     testRW.testName = L"Test32";
1081     testRW.flags = RDW_NOCHILDREN;
1082     testRW.useRegion = TRUE;
1083     SetRect(&testRW.regRect, 0, 300, 700, 500);
1084     testRW.useRect = FALSE;
1085     SetRect(&testRW.rectRect, 0, 0, 200, 200);
1086     testRW.forcePaint = TRUE;
1087     testRW.testChild = TRUE;
1088 
1089     testRWcompare.resultColorPre1 = 0x00FF0000;
1090     testRWcompare.resultColorPre2 = 0x0000FF00;
1091     testRWcompare.resultColorPost1 = 0x00FF0000;
1092     testRWcompare.resultColorPost2 = 0x0000FF00;
1093     SetRect(&testRWcompare.resultUpdateRect, 0, 300, 700, 500);
1094     testRWcompare.resultNeedsUpdate = FALSE;
1095     testRWcompare.resultWmEraseGnd = FALSE;
1096     testRWcompare.resultWmNcPaint = FALSE;
1097     testRWcompare.resultPaintIndex = 1;
1098     ok(0 == TestRedrawWindow2(&testRW, &testRWcompare),"Test32 fail\n");
1099 
1100     testRW.testName = L"Test33";
1101     testRW.flags = RDW_INVALIDATE | RDW_NOCHILDREN;
1102     testRW.useRegion = TRUE;
1103     SetRect(&testRW.regRect, 0, 300, 700, 500);
1104     testRW.useRect = FALSE;
1105     SetRect(&testRW.rectRect, 0, 0, 200, 200);
1106     testRW.forcePaint = TRUE;
1107     testRW.testChild = TRUE;
1108 
1109     testRWcompare.resultColorPre1 = 0x00FF0000;
1110     testRWcompare.resultColorPre2 = 0x0000FF00;
1111     testRWcompare.resultColorPre1 = 0x00FF0000;
1112     testRWcompare.resultColorPost2 = 0x0000FF00;
1113     SetRect(&testRWcompare.resultUpdateRect, 0, 300, 700, 500);
1114     testRWcompare.resultNeedsUpdate = FALSE;
1115     testRWcompare.resultWmEraseGnd = FALSE;
1116     testRWcompare.resultWmNcPaint = FALSE;
1117     testRWcompare.resultPaintIndex = 2;
1118     ok(0 == TestRedrawWindow2(&testRW, &testRWcompare),"Test33 fail\n");
1119 
1120     testRW.testName = L"Test34";
1121     testRW.flags = RDW_VALIDATE | RDW_NOCHILDREN;
1122     testRW.useRegion = TRUE;
1123     SetRect(&testRW.regRect, 0, 300, 700, 500);
1124     testRW.useRect = FALSE;
1125     SetRect(&testRW.rectRect, 0, 0, 200, 200);
1126     testRW.forcePaint = TRUE;
1127     testRW.testChild = TRUE;
1128 
1129     testRWcompare.resultColorPre1 = 0x00FF0000;
1130     testRWcompare.resultColorPre2 = 0x0000FF00;
1131     testRWcompare.resultColorPost1 = 0x00FF0000;
1132     testRWcompare.resultColorPost2 = 0x0000FF00;
1133     SetRect(&testRWcompare.resultUpdateRect, 0, 300, 700, 500);
1134     testRWcompare.resultNeedsUpdate = FALSE;
1135     testRWcompare.resultWmEraseGnd = FALSE;
1136     testRWcompare.resultWmNcPaint = FALSE;
1137     testRWcompare.resultPaintIndex = 1;
1138     ok(0 == TestRedrawWindow2(&testRW, &testRWcompare),"Test34 fail\n");
1139 
1140     // rect defined area tests
1141     testRW.testName = L"Test35";
1142     testRW.flags = 0;
1143     testRW.useRegion = FALSE;
1144     SetRect(&testRW.regRect, 0, 300, 700, 500);
1145     testRW.useRect = TRUE;
1146     SetRect(&testRW.rectRect, 0, 300, 700, 500);
1147     testRW.forcePaint = TRUE;
1148     testRW.testChild = FALSE;
1149 
1150     testRWcompare.resultColorPre1 = 0x000000FF;
1151     testRWcompare.resultColorPre2 = 0x000000FF;
1152     testRWcompare.resultColorPost1 = 0x000000FF;
1153     testRWcompare.resultColorPost2 = 0x000000FF;
1154     SetRect(&testRWcompare.resultUpdateRect, 0, 0, 200, 200);
1155     testRWcompare.resultNeedsUpdate = FALSE;
1156     testRWcompare.resultWmEraseGnd = FALSE;
1157     testRWcompare.resultWmNcPaint = FALSE;
1158     testRWcompare.resultPaintIndex = 1;
1159     ok(0 == TestRedrawWindow2(&testRW, &testRWcompare),"Test35 fail\n");
1160 
1161     testRW.testName = L"Test36";
1162     testRW.flags = RDW_INVALIDATE | RDW_ERASENOW;
1163     testRW.useRegion = FALSE;
1164     SetRect(&testRW.regRect, 0, 300, 700, 500);
1165     testRW.useRect = TRUE;
1166     SetRect(&testRW.rectRect, 0, 300, 700, 500);
1167     testRW.forcePaint = TRUE;
1168     testRW.testChild = FALSE;
1169 
1170     testRWcompare.resultColorPre1 = 0x000000FF;
1171     testRWcompare.resultColorPre2 = 0x000000FF;
1172     testRWcompare.resultColorPost1 = 0x000000FF;
1173     testRWcompare.resultColorPost2 = 0x0000FF00;
1174     SetRect(&testRWcompare.resultUpdateRect, 0, 300, 700, 500);
1175     testRWcompare.resultNeedsUpdate = TRUE;
1176     testRWcompare.resultWmEraseGnd = FALSE;
1177     testRWcompare.resultWmNcPaint = FALSE;
1178     testRWcompare.resultPaintIndex = 2;
1179     ok(0 == TestRedrawWindow2(&testRW, &testRWcompare),"Test36 fail\n");
1180 }
1181 
START_TEST(RedrawWindow)1182 START_TEST(RedrawWindow)
1183 {
1184     FlagsRedrawWindowTest();
1185     GetMessageRedrawWindowTest();
1186 }
1187