Module: wine Branch: master Commit: d60aead138869d14ae2a72750df33bc9620cfb9f URL: http://source.winehq.org/git/wine.git/?a=commit;h=d60aead138869d14ae2a72750d...
Author: Michael Stefaniuc mstefani@winehq.org Date: Tue Jul 25 20:57:19 2017 +0200
dmloader/tests: Add more SetSearchDirectory() tests.
Signed-off-by: Michael Stefaniuc mstefani@winehq.org Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/dmloader/tests/loader.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
diff --git a/dlls/dmloader/tests/loader.c b/dlls/dmloader/tests/loader.c index b24b2e2..136b054 100644 --- a/dlls/dmloader/tests/loader.c +++ b/dlls/dmloader/tests/loader.c @@ -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)