[PATCH v2 2/6] d3d9/tests: Test for window changes when it's not active.
Gabriel Ivăncescu
gabrielopcode at gmail.com
Mon Jan 3 08:08:08 CST 2022
Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---
dlls/d3d9/tests/d3d9ex.c | 89 ++++++++++++++++++++++++++++++++++++++++
dlls/d3d9/tests/device.c | 57 +++++++++++++++++++++++--
2 files changed, 143 insertions(+), 3 deletions(-)
diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c
index 2afe730..e181c72 100644
--- a/dlls/d3d9/tests/d3d9ex.c
+++ b/dlls/d3d9/tests/d3d9ex.c
@@ -3662,6 +3662,95 @@ static void test_window_style(void)
DestroyWindow(device_window);
DestroyWindow(focus_window);
}
+
+ /* Window changes are done only if either the device or focus windows are active */
+ focus_window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
+ 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 2, 0, 0, 0, 0);
+ device_window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
+ 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 2, 0, 0, 0, 0);
+
+ device_style = GetWindowLongA(device_window, GWL_STYLE);
+ device_exstyle = GetWindowLongA(device_window, GWL_EXSTYLE);
+ focus_style = GetWindowLongA(focus_window, GWL_STYLE);
+ focus_exstyle = GetWindowLongA(focus_window, GWL_EXSTYLE);
+
+ ret = SetForegroundWindow(GetDesktopWindow());
+ ok(ret, "Failed to set foreground window.\n");
+
+ device_desc.device_window = device_window;
+ device_desc.flags = CREATE_DEVICE_FULLSCREEN;
+ device = create_device(focus_window, &device_desc);
+ ok(!!device, "Failed to create a D3D device.\n");
+ ref = IDirect3DDevice9Ex_Release(device);
+ ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref);
+
+ ret = SetForegroundWindow(GetDesktopWindow());
+ ok(ret, "Failed to set foreground window.\n");
+
+ device_desc.flags = CREATE_DEVICE_FULLSCREEN;
+ device = create_device(focus_window, &device_desc);
+ ok(!!device, "Failed to create a D3D device.\n");
+ style = GetWindowLongA(device_window, GWL_STYLE);
+ todo_wine ok(style == device_style || broken(style == (device_style & ~WS_OVERLAPPEDWINDOW)) /* w1064v1809 */,
+ "Expected device window style %#x, got %#x.\n", device_style, style);
+ style = GetWindowLongA(device_window, GWL_EXSTYLE);
+ todo_wine ok(style == device_exstyle || broken(style == (device_exstyle & ~WS_EX_OVERLAPPEDWINDOW)) /* w1064v1809 */,
+ "Expected device window extended style %#x, got %#x.\n", device_exstyle, 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);
+ GetWindowRect(device_window, &r);
+ ok(EqualRect(&r, &fullscreen_rect), "Expected %s, got %s.\n", wine_dbgstr_rect(&fullscreen_rect), wine_dbgstr_rect(&r));
+
+ device_desc.flags = 0;
+ hr = reset_device(device, &device_desc);
+ ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr);
+
+ ret = SetForegroundWindow(GetDesktopWindow());
+ ok(ret, "Failed to set foreground window.\n");
+ device_desc.flags = CREATE_DEVICE_FULLSCREEN;
+ hr = reset_device(device, &device_desc);
+ ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr);
+
+ style = GetWindowLongA(device_window, GWL_STYLE);
+ todo_wine ok(style == device_style || broken(style == (device_style & ~WS_OVERLAPPEDWINDOW)) /* w1064v1809 */,
+ "Expected device window style %#x, got %#x.\n", device_style, style);
+ style = GetWindowLongA(device_window, GWL_EXSTYLE);
+ todo_wine ok(style == device_exstyle || broken(style == (device_exstyle & ~WS_EX_OVERLAPPEDWINDOW)) /* w1064v1809 */,
+ "Expected device window extended style %#x, got %#x.\n", device_exstyle, style);
+
+ SetForegroundWindow(focus_window);
+ ok(ret, "Failed to set foreground window.\n");
+ hr = reset_device(device, &device_desc);
+ ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr);
+
+ style = GetWindowLongA(device_window, GWL_STYLE);
+ todo_wine ok(style == device_style || broken(style == (device_style & ~WS_OVERLAPPEDWINDOW)) /* w1064v1809 */,
+ "Expected device window style %#x, got %#x.\n", device_style, style);
+ style = GetWindowLongA(device_window, GWL_EXSTYLE);
+ expected_style = device_exstyle | WS_EX_TOPMOST;
+ todo_wine ok(style == expected_style || broken(style == (expected_style & ~WS_EX_OVERLAPPEDWINDOW)) /* w1064v1809 */,
+ "Expected device window extended style %#x, got %#x.\n", expected_style, style);
+
+ device_desc.flags = 0;
+ hr = reset_device(device, &device_desc);
+ ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr);
+
+ style = GetWindowLongA(device_window, GWL_STYLE);
+ todo_wine ok(style == device_style || broken(style == (device_style & ~WS_OVERLAPPEDWINDOW)) /* w1064v1809 */,
+ "Expected device window style %#x, got %#x.\n", device_style, style);
+ style = GetWindowLongA(device_window, GWL_EXSTYLE);
+ expected_style = device_exstyle | WS_EX_TOPMOST;
+ todo_wine ok(style == expected_style || broken(style == (expected_style & ~WS_EX_OVERLAPPEDWINDOW)) /* w1064v1809 */,
+ "Expected device window extended style %#x, got %#x.\n", expected_style, style);
+
+ ref = IDirect3DDevice9Ex_Release(device);
+ ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref);
+
+ DestroyWindow(device_window);
+ DestroyWindow(focus_window);
}
static void test_swapchain_parameters(void)
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index c480a9d..b922c88 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -5051,9 +5051,7 @@ static void test_window_style(void)
if (!(device = create_device(d3d9, focus_window, &device_desc)))
{
skip("Failed to create a D3D device, skipping tests.\n");
- DestroyWindow(device_window);
- DestroyWindow(focus_window);
- break;
+ goto done;
}
style = GetWindowLongA(device_window, GWL_STYLE);
@@ -5148,6 +5146,59 @@ static void test_window_style(void)
DestroyWindow(device_window);
DestroyWindow(focus_window);
}
+
+ /* Window changes are always done no matter if it is active or not */
+ focus_window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
+ 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 2, 0, 0, 0, 0);
+ device_window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
+ 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 2, 0, 0, 0, 0);
+
+ device_style = GetWindowLongA(device_window, GWL_STYLE);
+ device_exstyle = GetWindowLongA(device_window, GWL_EXSTYLE);
+ focus_style = GetWindowLongA(focus_window, GWL_STYLE);
+ focus_exstyle = GetWindowLongA(focus_window, GWL_EXSTYLE);
+
+ ret = SetForegroundWindow(GetDesktopWindow());
+ ok(ret, "Failed to set foreground window.\n");
+
+ device_desc.device_window = device_window;
+ device_desc.flags = CREATE_DEVICE_FULLSCREEN;
+ device = create_device(d3d9, focus_window, &device_desc);
+ ok(!!device, "Failed to create a D3D device.\n");
+
+ style = GetWindowLongA(device_window, GWL_STYLE);
+ todo_wine ok(style == device_style || broken(style == (device_style & ~WS_OVERLAPPEDWINDOW)) /* w1064v1809 */,
+ "Expected device window style %#x, got %#x.\n", device_style, style);
+ style = GetWindowLongA(device_window, GWL_EXSTYLE);
+ expected_style = device_exstyle | WS_EX_TOPMOST;
+ todo_wine ok(style == expected_style || broken(style == (expected_style & ~WS_EX_OVERLAPPEDWINDOW)) /* w1064v1809 */,
+ "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);
+ GetWindowRect(device_window, &r);
+ ok(EqualRect(&r, &fullscreen_rect), "Expected %s, got %s.\n", wine_dbgstr_rect(&fullscreen_rect), wine_dbgstr_rect(&r));
+
+ device_desc.flags = 0;
+ hr = reset_device(device, &device_desc);
+ ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr);
+
+ style = GetWindowLongA(device_window, GWL_STYLE);
+ ok(style == device_style || broken(style == (device_style & ~WS_OVERLAPPEDWINDOW)) /* w1064v1809 */,
+ "Expected device window style %#x, got %#x.\n", device_style, style);
+ style = GetWindowLongA(device_window, GWL_EXSTYLE);
+ expected_style = device_exstyle | WS_EX_TOPMOST;
+ ok(style == expected_style || broken(style == (expected_style & ~WS_EX_OVERLAPPEDWINDOW)) /* w1064v1809 */,
+ "Expected device window extended style %#x, got %#x.\n", expected_style, style);
+
+ ref = IDirect3DDevice9_Release(device);
+ ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref);
+
+done:
+ DestroyWindow(device_window);
+ DestroyWindow(focus_window);
IDirect3D9_Release(d3d9);
}
--
2.34.1
More information about the wine-devel
mailing list