All pastes #1480554 Raw Edit

Another go at testing for bug 10

public text v1 · immutable
#1480554 ·published 2009-07-01 09:46 UTC
rendered paste body
From c7d3005b476728fa86d32829439a3e5a0528b7df Mon Sep 17 00:00:00 2001
From: Austin Lund <austin.lund@gmail.com>
Date: Wed, 1 Jul 2009 19:24:45 +1000
Subject: [PATCH] user32/tests: Test for processing multiple WM_NCPAINT messages

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

diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index d45eba3..061c3e1 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -4859,6 +4859,42 @@ static void test_Expose(void)
     DestroyWindow(mw);
 }
 
+static LRESULT CALLBACK TestMultiplePaint_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+    if(msg == WM_NCPAINT)
+    {
+      LRESULT ret;
+      MSG getmsg;
+      PostMessage(hwnd,msg,wParam,lParam);
+      PostMessage(hwnd,msg,wParam,lParam);
+      ret = DefWindowProc(hwnd,msg,wParam,lParam);
+
+      todo_wine ok(PeekMessage(&getmsg, hwnd, WM_NCPAINT, WM_NCPAINT, PM_NOREMOVE)==0,
+	 "Not all WM_NCPAINT messages were processed\n");
+
+      return ret;
+    }
+    return DefWindowProc(hwnd, msg, wParam, lParam);
+}
+
+static void test_MultiplePaint(void)
+{
+    ATOM atom;
+    WNDCLASSA cls;
+    HWND mw;
+    memset(&cls, 0, sizeof(WNDCLASSA));
+    cls.lpfnWndProc = TestMultiplePaint_WndProc;
+    cls.hbrBackground = GetStockObject(WHITE_BRUSH);
+    cls.lpszClassName = "TestMultiplePaint";
+    atom = RegisterClassA(&cls);
+
+    mw = CreateWindowA("TestMultiplePaint", "MainWindow", WS_VISIBLE|WS_OVERLAPPEDWINDOW,
+                            0, 0, 200, 100, NULL, NULL, 0, NULL);
+
+    UpdateWindow(mw);
+    DestroyWindow(mw);
+}
+
 static void test_GetWindowModuleFileName(void)
 {
     HWND hwnd;
@@ -5669,6 +5705,7 @@ START_TEST(win)
     if (0) test_gettext(); /* crashes on NT4 */
     test_GetUpdateRect();
     test_Expose();
+    test_MultiplePaint();
     test_layered_window();
 
     test_SetForegroundWindow(hwndMain);
-- 
1.6.0.4