dmime/tests: Added tests for IDirectMusicPerformance.
authorAustin Lund <austin.lund@gmail.com>
Fri, 6 Aug 2010 07:50:49 +0000 (17:50 +1000)
committerAlexandre Julliard <julliard@winehq.org>
Mon, 16 Aug 2010 15:28:55 +0000 (17:28 +0200)
configure
configure.ac
dlls/dmime/tests/Makefile.in [new file with mode: 0644]
dlls/dmime/tests/performance.c [new file with mode: 0644]

index 05a9317f9c6dd1c2dfd3d68620d3ed04e2f7cb9c..4549b38b941e6eab103e3be238c2002f4a7bcb78 100755 (executable)
--- 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
index eedfec58c3e3145e48aa6954e09a3e0478f5e86d..5b56bb99ac3c565fe019f87506b6910d9790d2f7 100644 (file)
@@ -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 (file)
index 0000000..f3c83dc
--- /dev/null
@@ -0,0 +1,11 @@
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ../../..
+SRCDIR    = @srcdir@
+VPATH     = @srcdir@
+TESTDLL   = dmime.dll
+IMPORTS   = user32 ole32
+
+C_SRCS = \
+       performance.c
+
+@MAKE_TEST_RULES@
diff --git a/dlls/dmime/tests/performance.c b/dlls/dmime/tests/performance.c
new file mode 100644 (file)
index 0000000..a681b6a
--- /dev/null
@@ -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();
+}