From 49d309804d3a0beebb178793a04f99f771d2bf53 Mon Sep 17 00:00:00 2001 From: Jeff Zaroyko Date: Wed, 10 Sep 2008 04:44:46 +1000 Subject: [PATCH] dsound: Fix a few failing tests and a crash on 2008 (revised). --- dlls/dsound/tests/dsound.c | 25 +++++++++++++++++++++---- dlls/dsound/tests/dsound8.c | 27 +++++++++++++++++++++++---- 2 files changed, 44 insertions(+), 8 deletions(-) diff --git a/dlls/dsound/tests/dsound.c b/dlls/dsound/tests/dsound.c index d6c0f29f211..9dc8f21c3e5 100644 --- a/dlls/dsound/tests/dsound.c +++ b/dlls/dsound/tests/dsound.c @@ -716,8 +716,9 @@ static HRESULT test_secondary(LPGUID lpGuid) if (gotdx8 || wfx.wBitsPerSample <= 16) { if (wfx.wBitsPerSample > 16) - ok((rc == DSERR_CONTROLUNAVAIL || rc == DSERR_INVALIDCALL) && - !secondary, "IDirectSound_CreateSoundBuffer() " + ok(((rc == DSERR_CONTROLUNAVAIL || rc == DSERR_INVALIDCALL || rc == DSERR_INVALIDPARAM /* 2003 */) && !secondary) + || rc == DS_OK, /* driver dependent? */ + "IDirectSound_CreateSoundBuffer() " "should have returned (DSERR_CONTROLUNAVAIL or DSERR_INVALIDCALL) " "and NULL, returned: %08x %p\n", rc, secondary); else @@ -750,20 +751,27 @@ static HRESULT test_secondary(LPGUID lpGuid) wfxe.dwChannelMask = (wfx.nChannels == 1 ? KSAUDIO_SPEAKER_MONO : KSAUDIO_SPEAKER_STEREO); rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL); - ok(rc==DSERR_INVALIDPARAM && !secondary, + ok((rc==DSERR_INVALIDPARAM || rc==DSERR_INVALIDCALL /* 2003 */) && !secondary, "IDirectSound_CreateSoundBuffer() returned: %08x %p\n", rc, secondary); if (secondary) + { IDirectSoundBuffer_Release(secondary); + secondary=NULL; + } wfxe.Format.cbSize = sizeof(wfxe) - sizeof(wfx) + 1; rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL); - ok(rc==DSERR_CONTROLUNAVAIL && !secondary, + ok(((rc==DSERR_CONTROLUNAVAIL || rc==DSERR_INVALIDCALL) && !secondary) + || rc==DS_OK, /* 2003 / 2008 */ "IDirectSound_CreateSoundBuffer() returned: %08x %p\n", rc, secondary); if (secondary) + { IDirectSoundBuffer_Release(secondary); + secondary=NULL; + } wfxe.Format.cbSize = sizeof(wfxe) - sizeof(wfx); wfxe.SubFormat = GUID_NULL; @@ -772,7 +780,10 @@ static HRESULT test_secondary(LPGUID lpGuid) "IDirectSound_CreateSoundBuffer() returned: %08x %p\n", rc, secondary); if (secondary) + { IDirectSoundBuffer_Release(secondary); + secondary=NULL; + } wfxe.SubFormat = KSDATAFORMAT_SUBTYPE_PCM; ++wfxe.Samples.wValidBitsPerSample; @@ -781,7 +792,10 @@ static HRESULT test_secondary(LPGUID lpGuid) "IDirectSound_CreateSoundBuffer() returned: %08x %p\n", rc, secondary); if (secondary) + { IDirectSoundBuffer_Release(secondary); + secondary=NULL; + } --wfxe.Samples.wValidBitsPerSample; wfxe.Samples.wValidBitsPerSample = 0; @@ -790,7 +804,10 @@ static HRESULT test_secondary(LPGUID lpGuid) "IDirectSound_CreateSoundBuffer() returned: %08x %p\n", rc, secondary); if (secondary) + { IDirectSoundBuffer_Release(secondary); + secondary=NULL; + } wfxe.Samples.wValidBitsPerSample = wfxe.Format.wBitsPerSample; rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL); diff --git a/dlls/dsound/tests/dsound8.c b/dlls/dsound/tests/dsound8.c index 8edb9b482d4..2e02a92eb36 100644 --- a/dlls/dsound/tests/dsound8.c +++ b/dlls/dsound/tests/dsound8.c @@ -574,7 +574,9 @@ static HRESULT test_primary_secondary8(LPGUID lpGuid) formats[f][2]); wfx2=wfx; rc=IDirectSoundBuffer_SetFormat(primary,&wfx); - ok(rc==DS_OK,"IDirectSoundBuffer_SetFormat(%s) failed: %08x\n", + ok(rc==DS_OK + || rc==DSERR_INVALIDPARAM, /* 2003 */ + "IDirectSoundBuffer_SetFormat(%s) failed: %08x\n", format_string(&wfx), rc); /* There is no guarantee that SetFormat will actually change the @@ -723,8 +725,9 @@ static HRESULT test_secondary8(LPGUID lpGuid) bufdesc.lpwfxFormat=&wfx; rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL); if (wfx.wBitsPerSample != 8 && wfx.wBitsPerSample != 16) - ok((rc == DSERR_CONTROLUNAVAIL || rc == DSERR_INVALIDCALL) && - !secondary, "IDirectSound_CreateSoundBuffer() " + ok(((rc == DSERR_CONTROLUNAVAIL || rc == DSERR_INVALIDCALL || rc == DSERR_INVALIDPARAM /* 2003 */) && !secondary) + || rc == DS_OK, /* driver dependent? */ + "IDirectSound_CreateSoundBuffer() " "should have returned (DSERR_CONTROLUNAVAIL or DSERR_INVALIDCALL) " "and NULL, returned: %08x %p\n", rc, secondary); else @@ -748,16 +751,23 @@ static HRESULT test_secondary8(LPGUID lpGuid) "IDirectSound_CreateSoundBuffer() returned: %08x %p\n", rc, secondary); if (secondary) + { IDirectSoundBuffer_Release(secondary); + secondary=NULL; + } wfxe.Format.cbSize = sizeof(wfxe) - sizeof(wfx) + 1; rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL); - ok(rc==DSERR_CONTROLUNAVAIL && !secondary, + ok(((rc==DSERR_CONTROLUNAVAIL || DSERR_INVALIDCALL /* 2003 */) && !secondary) + || rc==DS_OK /* driver dependent? */, "IDirectSound_CreateSoundBuffer() returned: %08x %p\n", rc, secondary); if (secondary) + { IDirectSoundBuffer_Release(secondary); + secondary=NULL; + } wfxe.Format.cbSize = sizeof(wfxe) - sizeof(wfx); wfxe.SubFormat = GUID_NULL; @@ -766,7 +776,10 @@ static HRESULT test_secondary8(LPGUID lpGuid) "IDirectSound_CreateSoundBuffer() returned: %08x %p\n", rc, secondary); if (secondary) + { IDirectSoundBuffer_Release(secondary); + secondary=NULL; + } wfxe.SubFormat = KSDATAFORMAT_SUBTYPE_PCM; ++wfxe.Samples.wValidBitsPerSample; @@ -775,7 +788,10 @@ static HRESULT test_secondary8(LPGUID lpGuid) "IDirectSound_CreateSoundBuffer() returned: %08x %p\n", rc, secondary); if (secondary) + { IDirectSoundBuffer_Release(secondary); + secondary=NULL; + } --wfxe.Samples.wValidBitsPerSample; wfxe.Samples.wValidBitsPerSample = 0; @@ -784,7 +800,10 @@ static HRESULT test_secondary8(LPGUID lpGuid) "IDirectSound_CreateSoundBuffer() returned: %08x %p\n", rc, secondary); if (secondary) + { IDirectSoundBuffer_Release(secondary); + secondary=NULL; + } wfxe.Samples.wValidBitsPerSample = wfxe.Format.wBitsPerSample; rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);