From 645ca7504ee60fe029bb4df7e749deb23975d5a8 Mon Sep 17 00:00:00 2001 From: Michael Stefaniuc Date: Sun, 29 Dec 2013 22:36:28 +0100 Subject: [PATCH] dmusic/tests: Centralize the skip(). --- dlls/dmusic/tests/dmusic.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/dlls/dmusic/tests/dmusic.c b/dlls/dmusic/tests/dmusic.c index 3174685f109..9cc9023a958 100644 --- a/dlls/dmusic/tests/dmusic.c +++ b/dlls/dmusic/tests/dmusic.c @@ -62,11 +62,7 @@ static void test_dmusic(void) IReferenceClock *clock = NULL; hr = CoCreateInstance(&CLSID_DirectMusic, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusic, (LPVOID*)&dmusic); - if (hr != S_OK) - { - skip("Cannot create DirectMusic object (%x)\n", hr); - return; - } + ok(hr == S_OK, "Cannot create DirectMusic object (%x)\n", hr); hr = IDirectMusic_GetMasterClock(dmusic, &guid_clock, &clock); ok(hr == S_OK, "IDirectMusic_GetMasterClock returned: %x\n", hr); @@ -149,11 +145,7 @@ static void test_dmbuffer(void) LPBYTE data; hr = CoCreateInstance(&CLSID_DirectMusic, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusic, (LPVOID*)&dmusic); - if (hr != S_OK) - { - skip("Cannot create DirectMusic object (%x)\n", hr); - return; - } + ok(hr == S_OK, "Cannot create DirectMusic object (%x)\n", hr); desc.dwSize = sizeof(DMUS_BUFFERDESC); desc.dwFlags = 0; @@ -230,10 +222,25 @@ static void test_dmbuffer(void) IDirectMusic_Release(dmusic); } +static BOOL missing_dmusic(void) +{ + IDirectMusic8 *dm; + HRESULT hr = CoCreateInstance(&CLSID_DirectMusic, (IUnknown*)&dm, CLSCTX_INPROC_SERVER, + &IID_IUnknown, (void**)&dm); + + return (hr == REGDB_E_CLASSNOTREG || hr == CLASS_E_CLASSNOTAVAILABLE); +} + START_TEST(dmusic) { CoInitializeEx(NULL, COINIT_MULTITHREADED); + if (missing_dmusic()) + { + skip("DirectMusic not available\n"); + CoUninitialize(); + return; + } test_dmusic(); test_dmbuffer();