dmband/tests: Move the dll availability check to a separate function.
[wine/wine-gecko.git] / dlls / dmband / tests / dmband.c
blob5195066c437bc8262e252f88764ae7589d7183eb
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 "dmplugin.h"
32 DEFINE_GUID(IID_IDirectMusicBandTrackPrivate, 0x53466056, 0x6dc4, 0x11d1, 0xbf, 0x7b, 0x00, 0xc0, 0x4f, 0xbf, 0x8f, 0xef);
34 static BOOL missing_dmband(void)
36 IDirectMusicBand *dmb;
37 HRESULT hr = CoCreateInstance(&CLSID_DirectMusicBand, NULL, CLSCTX_INPROC_SERVER,
38 &IID_IDirectMusicBand, (void**)&dmb);
40 if (hr == S_OK && dmb)
42 IDirectMusicBand_Release(dmb);
43 return FALSE;
45 return TRUE;
48 static void test_dmband(void)
50 IUnknown *unknown = NULL;
51 IDirectMusicTrack *track = NULL;
52 IPersistStream *stream = NULL;
53 IPersistStream *private = NULL;
54 HRESULT hr;
56 hr = CoCreateInstance(&CLSID_DirectMusicBandTrack, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (LPVOID*)&unknown);
57 ok(hr == S_OK, "CoCreateInstance returned: %x\n", hr);
58 hr = IUnknown_QueryInterface(unknown, &IID_IDirectMusicTrack, (LPVOID*)&track);
59 ok(hr == S_OK, "QueryInterface returned: %x\n", hr);
60 todo_wine ok((LPVOID)track == (LPVOID)unknown, "Interface are not the same %p != %p\n", stream, private);
61 hr = IUnknown_QueryInterface(unknown, &IID_IPersistStream, (LPVOID*)&stream);
62 ok(hr == S_OK, "QueryInterface returned: %x\n", hr);
63 /* Query private interface */
64 hr = IUnknown_QueryInterface(unknown, &IID_IDirectMusicBandTrackPrivate, (LPVOID*)&private);
65 todo_wine ok(hr == S_OK, "QueryInterface returned: %x\n", hr);
67 trace("Interfaces: unknown = %p, track = %p, stream = %p, private = %p\n", unknown, track, stream, private);
69 if (private)
70 IPersistStream_Release(private);
71 if (stream)
72 IPersistStream_Release(stream);
73 if (track)
74 IDirectMusicTrack_Release(track);
75 if (unknown)
76 IUnknown_Release(unknown);
79 START_TEST(dmband)
81 CoInitializeEx(NULL, COINIT_MULTITHREADED);
83 if (missing_dmband())
85 skip("dmband not available\n");
86 CoUninitialize();
87 return;
90 test_dmband();
92 CoUninitialize();