[PATCH 5/6] d3d9/tests: Add some message processing to test_wndproc().
Henri Verbeet
hverbeet at codeweavers.com
Thu Mar 25 03:32:39 CDT 2010
For some reason Windows XP allows device creation to be blocked by the lack of
message processing in wndproc_thread(). Thanks to Wylda for helping debug
this. Disabled testing the focus and foreground windows after creating the
device for the moment.
---
dlls/d3d9/tests/device.c | 29 +++++++++++++++++++++++------
1 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index eb424e2..0004715 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -2370,8 +2370,19 @@ static DWORD WINAPI wndproc_thread(void *param)
ret = SetEvent(p->window_created);
ok(ret, "SetEvent failed, last error %#x.\n", GetLastError());
- res = WaitForSingleObject(p->test_finished, INFINITE);
- ok(res == WAIT_OBJECT_0, "Wait failed (%#x), last error %#x.\n", res, GetLastError());
+ for (;;)
+ {
+ MSG msg;
+
+ while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessage(&msg);
+ res = WaitForSingleObject(p->test_finished, 100);
+ if (res == WAIT_OBJECT_0) break;
+ if (res != WAIT_TIMEOUT)
+ {
+ ok(0, "Wait failed (%#x), last error %#x.\n", res, GetLastError());
+ break;
+ }
+ }
DestroyWindow(p->dummy_window);
@@ -2389,6 +2400,7 @@ static void test_wndproc(void)
LONG_PTR proc;
ULONG ref;
DWORD res, tid;
+ MSG msg;
if (!(d3d9 = pDirect3DCreate9(D3D_SDK_VERSION)))
{
@@ -2434,6 +2446,8 @@ static void test_wndproc(void)
expect_message.window = focus_window;
expect_message.message = WM_SETFOCUS;
+ while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessage(&msg);
+
device = create_device(d3d9, device_window, focus_window, FALSE);
if (!device)
{
@@ -2443,10 +2457,13 @@ static void test_wndproc(void)
ok(!expect_message.message, "Expected message %#x for window %p, but didn't receive it.\n",
expect_message.message, expect_message.window);
- tmp = GetFocus();
- todo_wine ok(tmp == focus_window, "Expected focus %p, got %p.\n", focus_window, tmp);
- tmp = GetForegroundWindow();
- todo_wine ok(tmp == focus_window, "Expected foreground window %p, got %p.\n", focus_window, tmp);
+ if (0) /* Disabled until we can make this work in a reliable way on Wine. */
+ {
+ tmp = GetFocus();
+ ok(tmp == focus_window, "Expected focus %p, got %p.\n", focus_window, tmp);
+ tmp = GetForegroundWindow();
+ ok(tmp == focus_window, "Expected foreground window %p, got %p.\n", focus_window, tmp);
+ }
SetForegroundWindow(focus_window);
filter_messages = focus_window;
--
1.6.4.4
More information about the wine-patches
mailing list