[PATCH 2/5] ddraw/tests: Move test_window_style() to ddraw7.c.

Henri Verbeet hverbeet at codeweavers.com
Mon May 28 11:17:26 CDT 2012


---
 dlls/ddraw/tests/d3d.c    |   51 ---------------------------------------------
 dlls/ddraw/tests/ddraw7.c |   44 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 51 deletions(-)

diff --git a/dlls/ddraw/tests/d3d.c b/dlls/ddraw/tests/d3d.c
index 86e93b2..0daad33 100644
--- a/dlls/ddraw/tests/d3d.c
+++ b/dlls/ddraw/tests/d3d.c
@@ -3527,56 +3527,6 @@ static void BackBuffer3DAttachmentTest(void)
     DestroyWindow(window);
 }
 
-static void test_window_style(void)
-{
-    LONG style, exstyle, tmp;
-    RECT fullscreen_rect, r;
-    IDirectDraw7 *ddraw7;
-    HWND window;
-    HRESULT hr;
-    ULONG ref;
-
-    hr = pDirectDrawCreateEx(NULL, (void **)&ddraw7, &IID_IDirectDraw7, NULL);
-    if (FAILED(hr))
-    {
-        skip("Failed to create IDirectDraw7 object (%#x), skipping tests.\n", hr);
-        return;
-    }
-
-    window = CreateWindowA("static", "d3d7_test", WS_OVERLAPPEDWINDOW,
-            0, 0, 100, 100, 0, 0, 0, 0);
-
-    style = GetWindowLongA(window, GWL_STYLE);
-    exstyle = GetWindowLongA(window, GWL_EXSTYLE);
-    SetRect(&fullscreen_rect, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
-
-    hr = IDirectDraw7_SetCooperativeLevel(ddraw7, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
-    ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
-    if (FAILED(hr))
-    {
-        IDirectDraw7_Release(ddraw7);
-        DestroyWindow(window);
-        return;
-    }
-
-    tmp = GetWindowLongA(window, GWL_STYLE);
-    todo_wine ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp);
-    tmp = GetWindowLongA(window, GWL_EXSTYLE);
-    todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp);
-
-    GetWindowRect(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(window, &r);
-    todo_wine ok(!EqualRect(&r, &fullscreen_rect), "Client rect and window rect are equal.\n");
-
-    ref = IDirectDraw7_Release(ddraw7);
-    ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref);
-
-    DestroyWindow(window);
-}
-
 static void test_redundant_mode_set(void)
 {
     DDSURFACEDESC2 surface_desc = {0};
@@ -4740,7 +4690,6 @@ START_TEST(d3d)
         D3D1_releaseObjects();
     }
 
-    test_window_style();
     test_redundant_mode_set();
     test_coop_level_mode_set();
     test_initialize();
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index ad3e46a..3d151e1 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -1904,6 +1904,49 @@ static void test_wndproc(void)
     UnregisterClassA("ddraw_test_wndproc_wc", GetModuleHandleA(NULL));
 }
 
+static void test_window_style(void)
+{
+    LONG style, exstyle, tmp;
+    RECT fullscreen_rect, r;
+    IDirectDraw7 *ddraw;
+    HWND window;
+    HRESULT hr;
+    ULONG ref;
+
+    window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW,
+            0, 0, 100, 100, 0, 0, 0, 0);
+    if (!(ddraw = create_ddraw()))
+    {
+        skip("Failed to create a ddraw object, skipping test.\n");
+        DestroyWindow(window);
+        return;
+    }
+
+    style = GetWindowLongA(window, GWL_STYLE);
+    exstyle = GetWindowLongA(window, GWL_EXSTYLE);
+    SetRect(&fullscreen_rect, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
+
+    hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
+    ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
+
+    tmp = GetWindowLongA(window, GWL_STYLE);
+    todo_wine ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp);
+    tmp = GetWindowLongA(window, GWL_EXSTYLE);
+    todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp);
+
+    GetWindowRect(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(window, &r);
+    todo_wine ok(!EqualRect(&r, &fullscreen_rect), "Client rect and window rect are equal.\n");
+
+    ref = IDirectDraw7_Release(ddraw);
+    ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref);
+
+    DestroyWindow(window);
+}
+
 START_TEST(ddraw7)
 {
     HMODULE module = GetModuleHandleA("ddraw.dll");
@@ -1928,4 +1971,5 @@ START_TEST(ddraw7)
     test_surface_qi();
     test_device_qi();
     test_wndproc();
+    test_window_style();
 }
-- 
1.7.3.4




More information about the wine-patches mailing list