[DSOUND] DirectSoundBuffer_Lock tests

Robert Reif reif at earthlink.net
Sat Apr 29 09:14:40 CDT 2006


Add DirectSoundBuffer_Lock tests.
-------------- next part --------------
Index: dlls/dsound/tests/ds3d.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/tests/ds3d.c,v
retrieving revision 1.35
diff -p -u -r1.35 ds3d.c
--- dlls/dsound/tests/ds3d.c	10 Apr 2006 11:30:59 -0000	1.35
+++ dlls/dsound/tests/ds3d.c	29 Apr 2006 14:12:07 -0000
@@ -436,6 +436,8 @@ void test_buffer(LPDIRECTSOUND dso, LPDI
         LPDIRECTSOUND3DBUFFER buffer=NULL;
         DS3DBUFFER buffer_param;
         DWORD start_time,now;
+        LPVOID buffer1;
+        DWORD length1;
 
         if (winetest_interactive) {
             if (set_frequency)
@@ -559,6 +561,20 @@ void test_buffer(LPDIRECTSOUND dso, LPDI
             }
         }
 
+        /* try an offset past the end of the buffer */
+        rc = IDirectSoundBuffer_Lock(*dsbo, state.buffer_size, 0, &buffer1,
+                                      &length1, NULL, NULL,
+                                      DSBLOCK_ENTIREBUFFER);
+        ok(rc==DSERR_INVALIDPARAM, "IDirectSoundBuffer_Lock() should have "
+           "returned DSERR_INVALIDPARAM, returned %s\n", DXGetErrorString8(rc));
+
+        /* try a size larger than the buffer */
+        rc = IDirectSoundBuffer_Lock(*dsbo, 0, state.buffer_size + 1,
+                                     &buffer1, &length1, NULL, NULL,
+                                     DSBLOCK_FROMWRITECURSOR);
+        ok(rc==DSERR_INVALIDPARAM, "IDirectSoundBuffer_Lock() should have "
+           "returned DSERR_INVALIDPARAM, returned %s\n", DXGetErrorString8(rc));
+
         if (set_frequency)
             state.wave=wave_generate_la(&wfx,(duration*frequency)/wfx.nSamplesPerSec,&state.wave_len);
         else
Index: dlls/dsound/tests/ds3d8.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/tests/ds3d8.c,v
retrieving revision 1.26
diff -p -u -r1.26 ds3d8.c
--- dlls/dsound/tests/ds3d8.c	15 Mar 2006 11:13:45 -0000	1.26
+++ dlls/dsound/tests/ds3d8.c	29 Apr 2006 14:12:07 -0000
@@ -328,6 +328,8 @@ void test_buffer8(LPDIRECTSOUND8 dso, LP
         LPDIRECTSOUND3DBUFFER buffer=NULL;
         DS3DBUFFER buffer_param;
         DWORD start_time,now;
+        LPVOID buffer1;
+        DWORD length1;
 
         if (winetest_interactive) {
             trace("    Playing %g second 440Hz tone at %ldx%dx%d\n", duration,
@@ -445,6 +447,20 @@ void test_buffer8(LPDIRECTSOUND8 dso, LP
             }
         }
 
+        /* try an offset past the end of the buffer */
+        rc = IDirectSoundBuffer_Lock(*dsbo, state.buffer_size, 0, &buffer1,
+                                      &length1, NULL, NULL,
+                                      DSBLOCK_ENTIREBUFFER);
+        ok(rc==DSERR_INVALIDPARAM, "IDirectSoundBuffer_Lock() should have "
+           "returned DSERR_INVALIDPARAM, returned %s\n", DXGetErrorString8(rc));
+
+        /* try a size larger than the buffer */
+        rc = IDirectSoundBuffer_Lock(*dsbo, 0, state.buffer_size + 1,
+                                     &buffer1, &length1, NULL, NULL,
+                                     DSBLOCK_FROMWRITECURSOR);
+        ok(rc==DSERR_INVALIDPARAM, "IDirectSoundBuffer_Lock() should have "
+           "returned DSERR_INVALIDPARAM, returned %s\n", DXGetErrorString8(rc));
+
         state.wave=wave_generate_la(&wfx,duration,&state.wave_len);
 
         state.dsbo=*dsbo;


More information about the wine-patches mailing list