Fix winmm's check_position() tests

Francois Gouget fgouget at codeweavers.com
Mon Jul 19 12:24:16 CDT 2004


I got errors when running the winmm test in interactive mode. Checking 
it on Windows it turns out that waveOutGetPosition() is supposed to 
return the number of samples played plus one, and not the number of 
samples played as the test expected. The number of bytes also reflects 
that extra sample.
So I modified it accordingly.


Changelog:

  * dlls/winmm/tests/wave.c

    Francois Gouget <fgouget at codeweavers.com>
    Fix the check_position() test: on Windows waveOutGetPosition() 
returns the number of samples played plus one (also one extra sample for 
the byte count).

-- 
Francois Gouget
fgouget at codeweavers.com

-------------- next part --------------
Index: dlls/winmm/tests/wave.c
===================================================================
RCS file: /var/cvs/wine/dlls/winmm/tests/wave.c,v
retrieving revision 1.30
diff -u -r1.30 wave.c
--- dlls/winmm/tests/wave.c	14 Jun 2004 17:54:45 -0000	1.30
+++ dlls/winmm/tests/wave.c	19 Jul 2004 15:07:59 -0000
@@ -204,18 +209,18 @@
     ok(rc==MMSYSERR_NOERROR,
        "waveOutGetPosition: device=%s rc=%s\n",dev_name(device),wave_out_error(rc));
     if (mmtime.wType == TIME_BYTES)
-        ok(mmtime.u.cb==duration*pwfx->nAvgBytesPerSec,
+        ok(mmtime.u.cb==duration*pwfx->nAvgBytesPerSec+pwfx->wBitsPerSample/8,
            "waveOutGetPosition returned %ld bytes, should be %ld\n",
-           mmtime.u.cb, (DWORD)(duration*pwfx->nAvgBytesPerSec));
+           mmtime.u.cb, (DWORD)(duration*pwfx->nAvgBytesPerSec)+pwfx->wBitsPerSample/8);
 
     mmtime.wType = TIME_SAMPLES;
     rc=waveOutGetPosition(wout, &mmtime, sizeof(mmtime));
     ok(rc==MMSYSERR_NOERROR,
        "waveOutGetPosition: device=%s rc=%s\n",dev_name(device),wave_out_error(rc));
     if (mmtime.wType == TIME_SAMPLES)
-        ok(mmtime.u.sample==duration*pwfx->nSamplesPerSec,
+        ok(mmtime.u.sample==duration*pwfx->nSamplesPerSec+1,
            "waveOutGetPosition returned %ld samples, should be %ld\n",
-           mmtime.u.sample, (DWORD)(duration*pwfx->nSamplesPerSec));
+           mmtime.u.sample, (DWORD)(duration*pwfx->nSamplesPerSec)+1);
 
     mmtime.wType = TIME_MS;
     rc=waveOutGetPosition(wout, &mmtime, sizeof(mmtime));


More information about the wine-patches mailing list