Michael Stefaniuc : dmcompos/tests: Add COM tests for IDirectMusicChordMap.

Alexandre Julliard julliard at winehq.org
Thu Jan 16 14:52:27 CST 2014


Module: wine
Branch: master
Commit: ad52929b178981427ff56103fc6dc1a268102d8e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ad52929b178981427ff56103fc6dc1a268102d8e

Author: Michael Stefaniuc <mstefani at redhat.de>
Date:   Thu Jan 16 00:49:19 2014 +0100

dmcompos/tests: Add COM tests for IDirectMusicChordMap.

---

 dlls/dmcompos/tests/dmcompos.c |   51 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/dlls/dmcompos/tests/dmcompos.c b/dlls/dmcompos/tests/dmcompos.c
index 329d65e..6ff663a 100644
--- a/dlls/dmcompos/tests/dmcompos.c
+++ b/dlls/dmcompos/tests/dmcompos.c
@@ -75,6 +75,56 @@ static void test_COM(void)
     while (IDirectMusicComposer_Release(dmc));
 }
 
+static void test_COM_chordmap(void)
+{
+    IDirectMusicChordMap *dmcm = (IDirectMusicChordMap*)0xdeadbeef;
+    IDirectMusicObject *dmo;
+    IPersistStream *ps;
+    IUnknown *unk;
+    ULONG refcount;
+    HRESULT hr;
+
+    /* COM aggregation */
+    hr = CoCreateInstance(&CLSID_DirectMusicChordMap, (IUnknown*)&dmcm, CLSCTX_INPROC_SERVER,
+            &IID_IUnknown, (void**)&dmcm);
+    ok(hr == CLASS_E_NOAGGREGATION,
+            "DirectMusicChordMap create failed: %08x, expected CLASS_E_NOAGGREGATION\n", hr);
+    ok(!dmcm, "dmcm = %p\n", dmcm);
+
+    /* Invalid RIID */
+    hr = CoCreateInstance(&CLSID_DirectMusicChordMap, NULL, CLSCTX_INPROC_SERVER,
+            &IID_IClassFactory, (void**)&dmcm);
+    ok(hr == E_NOINTERFACE,
+            "DirectMusicChordMap create failed: %08x, expected E_NOINTERFACE\n", hr);
+
+    /* Same refcount for all DirectMusicChordMap interfaces */
+    hr = CoCreateInstance(&CLSID_DirectMusicChordMap, NULL, CLSCTX_INPROC_SERVER,
+            &IID_IDirectMusicChordMap, (void**)&dmcm);
+    ok(hr == S_OK, "DirectMusicChordMap create failed: %08x, expected S_OK\n", hr);
+    refcount = IDirectMusicChordMap_AddRef(dmcm);
+    ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
+
+    hr = IDirectMusicChordMap_QueryInterface(dmcm, &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 = IDirectMusicChordMap_QueryInterface(dmcm, &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 = IDirectMusicChordMap_QueryInterface(dmcm, &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 (IDirectMusicChordMap_Release(dmcm));
+}
+
 START_TEST(dmcompos)
 {
     CoInitialize(NULL);
@@ -86,6 +136,7 @@ START_TEST(dmcompos)
         return;
     }
     test_COM();
+    test_COM_chordmap();
 
     CoUninitialize();
 }




More information about the wine-cvs mailing list