From 5c9ce61e9bfb647c3c2de329eab793f024c6a997 Mon Sep 17 00:00:00 2001 From: Greg Geldorp Date: Wed, 12 Jan 2011 14:13:47 +0100 Subject: [PATCH] d3d9/tests: Skip tests if not running in the foreground. --- dlls/d3d9/tests/device.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index 671afbfc6c6..41d14464566 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -2385,6 +2385,7 @@ struct wndproc_thread_param HWND dummy_window; HANDLE window_created; HANDLE test_finished; + BOOL running_in_foreground; }; static LRESULT CALLBACK test_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) @@ -2428,6 +2429,7 @@ static DWORD WINAPI wndproc_thread(void *param) p->dummy_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, 640, 480, 0, 0, 0, 0); + p->running_in_foreground = SetForegroundWindow(p->dummy_window); ret = SetEvent(p->window_created); ok(ret, "SetEvent failed, last error %#x.\n", GetLastError()); @@ -2508,9 +2510,14 @@ static void test_wndproc(void) tmp = GetFocus(); ok(tmp == device_window, "Expected focus %p, got %p.\n", device_window, tmp); - tmp = GetForegroundWindow(); - ok(tmp == thread_params.dummy_window, "Expected foreground window %p, got %p.\n", - thread_params.dummy_window, tmp); + if (thread_params.running_in_foreground) + { + tmp = GetForegroundWindow(); + ok(tmp == thread_params.dummy_window, "Expected foreground window %p, got %p.\n", + thread_params.dummy_window, tmp); + } + else + skip("Not running in foreground, skip foreground window test\n"); flush_events(); @@ -2647,9 +2654,14 @@ static void test_wndproc_windowed(void) tmp = GetFocus(); ok(tmp == device_window, "Expected focus %p, got %p.\n", device_window, tmp); - tmp = GetForegroundWindow(); - ok(tmp == thread_params.dummy_window, "Expected foreground window %p, got %p.\n", - thread_params.dummy_window, tmp); + if (thread_params.running_in_foreground) + { + tmp = GetForegroundWindow(); + ok(tmp == thread_params.dummy_window, "Expected foreground window %p, got %p.\n", + thread_params.dummy_window, tmp); + } + else + skip("Not running in foreground, skip foreground window test\n"); filter_messages = focus_window;