Small DSound test

Francois Gouget fgouget at codeweavers.com
Tue Dec 3 18:23:15 CST 2002


Currently this only checks a small aspect of the IDirectSound.GetCaps 
behavior but it can serve as a framework for adding more tests...

Changelog:

    Francois Gouget <fgouget at codeweavers.com>

  * configure.ac,
    dlls/dsound/Makefile.in,
    dlls/dsound/tests/dsound.c

    A simple test for IDirectSound.GetCaps

-- 
Francois Gouget
fgouget at codeweavers.com

-------------- next part --------------
Index: configure.ac
===================================================================
RCS file: /home/wine/wine/configure.ac,v
retrieving revision 1.102
diff -u -r1.102 configure.ac
--- configure.ac	2 Dec 2002 21:17:05 -0000	1.102
+++ configure.ac	3 Dec 2002 23:44:24 -0000
@@ -1418,6 +1418,7 @@
 dlls/dplay/Makefile
 dlls/dplayx/Makefile
 dlls/dsound/Makefile
+dlls/dsound/tests/Makefile
 dlls/gdi/Makefile
 dlls/gdi/tests/Makefile
 dlls/glu32/Makefile
Index: dlls/dsound/Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/dsound/Makefile.in,v
retrieving revision 1.15
diff -u -r1.15 Makefile.in
--- dlls/dsound/Makefile.in	5 Jul 2002 22:48:33 -0000	1.15
+++ dlls/dsound/Makefile.in	3 Dec 2002 23:44:30 -0000
@@ -18,6 +18,8 @@
 	propset.c \
 	sound3d.c
 
+SUBDIRS = tests
+
 @MAKE_DLL_RULES@
 
 ### Dependencies:
--- /dev/null	2002-07-31 19:05:42.000000000 -0700
+++ dlls/dsound/tests/dsound.c	2002-12-02 19:02:04.000000000 -0800
@@ -0,0 +1,66 @@
+/*
+ * Unit tests for winmm functions
+ *
+ * Copyright (c) 2002 Francois Gouget
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "wine/test.h"
+#include "dsound.h"
+
+
+
+BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
+                            LPCSTR lpcstrModule, LPVOID lpContext)
+{
+    HRESULT rc;
+    LPDIRECTSOUND dso;
+
+    winetest_trace("Testing %s - %s\n",lpcstrDescription,lpcstrModule);
+    rc=DirectSoundCreate(lpGuid,&dso,NULL);
+    ok(rc==DS_OK,"DirectSoundCreate failed: %lx\n",rc);
+    if (rc==DS_OK) {
+        DSCAPS caps;
+
+        caps.dwSize=0;
+        rc=IDirectSound_GetCaps(dso,&caps);
+        ok(rc==DSERR_INVALIDPARAM,"GetCaps should have failed: %lx\n",rc);
+
+        caps.dwSize=sizeof(caps);
+        rc=IDirectSound_GetCaps(dso,&caps);
+        ok(rc==DS_OK,"GetCaps failed: %lx\n",rc);
+        if (rc==DS_OK) {
+            winetest_trace("  flags=%lx secondary min=%ld max=%ld\n",
+                           caps.dwFlags,caps.dwMinSecondarySampleRate,
+                           caps.dwMaxSecondarySampleRate);
+        }
+
+        IDirectSound_Release(dso);
+    }
+    return 1;
+}
+
+void dsound_out_tests()
+{
+    HRESULT rc;
+    rc=DirectSoundEnumerateA(&dsenum_callback,NULL);
+    ok(rc==DS_OK,"DirectSoundEnumerate failed: %ld\n",rc);
+}
+
+START_TEST(dsound)
+{
+    dsound_out_tests();
+}


More information about the wine-patches mailing list