Commit 0239026b authored by Andrew Eikum's avatar Andrew Eikum Committed by Alexandre Julliard

winmm/tests: Test using a device handle in wave{In,Out}GetDevCaps and wave{In,Out}Open.

parent ae13a279
......@@ -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);
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment