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

Signed-off-by: Michael Stefaniuc <mstefani@redhat.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2016-07-19 09:51:36 +02:00 committed by Alexandre Julliard
parent 91ba1a2561
commit 45c1f7d3ed
1 changed files with 21 additions and 5 deletions

View File

@ -30,6 +30,20 @@
#include "dmusici.h"
#include "dmksctrl.h"
static BOOL missing_dmsynth(void)
{
IDirectMusicSynth *dms;
HRESULT hr = CoCreateInstance(&CLSID_DirectMusicSynth, NULL, CLSCTX_INPROC_SERVER,
&IID_IDirectMusicSynth, (void**)&dms);
if (hr == S_OK && dms)
{
IDirectMusicSynth_Release(dms);
return FALSE;
}
return TRUE;
}
static void test_dmsynth(void)
{
IDirectMusicSynth *dmsynth = NULL;
@ -44,11 +58,7 @@ static void test_dmsynth(void)
ULONG bytes;
hr = CoCreateInstance(&CLSID_DirectMusicSynth, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusicSynth, (LPVOID*)&dmsynth);
if (hr != S_OK)
{
skip("Cannot create DirectMusicSync object (%x)\n", hr);
return;
}
ok(hr == S_OK, "CoCreateInstance returned: %x\n", hr);
hr = CoCreateInstance(&CLSID_DirectMusicSynthSink, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusicSynthSink, (LPVOID*)&dmsynth_sink);
ok(hr == S_OK, "CoCreateInstance returned: %x\n", hr);
@ -130,6 +140,12 @@ START_TEST(dmsynth)
{
CoInitializeEx(NULL, COINIT_MULTITHREADED);
if (missing_dmsynth())
{
skip("dmsynth not available\n");
CoUninitialize();
return;
}
test_dmsynth();
CoUninitialize();