From ebb31dbbb7fef3bf628c13edbf85a4ad0fc59cbd Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Fri, 5 Dec 2008 12:22:17 +0000 Subject: [PATCH] ddraw/tests: Skip tests if we can't create a primary surface. --- dlls/ddraw/tests/dsurface.c | 22 ++++++++++++++++++++++ dlls/ddraw/tests/visual.c | 3 +-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/dlls/ddraw/tests/dsurface.c b/dlls/ddraw/tests/dsurface.c index d4626addc4..80cf9b1341 100644 --- a/dlls/ddraw/tests/dsurface.c +++ b/dlls/ddraw/tests/dsurface.c @@ -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(); diff --git a/dlls/ddraw/tests/visual.c b/dlls/ddraw/tests/visual.c index 12f11c9e50..185cc334b0 100644 --- a/dlls/ddraw/tests/visual.c +++ b/dlls/ddraw/tests/visual.c @@ -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))