From d99fe44b3075dc81ef91c9752527650adc6a88b9 Mon Sep 17 00:00:00 2001 From: Austin Lund 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 | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 44 insertions(+), 0 deletions(-) diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index d45eba3..b6480b3 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -4859,6 +4859,49 @@ 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) +{ + ATOM atom; + WNDCLASSA cls; + HWND hwnd; + HRGN hrgn; + int updatergnret; + + memset(&cls, 0, sizeof(WNDCLASSA)); + cls.lpfnWndProc = TestNCRedraw_WndProc; + cls.hbrBackground = GetStockObject(WHITE_BRUSH); + cls.lpszClassName = "TestNCRedrawClass"; + atom = RegisterClassA(&cls); + + 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); + 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 +5712,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