From: Stefan Dösinger Subject: [PATCH 09/10] d3d/tests: Add focus loss style tests. Message-Id: <1411647866-17829-9-git-send-email-stefan@codeweavers.com> Date: Thu, 25 Sep 2014 14:24:25 +0200 --- dlls/d3d8/tests/device.c | 32 ++++++++++++++++++++++++++++++++ dlls/d3d9/tests/device.c | 22 ++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index 810d2b4..41b5b53 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -2904,6 +2904,7 @@ static void test_window_style(void) IDirect3D8 *d3d8; HRESULT hr; ULONG ref; + BOOL ret; focus_window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, 0, 0, screen_width / 2, screen_height / 2, 0, 0, 0, 0); @@ -2973,6 +2974,37 @@ static void test_window_style(void) ok(style == focus_exstyle, "Expected focus window extended style %#x, got %#x.\n", focus_exstyle, style); + hr = reset_device(device, device_window, FALSE); + ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + + style = GetWindowLongA(device_window, GWL_STYLE); + expected_style = device_style | WS_MINIMIZE | WS_VISIBLE; + todo_wine ok(style == expected_style, "Expected device window style %#x, got %#x.\n", + expected_style, style); + style = GetWindowLongA(device_window, GWL_EXSTYLE); + expected_style = device_exstyle | WS_EX_TOPMOST; + todo_wine ok(style == expected_style, "Expected device window extended style %#x, got %#x.\n", + expected_style, style); + + style = GetWindowLongA(focus_window, GWL_STYLE); + ok(style == focus_style, "Expected focus window style %#x, got %#x.\n", + focus_style, style); + style = GetWindowLongA(focus_window, GWL_EXSTYLE); + ok(style == focus_exstyle, "Expected focus window extended style %#x, got %#x.\n", + focus_exstyle, style); + + /* On Vista follow-up tests break if the device is destroyed in a lost state, + * so reset it properly. */ + ShowWindow(focus_window, SW_MINIMIZE); + ShowWindow(focus_window, SW_RESTORE); + ret = SetForegroundWindow(focus_window); + ok(ret, "Failed to set foreground window.\n"); + flush_events(); + hr = reset_device(device, device_window, FALSE); + ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); + ref = IDirect3DDevice8_Release(device); ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index 7177a36..2ab308b 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -3805,6 +3805,7 @@ static void test_window_style(void) IDirect3D9 *d3d9; HRESULT hr; ULONG ref; + BOOL ret; focus_window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, 0, 0, screen_width / 2, screen_height / 2, 0, 0, 0, 0); @@ -3874,6 +3875,27 @@ static void test_window_style(void) ok(style == focus_exstyle, "Expected focus window extended style %#x, got %#x.\n", focus_exstyle, style); + hr = reset_device(device, device_window, FALSE); + ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + + style = GetWindowLongA(device_window, GWL_STYLE); + expected_style = device_style | WS_MINIMIZE | WS_VISIBLE; + todo_wine ok(style == expected_style, "Expected device window style %#x, got %#x.\n", + expected_style, style); + style = GetWindowLongA(device_window, GWL_EXSTYLE); + expected_style = device_exstyle | WS_EX_TOPMOST; + todo_wine ok(style == expected_style, "Expected device window extended style %#x, got %#x.\n", + expected_style, style); + + style = GetWindowLongA(focus_window, GWL_STYLE); + ok(style == focus_style, "Expected focus window style %#x, got %#x.\n", + focus_style, style); + style = GetWindowLongA(focus_window, GWL_EXSTYLE); + ok(style == focus_exstyle, "Expected focus window extended style %#x, got %#x.\n", + focus_exstyle, style); + ref = IDirect3DDevice9_Release(device); ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); -- 1.8.5.5