Module: wine Branch: master Commit: 19b9c8fdb7fddbd094d0a67e0e7bf2816e4798b1 URL: http://source.winehq.org/git/wine.git/?a=commit;h=19b9c8fdb7fddbd094d0a67e0e...
Author: Michael Stefaniuc mstefani@redhat.de Date: Tue Jun 16 09:34:51 2015 +0200
dmstyle/tests: Add IPersistStream tests for DM*Track.
---
dlls/dmstyle/tests/dmstyle.c | 68 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+)
diff --git a/dlls/dmstyle/tests/dmstyle.c b/dlls/dmstyle/tests/dmstyle.c index 1401d75..0a0c5aa 100644 --- a/dlls/dmstyle/tests/dmstyle.c +++ b/dlls/dmstyle/tests/dmstyle.c @@ -239,6 +239,73 @@ static void test_dmstyle(void) while (IDirectMusicStyle_Release(dms)); }
+static void test_track(void) +{ + IDirectMusicTrack8 *dmt8; + IPersistStream *ps; + CLSID classid; + ULARGE_INTEGER size; + HRESULT hr; +#define X(class) &CLSID_ ## class, #class + const struct { + REFCLSID clsid; + const char *name; + BOOL has_save; + BOOL todo; + } class[] = { + { X(DirectMusicAuditionTrack), TRUE, TRUE }, + { X(DirectMusicChordTrack), TRUE, FALSE }, + { X(DirectMusicCommandTrack), TRUE, TRUE }, + { X(DirectMusicMotifTrack), FALSE, TRUE }, + { X(DirectMusicMuteTrack), TRUE, TRUE }, + { X(DirectMusicStyleTrack), FALSE, FALSE }, + }; +#undef X + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(class); i++) { + trace("Testing %s\n", class[i].name); + hr = CoCreateInstance(class[i].clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusicTrack8, + (void**)&dmt8); + if (hr == E_NOINTERFACE && !dmt8) { + skip("%s not created with CoCreateInstance()\n", class[i].name); + continue; + } + ok(hr == S_OK, "%s create failed: %08x, expected S_OK\n", class[i].name, hr); + + /* IPersistStream */ + hr = IDirectMusicTrack8_QueryInterface(dmt8, &IID_IPersistStream, (void**)&ps); + ok(hr == S_OK, "QueryInterface for IID_IPersistStream failed: %08x\n", hr); + hr = IPersistStream_GetClassID(ps, &classid); + if (class[i].todo) { + todo_wine { + ok(hr == S_OK, "IPersistStream_GetClassID failed: %08x\n", hr); + ok(IsEqualGUID(&classid, class[i].clsid), + "Expected class %s got %s\n", class[i].name, wine_dbgstr_guid(&classid)); + hr = IPersistStream_IsDirty(ps); + ok(hr == S_FALSE, "IPersistStream_IsDirty failed: %08x\n", hr); + } + } else { + ok(hr == S_OK, "IPersistStream_GetClassID failed: %08x\n", hr); + ok(IsEqualGUID(&classid, class[i].clsid), + "Expected class %s got %s\n", class[i].name, wine_dbgstr_guid(&classid)); + hr = IPersistStream_IsDirty(ps); + ok(hr == S_FALSE, "IPersistStream_IsDirty failed: %08x\n", hr); + } + + hr = IPersistStream_GetSizeMax(ps, &size); + ok(hr == E_NOTIMPL, "IPersistStream_GetSizeMax failed: %08x\n", hr); + + hr = IPersistStream_Save(ps, NULL, TRUE); + if (class[i].has_save) + todo_wine ok(hr == E_POINTER, "IPersistStream_Save failed: %08x\n", hr); + else + ok(hr == E_NOTIMPL, "IPersistStream_Save failed: %08x\n", hr); + + while (IDirectMusicTrack8_Release(dmt8)); + } +} + START_TEST(dmstyle) { CoInitialize(NULL); @@ -253,6 +320,7 @@ START_TEST(dmstyle) test_COM_section(); test_COM_track(); test_dmstyle(); + test_track();
CoUninitialize(); }