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

This fixes commit b0d4502c29.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2016-01-05 15:04:54 +01:00 committed by Alexandre Julliard
parent 8f91d3ccd8
commit 6862fc1dd7
1 changed files with 6 additions and 25 deletions

View File

@ -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);
}