Commit 2e44a3b2 authored by Robert Reif's avatar Robert Reif Committed by Alexandre Julliard

dsound: Fix tests for old versions of windows.

parent 670cf778
...@@ -3,7 +3,7 @@ TOPOBJDIR = ../../.. ...@@ -3,7 +3,7 @@ TOPOBJDIR = ../../..
SRCDIR = @srcdir@ SRCDIR = @srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
TESTDLL = dsound.dll TESTDLL = dsound.dll
IMPORTS = dsound ole32 version user32 kernel32 IMPORTS = ole32 version user32 kernel32
EXTRALIBS = -ldxguid -luuid -ldxerr8 EXTRALIBS = -ldxguid -luuid -ldxerr8
CTESTS = \ CTESTS = \
......
...@@ -710,20 +710,27 @@ START_TEST(capture) ...@@ -710,20 +710,27 @@ START_TEST(capture)
CoInitialize(NULL); CoInitialize(NULL);
hDsound = GetModuleHandleA("dsound.dll"); hDsound = LoadLibrary("dsound.dll");
ok(hDsound != NULL, "dsound.dll not loaded!\n"); if (hDsound)
trace("DLL Version: %s\n", get_file_version("dsound.dll"));
pDirectSoundCaptureCreate=(void*)GetProcAddress(hDsound,"DirectSoundCaptureCreate");
pDirectSoundCaptureEnumerateA=(void*)GetProcAddress(hDsound,"DirectSoundCaptureEnumerateA");
if (!pDirectSoundCaptureCreate || !pDirectSoundCaptureEnumerateA)
{ {
trace("capture test skipped\n"); trace("DLL Version: %s\n", get_file_version("dsound.dll"));
return;
} pDirectSoundCaptureCreate=(void*)GetProcAddress(hDsound,
"DirectSoundCaptureCreate");
pDirectSoundCaptureEnumerateA=(void*)GetProcAddress(hDsound,
"DirectSoundCaptureEnumerateA");
if (pDirectSoundCaptureCreate && pDirectSoundCaptureEnumerateA)
{
IDirectSoundCapture_tests();
capture_tests();
}
else
skip("capture test skipped\n");
IDirectSoundCapture_tests(); FreeLibrary(hDsound);
capture_tests(); }
else
skip("dsound.dll not found!\n");
CoUninitialize(); CoUninitialize();
} }
...@@ -34,6 +34,12 @@ ...@@ -34,6 +34,12 @@
#include "dsound_test.h" #include "dsound_test.h"
#define PI 3.14159265358979323846 #define PI 3.14159265358979323846
static HRESULT (WINAPI *pDirectSoundEnumerateA)(LPDSENUMCALLBACKA,LPVOID)=NULL;
static HRESULT (WINAPI *pDirectSoundCreate)(LPCGUID,LPDIRECTSOUND*,
LPUNKNOWN)=NULL;
char* wave_generate_la(WAVEFORMATEX* wfx, double duration, DWORD* size) char* wave_generate_la(WAVEFORMATEX* wfx, double duration, DWORD* size)
{ {
int i; int i;
...@@ -686,7 +692,7 @@ static HRESULT test_secondary(LPGUID lpGuid, int play, ...@@ -686,7 +692,7 @@ static HRESULT test_secondary(LPGUID lpGuid, int play,
int ref; int ref;
/* Create the DirectSound object */ /* Create the DirectSound object */
rc=DirectSoundCreate(lpGuid,&dso,NULL); rc=pDirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate() failed: %s\n", ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate() failed: %s\n",
DXGetErrorString8(rc)); DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
...@@ -954,7 +960,7 @@ static HRESULT test_for_driver(LPGUID lpGuid) ...@@ -954,7 +960,7 @@ static HRESULT test_for_driver(LPGUID lpGuid)
int ref; int ref;
/* Create the DirectSound object */ /* Create the DirectSound object */
rc=DirectSoundCreate(lpGuid,&dso,NULL); rc=pDirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc)); "DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
...@@ -978,7 +984,7 @@ static HRESULT test_primary(LPGUID lpGuid) ...@@ -978,7 +984,7 @@ static HRESULT test_primary(LPGUID lpGuid)
int ref, i; int ref, i;
/* Create the DirectSound object */ /* Create the DirectSound object */
rc=DirectSoundCreate(lpGuid,&dso,NULL); rc=pDirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate() failed: %s\n", ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate() failed: %s\n",
DXGetErrorString8(rc)); DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
...@@ -1065,7 +1071,7 @@ static HRESULT test_primary_3d(LPGUID lpGuid) ...@@ -1065,7 +1071,7 @@ static HRESULT test_primary_3d(LPGUID lpGuid)
int ref; int ref;
/* Create the DirectSound object */ /* Create the DirectSound object */
rc=DirectSoundCreate(lpGuid,&dso,NULL); rc=pDirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate() failed: %s\n", ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate() failed: %s\n",
DXGetErrorString8(rc)); DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
...@@ -1139,7 +1145,7 @@ static HRESULT test_primary_3d_with_listener(LPGUID lpGuid) ...@@ -1139,7 +1145,7 @@ static HRESULT test_primary_3d_with_listener(LPGUID lpGuid)
int ref; int ref;
/* Create the DirectSound object */ /* Create the DirectSound object */
rc=DirectSoundCreate(lpGuid,&dso,NULL); rc=pDirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate() failed: %s\n", ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate() failed: %s\n",
DXGetErrorString8(rc)); DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
...@@ -1280,17 +1286,32 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription, ...@@ -1280,17 +1286,32 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
static void ds3d_tests(void) static void ds3d_tests(void)
{ {
HRESULT rc; HRESULT rc;
rc=DirectSoundEnumerateA(&dsenum_callback,NULL); rc=pDirectSoundEnumerateA(&dsenum_callback,NULL);
ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %s\n",DXGetErrorString8(rc)); ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %s\n",DXGetErrorString8(rc));
} }
START_TEST(ds3d) START_TEST(ds3d)
{ {
HMODULE hDsound;
CoInitialize(NULL); CoInitialize(NULL);
trace("DLL Version: %s\n", get_file_version("dsound.dll")); hDsound = LoadLibrary("dsound.dll");
if (hDsound)
{
trace("DLL Version: %s\n", get_file_version("dsound.dll"));
ds3d_tests(); pDirectSoundEnumerateA = (void*)GetProcAddress(hDsound,
"DirectSoundEnumerateA");
pDirectSoundCreate = (void*)GetProcAddress(hDsound,
"DirectSoundCreate");
ds3d_tests();
FreeLibrary(hDsound);
}
else
skip("dsound.dll not found!\n");
CoUninitialize(); CoUninitialize();
} }
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "dsound_test.h" #include "dsound_test.h"
static HRESULT (WINAPI *pDirectSoundEnumerateA)(LPDSENUMCALLBACKA,LPVOID)=NULL;
static HRESULT (WINAPI *pDirectSoundCreate8)(LPCGUID,LPDIRECTSOUND8*,LPUNKNOWN)=NULL; static HRESULT (WINAPI *pDirectSoundCreate8)(LPCGUID,LPDIRECTSOUND8*,LPUNKNOWN)=NULL;
typedef struct { typedef struct {
...@@ -635,9 +636,18 @@ static HRESULT test_secondary8(LPGUID lpGuid, int play, ...@@ -635,9 +636,18 @@ static HRESULT test_secondary8(LPGUID lpGuid, int play,
&listener_param); &listener_param);
ok(rc==DS_OK,"IDirectSound3dListener_GetAllParameters() " ok(rc==DS_OK,"IDirectSound3dListener_GetAllParameters() "
"failed: %s\n",DXGetErrorString8(rc)); "failed: %s\n",DXGetErrorString8(rc));
} else {
ok(listener==NULL, "IDirectSoundBuffer_QueryInterface() "
"failed but returned a listener anyway\n");
ok(rc!=DS_OK, "IDirectSoundBuffer_QueryInterface() succeeded "
"but returned a NULL listener\n");
if (listener) {
ref=IDirectSound3DListener_Release(listener);
ok(ref==0,"IDirectSound3dListener_Release() listener has "
"%d references, should have 0\n",ref);
}
goto EXIT2;
} }
else
goto EXIT;
} }
init_format(&wfx,WAVE_FORMAT_PCM,22050,16,2); init_format(&wfx,WAVE_FORMAT_PCM,22050,16,2);
...@@ -795,18 +805,28 @@ static HRESULT test_secondary8(LPGUID lpGuid, int play, ...@@ -795,18 +805,28 @@ static HRESULT test_secondary8(LPGUID lpGuid, int play,
ref); ref);
} }
} }
}
EXIT1: EXIT1:
if (has_listener) { if (has_listener) {
ref=IDirectSound3DListener_Release(listener); ref=IDirectSound3DListener_Release(listener);
ok(ref==0,"IDirectSound3dListener_Release() listener has %d " ok(ref==0,"IDirectSound3dListener_Release() listener has %d "
"references, should have 0\n",ref); "references, should have 0\n",ref);
} else {
ref=IDirectSoundBuffer_Release(primary);
ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, "
"should have 0\n",ref);
}
} else { } else {
ref=IDirectSoundBuffer_Release(primary); ok(primary==NULL,"IDirectSound8_CreateSoundBuffer(primary) failed "
ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, " "but primary created anyway\n");
"should have 0\n",ref); ok(rc!=DS_OK,"IDirectSound8_CreateSoundBuffer(primary) succeeded "
"but primary not created\n");
if (primary) {
ref=IDirectSoundBuffer_Release(primary);
ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, "
"should have 0\n",ref);
}
} }
EXIT2:
/* Set the CooperativeLevel back to normal */ /* Set the CooperativeLevel back to normal */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL); rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
...@@ -1152,7 +1172,7 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription, ...@@ -1152,7 +1172,7 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
static void ds3d8_tests(void) static void ds3d8_tests(void)
{ {
HRESULT rc; HRESULT rc;
rc=DirectSoundEnumerateA(&dsenum_callback,NULL); rc=pDirectSoundEnumerateA(&dsenum_callback,NULL);
ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %s\n",DXGetErrorString8(rc)); ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %s\n",DXGetErrorString8(rc));
} }
...@@ -1162,17 +1182,24 @@ START_TEST(ds3d8) ...@@ -1162,17 +1182,24 @@ START_TEST(ds3d8)
CoInitialize(NULL); CoInitialize(NULL);
hDsound = GetModuleHandleA("dsound.dll"); hDsound = LoadLibrary("dsound.dll");
ok(hDsound != NULL, "dsound.dll not loaded!\n"); if (hDsound)
trace("DLL Version: %s\n", get_file_version("dsound.dll")); {
trace("DLL Version: %s\n", get_file_version("dsound.dll"));
pDirectSoundEnumerateA = (void*)GetProcAddress(hDsound,
"DirectSoundEnumerateA");
pDirectSoundCreate8 = (void*)GetProcAddress(hDsound,
"DirectSoundCreate8");
if (pDirectSoundCreate8)
ds3d8_tests();
else
skip("ds3d8 test skipped\n");
pDirectSoundCreate8 = (void*)GetProcAddress(hDsound, "DirectSoundCreate8"); FreeLibrary(hDsound);
if (!pDirectSoundCreate8) {
trace("ds3d8 test skipped\n");
return;
} }
else
ds3d8_tests(); skip("dsound.dll not found!\n");
CoUninitialize(); CoUninitialize();
} }
...@@ -34,6 +34,10 @@ ...@@ -34,6 +34,10 @@
#include "dsound_test.h" #include "dsound_test.h"
static HRESULT (WINAPI *pDirectSoundEnumerateA)(LPDSENUMCALLBACKA,LPVOID)=NULL;
static HRESULT (WINAPI *pDirectSoundCreate)(LPCGUID,LPDIRECTSOUND*,
LPUNKNOWN)=NULL;
static void IDirectSound_test(LPDIRECTSOUND dso, BOOL initialized, static void IDirectSound_test(LPDIRECTSOUND dso, BOOL initialized,
LPCGUID lpGuid) LPCGUID lpGuid)
{ {
...@@ -227,14 +231,14 @@ static void IDirectSound_tests(void) ...@@ -227,14 +231,14 @@ static void IDirectSound_tests(void)
"should have failed: %s\n",DXGetErrorString8(rc)); "should have failed: %s\n",DXGetErrorString8(rc));
/* try with no device specified */ /* try with no device specified */
rc=DirectSoundCreate(NULL,&dso,NULL); rc=pDirectSoundCreate(NULL,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
"DirectSoundCreate(NULL) failed: %s\n",DXGetErrorString8(rc)); "DirectSoundCreate(NULL) failed: %s\n",DXGetErrorString8(rc));
if (rc==S_OK && dso) if (rc==S_OK && dso)
IDirectSound_test(dso, TRUE, NULL); IDirectSound_test(dso, TRUE, NULL);
/* try with default playback device specified */ /* try with default playback device specified */
rc=DirectSoundCreate(&DSDEVID_DefaultPlayback,&dso,NULL); rc=pDirectSoundCreate(&DSDEVID_DefaultPlayback,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
"DirectSoundCreate(DSDEVID_DefaultPlayback) failed: %s\n", "DirectSoundCreate(DSDEVID_DefaultPlayback) failed: %s\n",
DXGetErrorString8(rc)); DXGetErrorString8(rc));
...@@ -242,7 +246,7 @@ static void IDirectSound_tests(void) ...@@ -242,7 +246,7 @@ static void IDirectSound_tests(void)
IDirectSound_test(dso, TRUE, NULL); IDirectSound_test(dso, TRUE, NULL);
/* try with default voice playback device specified */ /* try with default voice playback device specified */
rc=DirectSoundCreate(&DSDEVID_DefaultVoicePlayback,&dso,NULL); rc=pDirectSoundCreate(&DSDEVID_DefaultVoicePlayback,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
"DirectSoundCreate(DSDEVID_DefaultVoicePlayback) failed: %s\n", "DirectSoundCreate(DSDEVID_DefaultVoicePlayback) failed: %s\n",
DXGetErrorString8(rc)); DXGetErrorString8(rc));
...@@ -250,7 +254,7 @@ static void IDirectSound_tests(void) ...@@ -250,7 +254,7 @@ static void IDirectSound_tests(void)
IDirectSound_test(dso, TRUE, NULL); IDirectSound_test(dso, TRUE, NULL);
/* try with a bad device specified */ /* try with a bad device specified */
rc=DirectSoundCreate(&DSDEVID_DefaultVoiceCapture,&dso,NULL); rc=pDirectSoundCreate(&DSDEVID_DefaultVoiceCapture,&dso,NULL);
ok(rc==DSERR_NODRIVER,"DirectSoundCreate(DSDEVID_DefaultVoiceCapture) " ok(rc==DSERR_NODRIVER,"DirectSoundCreate(DSDEVID_DefaultVoiceCapture) "
"should have failed: %s\n",DXGetErrorString8(rc)); "should have failed: %s\n",DXGetErrorString8(rc));
if (rc==DS_OK && dso) if (rc==DS_OK && dso)
...@@ -264,12 +268,12 @@ static HRESULT test_dsound(LPGUID lpGuid) ...@@ -264,12 +268,12 @@ static HRESULT test_dsound(LPGUID lpGuid)
int ref; int ref;
/* DSOUND: Error: Invalid interface buffer */ /* DSOUND: Error: Invalid interface buffer */
rc=DirectSoundCreate(lpGuid,0,NULL); rc=pDirectSoundCreate(lpGuid,0,NULL);
ok(rc==DSERR_INVALIDPARAM,"DirectSoundCreate() should have returned " ok(rc==DSERR_INVALIDPARAM,"DirectSoundCreate() should have returned "
"DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc)); "DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc));
/* Create the DirectSound object */ /* Create the DirectSound object */
rc=DirectSoundCreate(lpGuid,&dso,NULL); rc=pDirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc)); "DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
...@@ -287,13 +291,13 @@ static HRESULT test_dsound(LPGUID lpGuid) ...@@ -287,13 +291,13 @@ static HRESULT test_dsound(LPGUID lpGuid)
IDirectSound_test(dso, FALSE, lpGuid); IDirectSound_test(dso, FALSE, lpGuid);
/* Create a DirectSound object */ /* Create a DirectSound object */
rc=DirectSoundCreate(lpGuid,&dso,NULL); rc=pDirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK,"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc)); ok(rc==DS_OK,"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc));
if (rc==DS_OK) { if (rc==DS_OK) {
LPDIRECTSOUND dso1=NULL; LPDIRECTSOUND dso1=NULL;
/* Create a second DirectSound object */ /* Create a second DirectSound object */
rc=DirectSoundCreate(lpGuid,&dso1,NULL); rc=pDirectSoundCreate(lpGuid,&dso1,NULL);
ok(rc==DS_OK,"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc)); ok(rc==DS_OK,"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc));
if (rc==DS_OK) { if (rc==DS_OK) {
/* Release the second DirectSound object */ /* Release the second DirectSound object */
...@@ -313,7 +317,7 @@ static HRESULT test_dsound(LPGUID lpGuid) ...@@ -313,7 +317,7 @@ static HRESULT test_dsound(LPGUID lpGuid)
return rc; return rc;
/* Create a DirectSound object */ /* Create a DirectSound object */
rc=DirectSoundCreate(lpGuid,&dso,NULL); rc=pDirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK,"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc)); ok(rc==DS_OK,"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc));
if (rc==DS_OK) { if (rc==DS_OK) {
LPDIRECTSOUNDBUFFER secondary; LPDIRECTSOUNDBUFFER secondary;
...@@ -369,7 +373,7 @@ static HRESULT test_primary(LPGUID lpGuid) ...@@ -369,7 +373,7 @@ static HRESULT test_primary(LPGUID lpGuid)
int ref; int ref;
/* Create the DirectSound object */ /* Create the DirectSound object */
rc=DirectSoundCreate(lpGuid,&dso,NULL); rc=pDirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED, ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED,
"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc)); "DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
...@@ -513,7 +517,7 @@ static HRESULT test_primary_secondary(LPGUID lpGuid) ...@@ -513,7 +517,7 @@ static HRESULT test_primary_secondary(LPGUID lpGuid)
int f,ref; int f,ref;
/* Create the DirectSound object */ /* Create the DirectSound object */
rc=DirectSoundCreate(lpGuid,&dso,NULL); rc=pDirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED, ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED,
"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc)); "DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
...@@ -651,7 +655,7 @@ static HRESULT test_secondary(LPGUID lpGuid) ...@@ -651,7 +655,7 @@ static HRESULT test_secondary(LPGUID lpGuid)
int ref; int ref;
/* Create the DirectSound object */ /* Create the DirectSound object */
rc=DirectSoundCreate(lpGuid,&dso,NULL); rc=pDirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED, ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED,
"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc)); "DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
...@@ -763,7 +767,7 @@ static HRESULT test_block_align(LPGUID lpGuid) ...@@ -763,7 +767,7 @@ static HRESULT test_block_align(LPGUID lpGuid)
int ref; int ref;
/* Create the DirectSound object */ /* Create the DirectSound object */
rc=DirectSoundCreate(lpGuid,&dso,NULL); rc=pDirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED, ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED,
"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc)); "DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
...@@ -823,7 +827,7 @@ static HRESULT test_frequency(LPGUID lpGuid) ...@@ -823,7 +827,7 @@ static HRESULT test_frequency(LPGUID lpGuid)
48000, 96000 }; 48000, 96000 };
/* Create the DirectSound object */ /* Create the DirectSound object */
rc=DirectSoundCreate(lpGuid,&dso,NULL); rc=pDirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED, ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED,
"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc)); "DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
...@@ -939,18 +943,33 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription, ...@@ -939,18 +943,33 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
static void dsound_tests(void) static void dsound_tests(void)
{ {
HRESULT rc; HRESULT rc;
rc=DirectSoundEnumerateA(&dsenum_callback,NULL); rc=pDirectSoundEnumerateA(&dsenum_callback,NULL);
ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %s\n",DXGetErrorString8(rc)); ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %s\n",DXGetErrorString8(rc));
} }
START_TEST(dsound) START_TEST(dsound)
{ {
HMODULE hDsound;
CoInitialize(NULL); CoInitialize(NULL);
trace("DLL Version: %s\n", get_file_version("dsound.dll")); hDsound = LoadLibrary("dsound.dll");
if (hDsound)
{
trace("DLL Version: %s\n", get_file_version("dsound.dll"));
pDirectSoundEnumerateA = (void*)GetProcAddress(hDsound,
"DirectSoundEnumerateA");
pDirectSoundCreate = (void*)GetProcAddress(hDsound,
"DirectSoundCreate");
IDirectSound_tests(); IDirectSound_tests();
dsound_tests(); dsound_tests();
FreeLibrary(hDsound);
}
else
skip("dsound.dll not found!\n");
CoUninitialize(); CoUninitialize();
} }
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include "dsound_test.h" #include "dsound_test.h"
static HRESULT (WINAPI *pDirectSoundEnumerateA)(LPDSENUMCALLBACKA,LPVOID)=NULL;
static HRESULT (WINAPI *pDirectSoundCreate8)(LPCGUID,LPDIRECTSOUND8*,LPUNKNOWN)=NULL; static HRESULT (WINAPI *pDirectSoundCreate8)(LPCGUID,LPDIRECTSOUND8*,LPUNKNOWN)=NULL;
int align(int length, int align) int align(int length, int align)
...@@ -808,7 +809,7 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription, ...@@ -808,7 +809,7 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
static void dsound8_tests(void) static void dsound8_tests(void)
{ {
HRESULT rc; HRESULT rc;
rc=DirectSoundEnumerateA(&dsenum_callback,NULL); rc=pDirectSoundEnumerateA(&dsenum_callback,NULL);
ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %s\n",DXGetErrorString8(rc)); ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %s\n",DXGetErrorString8(rc));
} }
...@@ -852,18 +853,27 @@ START_TEST(dsound8) ...@@ -852,18 +853,27 @@ START_TEST(dsound8)
CoInitialize(NULL); CoInitialize(NULL);
hDsound = GetModuleHandleA("dsound.dll"); hDsound = LoadLibrary("dsound.dll");
ok(hDsound != NULL, "dsound.dll not loaded!\n"); if (hDsound)
trace("DLL Version: %s\n", get_file_version("dsound.dll")); {
trace("DLL Version: %s\n", get_file_version("dsound.dll"));
pDirectSoundEnumerateA = (void*)GetProcAddress(hDsound,
"DirectSoundEnumerateA");
pDirectSoundCreate8 = (void*)GetProcAddress(hDsound,
"DirectSoundCreate8");
if (pDirectSoundCreate8)
{
IDirectSound8_tests();
dsound8_tests();
}
else
skip("dsound8 test skipped\n");
pDirectSoundCreate8 = (void*)GetProcAddress(hDsound, "DirectSoundCreate8"); FreeLibrary(hDsound);
if (!pDirectSoundCreate8) {
trace("dsound8 test skipped\n");
return;
} }
else
IDirectSound8_tests(); skip("dsound.dll not found!\n");
dsound8_tests();
CoUninitialize(); CoUninitialize();
} }
...@@ -237,19 +237,22 @@ START_TEST(duplex) ...@@ -237,19 +237,22 @@ START_TEST(duplex)
CoInitialize(NULL); CoInitialize(NULL);
hDsound = GetModuleHandleA("dsound.dll"); hDsound = LoadLibrary("dsound.dll");
ok(hDsound != NULL, "dsound.dll not loaded!\n"); if (hDsound)
trace("DLL Version: %s\n", get_file_version("dsound.dll"));
pDirectSoundFullDuplexCreate=(void*)GetProcAddress(hDsound,"DirectSoundFullDuplexCreate");
if (!pDirectSoundFullDuplexCreate)
{ {
trace("duplex test skipped\n"); trace("DLL Version: %s\n", get_file_version("dsound.dll"));
goto done;
}
IDirectSoundFullDuplex_tests(); pDirectSoundFullDuplexCreate=(void*)GetProcAddress(hDsound,
"DirectSoundFullDuplexCreate");
if (pDirectSoundFullDuplexCreate)
IDirectSoundFullDuplex_tests();
else
skip("duplex test skipped\n");
FreeLibrary(hDsound);
}
else
skip("dsound.dll not found!\n");
done:
CoUninitialize(); CoUninitialize();
} }
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