user32/tests: Added test for infinite WM_PAINT loop (resend)

Austin Lund austin.lund at gmail.com
Sat Jul 4 20:21:54 CDT 2009


The last time I sent this, the patch was broken.  I've tested it on
WinXPsp2 and wine-1.1.25.  This patch relates to bug 10522.
-------------- next part --------------
From 451501275ea94119b0bd846c01bc6be0b77c1467 Mon Sep 17 00:00:00 2001
From: Austin Lund <austin.lund at gmail.com>
Date: Thu, 2 Jul 2009 15:25:59 +1000
Subject: [PATCH] user32/tests: Added test for infinite WM_PAINT loop

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

diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index d45eba3..cbd4a3e 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -4859,6 +4859,56 @@ static void test_Expose(void)
     DestroyWindow(mw);
 }
 
+static LRESULT CALLBACK TestNCRedraw_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+    if(msg == WM_NCPAINT)
+    {
+        RedrawWindow(hwnd, NULL, NULL, RDW_FRAME | RDW_INVALIDATE);
+        return DefWindowProc(hwnd, msg, wParam, lParam);
+    }
+    return DefWindowProc(hwnd, msg, wParam, lParam);
+}
+
+static void test_NCRedraw(void)
+{
+    WNDCLASSA wndclass;
+    HWND hwnd;
+    HRGN hrgn;
+    int updatergnret;
+
+    wndclass.lpszClassName = "TestNCRedrawClass";
+    wndclass.style = CS_HREDRAW | CS_VREDRAW;
+    wndclass.lpfnWndProc = TestNCRedraw_WndProc;
+    wndclass.cbClsExtra = 0;
+    wndclass.cbWndExtra = 0;
+    wndclass.hInstance = 0;
+    wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
+    wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
+    wndclass.hbrBackground = GetStockObject(WHITE_BRUSH);
+    wndclass.lpszMenuName = NULL;
+
+    RegisterClassA(&wndclass);
+
+    hwnd = CreateWindowA("TestNCRedrawClass", "MainWindow", WS_VISIBLE|WS_OVERLAPPEDWINDOW,
+                         0, 0, 200, 100, NULL, NULL, 0, NULL);
+
+    ShowWindow(hwnd,1);
+
+    hrgn = CreateRectRgn(0, 0, 0, 0);
+    updatergnret = GetUpdateRgn(hwnd, hrgn, FALSE);
+    ok(updatergnret == SIMPLEREGION, "No update region for new window (%d)\n", updatergnret);
+    DeleteObject(hrgn);
+
+    CallWindowProc(TestNCRedraw_WndProc, hwnd, WM_PAINT, 0, 0);
+
+    hrgn = CreateRectRgn(0, 0, 0, 0);
+    updatergnret = GetUpdateRgn(hwnd, hrgn, FALSE);
+    todo_wine ok(updatergnret == NULLREGION, "WM_PAINT failed to clear update region (%d)\n", updatergnret);
+    DeleteObject(hrgn);
+
+    DestroyWindow(hwnd);
+}
+
 static void test_GetWindowModuleFileName(void)
 {
     HWND hwnd;
@@ -5669,6 +5719,7 @@ START_TEST(win)
     if (0) test_gettext(); /* crashes on NT4 */
     test_GetUpdateRect();
     test_Expose();
+    test_NCRedraw();
     test_layered_window();
 
     test_SetForegroundWindow(hwndMain);
-- 
1.6.0.4


More information about the wine-patches mailing list