ddraw/tests: New CreateSurface for 3D DDSCAPS_BACKBUFFER tests.
Oldřich Jedlička
oldium.pro at seznam.cz
Fri Aug 27 15:58:50 CDT 2010
It tests basic 3D back buffer creation and getting the D3D device.
---
dlls/ddraw/tests/d3d.c | 93 ++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 93 insertions(+), 0 deletions(-)
diff --git a/dlls/ddraw/tests/d3d.c b/dlls/ddraw/tests/d3d.c
index 53ef04b..23a0470 100644
--- a/dlls/ddraw/tests/d3d.c
+++ b/dlls/ddraw/tests/d3d.c
@@ -3536,6 +3536,98 @@ static void FindDevice(void)
"Expected IDirect3D1::FindDevice to return D3D_OK, got 0x%08x\n", hr);
}
+static void BackBuffer3DCreateSurfaceTest(void)
+{
+ DDSURFACEDESC ddsd;
+ DDSURFACEDESC created_ddsd;
+ DDSURFACEDESC2 ddsd2;
+ IDirectDrawSurface *surf;
+ IDirectDrawSurface4 *surf4;
+ IDirectDrawSurface7 *surf7;
+ HRESULT hr;
+ IDirectDraw2 *dd2;
+ IDirectDraw4 *dd4;
+ IDirectDraw7 *dd7;
+ DDCAPS ddcaps;
+ IDirect3DDevice *d3dhal;
+
+ const DWORD caps = DDSCAPS_BACKBUFFER | DDSCAPS_3DDEVICE;
+ const DWORD expected_caps = DDSCAPS_BACKBUFFER | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM;
+
+ memset(&ddcaps, 0, sizeof(ddcaps));
+ ddcaps.dwSize = sizeof(DDCAPS);
+ hr = IDirectDraw_GetCaps(DirectDraw1, &ddcaps, NULL);
+ if (!(ddcaps.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY))
+ {
+ skip("DDraw reported no VIDEOMEMORY cap. Broken video driver? Skipping surface caps tests.\n");
+ return ;
+ }
+
+ memset(&ddsd, 0, sizeof(ddsd));
+ ddsd.dwSize = sizeof(ddsd);
+ ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
+ ddsd.dwWidth = 64;
+ ddsd.dwHeight = 64;
+ ddsd.ddsCaps.dwCaps = caps;
+ memset(&ddsd2, 0, sizeof(ddsd2));
+ ddsd2.dwSize = sizeof(ddsd2);
+ ddsd2.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
+ ddsd2.dwWidth = 64;
+ ddsd2.dwHeight = 64;
+ ddsd2.ddsCaps.dwCaps = caps;
+ memset(&created_ddsd, 0, sizeof(created_ddsd));
+ created_ddsd.dwSize = sizeof(DDSURFACEDESC);
+
+ hr = IDirectDraw_CreateSurface(DirectDraw1, &ddsd, &surf, NULL);
+ todo_wine ok(SUCCEEDED(hr), "IDirectDraw_CreateSurface failed: 0x%08x\n", hr);
+ if (surf != NULL)
+ {
+ hr = IDirectDrawSurface_GetSurfaceDesc(surf, &created_ddsd);
+ ok(SUCCEEDED(hr), "IDirectDraw_GetSurfaceDesc failed: 0x%08x\n", hr);
+ todo_wine ok(created_ddsd.ddsCaps.dwCaps == expected_caps,
+ "GetSurfaceDesc returned caps %x, expected %x\n", created_ddsd.ddsCaps.dwCaps,
+ expected_caps);
+
+ hr = IDirectDrawSurface_QueryInterface(surf, &IID_IDirect3DHALDevice, (void **)&d3dhal);
+ /* Currently Wine only supports the creation of one Direct3D device
+ for a given DirectDraw instance. It has been created already
+ in D3D1_createObjects() - IID_IDirect3DRGBDevice */
+ todo_wine ok(SUCCEEDED(hr), "Expected IDirectDrawSurface::QueryInterface to succeed, got 0x%08x\n", hr);
+
+ if (SUCCEEDED(hr))
+ IDirect3DDevice_Release(d3dhal);
+
+ IDirectDrawSurface_Release(surf);
+ }
+
+ hr = IDirectDraw_QueryInterface(DirectDraw1, &IID_IDirectDraw2, (void **) &dd2);
+ ok(SUCCEEDED(hr), "IDirectDraw_QueryInterface failed: 0x%08x\n", hr);
+
+ hr = IDirectDraw2_CreateSurface(dd2, &ddsd, &surf, NULL);
+ ok(hr == DDERR_INVALIDCAPS, "IDirectDraw2_CreateSurface didn't return %x08x, but %x08x\n",
+ DDERR_INVALIDCAPS, hr);
+
+ IDirectDraw2_Release(dd2);
+
+ hr = IDirectDraw_QueryInterface(DirectDraw1, &IID_IDirectDraw4, (void **) &dd4);
+ ok(SUCCEEDED(hr), "IDirectDraw_QueryInterface failed: 0x%08x\n", hr);
+
+ hr = IDirectDraw4_CreateSurface(dd4, &ddsd2, &surf4, NULL);
+ ok(hr == DDERR_INVALIDCAPS, "IDirectDraw4_CreateSurface didn't return %x08x, but %x08x\n",
+ DDERR_INVALIDCAPS, hr);
+
+ IDirectDraw4_Release(dd4);
+
+ hr = IDirectDraw_QueryInterface(DirectDraw1, &IID_IDirectDraw7, (void **) &dd7);
+ ok(SUCCEEDED(hr), "IDirectDraw_QueryInterface failed: 0x%08x\n", hr);
+
+ hr = IDirectDraw7_CreateSurface(dd7, &ddsd2, &surf7, NULL);
+ ok(hr == DDERR_INVALIDCAPS, "IDirectDraw7_CreateSurface didn't return %x08x, but %x08x\n",
+ DDERR_INVALIDCAPS, hr);
+
+ IDirectDraw7_Release(dd7);
+}
+
START_TEST(d3d)
{
init_function_pointers();
@@ -3571,6 +3663,7 @@ START_TEST(d3d)
TextureLoadTest();
ViewportTest();
FindDevice();
+ BackBuffer3DCreateSurfaceTest();
D3D1_releaseObjects();
}
--
1.7.2.2
More information about the wine-patches
mailing list