dsound/tests: Call interface methods properly.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Zebediah Figura 2018-03-30 00:05:28 -05:00 committed by Alexandre Julliard
parent 264267fc2f
commit 1ec904906c
6 changed files with 34 additions and 56 deletions

View File

@ -114,7 +114,7 @@ static void IDirectSoundCapture_test(LPDIRECTSOUNDCAPTURE dsco,
ok(rc==DS_OK, "IDirectSoundCapture_QueryInterface(IID_IUnknown) "
"failed: %08x\n", rc);
if (rc==DS_OK)
IDirectSoundCapture_Release(unknown);
IUnknown_Release(unknown);
rc=IDirectSoundCapture_QueryInterface(dsco, &IID_IDirectSoundCapture,
(LPVOID*)&dsc);
@ -162,7 +162,7 @@ static void IDirectSoundCapture_test(LPDIRECTSOUNDCAPTURE dsco,
ZeroMemory(&dsccaps, sizeof(dsccaps));
/* DSOUND: Error: Invalid caps buffer */
rc=IDirectSound_GetCaps(dsco, &dsccaps);
rc=IDirectSoundCapture_GetCaps(dsco, &dsccaps);
ok(rc==DSERR_INVALIDPARAM, "IDirectSound_GetCaps() "
"should have returned DSERR_INVALIDPARAM, returned: %08x\n", rc);

View File

@ -535,18 +535,6 @@ void test_buffer(LPDIRECTSOUND dso, LPDIRECTSOUNDBUFFER *dsbo,
ok(ref==1,"IDirectSoundBuffer_Release() has %d references, "
"should have 1\n",ref);
temp_buffer=NULL;
rc=IDirectSound3DBuffer_QueryInterface(*dsbo,
&IID_IDirectSoundBuffer,
(LPVOID *)&temp_buffer);
ok(rc==DS_OK && temp_buffer!=NULL,
"IDirectSound3DBuffer_QueryInterface() failed: %08x\n", rc);
ok(temp_buffer==*dsbo,"COM interface broken: %p != %p\n",
temp_buffer,*dsbo);
ref=IDirectSoundBuffer_Release(temp_buffer);
ok(ref==1,"IDirectSoundBuffer_Release() has %d references, "
"should have 1\n",ref);
ref=IDirectSoundBuffer_Release(*dsbo);
ok(ref==0,"IDirectSoundBuffer_Release() has %d references, "
"should have 0\n",ref);
@ -1193,6 +1181,8 @@ static HRESULT test_primary_3d_with_listener(LPGUID lpGuid)
if (rc==DS_OK && primary!=NULL) {
LPDIRECTSOUND3DLISTENER listener=NULL;
LPDIRECTSOUNDBUFFER temp_buffer=NULL;
IKsPropertySet *propset;
rc=IDirectSoundBuffer_QueryInterface(primary,
&IID_IDirectSound3DListener,(void **)&listener);
ok(rc==DS_OK && listener!=NULL,"IDirectSoundBuffer_QueryInterface() "
@ -1231,11 +1221,10 @@ static HRESULT test_primary_3d_with_listener(LPGUID lpGuid)
temp_buffer = NULL;
rc = IDirectSound3DListener_QueryInterface(listener, &IID_IKsPropertySet,
(void **)&temp_buffer);
ok(rc==DS_OK && temp_buffer!=NULL,
(void **)&propset);
ok(rc == DS_OK && propset != NULL,
"IDirectSound3DListener_QueryInterface didn't handle IKsPropertySet: ret = %08x\n", rc);
if(temp_buffer)
IKsPropertySet_Release(temp_buffer);
IKsPropertySet_Release(propset);
}
/* Testing the reference counting */
@ -1244,12 +1233,11 @@ static HRESULT test_primary_3d_with_listener(LPGUID lpGuid)
"references, should have 0\n",ref);
}
temp_buffer = NULL;
rc = IDirectSoundBuffer_QueryInterface(primary, &IID_IKsPropertySet, (void **)&temp_buffer);
ok(rc==DS_OK && temp_buffer!=NULL,
propset = NULL;
rc = IDirectSoundBuffer_QueryInterface(primary, &IID_IKsPropertySet, (void **)&propset);
ok(rc == DS_OK && propset != NULL,
"IDirectSoundBuffer_QueryInterface didn't handle IKsPropertySet on primary buffer: ret = %08x\n", rc);
if(temp_buffer)
IKsPropertySet_Release(temp_buffer);
IKsPropertySet_Release(propset);
/* Testing the reference counting */
ref=IDirectSoundBuffer_Release(primary);

View File

@ -371,17 +371,6 @@ void test_buffer8(LPDIRECTSOUND8 dso, LPDIRECTSOUNDBUFFER * dsbo,
ok(ref==1,"IDirectSoundBuffer_Release() has %d references, "
"should have 1\n",ref);
temp_buffer=NULL;
rc=IDirectSound3DBuffer_QueryInterface(*dsbo, &IID_IDirectSoundBuffer,
(LPVOID *)&temp_buffer);
ok(rc==DS_OK && temp_buffer!=NULL,
"IDirectSound3DBuffer_QueryInterface() failed: %08x\n", rc);
ok(temp_buffer==*dsbo,"COM interface broken: %p != %p\n",
temp_buffer,*dsbo);
ref=IDirectSoundBuffer_Release(temp_buffer);
ok(ref==1,"IDirectSoundBuffer_Release() has %d references, "
"should have 1\n",ref);
ref=IDirectSoundBuffer_Release(*dsbo);
ok(ref==0,"IDirectSoundBuffer_Release() has %d references, "
"should have 0\n",ref);

View File

@ -30,6 +30,7 @@
#include "wine/test.h"
#include "mmsystem.h"
#define COBJMACROS
#include "dsound.h"
#include "dsconf.h"
#include "initguid.h"
@ -61,7 +62,7 @@ static void IDirectSound_test(LPDIRECTSOUND dso, BOOL initialized,
rc=IDirectSound_QueryInterface(dso,&IID_IUnknown,(LPVOID*)&unknown);
ok(rc==DS_OK,"IDirectSound_QueryInterface(IID_IUnknown) failed: %08x\n", rc);
if (rc==DS_OK)
IDirectSound_Release(unknown);
IUnknown_Release(unknown);
rc=IDirectSound_QueryInterface(dso,&IID_IDirectSound,(LPVOID*)&ds);
ok(rc==DS_OK,"IDirectSound_QueryInterface(IID_IDirectSound) failed: %08x\n", rc);
@ -337,7 +338,7 @@ static HRESULT test_dsound(LPGUID lpGuid)
"buffer %08x\n",rc);
if (rc==DS_OK && secondary!=NULL) {
LPDIRECTSOUND3DBUFFER buffer3d;
rc=IDirectSound_QueryInterface(secondary, &IID_IDirectSound3DBuffer,
rc = IDirectSoundBuffer_QueryInterface(secondary, &IID_IDirectSound3DBuffer,
(void **)&buffer3d);
ok(rc==DS_OK && buffer3d!=NULL,"IDirectSound_QueryInterface() "
"failed: %08x\n",rc);

View File

@ -72,7 +72,7 @@ static void IDirectSound8_test(LPDIRECTSOUND8 dso, BOOL initialized,
rc=IDirectSound8_QueryInterface(dso,&IID_IUnknown,(LPVOID*)&unknown);
ok(rc==DS_OK,"IDirectSound8_QueryInterface(IID_IUnknown) failed: %08x\n", rc);
if (rc==DS_OK)
IDirectSound8_Release(unknown);
IUnknown_Release(unknown);
rc=IDirectSound8_QueryInterface(dso,&IID_IDirectSound,(LPVOID*)&ds);
ok(rc==DS_OK,"IDirectSound8_QueryInterface(IID_IDirectSound) failed: %08x\n", rc);
@ -353,7 +353,7 @@ static HRESULT test_dsound8(LPGUID lpGuid)
if (rc==DS_OK && secondary!=NULL) {
LPDIRECTSOUND3DBUFFER buffer3d;
LPDIRECTSOUNDBUFFER8 buffer8;
rc=IDirectSound8_QueryInterface(secondary,
rc=IDirectSoundBuffer_QueryInterface(secondary,
&IID_IDirectSound3DBuffer,
(void **)&buffer3d);
ok(rc==DS_OK && buffer3d!=NULL,
@ -363,7 +363,7 @@ static HRESULT test_dsound8(LPGUID lpGuid)
ok(ref==2,"IDirectSound3DBuffer_AddRef() has %d references, "
"should have 2\n",ref);
}
rc=IDirectSound8_QueryInterface(secondary,
rc=IDirectSoundBuffer_QueryInterface(secondary,
&IID_IDirectSoundBuffer8,
(void **)&buffer8);
if (rc==DS_OK && buffer8!=NULL) {
@ -645,7 +645,7 @@ static HRESULT test_primary_secondary8(LPGUID lpGuid)
wfx.nSamplesPerSec,wfx.wBitsPerSample,wfx.nChannels,format_tags[tag],
wfx2.nSamplesPerSec,wfx2.wBitsPerSample,wfx2.nChannels);
}
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(rc==DS_OK && secondary!=NULL,
"IDirectSound_CreateSoundBuffer() failed to create a secondary "
"buffer %08x\n",rc);
@ -756,7 +756,7 @@ static HRESULT test_secondary8(LPGUID lpGuid)
bufdesc.dwBufferBytes=align(wfx.nAvgBytesPerSec*BUFFER_LEN/1000,
wfx.nBlockAlign);
bufdesc.lpwfxFormat=&wfx;
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
if (wfx.wBitsPerSample != 8 && wfx.wBitsPerSample != 16)
ok(((rc == DSERR_CONTROLUNAVAIL || rc == DSERR_INVALIDCALL || rc == DSERR_INVALIDPARAM /* 2003 */) && !secondary)
|| rc == DS_OK, /* driver dependent? */
@ -779,7 +779,7 @@ static HRESULT test_secondary8(LPGUID lpGuid)
wfxe.Samples.wValidBitsPerSample = wfx.wBitsPerSample;
wfxe.dwChannelMask = (wfx.nChannels == 1 ? KSAUDIO_SPEAKER_MONO : KSAUDIO_SPEAKER_STEREO);
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(rc==DSERR_INVALIDPARAM && !secondary,
"IDirectSound_CreateSoundBuffer() returned: %08x %p\n",
rc, secondary);
@ -791,7 +791,7 @@ static HRESULT test_secondary8(LPGUID lpGuid)
wfxe.Format.cbSize = sizeof(wfxe) - sizeof(wfx) + 1;
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(((rc==DSERR_CONTROLUNAVAIL || rc==DSERR_INVALIDCALL /* 2003 */ || rc==DSERR_INVALIDPARAM) && !secondary)
|| rc==DS_OK /* driver dependent? */,
"IDirectSound_CreateSoundBuffer() returned: %08x %p\n",
@ -804,7 +804,7 @@ static HRESULT test_secondary8(LPGUID lpGuid)
wfxe.Format.cbSize = sizeof(wfxe) - sizeof(wfx);
wfxe.SubFormat = GUID_NULL;
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok((rc==DSERR_INVALIDPARAM || rc==DSERR_INVALIDCALL) && !secondary,
"IDirectSound_CreateSoundBuffer() returned: %08x %p\n",
rc, secondary);
@ -815,7 +815,7 @@ static HRESULT test_secondary8(LPGUID lpGuid)
}
wfxe.Format.cbSize = sizeof(wfxe);
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok((rc==DSERR_CONTROLUNAVAIL || rc==DSERR_INVALIDCALL || rc==DSERR_INVALIDPARAM) && !secondary,
"IDirectSound_CreateSoundBuffer() returned: %08x %p\n",
rc, secondary);
@ -826,7 +826,7 @@ static HRESULT test_secondary8(LPGUID lpGuid)
}
wfxe.SubFormat = (format_tags[tag] == WAVE_FORMAT_PCM ? KSDATAFORMAT_SUBTYPE_PCM : KSDATAFORMAT_SUBTYPE_IEEE_FLOAT);
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(rc==DS_OK && secondary,
"IDirectSound_CreateSoundBuffer() returned: %08x %p\n",
rc, secondary);
@ -837,7 +837,7 @@ static HRESULT test_secondary8(LPGUID lpGuid)
}
wfxe.Format.cbSize = sizeof(wfxe) + 1;
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(((rc==DSERR_CONTROLUNAVAIL || rc==DSERR_INVALIDCALL /* 2003 */ || rc==DSERR_INVALIDPARAM) && !secondary)
|| rc==DS_OK /* driver dependent? */,
"IDirectSound_CreateSoundBuffer() returned: %08x %p\n",
@ -850,7 +850,7 @@ static HRESULT test_secondary8(LPGUID lpGuid)
wfxe.Format.cbSize = sizeof(wfxe) - sizeof(wfx);
++wfxe.Samples.wValidBitsPerSample;
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(rc==DSERR_INVALIDPARAM && !secondary,
"IDirectSound_CreateSoundBuffer() returned: %08x %p\n",
rc, secondary);
@ -862,7 +862,7 @@ static HRESULT test_secondary8(LPGUID lpGuid)
--wfxe.Samples.wValidBitsPerSample;
wfxe.Samples.wValidBitsPerSample = 0;
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(rc==DS_OK && secondary,
"IDirectSound_CreateSoundBuffer() returned: %08x %p\n",
rc, secondary);
@ -873,7 +873,7 @@ static HRESULT test_secondary8(LPGUID lpGuid)
}
wfxe.Samples.wValidBitsPerSample = wfxe.Format.wBitsPerSample;
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(rc==DS_OK && secondary!=NULL,
"IDirectSound_CreateSoundBuffer() failed to create a secondary "
"buffer %08x\n",rc);
@ -1162,7 +1162,7 @@ static void test_COM(void)
ok(hr == S_OK, "QueryInterface for IID_IUnknown failed: %08x\n", hr);
refcount = IUnknown_AddRef(unk);
ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
hr = IDirectSound_QueryInterface(ds8, &IID_IUnknown, (void**)&unk8);
hr = IDirectSound8_QueryInterface(ds8, &IID_IUnknown, (void**)&unk8);
ok(hr == S_OK, "QueryInterface for IID_IUnknown failed: %08x\n", hr);
refcount = IUnknown_AddRef(unk8);
ok(refcount == 4, "refcount == %u, expected 4\n", refcount);
@ -1194,7 +1194,7 @@ static void test_effects(void)
rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel() failed: %08x\n", rc);
if (rc!=DS_OK) {
IDirectSound_Release(dso);
IDirectSound8_Release(dso);
return;
}
@ -1372,7 +1372,7 @@ static void test_effects(void)
IDirectSoundBuffer_Release(primary);
}
while (IDirectSound_Release(dso));
while (IDirectSound8_Release(dso));
}
START_TEST(dsound8)

View File

@ -49,7 +49,7 @@ static void IDirectSoundFullDuplex_test(LPDIRECTSOUNDFULLDUPLEX dsfdo,
rc=IDirectSoundFullDuplex_QueryInterface(dsfdo,&IID_IUnknown,(LPVOID*)&unknown);
ok(rc==DS_OK,"IDirectSoundFullDuplex_QueryInterface(IID_IUnknown) failed: %08x\n", rc);
if (rc==DS_OK) {
ref=IDirectSoundFullDuplex_Release(unknown);
ref = IUnknown_Release(unknown);
ok(ref==0, "IDirectSoundFullDuplex_Release() has %d references, "
"should have 0\n", ref);
}
@ -94,7 +94,7 @@ static void IDirectSoundFullDuplex_test(LPDIRECTSOUNDFULLDUPLEX dsfdo,
"failed: %08x\n",rc);
if (rc==DS_OK) {
ok(dsfdo==dsfd, "different interfaces\n");
ref=IDirectSound8_Release(dsfd);
ref=IDirectSoundFullDuplex_Release(dsfd);
ok(ref==1, "IDirectSoundFullDuplex_Release() has %d references, should have 1\n", ref);
}
@ -319,7 +319,7 @@ static void test_COM(void)
ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
refcount = IDirectSoundFullDuplex_AddRef(dsfd);
ok(refcount == 4, "refcount == %u, expected 4\n", refcount);
hr = IDirectSoundCapture_QueryInterface(ds8, &IID_IUnknown, (void**)&unk8);
hr = IDirectSound8_QueryInterface(ds8, &IID_IUnknown, (void**)&unk8);
ok(hr == S_OK, "QueryInterface for IID_IUnknown failed: %08x\n", hr);
ok(unk == unk8,
"Got different IUnknown when QI'ing IDirectSoundFullDuplex and IDirectSoundCapture\n");