ReactOS 0.4.16-dev-550-g2186ce3
RedrawWindow.c File Reference
#include "precomp.h"
Include dependency graph for RedrawWindow.c:

Go to the source code of this file.

Classes

struct  STRUCT_TestRedrawWindow
 
struct  STRUCT_TestRedrawWindowCompare
 

Typedefs

typedef struct STRUCT_TestRedrawWindow STRUCT_TestRedrawWindow
 
typedef struct STRUCT_TestRedrawWindowCompare STRUCT_TestRedrawWindowCompare
 

Functions

static LRESULT CALLBACK WndProc (_In_ HWND hWnd, _In_ UINT message, _In_ WPARAM wParam, _In_ LPARAM lParam)
 
void GetMessageRedrawWindowTest (void)
 
void DrawContent (HDC hdc, RECT *rect, COLORREF color)
 
LRESULT CALLBACK WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
LRESULT CALLBACK ChildWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
void ServeSomeMessages (int messageTime, int messageCount)
 
void TestRedrawWindow (STRUCT_TestRedrawWindow *ptestRW)
 
UINT TestRedrawWindow2 (STRUCT_TestRedrawWindow *ptestRW, STRUCT_TestRedrawWindowCompare *ptestRWcompare)
 
void FlagsRedrawWindowTest (void)
 
 START_TEST (RedrawWindow)
 

Variables

static DWORD dwThreadId
 
static BOOL got_paint
 
BOOL resultWmEraseGnd = FALSE
 
BOOL resultWmNcPaint = FALSE
 
int paintIndex = 0
 
const wchar_t CHILD_CLASS_NAME [] = L"ChildWindowClass"
 

Typedef Documentation

◆ STRUCT_TestRedrawWindow

◆ STRUCT_TestRedrawWindowCompare

Function Documentation

◆ ChildWindowProc()

LRESULT CALLBACK ChildWindowProc ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 142 of file RedrawWindow.c.

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 {
169 return 0;
170 }
171 }
172 return DefWindowProcW(hwnd, uMsg, wParam, lParam);
173}
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define RGB(r, g, b)
Definition: precomp.h:71
pKey DeleteObject()
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:88
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
#define WM_PAINT
Definition: winuser.h:1623
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_SYNCPAINT
Definition: winuser.h:1693
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
#define WM_DESTROY
Definition: winuser.h:1612
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)

Referenced by TestRedrawWindow().

◆ DrawContent()

void DrawContent ( HDC  hdc,
RECT rect,
COLORREF  color 
)

Definition at line 95 of file RedrawWindow.c.

96{
97 HBRUSH hBrush = CreateSolidBrush(color);
98 FillRect(hdc, rect, hBrush);
99 DeleteObject(hBrush);
100
102 SetTextColor(hdc, RGB(255, 255, 255));
103 DrawTextW(hdc, L"Test RedrawWindow", -1, rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
104}
GLuint color
Definition: glext.h:6243
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:16
#define L(x)
Definition: ntvdm.h:50
& rect
Definition: startmenu.cpp:1413
#define TRANSPARENT
Definition: wingdi.h:950
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1056
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:918
#define DT_CENTER
Definition: winuser.h:527
#define DT_SINGLELINE
Definition: winuser.h:540
#define DT_VCENTER
Definition: winuser.h:543

Referenced by TestRedrawWindow(), and WindowProc().

◆ FlagsRedrawWindowTest()

void FlagsRedrawWindowTest ( void  )

Definition at line 434 of file RedrawWindow.c.

435{
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",
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";
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";
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";
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";
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";
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";
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";
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";
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";
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";
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";
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";
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";
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";
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";
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";
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";
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";
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}
UINT TestRedrawWindow2(STRUCT_TestRedrawWindow *ptestRW, STRUCT_TestRedrawWindowCompare *ptestRWcompare)
Definition: RedrawWindow.c:354
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
const wchar_t * testName
Definition: RedrawWindow.c:177
#define SM_CYSCREEN
Definition: winuser.h:963
#define RDW_NOINTERNALPAINT
Definition: winuser.h:1220
#define RDW_UPDATENOW
Definition: winuser.h:1223
#define RDW_ERASE
Definition: winuser.h:1214
#define RDW_NOCHILDREN
Definition: winuser.h:1225
#define RDW_ALLCHILDREN
Definition: winuser.h:1224
#define RDW_ERASENOW
Definition: winuser.h:1222
#define RDW_FRAME
Definition: winuser.h:1215
#define SM_CXSCREEN
Definition: winuser.h:962
#define RDW_NOFRAME
Definition: winuser.h:1219
#define RDW_INTERNALPAINT
Definition: winuser.h:1216
#define RDW_NOERASE
Definition: winuser.h:1218
#define RDW_VALIDATE
Definition: winuser.h:1221
int WINAPI GetSystemMetrics(_In_ int)
#define RDW_INVALIDATE
Definition: winuser.h:1217
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)

Referenced by START_TEST().

