[PATCH] ddraw/tests: Move CreateSurface() invalid arguments test

Nikolay Sivov nsivov at codeweavers.com
Thu Jan 11 07:23:30 CST 2018


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/ddraw/tests/ddraw1.c   | 15 +++++++++++++
 dlls/ddraw/tests/ddraw2.c   | 15 +++++++++++++
 dlls/ddraw/tests/ddraw4.c   | 15 +++++++++++++
 dlls/ddraw/tests/ddraw7.c   | 15 +++++++++++++
 dlls/ddraw/tests/dsurface.c | 55 ---------------------------------------------
 5 files changed, 60 insertions(+), 55 deletions(-)

diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c
index d276565763..7aad9ecac5 100644
--- a/dlls/ddraw/tests/ddraw1.c
+++ b/dlls/ddraw/tests/ddraw1.c
@@ -2012,6 +2012,21 @@ static void test_surface_qi(void)
     IDirectDrawSurface_Release(surface);
     IDirectDraw_Release(ddraw);
     DestroyWindow(window);
+
+    /* Invalid arguments. */
+    ddraw = create_ddraw();
+    ok(!!ddraw, "Failed to create a ddraw object.\n");
+
+    hr = IDirectDraw_CreateSurface(ddraw, NULL, &surface, NULL);
+    ok(hr == DDERR_NOCOOPERATIVELEVELSET, "Unexpected hr %#x.\n", hr);
+
+    hr = IDirectDraw_SetCooperativeLevel(ddraw, NULL, DDSCL_NORMAL);
+    ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
+
+    hr = IDirectDraw_CreateSurface(ddraw, NULL, &surface, NULL);
+    ok(hr == DDERR_INVALIDPARAMS, "Unexpected hr %#x.\n", hr);
+
+    IDirectDraw_Release(ddraw);
 }
 
 static void test_device_qi(void)
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c
index 8b23c01b07..e39392e20e 100644
--- a/dlls/ddraw/tests/ddraw2.c
+++ b/dlls/ddraw/tests/ddraw2.c
@@ -2127,6 +2127,21 @@ static void test_surface_qi(void)
     IDirectDrawSurface_Release(surface);
     IDirectDraw2_Release(ddraw);
     DestroyWindow(window);
+
+    /* Invalid arguments. */
+    ddraw = create_ddraw();
+    ok(!!ddraw, "Failed to create a ddraw object.\n");
+
+    hr = IDirectDraw2_CreateSurface(ddraw, NULL, &surface, NULL);
+    ok(hr == DDERR_NOCOOPERATIVELEVELSET, "Unexpected hr %#x.\n", hr);
+
+    hr = IDirectDraw2_SetCooperativeLevel(ddraw, NULL, DDSCL_NORMAL);
+    ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
+
+    hr = IDirectDraw2_CreateSurface(ddraw, NULL, &surface, NULL);
+    ok(hr == DDERR_INVALIDPARAMS, "Unexpected hr %#x.\n", hr);
+
+    IDirectDraw2_Release(ddraw);
 }
 
 static void test_device_qi(void)
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c
index 5eb391abd9..051826260b 100644
--- a/dlls/ddraw/tests/ddraw4.c
+++ b/dlls/ddraw/tests/ddraw4.c
@@ -2278,6 +2278,21 @@ static void test_surface_qi(void)
     IDirectDrawSurface4_Release(surface);
     IDirectDraw4_Release(ddraw);
     DestroyWindow(window);
+
+    /* Invalid arguments. */
+    ddraw = create_ddraw();
+    ok(!!ddraw, "Failed to create a ddraw object.\n");
+
+    hr = IDirectDraw4_CreateSurface(ddraw, NULL, &surface, NULL);
+    ok(hr == DDERR_NOCOOPERATIVELEVELSET, "Unexpected hr %#x.\n", hr);
+
+    hr = IDirectDraw4_SetCooperativeLevel(ddraw, NULL, DDSCL_NORMAL);
+    ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
+
+    hr = IDirectDraw4_CreateSurface(ddraw, NULL, &surface, NULL);
+    ok(hr == DDERR_INVALIDPARAMS, "Unexpected hr %#x.\n", hr);
+
+    IDirectDraw4_Release(ddraw);
 }
 
 static void test_device_qi(void)
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index d5969ab949..aeac144adc 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -2009,6 +2009,21 @@ static void test_surface_qi(void)
     IDirectDrawSurface7_Release(surface);
     IDirectDraw7_Release(ddraw);
     DestroyWindow(window);
