From 8b1c1edb6b29d68ec70043eb57ac74ea7b13e73a Mon Sep 17 00:00:00 2001 From: Andrew Nguyen Date: Sun, 18 Jul 2010 16:27:10 -0500 Subject: [PATCH] ddraw/tests: Test IDirect3D::FindDevice HAL enumeration. --- dlls/ddraw/tests/d3d.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/dlls/ddraw/tests/d3d.c b/dlls/ddraw/tests/d3d.c index aa87ca6b588..53ef04b5d40 100644 --- a/dlls/ddraw/tests/d3d.c +++ b/dlls/ddraw/tests/d3d.c @@ -3410,6 +3410,7 @@ static void FindDevice(void) D3DFINDDEVICESEARCH search = {0}; D3DFINDDEVICERESULT result = {0}; + IDirect3DDevice *d3dhal; HRESULT hr; int i; @@ -3472,6 +3473,34 @@ static void FindDevice(void) "[%d] Expected IDirect3D1::FindDevice to return DDERR_NOTFOUND, got 0x%08x\n", i, hr); } + /* The HAL device can only be enumerated if hardware acceleration is present. */ + search.dwSize = sizeof(search); + search.dwFlags = D3DFDS_GUID; + search.guid = IID_IDirect3DHALDevice; + result.dwSize = sizeof(result); + + hr = IDirect3D_FindDevice(Direct3D1, &search, &result); + trace("IDirect3D::FindDevice returned 0x%08x for the HAL device GUID\n", hr); + if (SUCCEEDED(hr)) + { + hr = IDirectDrawSurface_QueryInterface(Surface1, &IID_IDirect3DHALDevice, (void **)&d3dhal); + /* Currently Wine only supports the creation of one Direct3D device + * for a given DirectDraw instance. */ + todo_wine + ok(SUCCEEDED(hr), "Expected IDirectDrawSurface::QueryInterface to succeed, got 0x%08x\n", hr); + + if (SUCCEEDED(hr)) + IDirect3DDevice_Release(d3dhal); + } + else + { + hr = IDirectDrawSurface_QueryInterface(Surface1, &IID_IDirect3DHALDevice, (void **)&d3dhal); + ok(FAILED(hr), "Expected IDirectDrawSurface::QueryInterface to fail, got 0x%08x\n", hr); + + if (SUCCEEDED(hr)) + IDirect3DDevice_Release(d3dhal); + } + /* These GUIDs appear to be always present. */ for (i = 0; i < sizeof(deviceGUIDs)/sizeof(deviceGUIDs[0]); i++) { -- 2.11.4.GIT