d3d8/tests: Check for multiple expected messages in test_wndproc().
This commit is contained in:
parent
4c4a414596
commit
6632d2c45c
@ -1520,11 +1520,21 @@ cleanup:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static HWND filter_messages;
|
static HWND filter_messages;
|
||||||
static struct
|
|
||||||
|
enum message_window
|
||||||
|
{
|
||||||
|
DEVICE_WINDOW,
|
||||||
|
FOCUS_WINDOW,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct message
|
||||||
{
|
{
|
||||||
HWND window;
|
|
||||||
UINT message;
|
UINT message;
|
||||||
} expect_message;
|
enum message_window window;
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct message *expect_messages;
|
||||||
|
static HWND device_window, focus_window;
|
||||||
|
|
||||||
struct wndproc_thread_param
|
struct wndproc_thread_param
|
||||||
{
|
{
|
||||||
@ -1541,7 +1551,27 @@ static LRESULT CALLBACK test_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM
|
|||||||
todo_wine ok(0, "Received unexpected message %#x for window %p.\n", message, hwnd);
|
todo_wine ok(0, "Received unexpected message %#x for window %p.\n", message, hwnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (expect_message.window == hwnd && expect_message.message == message) expect_message.message = 0;
|
if (expect_messages)
|
||||||
|
{
|
||||||
|
HWND w;
|
||||||
|
|
||||||
|
switch (expect_messages->window)
|
||||||
|
{
|
||||||
|
case DEVICE_WINDOW:
|
||||||
|
w = device_window;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FOCUS_WINDOW:
|
||||||
|
w = focus_window;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
w = NULL;
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (hwnd == w && expect_messages->message == message) ++expect_messages;
|
||||||
|
}
|
||||||
|
|
||||||
return DefWindowProcA(hwnd, message, wparam, lparam);
|
return DefWindowProcA(hwnd, message, wparam, lparam);
|
||||||
}
|
}
|
||||||
@ -1580,7 +1610,6 @@ static DWORD WINAPI wndproc_thread(void *param)
|
|||||||
static void test_wndproc(void)
|
static void test_wndproc(void)
|
||||||
{
|
{
|
||||||
struct wndproc_thread_param thread_params;
|
struct wndproc_thread_param thread_params;
|
||||||
HWND device_window, focus_window, tmp;
|
|
||||||
IDirect3DDevice8 *device;
|
IDirect3DDevice8 *device;
|
||||||
WNDCLASSA wc = {0};
|
WNDCLASSA wc = {0};
|
||||||
IDirect3D8 *d3d8;
|
IDirect3D8 *d3d8;
|
||||||
@ -1588,6 +1617,17 @@ static void test_wndproc(void)
|
|||||||
LONG_PTR proc;
|
LONG_PTR proc;
|
||||||
ULONG ref;
|
ULONG ref;
|
||||||
DWORD res, tid;
|
DWORD res, tid;
|
||||||
|
HWND tmp;
|
||||||
|
|
||||||
|
static const struct message messages[] =
|
||||||
|
{
|
||||||
|
{WM_ACTIVATE, FOCUS_WINDOW},
|
||||||
|
{WM_SETFOCUS, FOCUS_WINDOW},
|
||||||
|
{WM_WINDOWPOSCHANGING, DEVICE_WINDOW},
|
||||||
|
{WM_MOVE, DEVICE_WINDOW},
|
||||||
|
{WM_SIZE, DEVICE_WINDOW},
|
||||||
|
{0, 0},
|
||||||
|
};
|
||||||
|
|
||||||
if (!(d3d8 = pDirect3DCreate8(D3D_SDK_VERSION)))
|
if (!(d3d8 = pDirect3DCreate8(D3D_SDK_VERSION)))
|
||||||
{
|
{
|
||||||
@ -1630,11 +1670,10 @@ static void test_wndproc(void)
|
|||||||
ok(tmp == thread_params.dummy_window, "Expected foreground window %p, got %p.\n",
|
ok(tmp == thread_params.dummy_window, "Expected foreground window %p, got %p.\n",
|
||||||
thread_params.dummy_window, tmp);
|
thread_params.dummy_window, tmp);
|
||||||
|
|
||||||
expect_message.window = focus_window;
|
|
||||||
expect_message.message = WM_SETFOCUS;
|
|
||||||
|
|
||||||
flush_events();
|
flush_events();
|
||||||
|
|
||||||
|
expect_messages = messages;
|
||||||
|
|
||||||
device = create_device(d3d8, device_window, focus_window, FALSE);
|
device = create_device(d3d8, device_window, focus_window, FALSE);
|
||||||
if (!device)
|
if (!device)
|
||||||
{
|
{
|
||||||
@ -1642,8 +1681,10 @@ static void test_wndproc(void)
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
ok(!expect_message.message, "Expected message %#x for window %p, but didn't receive it.\n",
|
ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it.\n",
|
||||||
expect_message.message, expect_message.window);
|
expect_messages->message, expect_messages->window);
|
||||||
|
expect_messages = NULL;
|
||||||
|
|
||||||
if (0) /* Disabled until we can make this work in a reliable way on Wine. */
|
if (0) /* Disabled until we can make this work in a reliable way on Wine. */
|
||||||
{
|
{
|
||||||
tmp = GetFocus();
|
tmp = GetFocus();
|
||||||
@ -1717,7 +1758,6 @@ done:
|
|||||||
static void test_wndproc_windowed(void)
|
static void test_wndproc_windowed(void)
|
||||||
{
|
{
|
||||||
struct wndproc_thread_param thread_params;
|
struct wndproc_thread_param thread_params;
|
||||||
HWND device_window, focus_window, tmp;
|
|
||||||
IDirect3DDevice8 *device;
|
IDirect3DDevice8 *device;
|
||||||
WNDCLASSA wc = {0};
|
WNDCLASSA wc = {0};
|
||||||
IDirect3D8 *d3d8;
|
IDirect3D8 *d3d8;
|
||||||
@ -1726,6 +1766,7 @@ static void test_wndproc_windowed(void)
|
|||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
ULONG ref;
|
ULONG ref;
|
||||||
DWORD res, tid;
|
DWORD res, tid;
|
||||||
|
HWND tmp;
|
||||||
|
|
||||||
if (!(d3d8 = pDirect3DCreate8(D3D_SDK_VERSION)))
|
if (!(d3d8 = pDirect3DCreate8(D3D_SDK_VERSION)))
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user