d3d8/tests: Add some message processing to test_wndproc().

Disabled testing the focus and foreground windows after creating the device
for the moment.
This commit is contained in:
Henri Verbeet 2010-03-25 09:32:40 +01:00 committed by Alexandre Julliard
parent ab4bf7600a
commit d11185a890
1 changed files with 23 additions and 6 deletions

View File

@ -1525,8 +1525,19 @@ static DWORD WINAPI wndproc_thread(void *param)
ret = SetEvent(p->window_created); ret = SetEvent(p->window_created);
ok(ret, "SetEvent failed, last error %#x.\n", GetLastError()); ok(ret, "SetEvent failed, last error %#x.\n", GetLastError());
res = WaitForSingleObject(p->test_finished, INFINITE); for (;;)
ok(res == WAIT_OBJECT_0, "Wait failed (%#x), last error %#x.\n", res, GetLastError()); {
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); DestroyWindow(p->dummy_window);
@ -1544,6 +1555,7 @@ static void test_wndproc(void)
LONG_PTR proc; LONG_PTR proc;
ULONG ref; ULONG ref;
DWORD res, tid; DWORD res, tid;
MSG msg;
if (!(d3d8 = pDirect3DCreate8(D3D_SDK_VERSION))) if (!(d3d8 = pDirect3DCreate8(D3D_SDK_VERSION)))
{ {
@ -1589,6 +1601,8 @@ static void test_wndproc(void)
expect_message.window = focus_window; expect_message.window = focus_window;
expect_message.message = WM_SETFOCUS; expect_message.message = WM_SETFOCUS;
while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessage(&msg);
device = create_device(d3d8, device_window, focus_window, FALSE); device = create_device(d3d8, device_window, focus_window, FALSE);
if (!device) if (!device)
{ {
@ -1598,10 +1612,13 @@ static void test_wndproc(void)
ok(!expect_message.message, "Expected message %#x for window %p, but didn't receive it.\n", ok(!expect_message.message, "Expected message %#x for window %p, but didn't receive it.\n",
expect_message.message, expect_message.window); expect_message.message, expect_message.window);
tmp = GetFocus(); if (0) /* Disabled until we can make this work in a reliable way on Wine. */
todo_wine ok(tmp == focus_window, "Expected focus %p, got %p.\n", focus_window, tmp); {
tmp = GetForegroundWindow(); tmp = GetFocus();
todo_wine ok(tmp == focus_window, "Expected foreground window %p, got %p.\n", focus_window, tmp); 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); SetForegroundWindow(focus_window);
filter_messages = focus_window; filter_messages = focus_window;