From: Rodrigo Rivas Subject: [3/4] user32: Add test case for EndDeferWindowPos() with destroyed HWND (try 2) Message-Id: Date: Wed, 2 Sep 2015 15:38:05 +0200 --- dlls/user32/tests/win.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index 4acfabe..6105752 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -8256,6 +8256,54 @@ static void test_bogus_DeferWindowPos(void) } } +static void test_destroyed_DeferWindowPos(void) +{ + HWND hwnds[3]; + int i; + BOOL res; + HDWP hdwp, hdwp2; + RECT rect; + + for (i = 0; i < 3; ++i) + { + hwnds[i] = CreateWindowExA(0, "button", "button", WS_VISIBLE, + 0, 0, 100, 100, 0, 0, 0, NULL); + } + + hdwp = BeginDeferWindowPos(1); + ok(hdwp != NULL, "BeginDeferWindowPos failed\n"); + for (i = 0; i < 3; ++i) + { + hdwp2 = DeferWindowPos(hdwp, hwnds[i], NULL, 0, 100, 0, 0, SWP_NOZORDER|SWP_NOSIZE|SWP_NOACTIVATE); + if (hdwp2) + hdwp = hdwp2; + ok(hdwp2 != NULL, "DeferWindowPos failed\n"); + } + DestroyWindow(hwnds[1]); + hwnds[1] = NULL; + + res = EndDeferWindowPos(hdwp); + todo_wine ok(res, "EndDeferWindowPos with destroyed HWND failed\n"); + + for (i = 0; i < 3; ++i) + { + if (!hwnds[i]) + continue; + GetWindowRect(hwnds[i], &rect); + if (i == 2) + todo_wine ok(rect.top == 100, "Deferred movement with destroyed HWND failed\n"); + else + ok(rect.top == 100, "Deferred movement with destroyed HWND failed\n"); + } + + for (i = 0; i < 3; ++i) + { + if (!hwnds[i]) + continue; + DestroyWindow(hwnds[i]); + } +} + START_TEST(win) { char **argv; @@ -8391,6 +8439,7 @@ START_TEST(win) test_DeferWindowPos(); test_bogus_DeferWindowPos(); + test_destroyed_DeferWindowPos(); /* add the tests above this line */ if (hhook) UnhookWindowsHookEx(hhook);