Maarten Lankhorst : dsound: Skip WAVE_FORMAT_EXTENSIBLE tests on directx < 8.

Alexandre Julliard julliard at winehq.org
Wed Apr 23 07:59:42 CDT 2008


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

Author: Maarten Lankhorst <m.b.lankhorst at gmail.com>
Date:   Tue Apr 22 17:12:28 2008 -0700

dsound: Skip WAVE_FORMAT_EXTENSIBLE tests on directx < 8.

---

 dlls/dsound/tests/dsound.c |   44 +++++++++++++++++++++++++++++++++++---------
 1 files changed, 35 insertions(+), 9 deletions(-)

diff --git a/dlls/dsound/tests/dsound.c b/dlls/dsound/tests/dsound.c
index 3a1bd18..6c81640 100644
--- a/dlls/dsound/tests/dsound.c
+++ b/dlls/dsound/tests/dsound.c
@@ -44,6 +44,8 @@ static HRESULT (WINAPI *pDirectSoundEnumerateA)(LPDSENUMCALLBACKA,LPVOID)=NULL;
 static HRESULT (WINAPI *pDirectSoundCreate)(LPCGUID,LPDIRECTSOUND*,
     LPUNKNOWN)=NULL;
 
+static BOOL gotdx8;
+
 static void IDirectSound_test(LPDIRECTSOUND dso, BOOL initialized,
                               LPCGUID lpGuid)
 {
@@ -569,8 +571,13 @@ static HRESULT test_primary_secondary(LPGUID lpGuid)
                         formats[f][2]);
             wfx2=wfx;
             rc=IDirectSoundBuffer_SetFormat(primary,&wfx);
-            ok(rc==DS_OK,"IDirectSoundBuffer_SetFormat(%s) failed: %s\n",
-               format_string(&wfx), DXGetErrorString8(rc));
+
+            if (wfx.wBitsPerSample <= 16)
+                ok(rc==DS_OK,"IDirectSoundBuffer_SetFormat(%s) failed: %s\n",
+                   format_string(&wfx), DXGetErrorString8(rc));
+            else
+                ok(rc==DS_OK || rc == E_INVALIDARG, "SetFormat (%s) failed: %s\n",
+                   format_string(&wfx), DXGetErrorString8(rc));
 
             /* There is no guarantee that SetFormat will actually change the
              * format to what we asked for. It depends on what the soundcard
@@ -723,14 +730,30 @@ static HRESULT test_secondary(LPGUID lpGuid)
                                         wfx.nBlockAlign);
             bufdesc.lpwfxFormat=&wfx;
             rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
-            if (wfx.wBitsPerSample != 8 && wfx.wBitsPerSample != 16)
-                ok(rc == DSERR_CONTROLUNAVAIL && !secondary, "IDirectSound_CreateSoundBuffer() "
-                    "should have returned DSERR_CONTROLUNAVAIL and NULL, returned: %s %p\n",
-                    DXGetErrorString8(rc), secondary);
+            if (gotdx8 || wfx.wBitsPerSample <= 16)
+            {
+                if (wfx.wBitsPerSample > 16)
+                    ok(rc == DSERR_CONTROLUNAVAIL && !secondary, "IDirectSound_CreateSoundBuffer() "
+                        "should have returned DSERR_CONTROLUNAVAIL and NULL, returned: %s %p\n",
+                        DXGetErrorString8(rc), secondary);
+                else
+                    ok(rc==DS_OK && secondary!=NULL,
+                        "IDirectSound_CreateSoundBuffer() failed to create a secondary "
+                        "buffer %s\n",DXGetErrorString8(rc));
+            }
             else
-                ok(rc==DS_OK && secondary!=NULL,
-                    "IDirectSound_CreateSoundBuffer() failed to create a secondary "
-                    "buffer %s\n",DXGetErrorString8(rc));
+                ok(rc==E_INVALIDARG, "Creating %d bpp buffer on dx < 8 returned: %p %s\n",
+                   wfx.wBitsPerSample, secondary, DXGetErrorString8(rc));
+
+            if (!gotdx8)
+            {
+                skip("Not doing the WAVE_FORMAT_EXTENSIBLE tests\n");
+                /* Apparently they succeed with bogus values,
+                 * which means that older dsound doesn't look at them
+                 */
+                goto no_wfe;
+            }
+
             if (secondary)
                 IDirectSoundBuffer_Release(secondary);
             secondary = NULL;
@@ -792,6 +815,7 @@ static HRESULT test_secondary(LPGUID lpGuid)
                 "IDirectSound_CreateSoundBuffer() failed to create a secondary "
                 "buffer %s\n",DXGetErrorString8(rc));
 
+no_wfe:
             if (rc==DS_OK && secondary!=NULL) {
                 if (winetest_interactive) {
                     trace("  Testing a secondary buffer at %dx%dx%d "
@@ -1066,6 +1090,8 @@ START_TEST(dsound)
         pDirectSoundCreate = (void*)GetProcAddress(hDsound,
             "DirectSoundCreate");
 
+        gotdx8 = !!GetProcAddress(hDsound, "DirectSoundCreate8");
+
         IDirectSound_tests();
         dsound_tests();
 




More information about the wine-cvs mailing list