ddraw/tests: Skip tests if we can't create a primary surface.

This commit is contained in:
Huw Davies 2008-12-05 12:22:17 +00:00 committed by Alexandre Julliard
parent 21bc015db3
commit ebb31dbbb7
2 changed files with 23 additions and 2 deletions

View File

@ -2748,6 +2748,22 @@ static void SurfaceCapsTest(void)
}
}
static BOOL can_create_primary_surface(void)
{
DDSURFACEDESC ddsd;
IDirectDrawSurface *surface;
HRESULT hr;
memset(&ddsd, 0, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS;
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
hr = IDirectDraw_CreateSurface(lpDD, &ddsd, &surface, NULL);
if(FAILED(hr)) return FALSE;
IDirectDrawSurface_Release(surface);
return TRUE;
}
START_TEST(dsurface)
{
HRESULT ret;
@ -2765,6 +2781,12 @@ START_TEST(dsurface)
}
IDirectDraw_Release(dd4);
if(!can_create_primary_surface())
{
skip("Unable to create primary surface\n");
return;
}
MipMapCreationTest();
SrcColorKey32BlitTest();
QueryInterface();

View File

@ -89,8 +89,7 @@ static BOOL createObjects(void)
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_3DDEVICE;
ddsd.dwBackBufferCount = 1;
hr = IDirectDraw7_CreateSurface(DirectDraw, &ddsd, &Surface, NULL);
ok(hr==DD_OK, "CreateSurface returned: %08x\n", hr);
if(!Surface) goto err;
if(FAILED(hr)) goto err;
hr = IDirect3D7_CreateDevice(Direct3D, &IID_IDirect3DTnLHalDevice, Surface, &Direct3DDevice);
if(FAILED(hr))