From ad66aa77a42aeaa623eb3986f3e72443028b34e0 Mon Sep 17 00:00:00 2001 From: Nicolas Le Cam Date: Wed, 29 Apr 2009 01:22:14 +0200 Subject: [PATCH] ddraw/tests: Fix a test failure on VirtualBox. --- dlls/ddraw/tests/dsurface.c | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/dlls/ddraw/tests/dsurface.c b/dlls/ddraw/tests/dsurface.c index 47a231e82e5..a0f69b1d9de 100644 --- a/dlls/ddraw/tests/dsurface.c +++ b/dlls/ddraw/tests/dsurface.c @@ -1374,20 +1374,28 @@ static void AttachmentTest(void) ok(hr==DD_OK,"CreateSurface returned: %x\n",hr); 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 */ - hr = IDirectDrawSurface_AddAttachedSurface(surface2, surface1); - ok(hr == DDERR_SURFACEALREADYATTACHED, "Attaching an attached surface to its attachee returned %08x\n", hr); - hr = IDirectDrawSurface_DeleteAttachedSurface(surface1, 0, surface2); - ok(hr == DD_OK, "DeleteAttachedSurface failed with %08x\n", hr); + ok(hr == DD_OK || broken(hr == DDERR_CANNOTATTACHSURFACE), + "Attaching an offscreen plain surface to a front buffer returned %08x\n", hr); + if(SUCCEEDED(hr)) + { + /* Try the reverse without detaching first */ + hr = IDirectDrawSurface_AddAttachedSurface(surface2, surface1); + ok(hr == DDERR_SURFACEALREADYATTACHED, "Attaching an attached surface to its attachee returned %08x\n", hr); + hr = IDirectDrawSurface_DeleteAttachedSurface(surface1, 0, surface2); + ok(hr == DD_OK, "DeleteAttachedSurface failed with %08x\n", hr); + } hr = IDirectDrawSurface_AddAttachedSurface(surface2, surface1); - ok(hr == DD_OK, "Attaching a front buffer to an offscreen plain surface returned %08x\n", hr); - /* Try to detach reversed */ - hr = IDirectDrawSurface_DeleteAttachedSurface(surface1, 0, surface2); - ok(hr == DDERR_CANNOTDETACHSURFACE, "DeleteAttachedSurface returned %08x\n", hr); - /* Now the proper detach */ - hr = IDirectDrawSurface_DeleteAttachedSurface(surface2, 0, surface1); - ok(hr == DD_OK, "DeleteAttachedSurface failed with %08x\n", hr); + ok(hr == DD_OK || broken(hr == DDERR_CANNOTATTACHSURFACE), + "Attaching a front buffer to an offscreen plain surface returned %08x\n", hr); + if(SUCCEEDED(hr)) + { + /* Try to detach reversed */ + hr = IDirectDrawSurface_DeleteAttachedSurface(surface1, 0, surface2); + ok(hr == DDERR_CANNOTDETACHSURFACE, "DeleteAttachedSurface returned %08x\n", hr); + /* Now the proper detach */ + hr = IDirectDrawSurface_DeleteAttachedSurface(surface2, 0, surface1); + ok(hr == DD_OK, "DeleteAttachedSurface failed with %08x\n", hr); + } hr = IDirectDrawSurface_AddAttachedSurface(surface2, surface3); /* Fails on refrast */ ok(hr == DD_OK || broken(hr == DDERR_CANNOTATTACHSURFACE), "Attaching an offscreen plain surface to another offscreen plain surface returned %08x\n", hr); -- 2.11.4.GIT