+
+    /* Invalid arguments. */
+    ddraw = create_ddraw();
+    ok(!!ddraw, "Failed to create a ddraw object.\n");
+
+    hr = IDirectDraw7_CreateSurface(ddraw, NULL, &surface, NULL);
+    ok(hr == DDERR_NOCOOPERATIVELEVELSET, "Unexpected hr %#x.\n", hr);
+
+    hr = IDirectDraw7_SetCooperativeLevel(ddraw, NULL, DDSCL_NORMAL);
+    ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
+
+    hr = IDirectDraw7_CreateSurface(ddraw, NULL, &surface, NULL);
+    ok(hr == DDERR_INVALIDPARAMS, "Unexpected hr %#x.\n", hr);
+
+    IDirectDraw7_Release(ddraw);
 }
 
 static void test_device_qi(void)
diff --git a/dlls/ddraw/tests/dsurface.c b/dlls/ddraw/tests/dsurface.c
index 0f775a0062..90de8b00b2 100644
--- a/dlls/ddraw/tests/dsurface.c
+++ b/dlls/ddraw/tests/dsurface.c
@@ -2476,60 +2476,6 @@ static void partial_block_lock_test(void)
     IDirectDraw7_Release(dd7);
 }
 
-static void create_surface_test(void)
-{
-    HRESULT hr;
-    IDirectDraw2 *ddraw2;
-    IDirectDraw4 *ddraw4;
-    IDirectDraw7 *ddraw7;
-    IDirectDrawSurface *surface;
-    IDirectDrawSurface4 *surface4;
-    IDirectDrawSurface7 *surface7;
-
-    hr = IDirectDraw_CreateSurface(lpDD, NULL, &surface, NULL);
-    ok(hr == DDERR_INVALIDPARAMS, "CreateSurface(ddsd=NULL) returned %#x,"
-            " expected %#x.\n", hr, DDERR_INVALIDPARAMS);
-
-    hr = IDirectDraw_QueryInterface(lpDD, &IID_IDirectDraw2, (void **) &ddraw2);
-    ok(SUCCEEDED(hr), "QueryInterface failed, hr %#x.\n", hr);
-
-    hr = IDirectDraw2_CreateSurface(ddraw2, NULL, &surface, NULL);
-    ok(hr == DDERR_INVALIDPARAMS, "CreateSurface(ddsd=NULL) returned %#x,"
-            " expected %#x.\n", hr, DDERR_INVALIDPARAMS);
-
-    IDirectDraw2_Release(ddraw2);
-
-    hr = IDirectDraw_QueryInterface(lpDD, &IID_IDirectDraw4, (void **) &ddraw4);
-    ok(SUCCEEDED(hr), "QueryInterface failed, hr %#x.\n", hr);
-
-    hr = IDirectDraw4_CreateSurface(ddraw4, NULL, &surface4, NULL);
-    ok(hr == DDERR_INVALIDPARAMS, "CreateSurface(ddsd=NULL) returned %#x,"
-            " expected %#x.\n", hr, DDERR_INVALIDPARAMS);
-
-    IDirectDraw4_Release(ddraw4);
-
-    if (!pDirectDrawCreateEx)
-    {
-        skip("DirectDrawCreateEx not available, skipping IDirectDraw7 tests.\n");
-        return;
-    }
-    hr = pDirectDrawCreateEx(NULL, (void **) &ddraw7, &IID_IDirectDraw7, NULL);
-    ok(SUCCEEDED(hr), "DirectDrawCreateEx failed, hr %#x.\n", hr);
-
-    hr = IDirectDraw7_CreateSurface(ddraw7, NULL, &surface7, NULL);
-    ok(hr == DDERR_NOCOOPERATIVELEVELSET, "CreateSurface(ddsd=NULL, pre-SCL) returned %#x,"
-            " expected %#x.\n", hr, DDERR_NOCOOPERATIVELEVELSET);
-
-    hr = IDirectDraw7_SetCooperativeLevel(ddraw7, NULL, DDSCL_NORMAL);
-    ok(hr == DD_OK, "SetCooperativeLevel failed, hr %#x.\n", hr);
-
-    hr = IDirectDraw7_CreateSurface(ddraw7, NULL, &surface7, NULL);
-    ok(hr == DDERR_INVALIDPARAMS, "CreateSurface(ddsd=NULL) returned %#x,"
-            " expected %#x.\n", hr, DDERR_INVALIDPARAMS);
-
-    IDirectDraw7_Release(ddraw7);
-}
-
 START_TEST(dsurface)
 {
     HRESULT ret;
@@ -2581,6 +2527,5 @@ START_TEST(dsurface)
     zbufferbitdepth_test();
     pixelformat_flag_test();
     partial_block_lock_test();
-    create_surface_test();
     ReleaseDirectDraw();
 }
-- 
2.15.1




More information about the wine-devel mailing list