From be25a23bc907df44d17c3343f844dd1aeb1169ab Mon Sep 17 00:00:00 2001 From: Michael Stefaniuc Date: Sun, 1 Jul 2012 00:07:41 +0200 Subject: [PATCH] qedit/tests: Add COM aggregation test for MediaDet. --- dlls/qedit/tests/mediadet.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/dlls/qedit/tests/mediadet.c b/dlls/qedit/tests/mediadet.c index b86eaa92d8f..7dc2af24283 100644 --- a/dlls/qedit/tests/mediadet.c +++ b/dlls/qedit/tests/mediadet.c @@ -132,7 +132,9 @@ static BOOL init_tests(void) static void test_mediadet(void) { HRESULT hr; + struct unk_impl unk_obj = {{&unk_vtbl}, 19, NULL}; IMediaDet *pM = NULL; + ULONG refcount; BSTR filename = NULL; LONG nstrms = 0; LONG strm; @@ -141,6 +143,22 @@ static void test_mediadet(void) int flags; int i; + /* COM aggregation */ + hr = CoCreateInstance(&CLSID_MediaDet, &unk_obj.IUnknown_iface, CLSCTX_INPROC_SERVER, + &IID_IUnknown, (void**)&unk_obj.inner_unk); + ok(hr == S_OK, "CoCreateInstance failed: %08x\n", hr); + + hr = IUnknown_QueryInterface(unk_obj.inner_unk, &IID_IMediaDet, (void**)&pM); + ok(hr == S_OK, "QueryInterface for IID_IMediaDet failed: %08x\n", hr); + refcount = IMediaDet_AddRef(pM); + ok(refcount == unk_obj.ref, "MediaDet just pretends to support COM aggregation\n"); + refcount = IMediaDet_Release(pM); + ok(refcount == unk_obj.ref, "MediaDet just pretends to support COM aggregation\n"); + refcount = IMediaDet_Release(pM); + ok(refcount == 19, "Refcount should be back at 19 but is %u\n", refcount); + + IUnknown_Release(unk_obj.inner_unk); + /* test.avi has one video stream. */ hr = CoCreateInstance(&CLSID_MediaDet, NULL, CLSCTX_INPROC_SERVER, &IID_IMediaDet, (LPVOID*)&pM); -- 2.11.4.GIT