quartz/tests: Avoid testing the result of GetQueueStatus().

It's very unreliable; our window can receive messages not related to the ones we're trying to test.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2021-05-17 10:49:12 -05:00 committed by Alexandre Julliard
parent 13cac6287c
commit 44472fae6b
3 changed files with 93 additions and 39 deletions

View File

@ -2109,37 +2109,55 @@ static void test_video_window_messages(IVideoWindow *window, HWND hwnd, HWND our
flush_events();
/* Demonstrate that messages should be sent, not posted, and that only some
* messages should be forwarded. A previous implementation unconditionally
* posted all messages. */
hr = IVideoWindow_NotifyOwnerMessage(window, (OAHWND)our_hwnd, WM_SYSCOLORCHANGE, 0, 0);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ret = GetQueueStatus(QS_SENDMESSAGE | QS_POSTMESSAGE);
ok(!ret, "Got unexpected status %#x.\n", ret);
while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
{
ok(msg.message != WM_SYSCOLORCHANGE, "WM_SYSCOLORCHANGE should not be posted.\n");
DispatchMessageA(&msg);
}
hr = IVideoWindow_NotifyOwnerMessage(window, (OAHWND)our_hwnd, WM_SETCURSOR,
(WPARAM)hwnd, MAKELONG(HTCLIENT, WM_MOUSEMOVE));
hr = IVideoWindow_NotifyOwnerMessage(window, (OAHWND)our_hwnd, WM_FONTCHANGE, 0, 0);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ret = GetQueueStatus(QS_SENDMESSAGE | QS_POSTMESSAGE);
ok(!ret, "Got unexpected status %#x.\n", ret);
while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
{
ok(msg.message != WM_FONTCHANGE, "WM_FONTCHANGE should not be posted.\n");
DispatchMessageA(&msg);
}
params.window = window;
params.hwnd = our_hwnd;
params.message = WM_SYSCOLORCHANGE;
thread = CreateThread(NULL, 0, notify_message_proc, &params, 0, NULL);
ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block.\n");
ret = GetQueueStatus(QS_SENDMESSAGE | QS_POSTMESSAGE);
ok(ret == ((QS_SENDMESSAGE << 16) | QS_SENDMESSAGE), "Got unexpected status %#x.\n", ret);
while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
ok(!WaitForSingleObject(thread, 1000), "Wait timed out.\n");
while ((ret = MsgWaitForMultipleObjects(1, &thread, FALSE, 1000, QS_ALLINPUT)) == 1)
{
while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
{
ok(msg.message != WM_SYSCOLORCHANGE, "WM_SYSCOLORCHANGE should not be posted.\n");
DispatchMessageA(&msg);
}
}
ok(!ret, "Wait timed out.\n");
CloseHandle(thread);
params.message = WM_SETCURSOR;
params.message = WM_FONTCHANGE;
thread = CreateThread(NULL, 0, notify_message_proc, &params, 0, NULL);
ok(!WaitForSingleObject(thread, 1000), "Thread should not block.\n");
CloseHandle(thread);
ret = GetQueueStatus(QS_SENDMESSAGE | QS_POSTMESSAGE);
ok(!ret, "Got unexpected status %#x.\n", ret);
while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
{
ok(msg.message != WM_FONTCHANGE, "WM_FONTCHANGE should not be posted.\n");
DispatchMessageA(&msg);
}
hr = IVideoWindow_put_Owner(window, 0);
ok(hr == S_OK, "Got hr %#x.\n", hr);

View File

@ -2094,37 +2094,55 @@ static void test_video_window_messages(IVideoWindow *window, HWND hwnd, HWND our
flush_events();
/* Demonstrate that messages should be sent, not posted, and that only some
* messages should be forwarded. A previous implementation unconditionally
* posted all messages. */
hr = IVideoWindow_NotifyOwnerMessage(window, (OAHWND)our_hwnd, WM_SYSCOLORCHANGE, 0, 0);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ret = GetQueueStatus(QS_SENDMESSAGE | QS_POSTMESSAGE);
ok(!ret, "Got unexpected status %#x.\n", ret);
while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
{
ok(msg.message != WM_SYSCOLORCHANGE, "WM_SYSCOLORCHANGE should not be posted.\n");
DispatchMessageA(&msg);
}
hr = IVideoWindow_NotifyOwnerMessage(window, (OAHWND)our_hwnd, WM_SETCURSOR,
(WPARAM)hwnd, MAKELONG(HTCLIENT, WM_MOUSEMOVE));
hr = IVideoWindow_NotifyOwnerMessage(window, (OAHWND)our_hwnd, WM_FONTCHANGE, 0, 0);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ret = GetQueueStatus(QS_SENDMESSAGE | QS_POSTMESSAGE);
ok(!ret, "Got unexpected status %#x.\n", ret);
while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
{
ok(msg.message != WM_FONTCHANGE, "WM_FONTCHANGE should not be posted.\n");
DispatchMessageA(&msg);
}
params.window = window;
params.hwnd = our_hwnd;
params.message = WM_SYSCOLORCHANGE;
thread = CreateThread(NULL, 0, notify_message_proc, &params, 0, NULL);
ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block.\n");
ret = MsgWaitForMultipleObjects(0, NULL, FALSE, 1000, QS_SENDMESSAGE);
ok(!ret, "Did not find a sent message.\n");
while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
ok(!WaitForSingleObject(thread, 1000), "Wait timed out.\n");
while ((ret = MsgWaitForMultipleObjects(1, &thread, FALSE, 1000, QS_ALLINPUT)) == 1)
{
while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
{
ok(msg.message != WM_SYSCOLORCHANGE, "WM_SYSCOLORCHANGE should not be posted.\n");
DispatchMessageA(&msg);
}
}
ok(!ret, "Wait timed out.\n");
CloseHandle(thread);
params.message = WM_SETCURSOR;
params.message = WM_FONTCHANGE;
thread = CreateThread(NULL, 0, notify_message_proc, &params, 0, NULL);
ok(!WaitForSingleObject(thread, 1000), "Thread should not block.\n");
CloseHandle(thread);
ret = GetQueueStatus(QS_SENDMESSAGE | QS_POSTMESSAGE);
ok(!ret, "Got unexpected status %#x.\n", ret);
while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
{
ok(msg.message != WM_FONTCHANGE, "WM_FONTCHANGE should not be posted.\n");
DispatchMessageA(&msg);
}
hr = IVideoWindow_put_Owner(window, 0);
ok(hr == S_OK, "Got hr %#x.\n", hr);

View File

@ -2333,37 +2333,55 @@ static void test_video_window_messages(IVideoWindow *window, HWND hwnd, HWND our
flush_events();
/* Demonstrate that messages should be sent, not posted, and that only some
* messages should be forwarded. A previous implementation unconditionally
* posted all messages. */
hr = IVideoWindow_NotifyOwnerMessage(window, (OAHWND)our_hwnd, WM_SYSCOLORCHANGE, 0, 0);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ret = GetQueueStatus(QS_SENDMESSAGE | QS_POSTMESSAGE);
ok(!ret, "Got unexpected status %#x.\n", ret);
while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
{
ok(msg.message != WM_SYSCOLORCHANGE, "WM_SYSCOLORCHANGE should not be posted.\n");
DispatchMessageA(&msg);
}
hr = IVideoWindow_NotifyOwnerMessage(window, (OAHWND)our_hwnd, WM_SETCURSOR,
(WPARAM)hwnd, MAKELONG(HTCLIENT, WM_MOUSEMOVE));
hr = IVideoWindow_NotifyOwnerMessage(window, (OAHWND)our_hwnd, WM_FONTCHANGE, 0, 0);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ret = GetQueueStatus(QS_SENDMESSAGE | QS_POSTMESSAGE);
ok(!ret, "Got unexpected status %#x.\n", ret);
while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
{
ok(msg.message != WM_FONTCHANGE, "WM_FONTCHANGE should not be posted.\n");
DispatchMessageA(&msg);
}
params.window = window;
params.hwnd = our_hwnd;
params.message = WM_SYSCOLORCHANGE;
thread = CreateThread(NULL, 0, notify_message_proc, &params, 0, NULL);
ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block.\n");
ret = MsgWaitForMultipleObjects(0, NULL, FALSE, 1000, QS_SENDMESSAGE);
ok(!ret, "Did not find a sent message.\n");
while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
ok(!WaitForSingleObject(thread, 1000), "Wait timed out.\n");
while ((ret = MsgWaitForMultipleObjects(1, &thread, FALSE, 1000, QS_ALLINPUT)) == 1)
{
while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
{
ok(msg.message != WM_SYSCOLORCHANGE, "WM_SYSCOLORCHANGE should not be posted.\n");
DispatchMessageA(&msg);
}
}
ok(!ret, "Wait timed out.\n");
CloseHandle(thread);
params.message = WM_SETCURSOR;
params.message = WM_FONTCHANGE;
thread = CreateThread(NULL, 0, notify_message_proc, &params, 0, NULL);
ok(!WaitForSingleObject(thread, 1000), "Thread should not block.\n");
CloseHandle(thread);
ret = GetQueueStatus(QS_SENDMESSAGE | QS_POSTMESSAGE);
ok(!ret, "Got unexpected status %#x.\n", ret);
while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
{
ok(msg.message != WM_FONTCHANGE, "WM_FONTCHANGE should not be posted.\n");
DispatchMessageA(&msg);
}
hr = IVideoWindow_put_Owner(window, 0);
ok(hr == S_OK, "Got hr %#x.\n", hr);