shell32/tests: Add tests for SHGetKnownFolderPath() flags.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2018-06-22 13:34:02 +02:00 committed by Alexandre Julliard
parent bd459ad015
commit 0304a312ed
1 changed files with 40 additions and 1 deletions

View File

@ -1842,8 +1842,9 @@ static void test_NonExistentPath(void)
static void test_SHGetFolderPathEx(void)
{
WCHAR buffer[MAX_PATH], *path, *path2;
unsigned int i;
HRESULT hr;
WCHAR buffer[MAX_PATH], *path;
DWORD len;
if (!pSHGetKnownFolderPath || !pSHGetFolderPathEx)
@ -1868,6 +1869,44 @@ if (0) { /* crashes */
ok(path != NULL, "expected path != NULL\n");
CoTaskMemFree(path);
for (i = 0; i < ARRAY_SIZE(known_folders); ++i)
{
const KNOWNFOLDERID *folder_id = known_folders[i].folderId;
if (!folder_id)
continue;
path = NULL;
hr = pSHGetKnownFolderPath(folder_id, KF_FLAG_DEFAULT, NULL, &path);
if (FAILED(hr))
continue;
ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);
ok(path != NULL, "expected path != NULL\n");
path2 = NULL;
hr = pSHGetKnownFolderPath(folder_id, KF_FLAG_SIMPLE_IDLIST, NULL, &path2);
ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);
ok(path != NULL, "expected path != NULL\n");
ok(!lstrcmpiW(path, path2), "expected equal paths: %s, %s\n", wine_dbgstr_w(path), wine_dbgstr_w(path2));
CoTaskMemFree(path2);
path2 = NULL;
hr = pSHGetKnownFolderPath(folder_id, KF_FLAG_DONT_UNEXPAND, NULL, &path2);
ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);
ok(path2 != NULL, "expected path != NULL\n");
ok(!lstrcmpiW(path, path2), "expected equal paths: %s, %s\n", wine_dbgstr_w(path), wine_dbgstr_w(path2));
CoTaskMemFree(path2);
path2 = NULL;
hr = pSHGetKnownFolderPath(folder_id, KF_FLAG_SIMPLE_IDLIST | KF_FLAG_DONT_UNEXPAND, NULL, &path2);
ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);
ok(path2 != NULL, "expected path != NULL\n");
ok(!lstrcmpiW(path, path2), "expected equal paths: %s, %s\n", wine_dbgstr_w(path), wine_dbgstr_w(path2));
CoTaskMemFree(path2);
CoTaskMemFree(path);
}
path = NULL;
hr = pSHGetKnownFolderPath(&FOLDERID_Desktop, 0, NULL, &path);
ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);