◆ GetMessageRedrawWindowTest()

void GetMessageRedrawWindowTest ( void  )

Definition at line 37 of file RedrawWindow.c.

38{
39 HWND hWnd;
40 MSG msg;
41 HRGN hRgn;
42 BOOL ret;
43 int i;
44
45 SetCursorPos(0,0);
46
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
54
55 while (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE))
56 {
58 }
59
60 ok(got_paint == TRUE, "Did not process WM_PAINT message\n");
62
63 hRgn = CreateRectRgn(0, 0, 1, 1);
64 ok(hRgn != NULL, "CreateRectRgn failed\n");
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 {
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
90
93}
static LRESULT CALLBACK WndProc(_In_ HWND hWnd, _In_ UINT message, _In_ WPARAM wParam, _In_ LPARAM lParam)
Definition: RedrawWindow.c:22
static DWORD dwThreadId
Definition: RedrawWindow.c:11
static BOOL got_paint
Definition: RedrawWindow.c:12
#define msg(x)
Definition: auth_time.c:54
HWND hWnd
Definition: settings.c:17
#define NULL
Definition: types.h:112
unsigned int BOOL
Definition: ntddk_ex.h:94
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static HRGN hRgn
Definition: mapping.c:33
#define RECORD_MESSAGE(...)
Definition: msgtrace.h:60
#define TRACE_CACHE()
Definition: msgtrace.h:58
@ POST
Definition: msgtrace.h:7
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
static __inline ATOM RegisterSimpleClass(WNDPROC lpfnWndProc, LPCWSTR lpszClassName)
int ret
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459
HRGN WINAPI CreateRectRgn(_In_ int, _In_ int, _In_ int, _In_ int)
BOOL WINAPI RedrawWindow(_In_opt_ HWND, _In_opt_ LPCRECT, _In_opt_ HRGN, _In_ UINT)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI SetCursorPos(_In_ int, _In_ int)
Definition: cursoricon.c:2748
BOOL WINAPI PeekMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define PM_REMOVE
Definition: winuser.h:1199
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
#define SW_SHOW
Definition: winuser.h:778
BOOL WINAPI DestroyWindow(_In_ HWND)

Referenced by START_TEST().

◆ ServeSomeMessages()

void ServeSomeMessages ( int  messageTime,
int  messageCount 
)

Definition at line 219 of file RedrawWindow.c.

220{
222
223 MSG msg = { 0 };
225 while (GetTickCount() - startTime < messageTime * messageCount)
226 {
227 if (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE))
228 {
231 }
232 else
233 {
234 Sleep(messageTime);
235 }
236 }
237}
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:455
static ULONGLONG startTime
Definition: main.c:113
unsigned long DWORD
Definition: ntddk_ex.h:95
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
BOOL WINAPI TranslateMessage(_In_ const MSG *)

Referenced by TestRedrawWindow().

◆ START_TEST()

START_TEST ( RedrawWindow  )

Definition at line 1182 of file RedrawWindow.c.

1183{
1186}
void GetMessageRedrawWindowTest(void)
Definition: RedrawWindow.c:37
void FlagsRedrawWindowTest(void)
Definition: RedrawWindow.c:434

◆ TestRedrawWindow()

void TestRedrawWindow ( STRUCT_TestRedrawWindow ptestRW)

Definition at line 239 of file RedrawWindow.c.

