[PATCH 3/5] d3drm/tests: Add refcount tests for IDirect3DRMFrame*. (v2)

Aaryaman Vasishta jem456.vasishta at gmail.com
Wed Jun 15 04:35:57 CDT 2016


Signed-off-by: Aaryaman Vasishta <jem456.vasishta at gmail.com>
---
 dlls/d3drm/tests/d3drm.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/dlls/d3drm/tests/d3drm.c b/dlls/d3drm/tests/d3drm.c
index 5cd6a11..6442ce3 100644
--- a/dlls/d3drm/tests/d3drm.c
+++ b/dlls/d3drm/tests/d3drm.c
@@ -2560,6 +2560,7 @@ static void test_frame_qi(void)
     IDirect3DRMFrame2 *frame2;
     IDirect3DRMFrame3 *frame3;
     IUnknown *unknown;
+    DWORD ref1, ref2, ref3;
 
     hr = Direct3DRMCreate(&d3drm1);
     ok(hr == D3DRM_OK, "Cannot get IDirect3DRM interface (hr = %x)\n", hr);
@@ -2592,6 +2593,34 @@ static void test_frame_qi(void)
     test_qi("frame3_qi", unknown, &IID_IUnknown, tests, sizeof(tests) / sizeof(*tests));
     IUnknown_Release(unknown);
 
+    hr = IDirect3DRM_CreateFrame(d3drm1, NULL, &frame1);
+    ok(SUCCEEDED(hr), "Cannot get IDirect3DRMFrame interface (hr = %#x).\n", hr);
+
+    hr = IDirect3DRMFrame_QueryInterface(frame1, &IID_IDirect3DRMFrame2, (void **)&frame2);
+    ok(SUCCEEDED(hr), "Could not get IDirect3DRMFrame2 interface (hr = %#x).\n", hr);
+    hr = IDirect3DRMFrame_QueryInterface(frame1, &IID_IDirect3DRMFrame3, (void **)&frame3);
+    ok(SUCCEEDED(hr), "Could not get IDirect3DRMFrame3 interface (hr = %#x).\n", hr);
+
+    ref1 = get_refcount((IUnknown *)frame1);
+    ref2 = get_refcount((IUnknown *)frame2);
+    ref3 = get_refcount((IUnknown *)frame3);
+    ok(ref1 == ref2, "Expected ref1 == ref2, got ref1 = %u, ref2 = %u.\n", ref1, ref2);
+    ok(ref2 == ref3, "Expected ref2 == ref3, got ref2 = %u, ref3 = %u.\n", ref2, ref3);
+    ok(ref1 == ref3, "Expected ref1 == ref3, got ref1 = %u, ref3 = %u.\n", ref1, ref3);
+
+    IDirect3DRMFrame2_AddRef(frame2);
+    ref1 = get_refcount((IUnknown *)frame1);
+    ref2 = get_refcount((IUnknown *)frame2);
+    ref3 = get_refcount((IUnknown *)frame3);
+    ok(ref1 == ref2, "Expected ref1 == ref2, got ref1 = %u, ref2 = %u.\n", ref1, ref2);
+    ok(ref2 == ref3, "Expected ref2 == ref3, got ref2 = %u, ref3 = %u.\n", ref2, ref3);
+    ok(ref1 == ref3, "Expected ref1 == ref3, got ref1 = %u, ref3 = %u.\n", ref1, ref3);
+    IDirect3DRMFrame2_Release(frame2);
+
+    IDirect3DRMFrame3_Release(frame3);
+    IDirect3DRMFrame2_Release(frame2);
+    IDirect3DRMFrame_Release(frame1);
+
     IDirect3DRM3_Release(d3drm3);
     IDirect3DRM2_Release(d3drm2);
     IDirect3DRM_Release(d3drm1);
-- 
2.3.2 (Apple Git-55)




More information about the wine-patches mailing list