dsound tests no driver fix (revised)
Robert Reif
reif at earthlink.net
Tue Oct 19 07:03:05 CDT 2004
Robert Reif wrote:
> Don't consider failure with DSERR_NODRIVER a test failure.
Inform user that there is no driver.
-------------- next part --------------
diff -u wine.cvs/dlls/dsound/tests/capture.c wine/dlls/dsound/tests/capture.c
--- wine.cvs/dlls/dsound/tests/capture.c 2004-09-14 21:15:48.000000000 -0400
+++ wine/dlls/dsound/tests/capture.c 2004-10-19 07:41:46.000000000 -0400
@@ -321,8 +321,11 @@
rc=pDirectSoundCaptureCreate(lpGuid,&dsco,NULL);
ok((rc==DS_OK)||(rc==DSERR_NODRIVER),"DirectSoundCaptureCreate() failed: "
"%s\n",DXGetErrorString8(rc));
- if (rc!=DS_OK)
+ if (rc!=DS_OK) {
+ if (rc==DSERR_NODRIVER)
+ trace(" No Driver\n");
goto EXIT;
+ }
/* Private dsound.dll: Error: Invalid caps buffer */
rc=IDirectSoundCapture_GetCaps(dsco,NULL);
diff -u wine.cvs/dlls/dsound/tests/ds3d8.c wine/dlls/dsound/tests/ds3d8.c
--- wine.cvs/dlls/dsound/tests/ds3d8.c 2004-10-19 07:14:06.000000000 -0400
+++ wine/dlls/dsound/tests/ds3d8.c 2004-10-19 08:00:54.000000000 -0400
@@ -781,6 +781,27 @@
return rc;
}
+static HRESULT test_for_driver8(LPGUID lpGuid)
+{
+ HRESULT rc;
+ LPDIRECTSOUND8 dso=NULL;
+ int ref;
+
+ /* Create the DirectSound object */
+ rc=DirectSoundCreate8(lpGuid,&dso,NULL);
+ ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate8() failed: %s\n",
+ DXGetErrorString8(rc));
+ if (rc!=DS_OK)
+ return rc;
+
+ ref=IDirectSound8_Release(dso);
+ ok(ref==0,"IDirectSound8_Release() has %d references, should have 0\n",ref);
+ if (ref!=0)
+ return DSERR_GENERIC;
+
+ return rc;
+}
+
static HRESULT test_primary8(LPGUID lpGuid)
{
HRESULT rc;
@@ -1043,8 +1064,15 @@
static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
LPCSTR lpcstrModule, LPVOID lpContext)
{
+ HRESULT rc;
trace("*** Testing %s - %s ***\n",lpcstrDescription,lpcstrModule);
+ rc = test_for_driver8(lpGuid);
+ if (rc == DSERR_NODRIVER) {
+ trace(" No Driver\n");
+ return 1;
+ }
+
trace(" Testing the primary buffer\n");
test_primary8(lpGuid);
diff -u wine.cvs/dlls/dsound/tests/ds3d.c wine/dlls/dsound/tests/ds3d.c
--- wine.cvs/dlls/dsound/tests/ds3d.c 2004-10-19 07:14:06.000000000 -0400
+++ wine/dlls/dsound/tests/ds3d.c 2004-10-19 07:52:20.000000000 -0400
@@ -867,6 +867,27 @@
return rc;
}
+static HRESULT test_for_driver(LPGUID lpGuid)
+{
+ HRESULT rc;
+ LPDIRECTSOUND dso=NULL;
+ int ref;
+
+ /* Create the DirectSound object */
+ rc=DirectSoundCreate(lpGuid,&dso,NULL);
+ ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate() failed: %s\n",
+ DXGetErrorString8(rc));
+ if (rc!=DS_OK)
+ return rc;
+
+ ref=IDirectSound_Release(dso);
+ ok(ref==0,"IDirectSound_Release() has %d references, should have 0\n",ref);
+ if (ref!=0)
+ return DSERR_GENERIC;
+
+ return rc;
+}
+
static HRESULT test_primary(LPGUID lpGuid)
{
HRESULT rc;
@@ -1128,8 +1149,15 @@
static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
LPCSTR lpcstrModule, LPVOID lpContext)
{
+ HRESULT rc;
trace("*** Testing %s - %s ***\n",lpcstrDescription,lpcstrModule);
+ rc = test_for_driver(lpGuid);
+ if (rc == DSERR_NODRIVER) {
+ trace(" No Driver\n");
+ return 1;
+ }
+
trace(" Testing the primary buffer\n");
test_primary(lpGuid);
diff -u wine.cvs/dlls/dsound/tests/dsound8.c wine/dlls/dsound/tests/dsound8.c
--- wine.cvs/dlls/dsound/tests/dsound8.c 2004-10-19 07:14:06.000000000 -0400
+++ wine/dlls/dsound/tests/dsound8.c 2004-10-19 07:47:21.000000000 -0400
@@ -222,20 +222,23 @@
/* try with no device specified */
rc=pDirectSoundCreate8(NULL,&dso,NULL);
- ok(rc==S_OK,"DirectSoundCreate8() failed: %s\n",DXGetErrorString8(rc));
- if (dso)
+ ok(rc==S_OK||rc==DSERR_NODRIVER,"DirectSoundCreate8() failed: %s\n",
+ DXGetErrorString8(rc));
+ if (rc==DS_OK && dso)
IDirectSound8_test(dso, TRUE, NULL);
/* try with default playback device specified */
rc=pDirectSoundCreate8(&DSDEVID_DefaultPlayback,&dso,NULL);
- ok(rc==S_OK,"DirectSoundCreate8() failed: %s\n",DXGetErrorString8(rc));
- if (dso)
+ ok(rc==S_OK||rc==DSERR_NODRIVER,"DirectSoundCreate8() failed: %s\n",
+ DXGetErrorString8(rc));
+ if (rc==DS_OK && dso)
IDirectSound8_test(dso, TRUE, NULL);
/* try with default voice playback device specified */
rc=pDirectSoundCreate8(&DSDEVID_DefaultVoicePlayback,&dso,NULL);
- ok(rc==S_OK,"DirectSoundCreate8() failed: %s\n",DXGetErrorString8(rc));
- if (dso)
+ ok(rc==S_OK||rc==DSERR_NODRIVER,"DirectSoundCreate8() failed: %s\n",
+ DXGetErrorString8(rc));
+ if (rc==DS_OK && dso)
IDirectSound8_test(dso, TRUE, NULL);
/* try with a bad device specified */
@@ -740,11 +743,16 @@
static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
LPCSTR lpcstrModule, LPVOID lpContext)
{
+ HRESULT rc;
trace("*** Testing %s - %s ***\n",lpcstrDescription,lpcstrModule);
- test_dsound8(lpGuid);
- test_primary8(lpGuid);
- test_primary_secondary8(lpGuid);
- test_secondary8(lpGuid);
+ rc = test_dsound8(lpGuid);
+ if (rc == DSERR_NODRIVER)
+ trace(" No Driver\n");
+ else {
+ test_primary8(lpGuid);
+ test_primary_secondary8(lpGuid);
+ test_secondary8(lpGuid);
+ }
return 1;
}
diff -u wine.cvs/dlls/dsound/tests/dsound.c wine/dlls/dsound/tests/dsound.c
--- wine.cvs/dlls/dsound/tests/dsound.c 2004-10-19 07:14:06.000000000 -0400
+++ wine/dlls/dsound/tests/dsound.c 2004-10-19 07:46:13.000000000 -0400
@@ -210,22 +210,24 @@
/* try with no device specified */
rc=DirectSoundCreate(NULL,&dso,NULL);
- ok(rc==S_OK,"DirectSoundCreate(NULL) failed: %s\n",DXGetErrorString8(rc));
- if (dso)
+ ok(rc==S_OK||rc==DSERR_NODRIVER,"DirectSoundCreate(NULL) failed: %s\n",
+ DXGetErrorString8(rc));
+ if (rc==S_OK && dso)
IDirectSound_test(dso, TRUE, NULL);
/* try with default playback device specified */
rc=DirectSoundCreate(&DSDEVID_DefaultPlayback,&dso,NULL);
- ok(rc==S_OK,"DirectSoundCreate(DSDEVID_DefaultPlayback) failed: %s\n",
- DXGetErrorString8(rc));
- if (dso)
+ ok(rc==S_OK||rc==DSERR_NODRIVER,"DirectSoundCreate(DSDEVID_DefaultPlayback)"
+ " failed: %s\n", DXGetErrorString8(rc));
+ if (rc==DS_OK && dso)
IDirectSound_test(dso, TRUE, NULL);
/* try with default voice playback device specified */
rc=DirectSoundCreate(&DSDEVID_DefaultVoicePlayback,&dso,NULL);
- ok(rc==S_OK,"DirectSoundCreate(DSDEVID_DefaultVoicePlayback) failed: %s\n",
+ ok(rc==S_OK||rc==DSERR_NODRIVER,
+ "DirectSoundCreate(DSDEVID_DefaultVoicePlayback) failed: %s\n",
DXGetErrorString8(rc));
- if (dso)
+ if (rc==DS_OK && dso)
IDirectSound_test(dso, TRUE, NULL);
/* try with a bad device specified */
@@ -719,11 +721,16 @@
static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
LPCSTR lpcstrModule, LPVOID lpContext)
{
+ HRESULT rc;
trace("*** Testing %s - %s ***\n",lpcstrDescription,lpcstrModule);
- test_dsound(lpGuid);
- test_primary(lpGuid);
- test_primary_secondary(lpGuid);
- test_secondary(lpGuid);
+ rc = test_dsound(lpGuid);
+ if (rc == DSERR_NODRIVER)
+ trace(" No Driver\n");
+ else {
+ test_primary(lpGuid);
+ test_primary_secondary(lpGuid);
+ test_secondary(lpGuid);
+ }
return 1;
}
diff -u wine.cvs/dlls/dsound/tests/propset.c wine/dlls/dsound/tests/propset.c
--- wine.cvs/dlls/dsound/tests/propset.c 2004-10-19 07:14:06.000000000 -0400
+++ wine/dlls/dsound/tests/propset.c 2004-10-19 07:55:35.000000000 -0400
@@ -270,8 +270,11 @@
rc=DirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate() failed: %s\n",
DXGetErrorString8(rc));
- if (rc!=DS_OK)
+ if (rc!=DS_OK) {
+ if (rc==DSERR_NODRIVER)
+ trace(" No Driver\n");
goto EXIT;
+ }
/* We must call SetCooperativeLevel before calling CreateSoundBuffer */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
More information about the wine-patches
mailing list