Module: wine Branch: master Commit: d4f504c698541826e665034fe2a1d75ae1be9742 URL: http://source.winehq.org/git/wine.git/?a=commit;h=d4f504c698541826e665034fe2...
Author: Stefan Dösinger stefan@codeweavers.com Date: Mon Dec 5 00:07:21 2011 +0100
ddraw/tests: Add a IDirect3DDevice7 GetCaps test.
---
dlls/ddraw/device.c | 6 ++++++ dlls/ddraw/tests/d3d.c | 16 ++++++++++++++++ 2 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c index 2c48ec1..c978d45 100644 --- a/dlls/ddraw/device.c +++ b/dlls/ddraw/device.c @@ -459,6 +459,12 @@ IDirect3DDeviceImpl_7_GetCaps(IDirect3DDevice7 *iface,
TRACE("iface %p, device_desc %p.\n", iface, Desc);
+ if (!Desc) + { + WARN("Desc is NULL, returning DDERR_INVALIDPARAMS.\n"); + return DDERR_INVALIDPARAMS; + } + /* Call the same function used by IDirect3D, this saves code */ return IDirect3DImpl_GetCaps(This->ddraw->wined3d, &OldDesc, Desc); } diff --git a/dlls/ddraw/tests/d3d.c b/dlls/ddraw/tests/d3d.c index d94fd7e..ae057bc 100644 --- a/dlls/ddraw/tests/d3d.c +++ b/dlls/ddraw/tests/d3d.c @@ -4980,6 +4980,21 @@ static void test_get_caps1(void) ok(hr == D3D_OK, "GetCaps with different sizes returned hr %#x, expected D3D_OK.\n", hr); }
+static void test_get_caps7(void) +{ + HRESULT hr; + D3DDEVICEDESC7 desc; + + hr = IDirect3DDevice7_GetCaps(lpD3DDevice, NULL); + ok(hr == DDERR_INVALIDPARAMS, "IDirect3DDevice7::GetCaps(NULL) returned hr %#x, expected INVALIDPARAMS.\n", hr); + + memset(&desc, 0, sizeof(desc)); + hr = IDirect3DDevice7_GetCaps(lpD3DDevice, &desc); + ok(hr == D3D_OK, "IDirect3DDevice7::GetCaps(non-NULL) returned hr %#x, expected D3D_OK.\n", hr); + + /* There's no dwSize in D3DDEVICEDESC7 */ +} + START_TEST(d3d) { init_function_pointers(); @@ -5007,6 +5022,7 @@ START_TEST(d3d) SetRenderTargetTest(); VertexBufferLockRest(); z_format_test(); + test_get_caps7(); ReleaseDirect3D(); }