Henri Verbeet : ddraw/tests: Don' t require a 3D device for test_resource_priority().

Alexandre Julliard julliard at wine.codeweavers.com
Tue Jan 5 12:18:33 CST 2016


Module: wine
Branch: master
Commit: 6862fc1dd7d15d4185f1d427487fce5e946ebdf9
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=6862fc1dd7d15d4185f1d427487fce5e946ebdf9

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Tue Jan  5 15:04:54 2016 +0100

ddraw/tests: Don't require a 3D device for test_resource_priority().

This fixes commit b0d4502c29941c31108a53d6c23f9e23196fb7ec.

Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ddraw/tests/ddraw7.c | 31 ++++++-------------------------
 1 file changed, 6 insertions(+), 25 deletions(-)

diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index f7a71b8..34e4c3d 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -8436,10 +8436,7 @@ static void test_lost_device(void)
 static void test_resource_priority(void)
 {
     IDirectDrawSurface7 *surface, *mipmap;
-    D3DDEVICEDESC7 device_desc;
     DDSURFACEDESC2 surface_desc;
-    IDirect3D7 *d3d;
-    IDirect3DDevice7 *device;
     IDirectDraw7 *ddraw;
     ULONG refcount;
     HWND window;
@@ -8472,19 +8469,10 @@ static void test_resource_priority(void)
 
     window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW,
             0, 0, 640, 480, 0, 0, 0, 0);
-    if (!(device = create_device(window, DDSCL_NORMAL)))
-    {
-        skip("Failed to create a 3D device, skipping test.\n");
-        DestroyWindow(window);
-        return;
-    }
-    hr = IDirect3DDevice7_GetCaps(device, &device_desc);
-    ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr);
-    hr = IDirect3DDevice7_GetDirect3D(device, &d3d);
-    ok(SUCCEEDED(hr), "Failed to get d3d interface, hr %#x.\n", hr);
-    hr = IDirect3D7_QueryInterface(d3d, &IID_IDirectDraw7, (void **)&ddraw);
-    ok(SUCCEEDED(hr), "Failed to get ddraw interface, hr %#x.\n", hr);
-    IDirect3D7_Release(d3d);
+    ddraw = create_ddraw();
+    ok(!!ddraw, "Failed to create a ddraw object.\n");
+    hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL);
+    ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
 
     memset(&hal_caps, 0, sizeof(hal_caps));
     hal_caps.dwSize = sizeof(hal_caps);
@@ -8505,12 +8493,6 @@ static void test_resource_priority(void)
         surface_desc.dwWidth = 32;
         surface_desc.dwHeight = 32;
         surface_desc.ddsCaps.dwCaps = test_data[i].caps;
-        if ((test_data[i].caps2 & DDSCAPS2_CUBEMAP)
-                && !(device_desc.dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_CUBEMAP))
-        {
-            skip("Device does not support cubemaps.\n");
-            continue;
-        }
         surface_desc.ddsCaps.dwCaps2 = test_data[i].caps2;
         hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface, NULL);
         if (is_ddraw64 && (test_data[i].caps & DDSCAPS_TEXTURE))
@@ -8550,10 +8532,10 @@ static void test_resource_priority(void)
         if (test_data[i].caps2 & DDSCAPS2_CUBEMAP)
         {
             caps.dwCaps2 = DDSCAPS2_CUBEMAP_NEGATIVEZ;
-            priority = 0xdeadbeef;
             hr = IDirectDrawSurface7_GetAttachedSurface(surface, &caps, &mipmap);
             ok(SUCCEEDED(hr), "Failed to get attached surface, i %u, hr %#x.\n", i, hr);
             /* IDirectDrawSurface7_SetPriority crashes when called on non-positive X surfaces on Windows */
+            priority = 0xdeadbeef;
             hr = IDirectDrawSurface7_GetPriority(mipmap, &priority);
             ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x, type %s.\n", hr, test_data[i].name);
             ok(priority == 0xdeadbeef, "Got unexpected priority %u, type %s.\n", priority, test_data[i].name);
@@ -8595,8 +8577,7 @@ static void test_resource_priority(void)
     ok(!refcount, "Got unexpected refcount %u.\n", refcount);
 
 done:
-    IDirectDraw7_Release(ddraw);
-    refcount = IDirect3DDevice7_Release(device);
+    refcount = IDirectDraw7_Release(ddraw);
     ok(!refcount, "Got unexpected refcount %u.\n", refcount);
     DestroyWindow(window);
 }




More information about the wine-cvs mailing list