ddraw/tests: New tests for CreateSurface for 3D DDSCAPS_BACKBUFFER.

This commit is contained in:
Oldřich Jedlička 2010-09-02 22:00:35 +02:00 committed by Alexandre Julliard
parent 8aa6ed97c8
commit 51332b7a03
1 changed files with 93 additions and 0 deletions

View File

@ -3526,6 +3526,98 @@ static void FindDevice(void)
"Expected IDirect3D1::FindDevice to return D3D_OK, got 0x%08x\n", hr); "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) START_TEST(d3d)
{ {
init_function_pointers(); init_function_pointers();
@ -3561,6 +3653,7 @@ START_TEST(d3d)
TextureLoadTest(); TextureLoadTest();
ViewportTest(); ViewportTest();
FindDevice(); FindDevice();
BackBuffer3DCreateSurfaceTest();
D3D1_releaseObjects(); D3D1_releaseObjects();
} }