[PATCH 1/2] d3drm/tests: Add tests for IDirect3DRM*::CreateObject.
Aaryaman Vasishta
jem456.vasishta at gmail.com
Sun Apr 3 14:04:01 CDT 2016
Signed-off-by: Aaryaman Vasishta <jem456.vasishta at gmail.com>
---
dlls/d3drm/tests/d3drm.c | 86 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 86 insertions(+)
diff --git a/dlls/d3drm/tests/d3drm.c b/dlls/d3drm/tests/d3drm.c
index c94d31e..1abfed3 100644
--- a/dlls/d3drm/tests/d3drm.c
+++ b/dlls/d3drm/tests/d3drm.c
@@ -1238,6 +1238,91 @@ static void CDECL destroy_callback1(IDirect3DRMObject *obj, void *arg)
ctxt->called++;
}
+static void test_object(void)
+{
+ static const struct
+ {
+ REFCLSID clsid;
+ REFIID iid;
+ }
+ tests[] =
+ {
+ { &CLSID_CDirect3DRMDevice, &IID_IDirect3DRMDevice },
+ { &CLSID_CDirect3DRMDevice, &IID_IDirect3DRMDevice2 },
+ { &CLSID_CDirect3DRMDevice, &IID_IDirect3DRMDevice3 },
+ { &CLSID_CDirect3DRMDevice, &IID_IDirect3DRMWinDevice },
+ { &CLSID_CDirect3DRMTexture, &IID_IDirect3DRMTexture },
+ { &CLSID_CDirect3DRMTexture, &IID_IDirect3DRMTexture2 },
+ { &CLSID_CDirect3DRMTexture, &IID_IDirect3DRMTexture3 },
+ { &CLSID_CDirect3DRMViewport, &IID_IDirect3DRMViewport },
+ { &CLSID_CDirect3DRMViewport, &IID_IDirect3DRMViewport2 },
+ };
+ IDirect3DRM *d3drm1;
+ IDirect3DRM2 *d3drm2;
+ IDirect3DRM3 *d3drm3;
+ IUnknown *unknown;
+ HRESULT hr;
+ ULONG ref1, ref2, ref3;
+ int i;
+
+ hr = Direct3DRMCreate(&d3drm1);
+ ok(SUCCEEDED(hr), "Cannot get IDirect3DRM interface (hr = %#x).\n", hr);
+ ref1 = get_refcount((IUnknown *)d3drm1);
+ hr = IDirect3DRM_QueryInterface(d3drm1, &IID_IDirect3DRM2, (void **)&d3drm2);
+ ok(SUCCEEDED(hr), "Cannot get IDirect3DRM2 interface (hr = %#x).\n", hr);
+ hr = IDirect3DRM_QueryInterface(d3drm1, &IID_IDirect3DRM3, (void **)&d3drm3);
+ ok(SUCCEEDED(hr), "Cannot get IDirect3DRM3 interface (hr = %#x).\n", hr);
+
+ for (i = 0; i < sizeof(tests) / sizeof(*tests); ++i)
+ {
+ hr = IDirect3DRM_CreateObject(d3drm1, NULL, NULL, tests[i].iid, (void **)&unknown);
+ todo_wine ok(hr == D3DRMERR_BADVALUE, "Test %u: expected hr == D3DRMERR_BADVALUE, got %#x.\n", i, hr);
+ hr = IDirect3DRM_CreateObject(d3drm1, tests[i].clsid, NULL, NULL, (void **)&unknown);
+ todo_wine ok(hr == D3DRMERR_BADVALUE, "Test %u: expected hr == D3DRMERR_BADVALUE, got %#x.\n", i, hr);
+ hr = IDirect3DRM_CreateObject(d3drm1, tests[i].clsid, NULL, NULL, NULL);
+ todo_wine ok(hr == D3DRMERR_BADVALUE, "Test %u: expected hr == D3DRMERR_BADVALUE, got %#x.\n", i, hr);
+
+ hr = IDirect3DRM_CreateObject(d3drm1, tests[i].clsid, NULL, tests[i].iid, (void **)&unknown);
+ todo_wine ok(SUCCEEDED(hr), "Test %u: expected hr == D3DRM_OK, got %#x.\n", i, hr);
+ if (SUCCEEDED(hr))
+ {
+ ref2 = get_refcount((IUnknown *)d3drm1);
+ ok(ref2 == ref1, "Test %u: expected ref2 == ref1, got ref1 = %u, ref2 = %u.\n", i, ref1, ref2);
+ IUnknown_Release(unknown);
+ ref2 = get_refcount((IUnknown *)d3drm1);
+ ok(ref2 == ref1, "Test %u: expected ref2 == ref1, got ref1 = %u, ref2 = %u.\n", i, ref1, ref2);
+
+ hr = IDirect3DRM2_CreateObject(d3drm2, tests[i].clsid, NULL, tests[i].iid, (void **)&unknown);
+ ok(SUCCEEDED(hr), "Test %u: expected hr == D3DRM_OK, got %#x.\n", i, hr);
+ ref2 = get_refcount((IUnknown *)d3drm1);
+ ok(ref2 == ref1, "Test %u: expected ref2 == ref1, got ref1 = %u, ref2 = %u.\n", i, ref1, ref2);
+ ref3 = get_refcount((IUnknown *)d3drm2);
+ ok(ref3 == ref1, "Test %u: expected ref3 == ref1, got ref1 = %u, ref3 = %u.\n", i, ref1, ref3);
+ IUnknown_Release(unknown);
+ ref2 = get_refcount((IUnknown *)d3drm1);
+ ok(ref2 == ref1, "Test %u: expected ref2 == ref1, got ref1 = %u, ref2 = %u.\n", i, ref1, ref2);
+ ref3 = get_refcount((IUnknown *)d3drm2);
+ ok(ref3 == ref1, "Test %u: expected ref3 == ref1, got ref1 = %u, ref3 = %u.\n", i, ref1, ref3);
+
+ hr = IDirect3DRM3_CreateObject(d3drm3, tests[i].clsid, NULL, tests[i].iid, (void **)&unknown);
+ ok(SUCCEEDED(hr), "Test %u: expected hr == D3DRM_OK, got %#x.\n", i, hr);
+ ref2 = get_refcount((IUnknown *)d3drm1);
+ ok(ref2 == ref1, "Test %u: expected ref2 == ref1, got ref1 = %u, ref2 = %u.\n", i, ref1, ref2);
+ ref3 = get_refcount((IUnknown *)d3drm3);
+ ok(ref3 == ref1, "Test %u: expected ref3 == ref1, got ref1 = %u, ref3 = %u.\n", i, ref1, ref3);
+ IUnknown_Release(unknown);
+ ref2 = get_refcount((IUnknown *)d3drm1);
+ ok(ref2 == ref1, "Test %u: expected ref2 == ref1, got ref1 = %u, ref2 = %u.\n", i, ref1, ref2);
+ ref3 = get_refcount((IUnknown *)d3drm3);
+ ok(ref3 == ref1, "Test %u: expected ref3 == ref1, got ref1 = %u, ref3 = %u.\n", i, ref1, ref3);
+ }
+ }
+
+ IDirect3DRM_Release(d3drm1);
+ IDirect3DRM2_Release(d3drm2);
+ IDirect3DRM3_Release(d3drm3);
+}
+
static void test_Viewport(void)
{
struct destroy_context context;
@@ -4287,6 +4372,7 @@ START_TEST(d3drm)
test_Face();
test_Frame();
test_Device();
+ test_object();
test_Viewport();
test_Light();
test_Material2();
--
2.3.2 (Apple Git-55)
More information about the wine-patches
mailing list