Commit 6862fc1d authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

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

This fixes commit b0d4502c. Signed-off-by: 's avatarHenri Verbeet <hverbeet@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 8f91d3cc
...@@ -8436,10 +8436,7 @@ static void test_lost_device(void) ...@@ -8436,10 +8436,7 @@ static void test_lost_device(void)
static void test_resource_priority(void) static void test_resource_priority(void)
{ {
IDirectDrawSurface7 *surface, *mipmap; IDirectDrawSurface7 *surface, *mipmap;
D3DDEVICEDESC7 device_desc;
DDSURFACEDESC2 surface_desc; DDSURFACEDESC2 surface_desc;
IDirect3D7 *d3d;
IDirect3DDevice7 *device;
IDirectDraw7 *ddraw; IDirectDraw7 *ddraw;
ULONG refcount; ULONG refcount;
HWND window; HWND window;
...@@ -8472,19 +8469,10 @@ static void test_resource_priority(void) ...@@ -8472,19 +8469,10 @@ static void test_resource_priority(void)
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW,
0, 0, 640, 480, 0, 0, 0, 0); 0, 0, 640, 480, 0, 0, 0, 0);
if (!(device = create_device(window, DDSCL_NORMAL))) ddraw = create_ddraw();
{ ok(!!ddraw, "Failed to create a ddraw object.\n");
skip("Failed to create a 3D device, skipping test.\n"); hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL);
DestroyWindow(window); ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
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);
memset(&hal_caps, 0, sizeof(hal_caps)); memset(&hal_caps, 0, sizeof(hal_caps));
hal_caps.dwSize = sizeof(hal_caps); hal_caps.dwSize = sizeof(hal_caps);
...@@ -8505,12 +8493,6 @@ static void test_resource_priority(void) ...@@ -8505,12 +8493,6 @@ static void test_resource_priority(void)
surface_desc.dwWidth = 32; surface_desc.dwWidth = 32;
surface_desc.dwHeight = 32; surface_desc.dwHeight = 32;
surface_desc.ddsCaps.dwCaps = test_data[i].caps; 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; surface_desc.ddsCaps.dwCaps2 = test_data[i].caps2;
hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface, NULL); hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface, NULL);
if (is_ddraw64 && (test_data[i].caps & DDSCAPS_TEXTURE)) if (is_ddraw64 && (test_data[i].caps & DDSCAPS_TEXTURE))
...@@ -8550,10 +8532,10 @@ static void test_resource_priority(void) ...@@ -8550,10 +8532,10 @@ static void test_resource_priority(void)
if (test_data[i].caps2 & DDSCAPS2_CUBEMAP) if (test_data[i].caps2 & DDSCAPS2_CUBEMAP)
{ {
caps.dwCaps2 = DDSCAPS2_CUBEMAP_NEGATIVEZ; caps.dwCaps2 = DDSCAPS2_CUBEMAP_NEGATIVEZ;
priority = 0xdeadbeef;
hr = IDirectDrawSurface7_GetAttachedSurface(surface, &caps, &mipmap); hr = IDirectDrawSurface7_GetAttachedSurface(surface, &caps, &mipmap);
ok(SUCCEEDED(hr), "Failed to get attached surface, i %u, hr %#x.\n", i, hr); 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 */ /* IDirectDrawSurface7_SetPriority crashes when called on non-positive X surfaces on Windows */
priority = 0xdeadbeef;
hr = IDirectDrawSurface7_GetPriority(mipmap, &priority); hr = IDirectDrawSurface7_GetPriority(mipmap, &priority);
ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x, type %s.\n", hr, test_data[i].name); 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); 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) ...@@ -8595,8 +8577,7 @@ static void test_resource_priority(void)
ok(!refcount, "Got unexpected refcount %u.\n", refcount); ok(!refcount, "Got unexpected refcount %u.\n", refcount);
done: done:
IDirectDraw7_Release(ddraw); refcount = IDirectDraw7_Release(ddraw);
refcount = IDirect3DDevice7_Release(device);
ok(!refcount, "Got unexpected refcount %u.\n", refcount); ok(!refcount, "Got unexpected refcount %u.\n", refcount);
DestroyWindow(window); DestroyWindow(window);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment