SHELL32/tests: add a test for IShellFolder_ParseDisplayName

Saulius Krasuckas saulius2 at ar.fi.lt
Thu Jun 30 03:56:35 CDT 2005


ChangeLog:
	Saulius Krasuckas <saulius.krasuckas at ieee.org>
	Added test for IShellFolder_ParseDisplayName.


--- dlls/shell32/tests/shlfolder.c.cvs  2005-06-30 11:38:48.000000000 +0300
+++ dlls/shell32/tests/shlfolder.c      2005-06-30 11:52:11.000000000 +0300
@@ -55,6 +55,37 @@ static void init_function_pointers(void)
     }
 }
 
+static void test_ParseDisplayName(void)
+{
+    HRESULT hr;
+    IShellFolder *IDesktopFolder;
+    static const char *cNonExistDir1A = "c:\\nonexist_subdir";
+    static const char *cNonExistDir2A = "c:\\\\nonexist_subdir";
+    DWORD res;
+    WCHAR cTestDirW [MAX_PATH] = {0};
+    ITEMIDLIST *newPIDL;
+
+    hr = SHGetDesktopFolder(&IDesktopFolder);
+    if(hr != S_OK) return;
+
+    res = GetFileAttributesA(cNonExistDir1A);
+    if(res != INVALID_FILE_ATTRIBUTES) return;
+
+    MultiByteToWideChar(CP_ACP, 0, cNonExistDir1A, -1, cTestDirW, MAX_PATH);
+    hr = IShellFolder_ParseDisplayName(IDesktopFolder, 
+        NULL, NULL, cTestDirW, NULL, &newPIDL, 0);
+    ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), 
+        "ParseDisplayName returned %08lx, expected 80070002\n", hr);
+
+    res = GetFileAttributesA(cNonExistDir2A);
+    if(res != INVALID_FILE_ATTRIBUTES) return;
+
+    MultiByteToWideChar(CP_ACP, 0, cNonExistDir2A, -1, cTestDirW, MAX_PATH);
+    hr = IShellFolder_ParseDisplayName(IDesktopFolder, 
+        NULL, NULL, cTestDirW, NULL, &newPIDL, 0);
+    ok(hr == E_FAIL, "ParseDisplayName returned %08lx, expected E_FAIL\n", hr);
+}
+
 /* creates a file with the specified name for tests */
 static void CreateTestFile(const CHAR *name)
 {
@@ -620,6 +651,7 @@ START_TEST(shlfolder)
        CO_E_NOTINITIALIZED for malformed directory names on win2k. */
     OleInitialize(NULL);
 
+    test_ParseDisplayName();
     test_BindToObject();
     test_EnumObjects_and_CompareIDs();
     test_GetDisplayName();




More information about the wine-patches mailing list