Module: wine Branch: master Commit: 7085a3f85b62bb3532164908b47640750e665572 URL: http://source.winehq.org/git/wine.git/?a=commit;h=7085a3f85b62bb3532164908b4...
Author: Oldřich Jedlička oldium.pro@seznam.cz Date: Tue Sep 14 18:51:59 2010 +0200
ddraw/tests: New attachment tests for 3D back buffers.
---
dlls/ddraw/tests/d3d.c | 98 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 98 insertions(+), 0 deletions(-)
diff --git a/dlls/ddraw/tests/d3d.c b/dlls/ddraw/tests/d3d.c index 3427563..d291705 100644 --- a/dlls/ddraw/tests/d3d.c +++ b/dlls/ddraw/tests/d3d.c @@ -3618,6 +3618,103 @@ static void BackBuffer3DCreateSurfaceTest(void) IDirectDraw7_Release(dd7); }
+static void BackBuffer3DAttachmentTest(void) +{ + HRESULT hr; + IDirectDrawSurface *surface1, *surface2, *surface3, *surface4; + DDSURFACEDESC ddsd; + HWND window = CreateWindow( "static", "ddraw_test", WS_OVERLAPPEDWINDOW, 100, 100, 160, 160, NULL, NULL, NULL, NULL ); + + hr = IDirectDraw_SetCooperativeLevel(DirectDraw1, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(hr == DD_OK, "SetCooperativeLevel returned %08x\n", hr); + + /* Perform attachment tests on a back-buffer */ + memset(&ddsd, 0, sizeof(ddsd)); + ddsd.dwSize = sizeof(ddsd); + ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; + ddsd.ddsCaps.dwCaps = DDSCAPS_BACKBUFFER | DDSCAPS_3DDEVICE; + ddsd.dwWidth = GetSystemMetrics(SM_CXSCREEN); + ddsd.dwHeight = GetSystemMetrics(SM_CYSCREEN); + hr = IDirectDraw_CreateSurface(DirectDraw1, &ddsd, &surface2, NULL); + todo_wine ok(SUCCEEDED(hr), "CreateSurface returned: %x\n",hr); + + if (surface2 != NULL) + { + /* Try a single primary and a two back buffers */ + memset(&ddsd, 0, sizeof(ddsd)); + ddsd.dwSize = sizeof(ddsd); + ddsd.dwFlags = DDSD_CAPS; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; + hr = IDirectDraw_CreateSurface(DirectDraw1, &ddsd, &surface1, NULL); + ok(hr==DD_OK,"CreateSurface returned: %x\n",hr); + + memset(&ddsd, 0, sizeof(ddsd)); + ddsd.dwSize = sizeof(ddsd); + ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; + ddsd.ddsCaps.dwCaps = DDSCAPS_BACKBUFFER | DDSCAPS_3DDEVICE; + ddsd.dwWidth = GetSystemMetrics(SM_CXSCREEN); + ddsd.dwHeight = GetSystemMetrics(SM_CYSCREEN); + hr = IDirectDraw_CreateSurface(DirectDraw1, &ddsd, &surface3, NULL); + ok(hr==DD_OK,"CreateSurface returned: %x\n",hr); + + /* This one has a different size */ + memset(&ddsd, 0, sizeof(ddsd)); + ddsd.dwSize = sizeof(ddsd); + ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; + ddsd.ddsCaps.dwCaps = DDSCAPS_BACKBUFFER | DDSCAPS_3DDEVICE; + ddsd.dwWidth = 128; + ddsd.dwHeight = 128; + hr = IDirectDraw_CreateSurface(DirectDraw1, &ddsd, &surface4, NULL); + ok(hr==DD_OK,"CreateSurface returned: %x\n",hr); + + hr = IDirectDrawSurface_AddAttachedSurface(surface1, surface2); + todo_wine ok(hr == DD_OK || broken(hr == DDERR_CANNOTATTACHSURFACE), + "Attaching a back buffer 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); + todo_wine ok(hr == DD_OK || broken(hr == DDERR_CANNOTATTACHSURFACE), + "Attaching a front buffer to a back buffer 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); + todo_wine ok(hr == DD_OK || broken(hr == DDERR_CANNOTATTACHSURFACE), + "Attaching a back buffer to another back buffer returned %08x\n", hr); + if(SUCCEEDED(hr)) + { + hr = IDirectDrawSurface_DeleteAttachedSurface(surface2, 0, surface3); + ok(hr == DD_OK, "DeleteAttachedSurface failed with %08x\n", hr); + } + hr = IDirectDrawSurface_AddAttachedSurface(surface1, surface4); + ok(hr == DDERR_CANNOTATTACHSURFACE, "Attaching a back buffer to a front buffer of different size returned %08x\n", hr); + hr = IDirectDrawSurface_AddAttachedSurface(surface4, surface1); + ok(hr == DDERR_CANNOTATTACHSURFACE, "Attaching a front buffer to a back buffer of different size returned %08x\n", hr); + + IDirectDrawSurface_Release(surface4); + IDirectDrawSurface_Release(surface3); + IDirectDrawSurface_Release(surface2); + IDirectDrawSurface_Release(surface1); + } + + hr =IDirectDraw_SetCooperativeLevel(DirectDraw1, NULL, DDSCL_NORMAL); + ok(hr == DD_OK, "SetCooperativeLevel returned %08x\n", hr); + + DestroyWindow(window); +} + START_TEST(d3d) { init_function_pointers(); @@ -3654,6 +3751,7 @@ START_TEST(d3d) ViewportTest(); FindDevice(); BackBuffer3DCreateSurfaceTest(); + BackBuffer3DAttachmentTest(); D3D1_releaseObjects(); }