dmband/tests: Move the dll availability check to a separate function.

This commit is contained in:
Michael Stefaniuc 2014-01-30 00:49:42 +01:00 committed by Alexandre Julliard
parent 05d1872575
commit 7012235479
1 changed files with 21 additions and 9 deletions

View File

@ -31,22 +31,28 @@
DEFINE_GUID(IID_IDirectMusicBandTrackPrivate, 0x53466056, 0x6dc4, 0x11d1, 0xbf, 0x7b, 0x00, 0xc0, 0x4f, 0xbf, 0x8f, 0xef);
static BOOL missing_dmband(void)
{
IDirectMusicBand *dmb;
HRESULT hr = CoCreateInstance(&CLSID_DirectMusicBand, NULL, CLSCTX_INPROC_SERVER,
&IID_IDirectMusicBand, (void**)&dmb);
if (hr == S_OK && dmb)
{
IDirectMusicBand_Release(dmb);
return FALSE;
}
return TRUE;
}
static void test_dmband(void)
{
IDirectMusicBand *band;
IUnknown *unknown = NULL;
IDirectMusicTrack *track = NULL;
IPersistStream *stream = NULL;
IPersistStream *private = NULL;
HRESULT hr;
hr = CoCreateInstance(&CLSID_DirectMusicBand, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusicBand, (LPVOID*)&band);
if (hr != S_OK)
{
skip("Cannot create DirectMusicBand object (%x)\n", hr);
return;
}
hr = CoCreateInstance(&CLSID_DirectMusicBandTrack, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (LPVOID*)&unknown);
ok(hr == S_OK, "CoCreateInstance returned: %x\n", hr);
hr = IUnknown_QueryInterface(unknown, &IID_IDirectMusicTrack, (LPVOID*)&track);
@ -68,13 +74,19 @@ static void test_dmband(void)
IDirectMusicTrack_Release(track);
if (unknown)
IUnknown_Release(unknown);
IDirectMusicBand_Release(band);
}
START_TEST(dmband)
{
CoInitializeEx(NULL, COINIT_MULTITHREADED);
if (missing_dmband())
{
skip("dmband not available\n");
CoUninitialize();
return;
}
test_dmband();
CoUninitialize();