240{
241 DWORD style;
242 int width;
243 int height;
244 HWND hChildWnd = NULL;
245 HRGN RgnUpdate;
246 RECT* prect;
247
250 paintIndex = 0;
251
252 WNDCLASSW wc = { 0 };
255 wc.lpszClassName = ptestRW->testName;
256 RegisterClassW(&wc);
257 RECT rectWin = { 0, 0, 700, 500 };
259 AdjustWindowRectEx(&rectWin, style, FALSE, 0);
260 width = rectWin.right - rectWin.left;
261 height = rectWin.bottom - rectWin.top;
264 if (hwnd == NULL)
265 return;
266 MoveWindow(hwnd, 10, 10, width, height, TRUE);
267
269 if(!ptestRW->testChild)
271
272 if (ptestRW->testChild)
273 {
274 WNDCLASSW wcChild = { 0 };
276 wcChild.hInstance = GetModuleHandle(NULL);
278 RegisterClassW(&wcChild);
279
280 hChildWnd = CreateWindowExW(
281 0,
283 L"Child Window",
285 10, 10, 200, 200,
286 hwnd,
287 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));
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);
328
330
331 if (ptestRW->forcePaint)
332 {
334 }
335
336 hdc = GetDC(hwnd);
337 ptestRW->resultColorPost1 = GetPixel(hdc, ptestRW->testPixelPost1x, ptestRW->testPixelPost1y);
338 ptestRW->resultColorPost2 = GetPixel(hdc, ptestRW->testPixelPost2x, ptestRW->testPixelPost2y);
340
343 ptestRW->resultPaintIndex = paintIndex;
344
345 if (RgnUpdate)
346 DeleteObject(RgnUpdate);
347
348 if (hChildWnd != NULL)
349 DestroyWindow(hChildWnd);
350 if (hwnd != NULL)
352}
LRESULT CALLBACK ChildWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: RedrawWindow.c:142
BOOL resultWmNcPaint
Definition: RedrawWindow.c:15
int paintIndex
Definition: RedrawWindow.c:16
const wchar_t CHILD_CLASS_NAME[]
Definition: RedrawWindow.c:17
BOOL resultWmEraseGnd
Definition: RedrawWindow.c:14
void DrawContent(HDC hdc, RECT *rect, COLORREF color)
Definition: RedrawWindow.c:95
void ServeSomeMessages(int messageTime, int messageCount)
Definition: RedrawWindow.c:219
LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: RedrawWindow.c:106
Arabic default style
Definition: afstyles.h:94
DWORD GetPixel(LPDIRECTDRAWSURFACE7 Surface, UINT x, UINT y)
Definition: blt.cpp:2
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
#define WS_CHILD
Definition: pedump.c:617
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define WS_VISIBLE
Definition: pedump.c:620
LPCWSTR lpszClassName
Definition: winuser.h:3188
HINSTANCE hInstance
Definition: winuser.h:3183
WNDPROC lpfnWndProc
Definition: winuser.h:3180
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
#define GetModuleHandle
Definition: winbase.h:3852
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
BOOL WINAPI AdjustWindowRectEx(_Inout_ LPRECT, _In_ DWORD, _In_ BOOL, _In_ DWORD)
BOOL WINAPI UpdateWindow(_In_ HWND)
HDC WINAPI GetDC(_In_opt_ HWND)
#define CW_USEDEFAULT
Definition: winuser.h:225
BOOL WINAPI GetUpdateRect(_In_ HWND, _Out_opt_ LPRECT, _In_ BOOL)
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)

Referenced by TestRedrawWindow2().

◆ TestRedrawWindow2()

UINT TestRedrawWindow2 ( STRUCT_TestRedrawWindow ptestRW,
STRUCT_TestRedrawWindowCompare ptestRWcompare 
)

Definition at line 354 of file RedrawWindow.c.

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}
void TestRedrawWindow(STRUCT_TestRedrawWindow *ptestRW)
Definition: RedrawWindow.c:239
unsigned int UINT
Definition: ndis.h:50

Referenced by FlagsRedrawWindowTest().

◆ WindowProc()

LRESULT CALLBACK WindowProc ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 106 of file RedrawWindow.c.

107{
108 switch (uMsg)
109 {
110 case WM_DESTROY:
111 {
113 return 0;
114 }
115 case WM_PAINT:
116 {
117 PAINTSTRUCT ps;
118 HDC hdc = BeginPaint(hwnd, &ps);
119 RECT 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)
130 return 0;
131 }
132 case WM_NCPAINT:
133 {
134 if (paintIndex != 0)
136 return 0;
137 }
138 }
139 return DefWindowProcW(hwnd, uMsg, wParam, lParam);
140}
#define WM_ERASEBKGND
Definition: winuser.h:1628
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define WM_NCPAINT
Definition: winuser.h:1690

Referenced by TestRedrawWindow().

◆ WndProc()

static LRESULT CALLBACK WndProc ( _In_ HWND  hWnd,
_In_ UINT  message,
_In_ WPARAM  wParam,
_In_ LPARAM  lParam 
)
static

Definition at line 22 of file RedrawWindow.c.

27{
29 ok(GetCurrentThreadId() == dwThreadId, "Thread 0x%lx instead of 0x%lx\n", GetCurrentThreadId(), dwThreadId);
30 if (message == WM_PAINT)
31 {
33 }
35}
#define disable_success_count
Definition: test.h:184
Definition: tftpd.h:60

Referenced by GetMessageRedrawWindowTest().

Variable Documentation

◆ CHILD_CLASS_NAME

const wchar_t CHILD_CLASS_NAME[] = L"ChildWindowClass"

Definition at line 17 of file RedrawWindow.c.

Referenced by TestRedrawWindow().

◆ dwThreadId

DWORD dwThreadId
static

Definition at line 11 of file RedrawWindow.c.

Referenced by GetMessageRedrawWindowTest(), and WndProc().

◆ got_paint

BOOL got_paint
static

Definition at line 12 of file RedrawWindow.c.

Referenced by GetMessageRedrawWindowTest(), and WndProc().

◆ paintIndex

int paintIndex = 0

Definition at line 16 of file RedrawWindow.c.

Referenced by TestRedrawWindow(), and WindowProc().

◆ resultWmEraseGnd

BOOL resultWmEraseGnd = FALSE

Definition at line 14 of file RedrawWindow.c.

Referenced by TestRedrawWindow(), and WindowProc().

◆ resultWmNcPaint

BOOL resultWmNcPaint = FALSE

Definition at line 15 of file RedrawWindow.c.

Referenced by TestRedrawWindow(), and WindowProc().