ok(rc==DDERR_INVALIDPARAMS,"CreateSurface returned: %x\n",rc);
- if (FAILED(rc)) {
skip("failed to create surface\n");
return;
}
here it is _expected_ that the surface creation fails. So this code is not useful. ALso in other places.
ciao, Marcus
Ok that I can fix easy enough...
chris
Ok I fixed the code to take this out... however : one section there is something I am not sure of so I left it in to prevent the exception from occuring.
here is my change that doesn't cause an exception:
ZeroMemory(&desc, sizeof(desc)); desc.dwSize = sizeof(desc); desc.dwFlags = DDSD_CAPS; desc.ddsCaps.dwCaps |= DDSCAPS_PRIMARYSURFACE; desc.dwHeight = 128; /* Keep them set to check what happens */ desc.dwWidth = 128; /* Keep them set to check what happens */ ret = IDirectDraw_CreateSurface(lpDD, &desc, &dsurface, NULL); ok(ret == DD_OK, "Creating a primary surface without width and height info returned %08x\n", ret);
/* This should be handled but CreateSurface is not returning right */ if (FAILED(ret)) { skip("Can't create cubemap surface\n"); return; }
if(dsurface) { ret = IDirectDrawSurface_GetSurfaceDesc(dsurface, &desc); ok(ret == DD_OK, "GetSurfaceDesc returned %x\n", ret);
If those lines are not there then when it gets to the ret = IDirectDrawSurface_GetSurfaceDesc(dsurface, &desc); line it throws and exception because dsurface is null.. so I am wondering if the if should be if(&dsurface) instead of the above?
Chris
From 6efc80d39533cd5940265b752442f607941fbab9 Mon Sep 17 00:00:00 2001
From: Chris Ahrendt celticht32@aol.com Date: Mon, 13 Oct 2008 14:23:30 -0400 Subject: [PATCH] Pared Down Test For ddraw test... fixes error with IDirectDraw_CreateSurface where the test is not checking the return from the call. CreateSurface is returning a null.
--- dlls/ddraw/tests/dsurface.c | 28 +++++++++++++++++++++++----- 1 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/dlls/ddraw/tests/dsurface.c b/dlls/ddraw/tests/dsurface.c index fc7bb88..21e6b15 100644 --- a/dlls/ddraw/tests/dsurface.c +++ b/dlls/ddraw/tests/dsurface.c @@ -1181,7 +1181,10 @@ static void AttachmentTest7(void) ddsd.dwHeight = GetSystemMetrics(SM_CYSCREEN); hr = IDirectDraw7_CreateSurface(dd7, &ddsd, &surface3, NULL); ok(hr==DD_OK,"CreateSurface returned: %x\n",hr); - + if (FAILED(hr)) { + skip("failed to create surface3\n"); + return; + } /* This one has a different size */ memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); @@ -1191,7 +1194,10 @@ static void AttachmentTest7(void) ddsd.dwHeight = 128; hr = IDirectDraw7_CreateSurface(dd7, &ddsd, &surface4, NULL); ok(hr==DD_OK,"CreateSurface returned: %x\n",hr); - + if (FAILED(hr)) { + skip("failed to create surface4\n"); + return; + } hr = IDirectDrawSurface7_AddAttachedSurface(surface1, surface2); ok(hr == DDERR_CANNOTATTACHSURFACE, "Attaching an offscreen plain surface to a front buffer returned %08x\n", hr); hr = IDirectDrawSurface7_AddAttachedSurface(surface2, surface1); @@ -1362,7 +1368,10 @@ static void AttachmentTest(void) ddsd.dwHeight = GetSystemMetrics(SM_CYSCREEN); hr = IDirectDraw_CreateSurface(lpDD, &ddsd, &surface3, NULL); ok(hr==DD_OK,"CreateSurface returned: %x\n",hr); - + if (FAILED(hr)) { + skip("failed to create surface3\n"); + return; + } /* This one has a different size */ memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); @@ -1372,7 +1381,10 @@ static void AttachmentTest(void) ddsd.dwHeight = 128; hr = IDirectDraw_CreateSurface(lpDD, &ddsd, &surface4, NULL); ok(hr==DD_OK,"CreateSurface returned: %x\n",hr); - + if (FAILED(hr)) { + skip("failed to create surface4\n"); + return; + } hr = IDirectDrawSurface_AddAttachedSurface(surface1, surface2); ok(hr == DD_OK, "Attaching an offscreen plain surface to a front buffer returned %08x\n", hr); /* Try the reverse without detaching first */ @@ -2208,6 +2220,12 @@ static void SizeTest(void) desc.dwWidth = 128; /* Keep them set to check what happens */ ret = IDirectDraw_CreateSurface(lpDD, &desc, &dsurface, NULL); ok(ret == DD_OK, "Creating a primary surface without width and height info returned %08x\n", ret); + /* This should be handled but CreateSurface is failing */ + if (FAILED(ret)) + { + skip("Can't create cubemap surface\n"); + return; + } if(dsurface) { ret = IDirectDrawSurface_GetSurfaceDesc(dsurface, &desc); @@ -2492,7 +2510,7 @@ static void PaletteTest(void) ok(hr==DD_OK, "CreateSurface returned: %x\n",hr); if (FAILED(hr)) { skip("failed to create surface\n"); - goto err; + return; }
hr = IDirectDrawSurface_SetPalette(lpSurf, palette);