wined3d: Pass a wined3d_device_context to wined3d_cs_emit_blt_sub_resource().
[wine/zf.git] / dlls / dmband / tests / dmband.c
blob4b8aaf61208ba72f81ae8f9ea68554200b88c7ce
1 /*
2 * Unit tests for dmband functions
4 * Copyright (C) 2012 Christian Costa
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #define COBJMACROS
23 #include <stdio.h>
25 #include "wine/test.h"
26 #include "uuids.h"
27 #include "ole2.h"
28 #include "initguid.h"
29 #include "dmusici.h"
30 #include "dmusicf.h"
31 #include "dmplugin.h"
33 DEFINE_GUID(IID_IDirectMusicBandTrackPrivate, 0x53466056, 0x6dc4, 0x11d1, 0xbf, 0x7b, 0x00, 0xc0, 0x4f, 0xbf, 0x8f, 0xef);
35 static BOOL missing_dmband(void)
37 IDirectMusicBand *dmb;
38 HRESULT hr = CoCreateInstance(&CLSID_DirectMusicBand, NULL, CLSCTX_INPROC_SERVER,
39 &IID_IDirectMusicBand, (void**)&dmb);
41 if (hr == S_OK && dmb)
43 IDirectMusicBand_Release(dmb);
44 return FALSE;
46 return TRUE;
49 static void test_COM(void)
51 IDirectMusicBand *dmb = (IDirectMusicBand*)0xdeadbeef;
52 IDirectMusicObject *dmo;
53 IPersistStream *ps;
54 IUnknown *unk;
55 ULONG refcount;
56 HRESULT hr;
58 /* COM aggregation */
59 hr = CoCreateInstance(&CLSID_DirectMusicBand, (IUnknown *)0xdeadbeef, CLSCTX_INPROC_SERVER,
60 &IID_IUnknown, (void**)&dmb);
61 ok(hr == CLASS_E_NOAGGREGATION,
62 "DirectMusicBand create failed: %08x, expected CLASS_E_NOAGGREGATION\n", hr);
63 ok(!dmb, "dmb = %p\n", dmb);
65 /* Invalid RIID */
66 hr = CoCreateInstance(&CLSID_DirectMusicBand, NULL, CLSCTX_INPROC_SERVER, &IID_IClassFactory,
67 (void**)&dmb);
68 ok(hr == E_NOINTERFACE, "DirectMusicBand create failed: %08x, expected E_NOINTERFACE\n", hr);
70 /* Same refcount for all DirectMusicBand interfaces */
71 hr = CoCreateInstance(&CLSID_DirectMusicBand, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusicBand,
72 (void**)&dmb);
73 ok(hr == S_OK, "DirectMusicBand create failed: %08x, expected S_OK\n", hr);
74 refcount = IDirectMusicBand_AddRef(dmb);
75 ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
77 hr = IDirectMusicBand_QueryInterface(dmb, &IID_IDirectMusicObject, (void**)&dmo);
78 ok(hr == S_OK, "QueryInterface for IID_IDirectMusicObject failed: %08x\n", hr);
79 refcount = IDirectMusicObject_AddRef(dmo);
80 ok(refcount == 4, "refcount == %u, expected 4\n", refcount);
81 refcount = IDirectMusicObject_Release(dmo);
83 hr = IDirectMusicBand_QueryInterface(dmb, &IID_IPersistStream, (void**)&ps);
84 ok(hr == S_OK, "QueryInterface for IID_IPersistStream failed: %08x\n", hr);
85 refcount = IPersistStream_AddRef(ps);
86 ok(refcount == 5, "refcount == %u, expected 5\n", refcount);
87 refcount = IPersistStream_Release(ps);
89 hr = IDirectMusicBand_QueryInterface(dmb, &IID_IUnknown, (void**)&unk);
90 ok(hr == S_OK, "QueryInterface for IID_IUnknown failed: %08x\n", hr);
91 refcount = IUnknown_AddRef(unk);
92 ok(refcount == 6, "refcount == %u, expected 6\n", refcount);
93 refcount = IUnknown_Release(unk);
95 while (IDirectMusicBand_Release(dmb));
98 static void test_COM_bandtrack(void)
100 IDirectMusicTrack *dmbt = (IDirectMusicTrack*)0xdeadbeef;
101 IPersistStream *ps;
102 IUnknown *private;
103 IUnknown *unk;
104 ULONG refcount;
105 HRESULT hr;
107 /* COM aggregation */
108 hr = CoCreateInstance(&CLSID_DirectMusicBandTrack, (IUnknown *)0xdeadbeef, CLSCTX_INPROC_SERVER,
109 &IID_IUnknown, (void**)&dmbt);
110 ok(hr == CLASS_E_NOAGGREGATION,
111 "DirectMusicBandTrack create failed: %08x, expected CLASS_E_NOAGGREGATION\n", hr);
112 ok(!dmbt, "dmbt = %p\n", dmbt);
114 /* Invalid RIID */
115 hr = CoCreateInstance(&CLSID_DirectMusicBandTrack, NULL, CLSCTX_INPROC_SERVER,
116 &IID_IDirectMusicObject, (void**)&dmbt);
117 ok(hr == E_NOINTERFACE, "DirectMusicBandTrack create failed: %08x, expected E_NOINTERFACE\n", hr);
119 /* Same refcount for all DirectMusicBandTrack interfaces */
120 hr = CoCreateInstance(&CLSID_DirectMusicBandTrack, NULL, CLSCTX_INPROC_SERVER,
121 &IID_IDirectMusicTrack, (void**)&dmbt);
122 ok(hr == S_OK, "DirectMusicBandTrack create failed: %08x, expected S_OK\n", hr);
123 refcount = IDirectMusicTrack_AddRef(dmbt);
124 ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
126 hr = IDirectMusicTrack_QueryInterface(dmbt, &IID_IPersistStream, (void**)&ps);
127 ok(hr == S_OK, "QueryInterface for IID_IPersistStream failed: %08x\n", hr);
128 refcount = IPersistStream_AddRef(ps);
129 ok(refcount == 4, "refcount == %u, expected 4\n", refcount);
130 IPersistStream_Release(ps);
132 hr = IDirectMusicTrack_QueryInterface(dmbt, &IID_IUnknown, (void**)&unk);
133 ok(hr == S_OK, "QueryInterface for IID_IUnknown failed: %08x\n", hr);
134 refcount = IUnknown_AddRef(unk);
135 ok(refcount == 5, "refcount == %u, expected 5\n", refcount);
136 refcount = IUnknown_Release(unk);
138 hr = IDirectMusicTrack_QueryInterface(dmbt, &IID_IDirectMusicBandTrackPrivate,
139 (void**)&private);
140 todo_wine ok(hr == S_OK, "QueryInterface for IID_IDirectMusicBandTrackPrivate failed: %08x\n", hr);
141 if (hr == S_OK) {
142 refcount = IUnknown_AddRef(private);
143 ok(refcount == 6, "refcount == %u, expected 6\n", refcount);
144 refcount = IUnknown_Release(private);
147 while (IDirectMusicTrack_Release(dmbt));
150 static void test_dmband(void)
152 IDirectMusicBand *dmb;
153 IPersistStream *ps;
154 CLSID class;
155 ULARGE_INTEGER size;
156 HRESULT hr;
158 hr = CoCreateInstance(&CLSID_DirectMusicBand, NULL, CLSCTX_INPROC_SERVER,
159 &IID_IDirectMusicBand, (void**)&dmb);
160 ok(hr == S_OK, "DirectMusicBand create failed: %08x, expected S_OK\n", hr);
162 /* Unimplemented IPersistStream methods */
163 hr = IDirectMusicBand_QueryInterface(dmb, &IID_IPersistStream, (void**)&ps);
164 ok(hr == S_OK, "QueryInterface for IID_IPersistStream failed: %08x\n", hr);
165 hr = IPersistStream_GetClassID(ps, &class);
166 ok(hr == E_NOTIMPL, "IPersistStream_GetClassID failed: %08x\n", hr);
167 hr = IPersistStream_IsDirty(ps);
168 ok(hr == S_FALSE, "IPersistStream_IsDirty failed: %08x\n", hr);
169 hr = IPersistStream_GetSizeMax(ps, &size);
170 ok(hr == E_NOTIMPL, "IPersistStream_GetSizeMax failed: %08x\n", hr);
171 hr = IPersistStream_Save(ps, NULL, TRUE);
172 ok(hr == E_NOTIMPL, "IPersistStream_Save failed: %08x\n", hr);
174 while (IDirectMusicBand_Release(dmb));
177 static void test_bandtrack(void)
179 IDirectMusicTrack8 *dmt8;
180 IPersistStream *ps;
181 CLSID class;
182 ULARGE_INTEGER size;
183 char buf[64] = { 0 };
184 HRESULT hr;
185 #define X(guid) &guid, #guid
186 const struct {
187 REFGUID type;
188 const char *name;
189 BOOL supported;
190 } param_types[] = {
191 { X(GUID_BandParam), TRUE },
192 { X(GUID_ChordParam), FALSE },
193 { X(GUID_Clear_All_Bands), TRUE },
194 { X(GUID_CommandParam), FALSE },
195 { X(GUID_CommandParam2), FALSE },
196 { X(GUID_CommandParamNext), FALSE },
197 { X(GUID_ConnectToDLSCollection), TRUE },
198 { X(GUID_Disable_Auto_Download), TRUE },
199 { X(GUID_DisableTempo), FALSE },
200 { X(GUID_DisableTimeSig), FALSE },
201 { X(GUID_Download), TRUE },
202 { X(GUID_DownloadToAudioPath), TRUE },
203 { X(GUID_Enable_Auto_Download), TRUE },
204 { X(GUID_EnableTempo), FALSE },
205 { X(GUID_EnableTimeSig), FALSE },
206 { X(GUID_IDirectMusicBand), TRUE },
207 { X(GUID_IDirectMusicChordMap), FALSE },
208 { X(GUID_IDirectMusicStyle), FALSE },
209 { X(GUID_MuteParam), FALSE },
210 { X(GUID_Play_Marker), FALSE },
211 { X(GUID_RhythmParam), FALSE },
212 { X(GUID_SeedVariations), FALSE },
213 { X(GUID_StandardMIDIFile), TRUE },
214 { X(GUID_TempoParam), FALSE },
215 { X(GUID_TimeSignature), FALSE },
216 { X(GUID_Unload), TRUE },
217 { X(GUID_UnloadFromAudioPath), TRUE },
218 { X(GUID_Valid_Start_Time), FALSE },
219 { X(GUID_Variations), FALSE },
221 #undef X
222 unsigned int i;
224 hr = CoCreateInstance(&CLSID_DirectMusicBandTrack, NULL, CLSCTX_INPROC_SERVER,
225 &IID_IDirectMusicTrack8, (void**)&dmt8);
226 ok(hr == S_OK, "DirectMusicBandTrack create failed: %08x, expected S_OK\n", hr);
228 /* IDirectMusicTrack8 */
229 todo_wine {
230 hr = IDirectMusicTrack8_Init(dmt8, NULL);
231 ok(hr == E_POINTER, "IDirectMusicTrack8_Init failed: %08x\n", hr);
232 hr = IDirectMusicTrack8_InitPlay(dmt8, NULL, NULL, NULL, 0, 0);
233 ok(hr == E_POINTER, "IDirectMusicTrack8_InitPlay failed: %08x\n", hr);
235 hr = IDirectMusicTrack8_EndPlay(dmt8, NULL);
236 ok(hr == S_OK, "IDirectMusicTrack8_EndPlay failed: %08x\n", hr);
237 hr = IDirectMusicTrack8_Play(dmt8, NULL, 0, 0, 0, 0, NULL, NULL, 0);
238 todo_wine
239 ok(hr == DMUS_S_END, "IDirectMusicTrack8_Play failed: %08x\n", hr);
240 hr = IDirectMusicTrack8_GetParam(dmt8, NULL, 0, NULL, NULL);
241 ok(hr == E_POINTER, "IDirectMusicTrack8_GetParam failed: %08x\n", hr);
242 hr = IDirectMusicTrack8_SetParam(dmt8, NULL, 0, NULL);
243 ok(hr == E_POINTER, "IDirectMusicTrack8_SetParam failed: %08x\n", hr);
245 hr = IDirectMusicTrack8_IsParamSupported(dmt8, NULL);
246 ok(hr == E_POINTER, "IDirectMusicTrack8_IsParamSupported failed: %08x\n", hr);
247 for (i = 0; i < ARRAY_SIZE(param_types); i++) {
248 hr = IDirectMusicTrack8_IsParamSupported(dmt8, param_types[i].type);
249 if (param_types[i].supported) {
250 ok(hr == S_OK, "IsParamSupported(%s) failed: %08x, expected S_OK\n",
251 param_types[i].name, hr);
252 hr = IDirectMusicTrack8_GetParam(dmt8, param_types[i].type, 0, NULL, buf);
253 if (param_types[i].type != &GUID_BandParam)
254 ok(hr == DMUS_E_GET_UNSUPPORTED,
255 "GetParam(%s) failed: %08x, expected DMUS_E_GET_UNSUPPORTED\n",
256 param_types[i].name, hr);
257 } else {
258 ok(hr == DMUS_E_TYPE_UNSUPPORTED,
259 "IsParamSupported(%s) failed: %08x, expected DMUS_E_TYPE_UNSUPPORTED\n",
260 param_types[i].name, hr);
261 hr = IDirectMusicTrack8_GetParam(dmt8, param_types[i].type, 0, NULL, buf);
262 ok(hr == DMUS_E_GET_UNSUPPORTED,
263 "GetParam(%s) failed: %08x, expected DMUS_E_GET_UNSUPPORTED\n",
264 param_types[i].name, hr);
265 hr = IDirectMusicTrack8_SetParam(dmt8, param_types[i].type, 0, buf);
266 ok(hr == DMUS_E_TYPE_UNSUPPORTED,
267 "SetParam(%s) failed: %08x, expected DMUS_E_TYPE_UNSUPPORTED\n",
268 param_types[i].name, hr);
272 hr = IDirectMusicTrack8_AddNotificationType(dmt8, NULL);
273 ok(hr == E_NOTIMPL, "IDirectMusicTrack8_AddNotificationType failed: %08x\n", hr);
274 hr = IDirectMusicTrack8_RemoveNotificationType(dmt8, NULL);
275 ok(hr == E_NOTIMPL, "IDirectMusicTrack8_RemoveNotificationType failed: %08x\n", hr);
276 todo_wine {
277 hr = IDirectMusicTrack8_Clone(dmt8, 0, 0, NULL);
278 ok(hr == E_POINTER, "IDirectMusicTrack8_Clone failed: %08x\n", hr);
279 hr = IDirectMusicTrack8_PlayEx(dmt8, NULL, 0, 0, 0, 0, NULL, NULL, 0);
280 ok(hr == DMUS_S_END, "IDirectMusicTrack8_PlayEx failed: %08x\n", hr);
281 hr = IDirectMusicTrack8_GetParamEx(dmt8, NULL, 0, NULL, NULL, NULL, 0);
282 ok(hr == E_POINTER, "IDirectMusicTrack8_GetParamEx failed: %08x\n", hr);
283 hr = IDirectMusicTrack8_SetParamEx(dmt8, NULL, 0, NULL, NULL, 0);
284 ok(hr == E_POINTER, "IDirectMusicTrack8_SetParamEx failed: %08x\n", hr);
286 hr = IDirectMusicTrack8_Compose(dmt8, NULL, 0, NULL);
287 ok(hr == E_NOTIMPL, "IDirectMusicTrack8_Compose failed: %08x\n", hr);
288 hr = IDirectMusicTrack8_Join(dmt8, NULL, 0, NULL, 0, NULL);
289 todo_wine ok(hr == E_POINTER, "IDirectMusicTrack8_Join failed: %08x\n", hr);
291 /* IPersistStream */
292 hr = IDirectMusicTrack8_QueryInterface(dmt8, &IID_IPersistStream, (void**)&ps);
293 ok(hr == S_OK, "QueryInterface for IID_IPersistStream failed: %08x\n", hr);
294 hr = IPersistStream_GetClassID(ps, &class);
295 ok(hr == S_OK, "IPersistStream_GetClassID failed: %08x\n", hr);
296 ok(IsEqualGUID(&class, &CLSID_DirectMusicBandTrack),
297 "Expected class CLSID_DirectMusicBandTrack got %s\n", wine_dbgstr_guid(&class));
299 /* Unimplemented IPersistStream methods */
300 hr = IPersistStream_IsDirty(ps);
301 ok(hr == S_FALSE, "IPersistStream_IsDirty failed: %08x\n", hr);
302 hr = IPersistStream_GetSizeMax(ps, &size);
303 ok(hr == E_NOTIMPL, "IPersistStream_GetSizeMax failed: %08x\n", hr);
304 hr = IPersistStream_Save(ps, NULL, TRUE);
305 ok(hr == E_NOTIMPL, "IPersistStream_Save failed: %08x\n", hr);
307 while (IDirectMusicTrack8_Release(dmt8));
310 struct chunk {
311 FOURCC id;
312 DWORD size;
313 FOURCC type;
316 #define CHUNK_HDR_SIZE (sizeof(FOURCC) + sizeof(DWORD))
318 /* Generate a RIFF file format stream from an array of FOURCC ids.
319 RIFF and LIST need to be followed by the form type respectively list type,
320 followed by the chunks of the list and terminated with 0. */
321 static IStream *gen_riff_stream(const FOURCC *ids)
323 static const LARGE_INTEGER zero;
324 int level = -1;
325 DWORD *sizes[4]; /* Stack for the sizes of RIFF and LIST chunks */
326 char riff[1024];
327 char *p = riff;
328 struct chunk *ck;
329 IStream *stream;
331 do {
332 ck = (struct chunk *)p;
333 ck->id = *ids++;
334 switch (ck->id) {
335 case 0:
336 *sizes[level] = p - (char *)sizes[level] - sizeof(DWORD);
337 level--;
338 break;
339 case FOURCC_LIST:
340 case FOURCC_RIFF:
341 level++;
342 sizes[level] = &ck->size;
343 ck->type = *ids++;
344 p += sizeof(*ck);
345 break;
346 case DMUS_FOURCC_GUID_CHUNK:
347 ck->size = sizeof(GUID_NULL);
348 p += CHUNK_HDR_SIZE;
349 memcpy(p, &GUID_NULL, sizeof(GUID_NULL));
350 p += ck->size;
351 break;
352 case DMUS_FOURCC_VERSION_CHUNK:
354 DMUS_VERSION ver = {5, 8};
356 ck->size = sizeof(ver);
357 p += CHUNK_HDR_SIZE;
358 memcpy(p, &ver, sizeof(ver));
359 p += ck->size;
360 break;
362 default:
364 /* Just convert the FOURCC id to a WCHAR string */
365 WCHAR *s;
367 ck->size = 5 * sizeof(WCHAR);
368 p += CHUNK_HDR_SIZE;
369 s = (WCHAR *)p;
370 s[0] = (char)(ck->id);
371 s[1] = (char)(ck->id >> 8);
372 s[2] = (char)(ck->id >> 16);
373 s[3] = (char)(ck->id >> 24);
374 s[4] = 0;
375 p += ck->size;
378 } while (level >= 0);
380 ck = (struct chunk *)riff;
381 CreateStreamOnHGlobal(NULL, TRUE, &stream);
382 IStream_Write(stream, riff, ck->size + CHUNK_HDR_SIZE, NULL);
383 IStream_Seek(stream, zero, STREAM_SEEK_SET, NULL);
385 return stream;
388 static void test_parsedescriptor(void)
390 IDirectMusicObject *dmo;
391 IStream *stream;
392 DMUS_OBJECTDESC desc = {0};
393 HRESULT hr;
394 DWORD valid;
395 const FOURCC alldesc[] =
397 FOURCC_RIFF, DMUS_FOURCC_BAND_FORM, DMUS_FOURCC_CATEGORY_CHUNK, FOURCC_LIST,
398 DMUS_FOURCC_UNFO_LIST, DMUS_FOURCC_UNAM_CHUNK, DMUS_FOURCC_UCOP_CHUNK,
399 DMUS_FOURCC_UCMT_CHUNK, DMUS_FOURCC_USBJ_CHUNK, 0, DMUS_FOURCC_VERSION_CHUNK,
400 DMUS_FOURCC_GUID_CHUNK, 0
402 const FOURCC dupes[] =
404 FOURCC_RIFF, DMUS_FOURCC_BAND_FORM, DMUS_FOURCC_CATEGORY_CHUNK, DMUS_FOURCC_CATEGORY_CHUNK,
405 DMUS_FOURCC_VERSION_CHUNK, DMUS_FOURCC_VERSION_CHUNK, DMUS_FOURCC_GUID_CHUNK,
406 DMUS_FOURCC_GUID_CHUNK, FOURCC_LIST, DMUS_FOURCC_UNFO_LIST, DMUS_FOURCC_UNAM_CHUNK, 0,
407 FOURCC_LIST, DMUS_FOURCC_UNFO_LIST, mmioFOURCC('I','N','A','M'), 0, 0
409 FOURCC empty[] = {FOURCC_RIFF, DMUS_FOURCC_BAND_FORM, 0};
410 FOURCC catdate[] = {FOURCC_RIFF, DMUS_FOURCC_BAND_FORM, DMUS_FOURCC_CATEGORY_CHUNK, 0};
411 FOURCC inam[] =
413 FOURCC_RIFF, DMUS_FOURCC_BAND_FORM, FOURCC_LIST, DMUS_FOURCC_UNFO_LIST,
414 mmioFOURCC('I','N','A','M'), 0, 0
417 hr = CoCreateInstance(&CLSID_DirectMusicBand, NULL, CLSCTX_INPROC_SERVER,
418 &IID_IDirectMusicObject, (void **)&dmo);
419 ok(hr == S_OK, "DirectMusicBand create failed: %08x, expected S_OK\n", hr);
421 /* Nothing loaded */
422 hr = IDirectMusicObject_GetDescriptor(dmo, &desc);
423 ok(hr == S_OK, "GetDescriptor failed: %08x, expected S_OK\n", hr);
424 ok(desc.dwValidData == DMUS_OBJ_CLASS, "Got valid data %#x, expected DMUS_OBJ_OBJECT\n",
425 desc.dwValidData);
426 ok(IsEqualGUID(&desc.guidClass, &CLSID_DirectMusicBand),
427 "Got class guid %s, expected CLSID_DirectMusicBand\n",
428 wine_dbgstr_guid(&desc.guidClass));
430 /* Empty RIFF stream */
431 stream = gen_riff_stream(empty);
432 memset(&desc, 0, sizeof(desc));
433 hr = IDirectMusicObject_ParseDescriptor(dmo, stream, &desc);
434 ok(hr == S_OK, "ParseDescriptor failed: %08x, expected S_OK\n", hr);
435 ok(desc.dwValidData == DMUS_OBJ_CLASS, "Got valid data %#x, expected DMUS_OBJ_CLASS\n",
436 desc.dwValidData);
437 ok(IsEqualGUID(&desc.guidClass, &CLSID_DirectMusicBand),
438 "Got class guid %s, expected CLSID_DirectMusicBand\n",
439 wine_dbgstr_guid(&desc.guidClass));
440 IStream_Release(stream);
442 /* NULL pointers */
443 memset(&desc, 0, sizeof(desc));
444 hr = IDirectMusicObject_ParseDescriptor(dmo, NULL, &desc);
445 ok(hr == E_POINTER, "ParseDescriptor failed: %08x, expected E_POINTER\n", hr);
446 hr = IDirectMusicObject_ParseDescriptor(dmo, stream, NULL);
447 ok(hr == E_POINTER, "ParseDescriptor failed: %08x, expected E_POINTER\n", hr);
449 /* Wrong form */
450 empty[1] = DMUS_FOURCC_CONTAINER_FORM;
451 stream = gen_riff_stream(empty);
452 hr = IDirectMusicObject_ParseDescriptor(dmo, stream, &desc);
453 ok(hr == DMUS_E_INVALID_BAND,
454 "ParseDescriptor failed: %08x, expected DMUS_E_INVALID_BAND\n", hr);
455 IStream_Release(stream);
457 /* A category chunk adds DMUS_OBJ_DATE too */
458 stream = gen_riff_stream(catdate);
459 memset(&desc, 0, sizeof(desc));
460 hr = IDirectMusicObject_ParseDescriptor(dmo, stream, &desc);
461 ok(hr == S_OK, "ParseDescriptor failed: %08x, expected S_OK\n", hr);
462 valid = DMUS_OBJ_CLASS | DMUS_OBJ_CATEGORY | DMUS_OBJ_DATE;
463 ok(desc.dwValidData == valid, "Got valid data %#x, expected %#x\n", desc.dwValidData, valid);
464 IStream_Release(stream);
466 /* All desc chunks, extra DMUS_OBJ_DATE */
467 stream = gen_riff_stream(alldesc);
468 memset(&desc, 0, sizeof(desc));
469 hr = IDirectMusicObject_ParseDescriptor(dmo, stream, &desc);
470 ok(hr == S_OK, "ParseDescriptor failed: %08x, expected S_OK\n", hr);
471 valid = DMUS_OBJ_OBJECT|DMUS_OBJ_CLASS|DMUS_OBJ_NAME|DMUS_OBJ_CATEGORY|DMUS_OBJ_VERSION|DMUS_OBJ_DATE;
472 ok(desc.dwValidData == valid, "Got valid data %#x, expected %#x\n", desc.dwValidData, valid);
473 ok(IsEqualGUID(&desc.guidClass, &CLSID_DirectMusicBand),
474 "Got class guid %s, expected CLSID_DirectMusicBand\n",
475 wine_dbgstr_guid(&desc.guidClass));
476 ok(IsEqualGUID(&desc.guidObject, &GUID_NULL), "Got object guid %s, expected GUID_NULL\n",
477 wine_dbgstr_guid(&desc.guidClass));
478 ok(!lstrcmpW(desc.wszName, L"UNAM"), "Got name '%s', expected 'UNAM'\n",
479 wine_dbgstr_w(desc.wszName));
480 ok(!desc.ftDate.dwHighDateTime && !desc.ftDate.dwLowDateTime,
481 "Got file time %08x %08x, expected 0\n", desc.ftDate.dwHighDateTime,
482 desc.ftDate.dwLowDateTime);
483 IStream_Release(stream);
485 /* UNFO list with INAM */
486 inam[3] = DMUS_FOURCC_UNFO_LIST;
487 stream = gen_riff_stream(inam);
488 memset(&desc, 0, sizeof(desc));
489 hr = IDirectMusicObject_ParseDescriptor(dmo, stream, &desc);
490 ok(hr == S_OK, "ParseDescriptor failed: %08x, expected S_OK\n", hr);
491 ok(desc.dwValidData == (DMUS_OBJ_CLASS | DMUS_OBJ_NAME),
492 "Got valid data %#x, expected DMUS_OBJ_CLASS | DMUS_OBJ_NAME\n", desc.dwValidData);
493 ok(!lstrcmpW(desc.wszName, L"INAM"), "Got name '%s', expected 'INAM'\n",
494 wine_dbgstr_w(desc.wszName));
495 IStream_Release(stream);
497 /* INFO list with INAM */
498 inam[3] = DMUS_FOURCC_INFO_LIST;
499 stream = gen_riff_stream(inam);
500 memset(&desc, 0, sizeof(desc));
501 hr = IDirectMusicObject_ParseDescriptor(dmo, stream, &desc);
502 ok(hr == S_OK, "ParseDescriptor failed: %08x, expected S_OK\n", hr);
503 ok(desc.dwValidData == DMUS_OBJ_CLASS, "Got valid data %#x, expected DMUS_OBJ_CLASS\n",
504 desc.dwValidData);
505 IStream_Release(stream);
507 /* Duplicated chunks */
508 stream = gen_riff_stream(dupes);
509 memset(&desc, 0, sizeof(desc));
510 hr = IDirectMusicObject_ParseDescriptor(dmo, stream, &desc);
511 ok(hr == S_OK, "ParseDescriptor failed: %08x, expected S_OK\n", hr);
512 valid = DMUS_OBJ_OBJECT|DMUS_OBJ_CLASS|DMUS_OBJ_NAME|DMUS_OBJ_CATEGORY|DMUS_OBJ_VERSION|DMUS_OBJ_DATE;
513 ok(desc.dwValidData == valid, "Got valid data %#x, expected %#x\n", desc.dwValidData, valid);
514 ok(!lstrcmpW(desc.wszName, L"INAM"), "Got name '%s', expected 'INAM'\n",
515 wine_dbgstr_w(desc.wszName));
516 IStream_Release(stream);
518 IDirectMusicObject_Release(dmo);
521 START_TEST(dmband)
523 CoInitializeEx(NULL, COINIT_MULTITHREADED);
525 if (missing_dmband())
527 skip("dmband not available\n");
528 CoUninitialize();
529 return;
532 test_COM();
533 test_COM_bandtrack();
534 test_dmband();
535 test_bandtrack();
536 test_parsedescriptor();
538 CoUninitialize();