rendered paste bodyFrom 600943ad194d75a2e59ae567ff4340f6dfb4ebb0 Mon Sep 17 00:00:00 2001
From: Austin Lund <austin.lund@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..9cad2c3 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,0x401);
+ 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);
+ 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