Michael Stefaniuc : dmcompos/tests: Add COM tests for IDirectMusicComposer.
Alexandre Julliard
julliard at winehq.org
Thu Jan 16 14:52:27 CST 2014
Module: wine
Branch: master
Commit: 6c22a6ad5632e7d53989933c9daea5c3b7625703
URL: http://source.winehq.org/git/wine.git/?a=commit;h=6c22a6ad5632e7d53989933c9daea5c3b7625703
Author: Michael Stefaniuc <mstefani at redhat.de>
Date: Thu Jan 16 00:47:38 2014 +0100
dmcompos/tests: Add COM tests for IDirectMusicComposer.
---
configure | 1 +
configure.ac | 1 +
dlls/dmcompos/tests/Makefile.in | 5 +++
dlls/dmcompos/tests/dmcompos.c | 91 +++++++++++++++++++++++++++++++++++++++
4 files changed, 98 insertions(+)
diff --git a/configure b/configure
index 48f12f1..c59d934 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 75faadf..4f51909 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 0000000..b794d4d
--- /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 0000000..329d65e
--- /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 <stdarg.h>
+#include <windef.h>
+#include <initguid.h>
+#include <wine/test.h>
+#include <dmusici.h>
+
+
+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();
+}
More information about the wine-cvs
mailing list