diff --git a/configure b/configure index 48f12f1062c..c59d93435e6 100755 --- a/configure +++ b/configure @@ -16665,6 +16665,7 @@ wine_fn_config_dll display.drv16 enable_win16 wine_fn_config_dll dmband enable_dmband clean wine_fn_config_test dlls/dmband/tests dmband_test wine_fn_config_dll dmcompos enable_dmcompos clean +wine_fn_config_test dlls/dmcompos/tests dmcompos_test wine_fn_config_dll dmime enable_dmime clean wine_fn_config_test dlls/dmime/tests dmime_test wine_fn_config_dll dmloader enable_dmloader clean diff --git a/configure.ac b/configure.ac index 75faadf23e4..4f51909fade 100644 --- a/configure.ac +++ b/configure.ac @@ -2789,6 +2789,7 @@ WINE_CONFIG_DLL(display.drv16,enable_win16) WINE_CONFIG_DLL(dmband,,[clean]) WINE_CONFIG_TEST(dlls/dmband/tests) WINE_CONFIG_DLL(dmcompos,,[clean]) +WINE_CONFIG_TEST(dlls/dmcompos/tests) WINE_CONFIG_DLL(dmime,,[clean]) WINE_CONFIG_TEST(dlls/dmime/tests) WINE_CONFIG_DLL(dmloader,,[clean]) diff --git a/dlls/dmcompos/tests/Makefile.in b/dlls/dmcompos/tests/Makefile.in new file mode 100644 index 00000000000..b794d4d48e0 --- /dev/null +++ b/dlls/dmcompos/tests/Makefile.in @@ -0,0 +1,5 @@ +TESTDLL = dmcompos.dll +IMPORTS = ole32 + +C_SRCS = \ + dmcompos.c diff --git a/dlls/dmcompos/tests/dmcompos.c b/dlls/dmcompos/tests/dmcompos.c new file mode 100644 index 00000000000..329d65ec915 --- /dev/null +++ b/dlls/dmcompos/tests/dmcompos.c @@ -0,0 +1,91 @@ +/* + * Copyright 2014 Michael Stefaniuc + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#define COBJMACROS + +#include +#include +#include +#include +#include + + +static BOOL missing_dmcompos(void) +{ + IDirectMusicComposer *dmc; + HRESULT hr = CoCreateInstance(&CLSID_DirectMusicComposer, NULL, CLSCTX_INPROC_SERVER, + &IID_IDirectMusicComposer, (void**)&dmc); + + if (hr == S_OK && dmc) + { + IDirectMusicComposer_Release(dmc); + return FALSE; + } + return TRUE; +} + +static void test_COM(void) +{ + IDirectMusicComposer *dmc = (IDirectMusicComposer*)0xdeadbeef; + IUnknown *unk; + ULONG refcount; + HRESULT hr; + + /* COM aggregation */ + hr = CoCreateInstance(&CLSID_DirectMusicComposer, (IUnknown*)&dmc, CLSCTX_INPROC_SERVER, + &IID_IUnknown, (void**)&dmc); + ok(hr == CLASS_E_NOAGGREGATION, + "DirectMusicComposer create failed: %08x, expected CLASS_E_NOAGGREGATION\n", hr); + ok(!dmc, "dmc = %p\n", dmc); + + /* Invalid RIID */ + hr = CoCreateInstance(&CLSID_DirectMusicComposer, NULL, CLSCTX_INPROC_SERVER, + &IID_IDirectMusicObject, (void**)&dmc); + ok(hr == E_NOINTERFACE, + "DirectMusicComposer create failed: %08x, expected E_NOINTERFACE\n", hr); + + /* Same refcount for all DirectMusicComposer interfaces */ + hr = CoCreateInstance(&CLSID_DirectMusicComposer, NULL, CLSCTX_INPROC_SERVER, + &IID_IDirectMusicComposer, (void**)&dmc); + ok(hr == S_OK, "DirectMusicComposer create failed: %08x, expected S_OK\n", hr); + refcount = IDirectMusicComposer_AddRef(dmc); + ok(refcount == 2, "refcount == %u, expected 2\n", refcount); + + hr = IDirectMusicComposer_QueryInterface(dmc, &IID_IUnknown, (void**)&unk); + ok(hr == S_OK, "QueryInterface for IID_IUnknown failed: %08x\n", hr); + refcount = IUnknown_AddRef(unk); + ok(refcount == 4, "refcount == %u, expected 4\n", refcount); + refcount = IUnknown_Release(unk); + + while (IDirectMusicComposer_Release(dmc)); +} + +START_TEST(dmcompos) +{ + CoInitialize(NULL); + + if (missing_dmcompos()) + { + skip("dmcompos not available\n"); + CoUninitialize(); + return; + } + test_COM(); + + CoUninitialize(); +}