[PATCH 5/5] dmstyle/tests: COM tests for DirectMusicSection.

Michael Stefaniuc mstefani at redhat.de
Tue Jan 14 18:13:32 CST 2014


---
Unclear what this is as it is a Wine "private" CLSID but a search for
the GUID finds quite a few hits from Windows.
As I thought I've seen "section" mentioned in relation to the
DirectMusic file format I tried IDirectMusicObject on it and got
lucky...
https://newtestbot.winehq.org/JobDetails.pl?Key=4233


 dlls/dmstyle/tests/dmstyle.c | 48 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/dlls/dmstyle/tests/dmstyle.c b/dlls/dmstyle/tests/dmstyle.c
index 18f2a6b..a1565c0 100644
--- a/dlls/dmstyle/tests/dmstyle.c
+++ b/dlls/dmstyle/tests/dmstyle.c
@@ -89,6 +89,53 @@ static void test_COM(void)
     while (IDirectMusicStyle8_Release(dms8));
 }
 
+static void test_COM_section(void)
+{
+    IDirectMusicObject *dmo = (IDirectMusicObject*)0xdeadbeef;
+    IPersistStream *ps;
+    IUnknown *unk;
+    ULONG refcount;
+    HRESULT hr;
+
+    /* COM aggregation */
+    hr = CoCreateInstance(&CLSID_DirectMusicSection, (IUnknown*)&dmo, CLSCTX_INPROC_SERVER,
+            &IID_IUnknown, (void**)&dmo);
+    ok(hr == CLASS_E_NOAGGREGATION,
+            "DirectMusicSection create failed: %08x, expected CLASS_E_NOAGGREGATION\n", hr);
+    ok(!dmo, "dmo = %p\n", dmo);
+
+    /* Invalid RIID */
+    hr = CoCreateInstance(&CLSID_DirectMusicSection, NULL, CLSCTX_INPROC_SERVER, &IID_IClassFactory,
+            (void**)&dmo);
+    todo_wine ok(hr == E_NOINTERFACE,
+            "DirectMusicSection create failed: %08x, expected E_NOINTERFACE\n", hr);
+
+    /* Same refcount for all DirectMusicObject interfaces */
+    hr = CoCreateInstance(&CLSID_DirectMusicSection, NULL, CLSCTX_INPROC_SERVER,
+            &IID_IDirectMusicObject, (void**)&dmo);
+    todo_wine ok(hr == S_OK, "DirectMusicSection create failed: %08x, expected S_OK\n", hr);
+    if (hr != S_OK) {
+        skip("DirectMusicSection not implemented\n");
+        return;
+    }
+    refcount = IDirectMusicObject_AddRef(dmo);
+    ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
+
+    hr = IDirectMusicObject_QueryInterface(dmo, &IID_IPersistStream, (void**)&ps);
+    ok(hr == S_OK, "QueryInterface for IID_IPersistStream failed: %08x\n", hr);
+    refcount = IPersistStream_AddRef(ps);
+    ok(refcount == 4, "refcount == %u, expected 4\n", refcount);
+    refcount = IPersistStream_Release(ps);
+
+    hr = IDirectMusicObject_QueryInterface(dmo, &IID_IUnknown, (void**)&unk);
+    ok(hr == S_OK, "QueryInterface for IID_IUnknown failed: %08x\n", hr);
+    refcount = IUnknown_AddRef(unk);
+    ok(refcount == 5, "refcount == %u, expected 5\n", refcount);
+    refcount = IUnknown_Release(unk);
+
+    while (IDirectMusicObject_Release(dmo));
+}
+
 static void test_COM_track(void)
 {
     IDirectMusicTrack8 *dmt8;
@@ -168,6 +215,7 @@ START_TEST(dmstyle)
         return;
     }
     test_COM();
+    test_COM_section();
     test_COM_track();
 
     CoUninitialize();
-- 
1.8.3.1



More information about the wine-patches mailing list