dmloader/tests: Add more SetSearchDirectory() tests.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Michael Stefaniuc 2017-07-25 20:57:19 +02:00 committed by Alexandre Julliard
parent 2e3a8a6fb8
commit d60aead138
1 changed files with 26 additions and 0 deletions

View File

@ -49,6 +49,7 @@ static void test_directory(void)
HRESULT hr;
WCHAR con[] = {'c', 'o', 'n', 0};
WCHAR path[MAX_PATH];
WCHAR empty[] = {0};
WCHAR invalid_path[] = {'/', 'i', 'n', 'v', 'a', 'l', 'i', 'd', ' ', 'p', 'a', 't', 'h', 0};
hr = CoCreateInstance(&CLSID_DirectMusicLoader, NULL, CLSCTX_INPROC, &IID_IDirectMusicLoader8,
@ -60,9 +61,16 @@ static void test_directory(void)
ok(hr == S_FALSE, "ScanDirectory for \"con\" files failed with %#x\n", hr);
/* SetSearchDirectory with invalid path */
hr = IDirectMusicLoader_SetSearchDirectory(loader, &GUID_DirectMusicAllTypes, NULL, 0);
ok(hr == E_POINTER, "SetSearchDirectory failed with %#x\n", hr);
hr = IDirectMusicLoader_SetSearchDirectory(loader, &GUID_DirectMusicAllTypes, invalid_path, 0);
ok(hr == DMUS_E_LOADER_BADPATH, "SetSearchDirectory failed with %#x\n", hr);
/* SetSearchDirectory with the current directory */
GetCurrentDirectoryW(ARRAY_SIZE(path), path);
hr = IDirectMusicLoader_SetSearchDirectory(loader, &GUID_DirectMusicAllTypes, path, 0);
ok(hr == S_OK, "SetSearchDirectory failed with %#x\n", hr);
/* Two consecutive SetSearchDirectory with the same path */
GetTempPathW(ARRAY_SIZE(path), path);
hr = IDirectMusicLoader_SetSearchDirectory(loader, &GUID_DirectMusicAllTypes, path, 0);
@ -74,11 +82,29 @@ static void test_directory(void)
hr = IDirectMusicLoader_SetSearchDirectory(loader, &CLSID_DirectSoundWave, path, 0);
ok(hr == S_FALSE, "Second SetSearchDirectory failed with %#x\n", hr);
/* Invalid GUIDs */
if (0)
IDirectMusicLoader_SetSearchDirectory(loader, NULL, path, 0); /* Crashes on Windows */
hr = IDirectMusicLoader_SetSearchDirectory(loader, &IID_IDirectMusicLoader8, path, 0);
todo_wine ok(hr == S_OK, "SetSearchDirectory failed with %#x\n", hr);
/* NULL extension is not an error */
hr = IDirectMusicLoader_ScanDirectory(loader, &CLSID_DirectSoundWave, NULL, NULL);
ok(hr == S_FALSE, "ScanDirectory for \"wav\" files failed, received %#x\n", hr);
IDirectMusicLoader_Release(loader);
/* An empty path is a valid path */
hr = CoCreateInstance(&CLSID_DirectMusicLoader, NULL, CLSCTX_INPROC, &IID_IDirectMusicLoader8,
(void**)&loader);
ok(hr == S_OK, "Couldn't create Loader %#x\n", hr);
hr = IDirectMusicLoader_SetSearchDirectory(loader, &GUID_DirectMusicAllTypes, empty, 0);
todo_wine ok(hr == S_OK, "SetSearchDirectory failed with %#x\n", hr);
hr = IDirectMusicLoader_SetSearchDirectory(loader, &GUID_DirectMusicAllTypes, empty, 0);
ok(hr == S_FALSE, "SetSearchDirectory failed with %#x\n", hr);
hr = IDirectMusicLoader_ScanDirectory(loader, &CLSID_DirectMusicContainer, con, NULL);
ok(hr == S_FALSE, "ScanDirectory for \"con\" files failed with %#x\n", hr);
IDirectMusicLoader_Release(loader);
}
static void test_release_object(void)