Austin Lund : dmime/tests: Added tests for IDirectMusicPerformance.

Alexandre Julliard julliard at winehq.org
Mon Aug 16 12:25:06 CDT 2010


Module: wine
Branch: master
Commit: 203272eafa2bd530c9078d8e59fc38550e9b3056
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=203272eafa2bd530c9078d8e59fc38550e9b3056

Author: Austin Lund <austin.lund at gmail.com>
Date:   Fri Aug  6 17:50:49 2010 +1000

dmime/tests: Added tests for IDirectMusicPerformance.

---

 configure                      |    1 +
 configure.ac                   |    1 +
 dlls/dmime/tests/Makefile.in   |   11 ++++
 dlls/dmime/tests/performance.c |  102 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 115 insertions(+), 0 deletions(-)

diff --git a/configure b/configure
index 05a9317..4549b38 100755
--- a/configure
+++ b/configure
@@ -14499,6 +14499,7 @@ wine_fn_config_dll display.drv16 enable_win16
 wine_fn_config_dll dmband enable_dmband
 wine_fn_config_dll dmcompos enable_dmcompos
 wine_fn_config_dll dmime enable_dmime
+wine_fn_config_test dlls/dmime/tests dmime_test
 wine_fn_config_dll dmloader enable_dmloader
 wine_fn_config_test dlls/dmloader/tests dmloader_test
 wine_fn_config_dll dmscript enable_dmscript
diff --git a/configure.ac b/configure.ac
index eedfec5..5b56bb9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2338,6 +2338,7 @@ WINE_CONFIG_DLL(display.drv16,enable_win16)
 WINE_CONFIG_DLL(dmband)
 WINE_CONFIG_DLL(dmcompos)
 WINE_CONFIG_DLL(dmime)
+WINE_CONFIG_TEST(dlls/dmime/tests)
 WINE_CONFIG_DLL(dmloader)
 WINE_CONFIG_TEST(dlls/dmloader/tests)
 WINE_CONFIG_DLL(dmscript)
diff --git a/dlls/dmime/tests/Makefile.in b/dlls/dmime/tests/Makefile.in
new file mode 100644
index 0000000..f3c83dc
--- /dev/null
+++ b/dlls/dmime/tests/Makefile.in
@@ -0,0 +1,11 @@
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ../../..
+SRCDIR    = @srcdir@
+VPATH     = @srcdir@
+TESTDLL   = dmime.dll
+IMPORTS   = user32 ole32
+
+C_SRCS = \
+	performance.c
+
+ at MAKE_TEST_RULES@
diff --git a/dlls/dmime/tests/performance.c b/dlls/dmime/tests/performance.c
new file mode 100644
index 0000000..a681b6a
--- /dev/null
+++ b/dlls/dmime/tests/performance.c
@@ -0,0 +1,102 @@
+/*
+ * Unit test suite for IDirectMusicPerformance
+ *
+ * Copyright 2010 Austin Lund
+ *
+ * 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
+ */
+
+#include <stdarg.h>
+#include <windef.h>
+#include <initguid.h>
+#include <wine/test.h>
+#include <dmusici.h>
+
+IDirectMusicPerformance8 *idmusicperformance;
+
+static HRESULT test_InitAudio(void)
+{
+    IDirectSound *pDirectSound;
+    HRESULT hr;
+
+    pDirectSound = NULL;
+    hr = IDirectMusicPerformance8_InitAudio(idmusicperformance ,NULL,
+        &pDirectSound, NULL, DMUS_APATH_SHARED_STEREOPLUSREVERB, 128, DMUS_AUDIOF_ALL, NULL);
+    return hr;
+}
+
+static void test_PChannelInfo(void)
+{
+    IDirectMusicPort *pDirectMusicPort;
+    HRESULT hr;
+
+    pDirectMusicPort = NULL;
+    hr = IDirectMusicPerformance8_PChannelInfo(idmusicperformance, 0, &pDirectMusicPort, NULL, NULL);
+    ok(hr == S_OK, "Failed to call PChannelInfo (%x)\n", hr);
+    todo_wine ok(pDirectMusicPort != NULL, "IDirectMusicPort not set\n");
+    if (hr == S_OK && pDirectMusicPort != NULL)
+        IDirectMusicPort_Release(pDirectMusicPort);
+}
+
+static void test_GetDefaultAudioPath(void)
+{
+    IDirectMusicAudioPath *pDirectMusicAudioPath;
+    HRESULT hr;
+
+    hr = IDirectMusicPerformance8_GetDefaultAudioPath(idmusicperformance, &pDirectMusicAudioPath);
+    ok(hr == S_OK, "Failed to call GetDefaultAudioPath (%x)\n", hr);
+    if (hr == S_OK)
+        IDirectMusicAudioPath_Release(pDirectMusicAudioPath);
+}
+
+static void test_CloseDown(void)
+{
+    HRESULT hr;
+
+    hr = IDirectMusicPerformance8_CloseDown(idmusicperformance);
+    ok(hr == S_OK, "Failed to call CloseDown (%x)\n", hr);
+}
+
+START_TEST( performance )
+{
+    HRESULT hr;
+
+    hr = CoInitialize(NULL);
+    if (FAILED(hr)) {
+        skip("Cannot initialize COM (%x)\n", hr);
+        return;
+    }
+
+    hr = CoCreateInstance(&CLSID_DirectMusicPerformance, NULL,
+            CLSCTX_INPROC_SERVER, &IID_IDirectMusicPerformance8, (LPVOID *)&idmusicperformance);
+    if (hr != S_OK) {
+        skip("Cannot create DirectMusicPerformance object (%x)\n", hr);
+        CoUninitialize();
+        return;
+    }
+
+    hr = test_InitAudio();
+    if (hr != S_OK) {
+        skip("InitAudio failed (%x)\n", hr);
+        return;
+    }
+
+    test_GetDefaultAudioPath();
+    test_PChannelInfo();
+    test_CloseDown();
+
+    IDirectMusicPerformance8_Release(idmusicperformance);
+    CoUninitialize();
+}




More information about the wine-cvs mailing list