Andrew Eikum : winmm/tests: Test using a device handle in wave{In,Out}GetDevCaps and wave{In,Out}Open.
Alexandre Julliard
julliard at winehq.org
Fri May 8 15:20:32 CDT 2020
Module: wine
Branch: master
Commit: 0239026bf3da2bc5114ba60c7da8f7f54d30c0f5
URL: https://source.winehq.org/git/wine.git/?a=commit;h=0239026bf3da2bc5114ba60c7da8f7f54d30c0f5
Author: Andrew Eikum <aeikum at codeweavers.com>
Date: Fri May 8 09:25:16 2020 -0500
winmm/tests: Test using a device handle in wave{In,Out}GetDevCaps and wave{In,Out}Open.
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/winmm/tests/capture.c | 17 ++++++++++++++++-
dlls/winmm/tests/wave.c | 17 ++++++++++++++++-
2 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/dlls/winmm/tests/capture.c b/dlls/winmm/tests/capture.c
index 4290c358a9..f60b44b096 100644
--- a/dlls/winmm/tests/capture.c
+++ b/dlls/winmm/tests/capture.c
@@ -130,7 +130,7 @@ static void check_position(int device, HWAVEIN win, DWORD bytes,
static void wave_in_test_deviceIn(int device, WAVEFORMATEX *pwfx, DWORD format, DWORD flags,
WAVEINCAPSA *pcaps)
{
- HWAVEIN win;
+ HWAVEIN win, win2;
HANDLE hevent = CreateEventW(NULL, FALSE, FALSE, NULL);
WAVEHDR frag;
MMRESULT rc;
@@ -139,6 +139,7 @@ static void wave_in_test_deviceIn(int device, WAVEFORMATEX *pwfx, DWORD format,
WORD nChannels = pwfx->nChannels;
WORD wBitsPerSample = pwfx->wBitsPerSample;
DWORD nSamplesPerSec = pwfx->nSamplesPerSec;
+ WAVEINCAPSW capsW;
win=NULL;
flags |= CALLBACK_EVENT;
@@ -181,6 +182,20 @@ static void wave_in_test_deviceIn(int device, WAVEFORMATEX *pwfx, DWORD format,
pwfx->nSamplesPerSec, pwfx->wBitsPerSample,
pwfx->nChannels, nSamplesPerSec, wBitsPerSample, nChannels);
+ /* waveInGetDevCaps allows an open handle instead of a device id */
+ rc=waveInGetDevCapsW(HandleToUlong(win),&capsW,sizeof(capsW));
+ ok(rc==MMSYSERR_NOERROR,
+ "waveInGetDevCapsW(%s): MMSYSERR_NOERROR "
+ "expected, got %s\n",dev_name(device),wave_in_error(rc));
+
+ /* waveInOpen does not allow an open handle instead of a device id */
+ rc=waveInOpen(&win2,HandleToUlong(win),pwfx,0,0,CALLBACK_NULL);
+ ok(rc==MMSYSERR_BADDEVICEID,
+ "waveInOpen(%s): MMSYSERR_BADDEVICEID "
+ "expected, got %s\n",dev_name(device),wave_in_error(rc));
+ if(rc==MMSYSERR_NOERROR)
+ waveInClose(win2);
+
/* Check that the position is 0 at start */
check_position(device, win, 0, pwfx);
diff --git a/dlls/winmm/tests/wave.c b/dlls/winmm/tests/wave.c
index f9fc5c5aad..eec1ba2a03 100644
--- a/dlls/winmm/tests/wave.c
+++ b/dlls/winmm/tests/wave.c
@@ -599,9 +599,10 @@ static void wave_out_test_deviceOut(int device, double duration, int headers, in
WAVEFORMATEX *pwfx, DWORD format, DWORD flags, WAVEOUTCAPSA *pcaps, BOOL interactive,
BOOL sine, BOOL pause)
{
- HWAVEOUT wout;
+ HWAVEOUT wout, wout2;
HANDLE hevent = CreateEventW(NULL, FALSE, FALSE, NULL);
WAVEHDR *frags = 0;
+ WAVEOUTCAPSW capsW;
MMRESULT rc;
DWORD volume;
WORD nChannels = pwfx->nChannels;
@@ -705,6 +706,20 @@ static void wave_out_test_deviceOut(int device, double duration, int headers, in
ok(has_volume ? rc==MMSYSERR_NOERROR : rc==MMSYSERR_NOTSUPPORTED,
"waveOutGetVolume(%s): rc=%s\n",dev_name(device),wave_out_error(rc));
+ /* waveOutGetDevCaps allows an open handle instead of a device id */
+ rc=waveOutGetDevCapsW(HandleToUlong(wout),&capsW,sizeof(capsW));
+ ok(rc==MMSYSERR_NOERROR,
+ "waveOutGetDevCapsW(%s): MMSYSERR_NOERROR "
+ "expected, got %s\n",dev_name(device),wave_out_error(rc));
+
+ /* waveOutOpen does not allow an open handle instead of a device id */
+ rc=waveOutOpen(&wout2,HandleToUlong(wout),pwfx,0,0,CALLBACK_NULL);
+ ok(rc==MMSYSERR_BADDEVICEID,
+ "waveOutOpen(%s): MMSYSERR_BADDEVICEID "
+ "expected, got %s\n",dev_name(device),wave_out_error(rc));
+ if(rc==MMSYSERR_NOERROR)
+ waveOutClose(wout2);
+
/* make sure fragment length is a multiple of block size */
frag_length = ((length / headers) / pwfx->nBlockAlign) * pwfx->nBlockAlign;
More information about the wine-cvs
mailing list