Release 1.5.29.
[wine] / dlls / dmband / tests / dmband.c
1 /*
2  * Unit tests for dmband functions
3  *
4  * Copyright (C) 2012 Christian Costa
5  *
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.
10  *
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.
15  *
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
19  */
20
21 #define COBJMACROS
22
23 #include <stdio.h>
24
25 #include "wine/test.h"
26 #include "uuids.h"
27 #include "ole2.h"
28 #include "initguid.h"
29 #include "dmusici.h"
30 #include "dmplugin.h"
31
32 DEFINE_GUID(IID_IDirectMusicBandTrackPrivate, 0x53466056, 0x6dc4, 0x11d1, 0xbf, 0x7b, 0x00, 0xc0, 0x4f, 0xbf, 0x8f, 0xef);
33
34 static void test_dmband(void)
35 {
36     IDirectMusicBand *band;
37     IUnknown *unknown = NULL;
38     IDirectMusicTrack *track = NULL;
39     IPersistStream *stream = NULL;
40     IPersistStream *private = NULL;
41     HRESULT hr;
42
43     hr = CoCreateInstance(&CLSID_DirectMusicBand, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusicBand, (LPVOID*)&band);
44     if (hr != S_OK)
45     {
46         skip("Cannot create DirectMusicBand object (%x)\n", hr);
47         return;
48     }
49
50     hr = CoCreateInstance(&CLSID_DirectMusicBandTrack, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (LPVOID*)&unknown);
51     ok(hr == S_OK, "CoCreateInstance returned: %x\n", hr);
52     hr = IUnknown_QueryInterface(unknown, &IID_IDirectMusicTrack, (LPVOID*)&track);
53     ok(hr == S_OK, "QueryInterface returned: %x\n", hr);
54     todo_wine ok((LPVOID)track == (LPVOID)unknown, "Interface are not the same %p != %p\n", stream, private);
55     hr = IUnknown_QueryInterface(unknown, &IID_IPersistStream, (LPVOID*)&stream);
56     ok(hr == S_OK, "QueryInterface returned: %x\n", hr);
57     /* Query private interface */
58     hr = IUnknown_QueryInterface(unknown, &IID_IDirectMusicBandTrackPrivate, (LPVOID*)&private);
59     todo_wine ok(hr == S_OK, "QueryInterface returned: %x\n", hr);
60
61     trace("Interfaces: unknown = %p, track = %p, stream = %p, private = %p\n", unknown, track, stream, private);
62
63     if (private)
64         IPersistStream_Release(private);
65     if (stream)
66         IPersistStream_Release(stream);
67     if (track)
68         IDirectMusicTrack_Release(track);
69     if (unknown)
70         IUnknown_Release(unknown);
71     IDirectMusicBand_Release(band);
72 }
73
74 START_TEST(dmband)
75 {
76     CoInitializeEx(NULL, COINIT_MULTITHREADED);
77
78     test_dmband();
79
80     CoUninitialize();
81 }