Michael Stefaniuc : dmband/tests: Add COM tests for DirectMusicBand.
Alexandre Julliard
julliard at winehq.org
Thu Jan 30 13:25:25 CST 2014
Module: wine
Branch: master
Commit: 2c6b86418d2162fa7b71d01e694ba45fc9149e20
URL: http://source.winehq.org/git/wine.git/?a=commit;h=2c6b86418d2162fa7b71d01e694ba45fc9149e20
Author: Michael Stefaniuc <mstefani at redhat.de>
Date: Thu Jan 30 00:52:33 2014 +0100
dmband/tests: Add COM tests for DirectMusicBand.
---
dlls/dmband/tests/dmband.c | 50 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)
diff --git a/dlls/dmband/tests/dmband.c b/dlls/dmband/tests/dmband.c
index 5195066..0594c3e 100644
--- a/dlls/dmband/tests/dmband.c
+++ b/dlls/dmband/tests/dmband.c
@@ -45,6 +45,55 @@ static BOOL missing_dmband(void)
return TRUE;
}
+static void test_COM(void)
+{
+ IDirectMusicBand *dmb = (IDirectMusicBand*)0xdeadbeef;
+ IDirectMusicObject *dmo;
+ IPersistStream *ps;
+ IUnknown *unk;
+ ULONG refcount;
+ HRESULT hr;
+
+ /* COM aggregation */
+ hr = CoCreateInstance(&CLSID_DirectMusicBand, (IUnknown*)&dmb, CLSCTX_INPROC_SERVER,
+ &IID_IUnknown, (void**)&dmb);
+ ok(hr == CLASS_E_NOAGGREGATION,
+ "DirectMusicBand create failed: %08x, expected CLASS_E_NOAGGREGATION\n", hr);
+ ok(!dmb, "dmb = %p\n", dmb);
+
+ /* Invalid RIID */
+ hr = CoCreateInstance(&CLSID_DirectMusicBand, NULL, CLSCTX_INPROC_SERVER, &IID_IClassFactory,
+ (void**)&dmb);
+ ok(hr == E_NOINTERFACE, "DirectMusicBand create failed: %08x, expected E_NOINTERFACE\n", hr);
+
+ /* Same refcount for all DirectMusicBand interfaces */
+ hr = CoCreateInstance(&CLSID_DirectMusicBand, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusicBand,
+ (void**)&dmb);
+ ok(hr == S_OK, "DirectMusicBand create failed: %08x, expected S_OK\n", hr);
+ refcount = IDirectMusicBand_AddRef(dmb);
+ ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
+
+ hr = IDirectMusicBand_QueryInterface(dmb, &IID_IDirectMusicObject, (void**)&dmo);
+ ok(hr == S_OK, "QueryInterface for IID_IDirectMusicObject failed: %08x\n", hr);
+ refcount = IDirectMusicObject_AddRef(dmo);
+ ok(refcount == 4, "refcount == %u, expected 4\n", refcount);
+ refcount = IDirectMusicObject_Release(dmo);
+
+ hr = IDirectMusicBand_QueryInterface(dmb, &IID_IPersistStream, (void**)&ps);
+ ok(hr == S_OK, "QueryInterface for IID_IPersistStream failed: %08x\n", hr);
+ refcount = IPersistStream_AddRef(ps);
+ ok(refcount == 5, "refcount == %u, expected 5\n", refcount);
+ refcount = IPersistStream_Release(ps);
+
+ hr = IDirectMusicBand_QueryInterface(dmb, &IID_IUnknown, (void**)&unk);
+ ok(hr == S_OK, "QueryInterface for IID_IUnknown failed: %08x\n", hr);
+ refcount = IUnknown_AddRef(unk);
+ ok(refcount == 6, "refcount == %u, expected 6\n", refcount);
+ refcount = IUnknown_Release(unk);
+
+ while (IDirectMusicBand_Release(dmb));
+}
+
static void test_dmband(void)
{
IUnknown *unknown = NULL;
@@ -87,6 +136,7 @@ START_TEST(dmband)
return;
}
+ test_COM();
test_dmband();
CoUninitialize();
More information about the wine-cvs
mailing list