[PATCH 2/3] ddraw/tests: Add a IDirect3DDevice7 GetCaps test
stefan at codeweavers.com
stefan at codeweavers.com
Thu Dec 1 06:05:10 CST 2011
From: Stefan Dösinger <stefan at codeweavers.com>
---
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 0207722..924eda0 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 f9965db..172600e 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();
}
--
1.7.3.4
More information about the wine-patches
mailing list