Henri Verbeet : d3d9/tests: Add a test for window styles on device creation .
Alexandre Julliard
julliard at winehq.org
Wed May 4 13:47:39 CDT 2011
Module: wine
Branch: master
Commit: d2479406e877ec19b334f6be7ec90a38e356b410
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d2479406e877ec19b334f6be7ec90a38e356b410
Author: Henri Verbeet <hverbeet at codeweavers.com>
Date: Tue May 3 22:30:16 2011 +0200
d3d9/tests: Add a test for window styles on device creation.
---
dlls/d3d9/tests/device.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 75 insertions(+), 0 deletions(-)
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index 55b6982..39f84d7 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -2889,6 +2889,80 @@ done:
#endif
}
+static void test_window_style(void)
+{
+ RECT focus_rect, fullscreen_rect, r;
+ LONG device_style, device_exstyle;
+ LONG focus_style, focus_exstyle;
+ LONG style, expected_style;
+ IDirect3DDevice9 *device;
+ IDirect3D9 *d3d9;
+ ULONG ref;
+
+
+ if (!(d3d9 = pDirect3DCreate9(D3D_SDK_VERSION)))
+ {
+ skip("Failed to create IDirect3D9 object, skipping tests.\n");
+ return;
+ }
+
+ focus_window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW,
+ 0, 0, screen_width / 2, screen_height / 2, 0, 0, 0, 0);
+ device_window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW,
+ 0, 0, screen_width / 2, screen_height / 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);
+
+ SetRect(&fullscreen_rect, 0, 0, screen_width, screen_height);
+ GetWindowRect(focus_window, &focus_rect);
+
+ device = create_device(d3d9, device_window, focus_window, FALSE);
+ if (!device)
+ {
+ skip("Failed to create a D3D device, skipping tests.\n");
+ goto done;
+ }
+
+ style = GetWindowLongA(device_window, GWL_STYLE);
+ expected_style = device_style | 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);
+
+ GetWindowRect(device_window, &r);
+ ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n",
+ fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom,
+ r.left, r.top, r.right, r.bottom);
+ GetClientRect(device_window, &r);
+ todo_wine ok(!EqualRect(&r, &fullscreen_rect), "Client rect and window rect are equal.\n");
+ GetWindowRect(focus_window, &r);
+ ok(EqualRect(&r, &focus_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n",
+ focus_rect.left, focus_rect.top, focus_rect.right, focus_rect.bottom,
+ r.left, r.top, r.right, r.bottom);
+
+ ref = IDirect3DDevice9_Release(device);
+ ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref);
+
+done:
+ IDirect3D9_Release(d3d9);
+
+ DestroyWindow(device_window);
+ DestroyWindow(focus_window);
+}
+
START_TEST(device)
{
HMODULE d3d9_handle = LoadLibraryA( "d3d9.dll" );
@@ -2939,6 +3013,7 @@ START_TEST(device)
test_scissor_size();
test_wndproc();
test_wndproc_windowed();
+ test_window_style();
}
out:
More information about the wine-cvs
mailing list