Signed-off-by: Zebediah Figura z.figura12@gmail.com --- This mitigates an intermittent failure in the tests for LockWindowUpdate() on the testbot, reducing it from a crash to a normal failure. For as-yet undetermined reasons, the test window is being minimized, causing GetPixel() to attempt to access memory around (-32000,-32000) pixels outside of the window's actual bitmap.
More work should be done in the interest of using actual Win32 minimized windows, rather than icons; this however is just an attempt to fix the tests.
dlls/user32/nonclient.c | 5 +++++ dlls/user32/tests/win.c | 21 +++++++++++++-------- 2 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/dlls/user32/nonclient.c b/dlls/user32/nonclient.c index 2b38897..0edf439 100644 --- a/dlls/user32/nonclient.c +++ b/dlls/user32/nonclient.c @@ -457,6 +457,11 @@ LRESULT NC_HandleNCCalcSize( HWND hwnd, WPARAM wparam, RECT *winRect ) if (winRect->left > winRect->right) winRect->right = winRect->left; } + else + { + winRect->right = winRect->left; + winRect->bottom = winRect->top; + } return result; }
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index 4190c7f..54484ae 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -1082,7 +1082,7 @@ static void wine_AdjustWindowRectEx( RECT *rect, LONG style, BOOL menu, LONG exS static void test_nonclient_area(HWND hwnd) { DWORD style, exstyle; - RECT rc_window, rc_client, rc; + RECT rc_window, rc_client, rc_minimized, rc_empty, rc; BOOL menu; LRESULT ret;
@@ -1124,6 +1124,18 @@ static void test_nonclient_area(HWND hwnd) ret = DefWindowProcA(hwnd, WM_NCCALCSIZE, 0, 0); ok(ret == 0, "NULL rectangle returned %ld instead of 0\n", ret);
+ /* try minimized */ + ShowWindow(hwnd, SW_MINIMIZE); + GetWindowRect(hwnd, &rc_minimized); + SetRectEmpty(&rc_empty); + rc = rc_minimized; + DefWindowProcA(hwnd, WM_NCCALCSIZE, 0, (LPARAM)&rc); + MapWindowPoints(0, hwnd, (LPPOINT)&rc, 2); + ok(EqualRect(&rc, &rc_empty), + "client rect does not match: style:exstyle=0x%08x:0x%08x, menu=%d client=%s, calc=%s\n", + style, exstyle, menu, wine_dbgstr_rect(&rc_empty), wine_dbgstr_rect(&rc)); + ShowWindow(hwnd, SW_RESTORE); + /* Win9x doesn't like WM_NCCALCSIZE with synthetic data and crashes */; if (is_win9x) return; @@ -6592,7 +6604,6 @@ static void test_ShowWindow(void) ok(EqualRect(&rcMinimized, &rc), "expected %s, got %s\n", wine_dbgstr_rect(&rcMinimized), wine_dbgstr_rect(&rc)); GetClientRect(hwnd, &rc); - todo_wine ok(EqualRect(&rcEmpty, &rc), "expected %s, got %s\n", wine_dbgstr_rect(&rcEmpty), wine_dbgstr_rect(&rc)); /* shouldn't be able to resize minimized windows */ @@ -6606,7 +6617,6 @@ static void test_ShowWindow(void) ok(EqualRect(&rcMinimized, &rc), "expected %s, got %s\n", wine_dbgstr_rect(&rcMinimized), wine_dbgstr_rect(&rc)); GetClientRect(hwnd, &rc); - todo_wine ok(EqualRect(&rcEmpty, &rc), "expected %s, got %s\n", wine_dbgstr_rect(&rcEmpty), wine_dbgstr_rect(&rc)); /* SetWindowPos shouldn't affect the client rect */ @@ -6618,7 +6628,6 @@ static void test_ShowWindow(void) ok(EqualRect(&rcMinimized, &rc), "expected %s, got %s\n", wine_dbgstr_rect(&rcMinimized), wine_dbgstr_rect(&rc)); GetClientRect(hwnd, &rc); - todo_wine ok(EqualRect(&rcEmpty, &rc), "expected %s, got %s\n", wine_dbgstr_rect(&rcEmpty), wine_dbgstr_rect(&rc));
@@ -6710,7 +6719,6 @@ static void test_ShowWindow(void) ok(EqualRect(&rcMinimized, &rc), "expected %s, got %s\n", wine_dbgstr_rect(&rcMinimized), wine_dbgstr_rect(&rc)); GetClientRect(hwnd, &rc); - todo_wine ok(EqualRect(&rcEmpty, &rc), "expected %s, got %s\n", wine_dbgstr_rect(&rcEmpty), wine_dbgstr_rect(&rc));
@@ -6726,7 +6734,6 @@ static void test_ShowWindow(void) ok(EqualRect(&rcMinimized, &rc), "expected %s, got %s\n", wine_dbgstr_rect(&rcMinimized), wine_dbgstr_rect(&rc)); GetClientRect(hwnd, &rc); - todo_wine ok(EqualRect(&rcEmpty, &rc), "expected %s, got %s\n", wine_dbgstr_rect(&rcEmpty), wine_dbgstr_rect(&rc));
@@ -6769,7 +6776,6 @@ static void test_ShowWindow(void) ok(EqualRect(&rcMinimized, &rc), "expected %s, got %s\n", wine_dbgstr_rect(&rcMinimized), wine_dbgstr_rect(&rc)); GetClientRect(hwnd, &rc); - todo_wine ok(EqualRect(&rcEmpty, &rc), "expected %s, got %s\n", wine_dbgstr_rect(&rcEmpty), wine_dbgstr_rect(&rc)); DestroyWindow(hwnd); @@ -6788,7 +6794,6 @@ static void test_ShowWindow(void) ok(EqualRect(&rcMinimized, &rc), "expected %s, got %s\n", wine_dbgstr_rect(&rcMinimized), wine_dbgstr_rect(&rc)); GetClientRect(hwnd, &rc); - todo_wine ok(EqualRect(&rcEmpty, &rc), "expected %s, got %s\n", wine_dbgstr_rect(&rcEmpty), wine_dbgstr_rect(&rc)); DestroyWindow(hwnd);