Commit 6ec5b351 authored by Robert Reif's avatar Robert Reif Committed by Alexandre Julliard

Move initialization to IDirectSound_Initialize.

Fix error paths to handle a failed IDirectSound_Initialize. Add tests for IDirectSound_Initialize.
parent 15934680
......@@ -93,16 +93,21 @@ static void IDirectSound_test(LPDIRECTSOUND dso, BOOL initialized,
"IDirectSound_Initialize() failed: %s\n",DXGetErrorString8(rc));
if (rc==DSERR_NODRIVER) {
trace(" No Driver\n");
return;
goto EXIT;
} else if (rc==E_FAIL) {
trace(" No Device\n");
return;
goto EXIT;
} else if (rc==DSERR_ALLOCATED) {
trace(" Already In Use\n");
return;
goto EXIT;
}
}
rc=IDirectSound_Initialize(dso,lpGuid);
ok(rc==DSERR_ALREADYINITIALIZED, "IDirectSound_Initialize() "
"should have returned DSERR_ALREADYINITIALIZED: %s\n",
DXGetErrorString8(rc));
/* DSOUND: Error: Invalid caps buffer */
rc=IDirectSound_GetCaps(dso,0);
ok(rc==DSERR_INVALIDPARAM,"IDirectSound_GetCaps(NULL) "
......@@ -158,6 +163,7 @@ static void IDirectSound_test(LPDIRECTSOUND dso, BOOL initialized,
speaker_config,new_speaker_config);
}
EXIT:
ref=IDirectSound_Release(dso);
ok(ref==0,"IDirectSound_Release() has %d references, should have 0\n",ref);
}
......@@ -238,6 +244,8 @@ static void IDirectSound_tests()
rc=DirectSoundCreate(&DSDEVID_DefaultVoiceCapture,&dso,NULL);
ok(rc==DSERR_NODRIVER,"DirectSoundCreate(DSDEVID_DefaultVoiceCapture) "
"should have failed: %s\n",DXGetErrorString8(rc));
if (rc==DS_OK && dso)
IDirectSound_Release(dso);
}
static HRESULT test_dsound(LPGUID lpGuid)
......
......@@ -108,16 +108,21 @@ static void IDirectSound8_test(LPDIRECTSOUND8 dso, BOOL initialized,
"IDirectSound8_Initialize() failed: %s\n",DXGetErrorString8(rc));
if (rc==DSERR_NODRIVER) {
trace(" No Driver\n");
return;
goto EXIT;
} else if (rc==E_FAIL) {
trace(" No Device\n");
return;
goto EXIT;
} else if (rc==DSERR_ALLOCATED) {
trace(" Already In Use\n");
return;
goto EXIT;
}
}
rc=IDirectSound8_Initialize(dso,lpGuid);
ok(rc==DSERR_ALREADYINITIALIZED, "IDirectSound8_Initialize() "
"should have returned DSERR_ALREADYINITIALIZED: %s\n",
DXGetErrorString8(rc));
/* DSOUND: Error: Invalid caps buffer */
rc=IDirectSound8_GetCaps(dso,0);
ok(rc==DSERR_INVALIDPARAM,"IDirectSound8_GetCaps() "
......@@ -177,6 +182,7 @@ static void IDirectSound8_test(LPDIRECTSOUND8 dso, BOOL initialized,
ok(rc==DS_OK||rc==E_NOTIMPL,"IDirectSound8_VerifyCertification() failed: %s\n",
DXGetErrorString8(rc));
EXIT:
ref=IDirectSound8_Release(dso);
ok(ref==0,"IDirectSound8_Release() has %d references, should have 0\n",ref);
}
......
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