[DSOUND] fix tests for missing primary buffer

Robert Reif reif at earthlink.net
Sat Jun 4 11:15:46 CDT 2005


Fix tests to work with drivers that don't support a primary buffer.
-------------- next part --------------
Index: dlls/dsound/tests/ds3d.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/tests/ds3d.c,v
retrieving revision 1.23
diff -p -u -r1.23 ds3d.c
--- dlls/dsound/tests/ds3d.c	5 Mar 2005 10:49:08 -0000	1.23
+++ dlls/dsound/tests/ds3d.c	4 Jun 2005 16:10:38 -0000
@@ -674,11 +674,12 @@ static HRESULT test_secondary(LPGUID lpG
     else
         bufdesc.dwFlags|=(DSBCAPS_CTRLVOLUME|DSBCAPS_CTRLPAN);
     rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
-    ok(rc==DS_OK && primary!=NULL,"IDirectSound_CreateSoundBuffer() "
-       "failed to create a %sprimary buffer: %s\n",has_3d?"3D ":"",
-        DXGetErrorString8(rc));
-
-    if (rc==DS_OK && primary!=NULL) {
+    ok((rc==DS_OK && primary!=NULL) || (rc==DSERR_CONTROLUNAVAIL),
+       "IDirectSound_CreateSoundBuffer() failed to create a %sprimary buffer: "
+       "%s\n",has_3d?"3D ":"", DXGetErrorString8(rc));
+    if (rc==DSERR_CONTROLUNAVAIL)
+        trace("  No Primary\n");
+    else if (rc==DS_OK && primary!=NULL) {
         rc=IDirectSoundBuffer_GetFormat(primary,&wfx1,sizeof(wfx1),NULL);
         ok(rc==DS_OK,"IDirectSoundBuffer8_Getformat() failed: %s\n",
            DXGetErrorString8(rc));
@@ -953,9 +954,12 @@ static HRESULT test_primary(LPGUID lpGui
     bufdesc.dwSize=sizeof(bufdesc);
     bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_CTRLVOLUME|DSBCAPS_CTRLPAN;
     rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
-    ok(rc==DS_OK && primary!=NULL,"IDirectSound_CreateSoundBuffer() failed "
-       "to create a primary buffer: %s\n",DXGetErrorString8(rc));
-    if (rc==DS_OK && primary!=NULL) {
+    ok((rc==DS_OK && primary!=NULL) || (rc==DSERR_CONTROLUNAVAIL),
+       "IDirectSound_CreateSoundBuffer() failed to create a primary buffer: "
+       "%s\n",DXGetErrorString8(rc));
+    if (rc==DSERR_CONTROLUNAVAIL)
+        trace("  No Primary\n");
+    else if (rc==DS_OK && primary!=NULL) {
         test_buffer(dso,primary,1,TRUE,0,TRUE,0,winetest_interactive &&
                     !(dscaps.dwFlags & DSCAPS_EMULDRIVER),1.0,0,NULL,0,0,
                     FALSE,0);
Index: dlls/dsound/tests/ds3d8.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/tests/ds3d8.c,v
retrieving revision 1.17
diff -p -u -r1.17 ds3d8.c
--- dlls/dsound/tests/ds3d8.c	5 Mar 2005 10:49:08 -0000	1.17
+++ dlls/dsound/tests/ds3d8.c	4 Jun 2005 16:10:39 -0000
@@ -556,11 +556,12 @@ static HRESULT test_secondary8(LPGUID lp
     else
         bufdesc.dwFlags|=(DSBCAPS_CTRLVOLUME|DSBCAPS_CTRLPAN);
     rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
-    ok(rc==DS_OK && primary!=NULL,"IDirectSound8_CreateSoundBuffer() "
-       "failed to create a %sprimary buffer: %s\n",has_3d?"3D ":"",
-       DXGetErrorString8(rc));
-
-    if (rc==DS_OK && primary!=NULL) {
+    ok((rc==DS_OK && primary!=NULL) || (rc == DSERR_CONTROLUNAVAIL),
+       "IDirectSound8_CreateSoundBuffer() failed to create a %sprimary buffer: "
+       "%s\n",has_3d?"3D ":"", DXGetErrorString8(rc));
+    if (rc == DSERR_CONTROLUNAVAIL)
+        trace("  No Primary\n");
+    else if (rc==DS_OK && primary!=NULL) {
         rc=IDirectSoundBuffer_GetFormat(primary,&wfx1,sizeof(wfx1),NULL);
         ok(rc==DS_OK,"IDirectSoundBuffer8_Getformat() failed: %s\n",
            DXGetErrorString8(rc));
@@ -847,9 +848,12 @@ static HRESULT test_primary8(LPGUID lpGu
     bufdesc.dwSize=sizeof(bufdesc);
     bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_CTRLVOLUME|DSBCAPS_CTRLPAN;
     rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
-    ok(rc==DS_OK && primary!=NULL,"IDirectSound8_CreateSoundBuffer() failed "
-       "to create a primary buffer: 0x%lx\n",rc);
-    if (rc==DS_OK && primary!=NULL) {
+    ok((rc==DS_OK && primary!=NULL) || (rc == DSERR_CONTROLUNAVAIL),
+       "IDirectSound8_CreateSoundBuffer() failed to create a primary buffer: "
+       "%s\n",DXGetErrorString8(rc));
+    if (rc == DSERR_CONTROLUNAVAIL)
+        trace("  No Primary\n");
+    else if (rc==DS_OK && primary!=NULL) {
         test_buffer8(dso,primary,1,TRUE,0,TRUE,0,winetest_interactive &&
                      !(dscaps.dwFlags & DSCAPS_EMULDRIVER),1.0,0,NULL,0,0);
         if (winetest_interactive) {
Index: dlls/dsound/tests/dsound.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/tests/dsound.c,v
retrieving revision 1.53
diff -p -u -r1.53 dsound.c
--- dlls/dsound/tests/dsound.c	6 May 2005 19:33:32 -0000	1.53
+++ dlls/dsound/tests/dsound.c	4 Jun 2005 16:10:40 -0000
@@ -428,10 +428,12 @@ static HRESULT test_primary(LPGUID lpGui
     bufdesc.dwSize=sizeof(bufdesc);
     bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_CTRLVOLUME;
     rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
-    ok(rc==DS_OK && primary!=NULL,
+    ok((rc==DS_OK && primary!=NULL) || (rc==DSERR_CONTROLUNAVAIL),
        "IDirectSound_CreateSoundBuffer() failed to create a primary buffer: "
        "%s\n",DXGetErrorString8(rc));
-    if (rc==DS_OK && primary!=NULL) {
+    if (rc==DSERR_CONTROLUNAVAIL)
+        trace("  No Primary\n");
+    else if (rc==DS_OK && primary!=NULL) {
         LONG vol;
 
         /* Try to create a second primary buffer */
Index: dlls/dsound/tests/dsound8.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/tests/dsound8.c,v
retrieving revision 1.22
diff -p -u -r1.22 dsound8.c
--- dlls/dsound/tests/dsound8.c	6 May 2005 19:33:32 -0000	1.22
+++ dlls/dsound/tests/dsound8.c	4 Jun 2005 16:10:40 -0000
@@ -454,10 +454,12 @@ static HRESULT test_primary8(LPGUID lpGu
     bufdesc.dwSize=sizeof(bufdesc);
     bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_CTRLVOLUME;
     rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
-    ok(rc==DS_OK && primary!=NULL,
+    ok((rc==DS_OK && primary!=NULL) || (rc==DSERR_CONTROLUNAVAIL),
        "IDirectSound8_CreateSoundBuffer() failed to create a primary buffer: "
        "%s\n",DXGetErrorString8(rc));
-    if (rc==DS_OK && primary!=NULL) {
+    if (rc==DSERR_CONTROLUNAVAIL)
+        trace("  No Primary\n");
+    else if (rc==DS_OK && primary!=NULL) {
         LONG vol;
 
         /* Try to create a second primary buffer */


More information about the wine-patches mailing list