[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.

Chris Ahrendt celticht32 at aol.com
Mon Oct 13 13:23:30 CDT 2008


---
 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);
-- 
1.5.5.1


--------------000307030504050807020108--



More information about the wine-devel mailing list