user32: Add tests for BeginPaint

Илья Шпигорь shpigor at etersoft.ru
Fri Jul 4 04:40:08 CDT 2008


---
 dlls/user32/tests/msg.c |   86 
+++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 86 insertions(+), 0 deletions(-)

diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index f68f73a..e925e72 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -114,6 +114,14 @@ struct message {
     LPARAM lParam;         /* expected value of lParam */
 };
 
+/*BeginPaint for child window*/
+static const struct message WmBeginPaintChild[] = {
+    { WM_NCPAINT, sent},
+    { WM_ERASEBKGND, sent},
+    { 0 }
+};
+
+
 /* Empty message sequence */
 static const struct message WmEmptySeq[] =
 {
@@ -4783,6 +4791,83 @@ static void subclass_button(void)
     if (!RegisterClassA(&cls)) assert(0);
 }
 
+static void test_BeginPaint(void)
+{
+    HDC hdc;
+    PAINTSTRUCT ps;
+    HWND hwnd,hchild;
+
+/*Test overlapped window*/
+    hwnd = CreateWindowExA( 0, "TestWindowClass", "Test overlapped", 
WS_OVERLAPPEDWINDOW | WS_VISIBLE, 100, 100, 200, 200, 0, 0, 0, NULL );
+    ok( hwnd != 0, "Failed to create overlapped window\n" );
+    flush_sequence();
+    hdc = BeginPaint( hwnd, &ps );
+    ok_sequence( WmEmptySeq, "test_BeginPaint failed: message sequences not 
compatible for overlapped window", TRUE );
+    EndPaint( hwnd, &ps );
+    DestroyWindow( hwnd );
+
+/*Test popup window*/
+    hwnd = CreateWindowExA( 0, "TestWindowClass", "Test popup", 
WS_POPUPWINDOW | WS_VISIBLE, 100, 100, 200, 200, 0, 0, 0, NULL );
+    ok( hwnd != 0, "Failed to create popup window\n" );
+    flush_sequence();
+    hdc = BeginPaint( hwnd, &ps );
+    ok_sequence( WmEmptySeq, "test_BeginPaint failed: message sequences not 
compatible for popup window", TRUE );
+    EndPaint( hwnd, &ps );
+    DestroyWindow( hwnd );
+
+/*Test tiled window*/
+    hwnd = CreateWindowExA( 0, "TestWindowClass", "Test tiled", 
WS_TILEDWINDOW | WS_VISIBLE, 100, 100, 200, 200, 0, 0, 0, NULL );
+    ok( hwnd != 0, "Failed to create tiled window\n" );
+    flush_sequence();
+    hdc = BeginPaint( hwnd, &ps );
+    ok_sequence( WmEmptySeq, "test_BeginPaint failed: message sequences not 
compatible for tiled window", TRUE );
+    EndPaint( hwnd, &ps );
+    DestroyWindow( hwnd );
+
+/*Test child window*/
+    hwnd = CreateWindowExA( 0, "TestWindowClass", "Test overlapped", 
WS_OVERLAPPEDWINDOW | WS_VISIBLE, 100, 100, 200, 200, 0, 0, 0, NULL );
+    ok( hwnd != 0, "Failed to create overlapped window\n" );
+    hchild = CreateWindowExA( 0, "TestWindowClass", "Test child", WS_CHILD | 
WS_VISIBLE, 0, 0, 10, 10, hwnd, 0, 0, NULL );
+    ok( hchild != 0, "Failed to create child\n" );
+    flush_sequence();
+    hdc = BeginPaint( hwnd, &ps );
+    ok_sequence( WmEmptySeq, "test_BeginPaint failed: message sequences not 
compatible for overlapped window with child window", TRUE );
+    EndPaint( hwnd, &ps );
+    flush_sequence();
+    hdc = BeginPaint( hchild, &ps );
+    ok_sequence( WmBeginPaintChild, "test_BeginPaint failed: message 
sequences not compatible for child window", FALSE );
+    EndPaint( hchild, &ps );
+    DestroyWindow( hchild );
+    DestroyWindow( hwnd );
+
+/*Test invisible window*/
+    hwnd = CreateWindowExA( 0, "TestWindowClass", "Test overlapped", 
WS_OVERLAPPEDWINDOW, 100, 100, 200, 200, 0, 0, 0, NULL );
+    ok( hwnd != 0, "Failed to create overlapped window\n" );
+    flush_sequence();
+    hdc = BeginPaint( hwnd, &ps );
+    ok_sequence( WmEmptySeq, "test_BeginPaint failed: message sequences not 
compatible for unvisible overlapped window", TRUE );
+    EndPaint( hwnd, &ps );
+    DestroyWindow( hwnd );
+
+/*Test for minimized window*/
+    hwnd = CreateWindowExA( 0, "TestWindowClass", "Test overlapped", 
WS_OVERLAPPEDWINDOW | WS_MINIMIZE | WS_VISIBLE, 100, 100, 200, 200, 0, 0, 0, 
NULL );
+    ok( hwnd != 0, "Failed to create overlapped window\n" );
+    flush_sequence();
+    hdc = BeginPaint( hwnd, &ps );
+    ok_sequence( WmEmptySeq, "test_BeginPaint failed: message sequences not 
compatible for minimized overlapped window", TRUE);
+    EndPaint( hwnd, &ps );
+    DestroyWindow( hwnd );
+
+/*Test for maximized window*/
+    hwnd = CreateWindowExA( 0, "TestWindowClass", "Test overlapped", 
WS_OVERLAPPEDWINDOW | WS_MAXIMIZE | WS_VISIBLE, 100, 100, 200, 200, 0, 0, 0, 
NULL );
+    ok( hwnd != 0, "Failed to create overlapped window\n" );
+    flush_sequence();
+    hdc = BeginPaint( hwnd, &ps );
+    ok_sequence( WmEmptySeq, "test_BeginPaint failed: message sequences not 
compatible for maximized overlapped window", TRUE );
+    EndPaint( hwnd, &ps );
+    DestroyWindow( hwnd );
+}
+
 static void test_button_messages(void)
 {
     static const struct
@@ -10491,6 +10576,7 @@ START_TEST(msg)
     hEvent_hook = 0;
 #endif
 
+    test_BeginPaint();
     test_ShowWindow();
     test_PeekMessage();
     test_PeekMessage2();
-- 
1.5.4.5.GIT




More information about the wine-patches mailing list