2 * Copyright 2012, 2014 Michael Stefaniuc
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #include <wine/test.h>
26 #define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0]))
28 static BOOL
missing_dmime(void)
30 IDirectMusicSegment8
*dms
;
31 HRESULT hr
= CoCreateInstance(&CLSID_DirectMusicSegment
, NULL
, CLSCTX_INPROC_SERVER
,
32 &IID_IDirectMusicSegment
, (void**)&dms
);
34 if (hr
== S_OK
&& dms
)
36 IDirectMusicSegment_Release(dms
);
42 static void test_COM_audiopath(void)
44 IDirectMusicAudioPath
*dmap
;
46 IDirectMusicPerformance8
*performance
;
50 hr
= CoCreateInstance(&CLSID_DirectMusicPerformance
, NULL
, CLSCTX_INPROC_SERVER
,
51 &IID_IDirectMusicPerformance8
, (void**)&performance
);
52 ok(hr
== S_OK
|| broken(hr
== E_NOINTERFACE
),
53 "DirectMusicPerformance create failed: %08x\n", hr
);
55 win_skip("IDirectMusicPerformance8 not available\n");
58 hr
= IDirectMusicPerformance8_InitAudio(performance
, NULL
, NULL
, NULL
,
59 DMUS_APATH_SHARED_STEREOPLUSREVERB
, 64, DMUS_AUDIOF_ALL
, NULL
);
60 if (hr
== DSERR_NODRIVER
) {
61 skip("No audio driver\n");
64 ok(hr
== S_OK
, "DirectMusicPerformance_InitAudio failed: %08x\n", hr
);
65 hr
= IDirectMusicPerformance8_GetDefaultAudioPath(performance
, &dmap
);
66 ok(hr
== S_OK
, "DirectMusicPerformance_GetDefaultAudioPath failed: %08x\n", hr
);
68 /* IDirectMusicObject and IPersistStream are not supported */
69 hr
= IDirectMusicAudioPath_QueryInterface(dmap
, &IID_IDirectMusicObject
, (void**)&unk
);
70 todo_wine
ok(FAILED(hr
) && !unk
, "Unexpected IDirectMusicObject interface: hr=%08x, iface=%p\n",
72 if (unk
) IUnknown_Release(unk
);
73 hr
= IDirectMusicAudioPath_QueryInterface(dmap
, &IID_IPersistStream
, (void**)&unk
);
74 todo_wine
ok(FAILED(hr
) && !unk
, "Unexpected IPersistStream interface: hr=%08x, iface=%p\n",
76 if (unk
) IUnknown_Release(unk
);
78 /* Same refcount for all DirectMusicAudioPath interfaces */
79 refcount
= IDirectMusicAudioPath_AddRef(dmap
);
80 ok(refcount
== 3, "refcount == %u, expected 3\n", refcount
);
82 hr
= IDirectMusicAudioPath_QueryInterface(dmap
, &IID_IUnknown
, (void**)&unk
);
83 ok(hr
== S_OK
, "QueryInterface for IID_IUnknown failed: %08x\n", hr
);
84 ok(unk
== (IUnknown
*)dmap
, "got %p, %p\n", unk
, dmap
);
85 refcount
= IUnknown_AddRef(unk
);
86 ok(refcount
== 5, "refcount == %u, expected 5\n", refcount
);
87 refcount
= IUnknown_Release(unk
);
89 while (IDirectMusicAudioPath_Release(dmap
) > 1); /* performance has a reference too */
90 IDirectMusicPerformance8_CloseDown(performance
);
91 IDirectMusicPerformance8_Release(performance
);
94 static void test_COM_audiopathconfig(void)
96 IDirectMusicAudioPath
*dmap
= (IDirectMusicAudioPath
*)0xdeadbeef;
97 IDirectMusicObject
*dmo
;
103 /* COM aggregation */
104 hr
= CoCreateInstance(&CLSID_DirectMusicAudioPathConfig
, (IUnknown
*)&dmap
, CLSCTX_INPROC_SERVER
,
105 &IID_IUnknown
, (void**)&dmap
);
106 if (hr
== REGDB_E_CLASSNOTREG
) {
107 win_skip("DirectMusicAudioPathConfig not registered\n");
110 ok(hr
== CLASS_E_NOAGGREGATION
,
111 "DirectMusicAudioPathConfig create failed: %08x, expected CLASS_E_NOAGGREGATION\n", hr
);
112 ok(!dmap
, "dmap = %p\n", dmap
);
114 /* IDirectMusicAudioPath not supported */
115 hr
= CoCreateInstance(&CLSID_DirectMusicAudioPathConfig
, NULL
, CLSCTX_INPROC_SERVER
,
116 &IID_IDirectMusicAudioPath
, (void**)&dmap
);
117 todo_wine
ok(FAILED(hr
) && !dmap
,
118 "Unexpected IDirectMusicAudioPath interface: hr=%08x, iface=%p\n", hr
, dmap
);
120 /* IDirectMusicObject and IPersistStream supported */
121 hr
= CoCreateInstance(&CLSID_DirectMusicAudioPathConfig
, NULL
, CLSCTX_INPROC_SERVER
,
122 &IID_IPersistStream
, (void**)&ps
);
123 ok(hr
== S_OK
, "DirectMusicObject create failed: %08x, expected S_OK\n", hr
);
124 IPersistStream_Release(ps
);
125 hr
= CoCreateInstance(&CLSID_DirectMusicAudioPathConfig
, NULL
, CLSCTX_INPROC_SERVER
,
126 &IID_IDirectMusicObject
, (void**)&dmo
);
127 ok(hr
== S_OK
, "DirectMusicObject create failed: %08x, expected S_OK\n", hr
);
129 /* Same refcount for all DirectMusicObject interfaces */
130 refcount
= IDirectMusicObject_AddRef(dmo
);
131 ok(refcount
== 2, "refcount == %u, expected 2\n", refcount
);
133 hr
= IDirectMusicObject_QueryInterface(dmo
, &IID_IPersistStream
, (void**)&ps
);
134 ok(hr
== S_OK
, "QueryInterface for IID_IPersistStream failed: %08x\n", hr
);
135 refcount
= IPersistStream_AddRef(ps
);
136 ok(refcount
== 4, "refcount == %u, expected 4\n", refcount
);
137 IPersistStream_Release(ps
);
139 hr
= IDirectMusicObject_QueryInterface(dmo
, &IID_IUnknown
, (void**)&unk
);
140 ok(hr
== S_OK
, "QueryInterface for IID_IUnknown failed: %08x\n", hr
);
141 refcount
= IUnknown_AddRef(unk
);
142 ok(refcount
== 5, "refcount == %u, expected 5\n", refcount
);
143 refcount
= IUnknown_Release(unk
);
145 /* IDirectMusicAudioPath still not supported */
146 hr
= IDirectMusicObject_QueryInterface(dmo
, &IID_IDirectMusicAudioPath
, (void**)&dmap
);
147 todo_wine
ok(FAILED(hr
) && !dmap
,
148 "Unexpected IDirectMusicAudioPath interface: hr=%08x, iface=%p\n", hr
, dmap
);
150 while (IDirectMusicObject_Release(dmo
));
154 static void test_COM_graph(void)
156 IDirectMusicGraph
*dmg
= (IDirectMusicGraph
*)0xdeadbeef;
157 IDirectMusicObject
*dmo
;
163 /* COM aggregation */
164 hr
= CoCreateInstance(&CLSID_DirectMusicGraph
, (IUnknown
*)&dmg
, CLSCTX_INPROC_SERVER
,
165 &IID_IUnknown
, (void**)&dmg
);
166 ok(hr
== CLASS_E_NOAGGREGATION
,
167 "DirectMusicGraph create failed: %08x, expected CLASS_E_NOAGGREGATION\n", hr
);
168 ok(!dmg
, "dmg = %p\n", dmg
);
171 hr
= CoCreateInstance(&CLSID_DirectMusicGraph
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IClassFactory
,
173 ok(hr
== E_NOINTERFACE
, "DirectMusicGraph create failed: %08x, expected E_NOINTERFACE\n", hr
);
175 /* Same refcount for all DirectMusicGraph interfaces */
176 hr
= CoCreateInstance(&CLSID_DirectMusicGraph
, NULL
, CLSCTX_INPROC_SERVER
,
177 &IID_IDirectMusicGraph
, (void**)&dmg
);
178 ok(hr
== S_OK
, "DirectMusicGraph create failed: %08x, expected S_OK\n", hr
);
179 refcount
= IDirectMusicGraph_AddRef(dmg
);
180 ok(refcount
== 2, "refcount == %u, expected 2\n", refcount
);
182 hr
= IDirectMusicGraph_QueryInterface(dmg
, &IID_IDirectMusicObject
, (void**)&dmo
);
183 if (hr
== E_NOINTERFACE
) {
184 win_skip("DirectMusicGraph without IDirectMusicObject\n");
187 ok(hr
== S_OK
, "QueryInterface for IID_IDirectMusicObject failed: %08x\n", hr
);
188 refcount
= IDirectMusicObject_AddRef(dmo
);
189 ok(refcount
== 4, "refcount == %u, expected 4\n", refcount
);
190 refcount
= IDirectMusicObject_Release(dmo
);
192 hr
= IDirectMusicGraph_QueryInterface(dmg
, &IID_IPersistStream
, (void**)&ps
);
193 ok(hr
== S_OK
, "QueryInterface for IID_IPersistStream failed: %08x\n", hr
);
194 refcount
= IPersistStream_AddRef(ps
);
195 ok(refcount
== 5, "refcount == %u, expected 5\n", refcount
);
196 refcount
= IPersistStream_Release(ps
);
198 hr
= IDirectMusicGraph_QueryInterface(dmg
, &IID_IUnknown
, (void**)&unk
);
199 ok(hr
== S_OK
, "QueryInterface for IID_IUnknown failed: %08x\n", hr
);
200 refcount
= IUnknown_AddRef(unk
);
201 ok(refcount
== 6, "refcount == %u, expected 6\n", refcount
);
202 refcount
= IUnknown_Release(unk
);
204 while (IDirectMusicGraph_Release(dmg
));
207 static void test_COM_segment(void)
209 IDirectMusicSegment8
*dms
= (IDirectMusicSegment8
*)0xdeadbeef;
210 IDirectMusicObject
*dmo
;
211 IPersistStream
*stream
;
216 /* COM aggregation */
217 hr
= CoCreateInstance(&CLSID_DirectMusicSegment
, (IUnknown
*)&dms
, CLSCTX_INPROC_SERVER
,
218 &IID_IUnknown
, (void**)&dms
);
219 ok(hr
== CLASS_E_NOAGGREGATION
,
220 "DirectMusicSegment create failed: %08x, expected CLASS_E_NOAGGREGATION\n", hr
);
221 ok(!dms
, "dms = %p\n", dms
);
224 hr
= CoCreateInstance(&CLSID_DirectMusicSegment
, NULL
, CLSCTX_INPROC_SERVER
,
225 &IID_IDirectSound
, (void**)&dms
);
226 ok(hr
== E_NOINTERFACE
,
227 "DirectMusicSegment create failed: %08x, expected E_NOINTERFACE\n", hr
);
230 hr
= CoCreateInstance(&CLSID_DirectMusicSegment
, NULL
, CLSCTX_INPROC_SERVER
,
231 &IID_IDirectMusicSegment8
, (void**)&dms
);
232 if (hr
== E_NOINTERFACE
) {
233 win_skip("DirectMusicSegment without IDirectMusicSegment8\n");
236 ok(hr
== S_OK
, "DirectMusicSegment create failed: %08x, expected S_OK\n", hr
);
237 refcount
= IDirectMusicSegment8_AddRef(dms
);
238 ok (refcount
== 2, "refcount == %u, expected 2\n", refcount
);
239 hr
= IDirectMusicSegment8_QueryInterface(dms
, &IID_IDirectMusicObject
, (void**)&dmo
);
240 ok(hr
== S_OK
, "QueryInterface for IID_IDirectMusicObject failed: %08x\n", hr
);
241 IDirectMusicSegment8_AddRef(dms
);
242 refcount
= IDirectMusicSegment8_Release(dms
);
243 ok (refcount
== 3, "refcount == %u, expected 3\n", refcount
);
244 hr
= IDirectMusicSegment8_QueryInterface(dms
, &IID_IPersistStream
, (void**)&stream
);
245 ok(hr
== S_OK
, "QueryInterface for IID_IPersistStream failed: %08x\n", hr
);
246 refcount
= IDirectMusicSegment8_Release(dms
);
247 ok (refcount
== 3, "refcount == %u, expected 3\n", refcount
);
248 hr
= IDirectMusicSegment8_QueryInterface(dms
, &IID_IUnknown
, (void**)&unk
);
249 ok(hr
== S_OK
, "QueryInterface for IID_IUnknown failed: %08x\n", hr
);
250 refcount
= IUnknown_Release(unk
);
251 ok (refcount
== 3, "refcount == %u, expected 3\n", refcount
);
252 refcount
= IDirectMusicObject_Release(dmo
);
253 ok (refcount
== 2, "refcount == %u, expected 2\n", refcount
);
254 refcount
= IPersistStream_Release(stream
);
255 ok (refcount
== 1, "refcount == %u, expected 1\n", refcount
);
256 refcount
= IDirectMusicSegment8_Release(dms
);
257 ok (refcount
== 0, "refcount == %u, expected 0\n", refcount
);
260 static void test_COM_segmentstate(void)
262 IDirectMusicSegmentState8
*dmss8
= (IDirectMusicSegmentState8
*)0xdeadbeef;
267 /* COM aggregation */
268 hr
= CoCreateInstance(&CLSID_DirectMusicSegmentState
, (IUnknown
*)&dmss8
, CLSCTX_INPROC_SERVER
,
269 &IID_IUnknown
, (void**)&dmss8
);
270 ok(hr
== CLASS_E_NOAGGREGATION
,
271 "DirectMusicSegmentState8 create failed: %08x, expected CLASS_E_NOAGGREGATION\n", hr
);
272 ok(!dmss8
, "dmss8 = %p\n", dmss8
);
275 hr
= CoCreateInstance(&CLSID_DirectMusicSegmentState
, NULL
, CLSCTX_INPROC_SERVER
,
276 &IID_IDirectMusicObject
, (void**)&dmss8
);
277 ok(hr
== E_NOINTERFACE
,
278 "DirectMusicSegmentState8 create failed: %08x, expected E_NOINTERFACE\n", hr
);
280 /* Same refcount for all DirectMusicSegmentState interfaces */
281 hr
= CoCreateInstance(&CLSID_DirectMusicSegmentState
, NULL
, CLSCTX_INPROC_SERVER
,
282 &IID_IDirectMusicSegmentState8
, (void**)&dmss8
);
283 if (hr
== E_NOINTERFACE
) {
284 win_skip("DirectMusicSegmentState without IDirectMusicSegmentState8\n");
287 ok(hr
== S_OK
, "DirectMusicSegmentState8 create failed: %08x, expected S_OK\n", hr
);
288 refcount
= IDirectMusicSegmentState8_AddRef(dmss8
);
289 ok(refcount
== 2, "refcount == %u, expected 2\n", refcount
);
291 hr
= IDirectMusicSegmentState8_QueryInterface(dmss8
, &IID_IUnknown
, (void**)&unk
);
292 ok(hr
== S_OK
, "QueryInterface for IID_IUnknown failed: %08x\n", hr
);
293 refcount
= IUnknown_AddRef(unk
);
294 ok(refcount
== 4, "refcount == %u, expected 4\n", refcount
);
295 refcount
= IUnknown_Release(unk
);
297 hr
= IDirectMusicSegmentState8_QueryInterface(dmss8
, &IID_IUnknown
, NULL
);
298 ok(hr
== E_POINTER
, "got %08x\n", hr
);
300 while (IDirectMusicSegmentState8_Release(dmss8
));
303 static void test_COM_track(void)
305 IDirectMusicTrack
*dmt
;
306 IDirectMusicTrack8
*dmt8
;
311 #define X(class) &CLSID_ ## class, #class
317 { X(DirectMusicLyricsTrack
), TRUE
},
318 { X(DirectMusicMarkerTrack
), FALSE
},
319 { X(DirectMusicParamControlTrack
), TRUE
},
320 { X(DirectMusicSegmentTriggerTrack
), TRUE
},
321 { X(DirectMusicSeqTrack
), TRUE
},
322 { X(DirectMusicSysExTrack
), TRUE
},
323 { X(DirectMusicTempoTrack
), TRUE
},
324 { X(DirectMusicTimeSigTrack
), FALSE
},
325 { X(DirectMusicWaveTrack
), TRUE
}
330 for (i
= 0; i
< ARRAY_SIZE(class); i
++) {
331 trace("Testing %s\n", class[i
].name
);
332 /* COM aggregation */
333 dmt8
= (IDirectMusicTrack8
*)0xdeadbeef;
334 hr
= CoCreateInstance(class[i
].clsid
, (IUnknown
*)&dmt8
, CLSCTX_INPROC_SERVER
, &IID_IUnknown
,
336 if (hr
== REGDB_E_CLASSNOTREG
) {
337 win_skip("%s not registered\n", class[i
].name
);
340 ok(hr
== CLASS_E_NOAGGREGATION
,
341 "%s create failed: %08x, expected CLASS_E_NOAGGREGATION\n", class[i
].name
, hr
);
342 ok(!dmt8
, "dmt8 = %p\n", dmt8
);
345 hr
= CoCreateInstance(class[i
].clsid
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IDirectMusicObject
,
347 ok(hr
== E_NOINTERFACE
, "%s create failed: %08x, expected E_NOINTERFACE\n",
350 /* Same refcount for all DirectMusicTrack interfaces */
351 hr
= CoCreateInstance(class[i
].clsid
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IDirectMusicTrack
,
353 ok(hr
== S_OK
, "%s create failed: %08x, expected S_OK\n", class[i
].name
, hr
);
354 refcount
= IDirectMusicTrack_AddRef(dmt
);
355 ok(refcount
== 2, "refcount == %u, expected 2\n", refcount
);
357 hr
= IDirectMusicTrack_QueryInterface(dmt
, &IID_IPersistStream
, (void**)&ps
);
358 ok(hr
== S_OK
, "QueryInterface for IID_IPersistStream failed: %08x\n", hr
);
359 refcount
= IPersistStream_AddRef(ps
);
360 ok(refcount
== 4, "refcount == %u, expected 4\n", refcount
);
361 IPersistStream_Release(ps
);
363 hr
= IDirectMusicTrack_QueryInterface(dmt
, &IID_IUnknown
, (void**)&unk
);
364 ok(hr
== S_OK
, "QueryInterface for IID_IUnknown failed: %08x\n", hr
);
365 refcount
= IUnknown_AddRef(unk
);
366 ok(refcount
== 5, "refcount == %u, expected 5\n", refcount
);
367 refcount
= IUnknown_Release(unk
);
369 hr
= IDirectMusicTrack_QueryInterface(dmt
, &IID_IDirectMusicTrack8
, (void**)&dmt8
);
370 if (class[i
].has_dmt8
) {
371 ok(hr
== S_OK
, "QueryInterface for IID_IDirectMusicTrack8 failed: %08x\n", hr
);
372 refcount
= IDirectMusicTrack8_AddRef(dmt8
);
373 ok(refcount
== 6, "refcount == %u, expected 6\n", refcount
);
374 refcount
= IDirectMusicTrack8_Release(dmt8
);
376 ok(hr
== E_NOINTERFACE
, "QueryInterface for IID_IDirectMusicTrack8 failed: %08x\n", hr
);
377 refcount
= IDirectMusicTrack_AddRef(dmt
);
378 ok(refcount
== 5, "refcount == %u, expected 5\n", refcount
);
381 while (IDirectMusicTrack_Release(dmt
));
385 static void test_audiopathconfig(void)
387 IDirectMusicObject
*dmo
;
393 hr
= CoCreateInstance(&CLSID_DirectMusicAudioPathConfig
, NULL
, CLSCTX_INPROC_SERVER
,
394 &IID_IDirectMusicObject
, (void**)&dmo
);
395 if (hr
== REGDB_E_CLASSNOTREG
) {
396 win_skip("DirectMusicAudioPathConfig not registered\n");
399 ok(hr
== S_OK
, "DirectMusicAudioPathConfig create failed: %08x, expected S_OK\n", hr
);
402 hr
= IDirectMusicObject_QueryInterface(dmo
, &IID_IPersistStream
, (void**)&ps
);
403 ok(hr
== S_OK
, "QueryInterface for IID_IPersistStream failed: %08x\n", hr
);
404 hr
= IPersistStream_GetClassID(ps
, &class);
405 ok(hr
== S_OK
, "IPersistStream_GetClassID failed: %08x\n", hr
);
406 ok(IsEqualGUID(&class, &CLSID_DirectMusicAudioPathConfig
),
407 "Expected class CLSID_DirectMusicAudioPathConfig got %s\n", wine_dbgstr_guid(&class));
409 /* Unimplemented IPersistStream methods */
410 hr
= IPersistStream_IsDirty(ps
);
411 ok(hr
== S_FALSE
, "IPersistStream_IsDirty failed: %08x\n", hr
);
412 hr
= IPersistStream_GetSizeMax(ps
, &size
);
413 ok(hr
== E_NOTIMPL
, "IPersistStream_GetSizeMax failed: %08x\n", hr
);
414 hr
= IPersistStream_Save(ps
, NULL
, TRUE
);
415 ok(hr
== E_NOTIMPL
, "IPersistStream_Save failed: %08x\n", hr
);
417 while (IDirectMusicObject_Release(dmo
));
420 static void test_graph(void)
422 IDirectMusicGraph
*dmg
;
428 hr
= CoCreateInstance(&CLSID_DirectMusicGraph
, NULL
, CLSCTX_INPROC_SERVER
,
429 &IID_IDirectMusicGraph
, (void**)&dmg
);
430 ok(hr
== S_OK
, "DirectMusicGraph create failed: %08x, expected S_OK\n", hr
);
433 hr
= IDirectMusicGraph_QueryInterface(dmg
, &IID_IPersistStream
, (void**)&ps
);
434 ok(hr
== S_OK
, "QueryInterface for IID_IPersistStream failed: %08x\n", hr
);
435 hr
= IPersistStream_GetClassID(ps
, &class);
436 ok(hr
== S_OK
|| broken(hr
== E_NOTIMPL
) /* win2k */, "IPersistStream_GetClassID failed: %08x\n", hr
);
438 ok(IsEqualGUID(&class, &CLSID_DirectMusicGraph
),
439 "Expected class CLSID_DirectMusicGraph got %s\n", wine_dbgstr_guid(&class));
441 /* Unimplemented IPersistStream methods */
442 hr
= IPersistStream_IsDirty(ps
);
443 ok(hr
== S_FALSE
, "IPersistStream_IsDirty failed: %08x\n", hr
);
444 hr
= IPersistStream_GetSizeMax(ps
, &size
);
445 ok(hr
== E_NOTIMPL
, "IPersistStream_GetSizeMax failed: %08x\n", hr
);
446 hr
= IPersistStream_Save(ps
, NULL
, TRUE
);
447 ok(hr
== E_NOTIMPL
, "IPersistStream_Save failed: %08x\n", hr
);
449 while (IDirectMusicGraph_Release(dmg
));
452 static void test_segment(void)
454 IDirectMusicSegment
*dms
;
460 hr
= CoCreateInstance(&CLSID_DirectMusicSegment
, NULL
, CLSCTX_INPROC_SERVER
,
461 &IID_IDirectMusicSegment
, (void**)&dms
);
462 ok(hr
== S_OK
, "DirectMusicSegment create failed: %08x, expected S_OK\n", hr
);
465 hr
= IDirectMusicSegment_QueryInterface(dms
, &IID_IPersistStream
, (void**)&ps
);
466 ok(hr
== S_OK
, "QueryInterface for IID_IPersistStream failed: %08x\n", hr
);
467 hr
= IPersistStream_GetClassID(ps
, &class);
468 ok(hr
== S_OK
|| broken(hr
== E_NOTIMPL
) /* win2k */, "IPersistStream_GetClassID failed: %08x\n", hr
);
470 ok(IsEqualGUID(&class, &CLSID_DirectMusicSegment
),
471 "Expected class CLSID_DirectMusicSegment got %s\n", wine_dbgstr_guid(&class));
473 /* Unimplemented IPersistStream methods */
474 hr
= IPersistStream_IsDirty(ps
);
475 ok(hr
== S_FALSE
, "IPersistStream_IsDirty failed: %08x\n", hr
);
476 hr
= IPersistStream_GetSizeMax(ps
, &size
);
477 ok(hr
== E_NOTIMPL
, "IPersistStream_GetSizeMax failed: %08x\n", hr
);
478 hr
= IPersistStream_Save(ps
, NULL
, TRUE
);
479 ok(hr
== E_NOTIMPL
, "IPersistStream_Save failed: %08x\n", hr
);
481 while (IDirectMusicSegment_Release(dms
));
484 static void test_track(void)
486 IDirectMusicTrack
*dmt
;
491 #define X(class) &CLSID_ ## class, #class
497 { X(DirectMusicLyricsTrack
), TRUE
},
498 { X(DirectMusicMarkerTrack
), FALSE
},
499 { X(DirectMusicParamControlTrack
), TRUE
},
500 { X(DirectMusicSegmentTriggerTrack
), FALSE
},
501 { X(DirectMusicSeqTrack
), TRUE
},
502 { X(DirectMusicSysExTrack
), TRUE
},
503 { X(DirectMusicTempoTrack
), FALSE
},
504 { X(DirectMusicTimeSigTrack
), TRUE
},
505 { X(DirectMusicWaveTrack
), TRUE
}
510 for (i
= 0; i
< ARRAY_SIZE(class); i
++) {
511 trace("Testing %s\n", class[i
].name
);
512 hr
= CoCreateInstance(class[i
].clsid
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IDirectMusicTrack
,
514 ok(hr
== S_OK
, "%s create failed: %08x, expected S_OK\n", class[i
].name
, hr
);
517 hr
= IDirectMusicTrack_QueryInterface(dmt
, &IID_IPersistStream
, (void**)&ps
);
518 ok(hr
== S_OK
, "QueryInterface for IID_IPersistStream failed: %08x\n", hr
);
519 hr
= IPersistStream_GetClassID(ps
, &classid
);
522 ok(hr
== S_OK
, "IPersistStream_GetClassID failed: %08x\n", hr
);
523 ok(IsEqualGUID(&classid
, class[i
].clsid
),
524 "Expected class %s got %s\n", class[i
].name
, wine_dbgstr_guid(&classid
));
525 hr
= IPersistStream_IsDirty(ps
);
526 ok(hr
== S_FALSE
, "IPersistStream_IsDirty failed: %08x\n", hr
);
529 ok(hr
== S_OK
, "IPersistStream_GetClassID failed: %08x\n", hr
);
530 ok(IsEqualGUID(&classid
, class[i
].clsid
),
531 "Expected class %s got %s\n", class[i
].name
, wine_dbgstr_guid(&classid
));
532 hr
= IPersistStream_IsDirty(ps
);
533 ok(hr
== S_FALSE
, "IPersistStream_IsDirty failed: %08x\n", hr
);
536 /* Unimplemented IPersistStream methods */
537 hr
= IPersistStream_GetSizeMax(ps
, &size
);
538 ok(hr
== E_NOTIMPL
, "IPersistStream_GetSizeMax failed: %08x\n", hr
);
539 hr
= IPersistStream_Save(ps
, NULL
, TRUE
);
540 ok(hr
== E_NOTIMPL
, "IPersistStream_Save failed: %08x\n", hr
);
542 while (IDirectMusicTrack_Release(dmt
));
552 skip("dmime not available\n");
556 test_COM_audiopath();
557 test_COM_audiopathconfig();
560 test_COM_segmentstate();
562 test_audiopathconfig();