[PATCH 3/4] shell32/tests: Add tests for SHGetKnownFolderPath() flags.

Józef Kucia jkucia at codeweavers.com
Fri Jun 22 06:34:02 CDT 2018


Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
 dlls/shell32/tests/shellpath.c | 41 ++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 40 insertions(+), 1 deletion(-)

diff --git a/dlls/shell32/tests/shellpath.c b/dlls/shell32/tests/shellpath.c
index 736cd3b8caa3..a5784237b162 100644
--- a/dlls/shell32/tests/shellpath.c
+++ b/dlls/shell32/tests/shellpath.c
@@ -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);
-- 
2.16.4




More information about the wine-devel mailing list