Author: tfaber
Date: Sat Apr 30 15:06:57 2016
New Revision: 71216
URL:
http://svn.reactos.org/svn/reactos?rev=71216&view=rev
Log:
[SHELL32_APITEST]
- Add a test for SHParseDisplayName
CORE-10434
Added:
trunk/rostests/apitests/shell32/SHParseDisplayName.cpp (with props)
Modified:
trunk/rostests/apitests/shell32/CMakeLists.txt
trunk/rostests/apitests/shell32/testlist.c
Modified: trunk/rostests/apitests/shell32/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/shell32/CMakeLis…
==============================================================================
--- trunk/rostests/apitests/shell32/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/rostests/apitests/shell32/CMakeLists.txt [iso-8859-1] Sat Apr 30 15:06:57 2016
@@ -8,6 +8,7 @@
CShellDesktop.cpp
menu.cpp
shelltest.cpp
+ SHParseDisplayName.cpp
testlist.c)
target_link_libraries(shell32_apitest wine uuid ${PSEH_LIB})
set_module_type(shell32_apitest win32cui)
Added: trunk/rostests/apitests/shell32/SHParseDisplayName.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/shell32/SHParseD…
==============================================================================
--- trunk/rostests/apitests/shell32/SHParseDisplayName.cpp (added)
+++ trunk/rostests/apitests/shell32/SHParseDisplayName.cpp [iso-8859-1] Sat Apr 30
15:06:57 2016
@@ -0,0 +1,159 @@
+/*
+ * PROJECT: ReactOS API tests
+ * LICENSE: LGPLv2.1+ - See COPYING.LIB in the top level directory
+ * PURPOSE: Test for SHParseDisplayName
+ * PROGRAMMERS: Thomas Faber <thomas.faber(a)reactos.org>
+ */
+
+#include "shelltest.h"
+#include "apitest.h"
+#include <ndk/umtypes.h>
+#include <strsafe.h>
+
+START_TEST(SHParseDisplayName)
+{
+ HRESULT hr;
+ PIDLIST_ABSOLUTE pidl;
+ WCHAR systemDir[MAX_PATH];
+ WCHAR path[MAX_PATH];
+ WCHAR resultPath[MAX_PATH];
+ BOOL winv6 = LOBYTE(LOWORD(GetVersion())) >= 6;
+
+ CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
+
+ GetSystemDirectoryW(systemDir, RTL_NUMBER_OF(systemDir));
+ SetCurrentDirectoryW(systemDir);
+
+ /* The code below relies on these properties */
+ ok(systemDir[1] == L':', "systemDir = %ls\n", systemDir);
+ ok(systemDir[2] == L'\\', "systemDir = %ls\n", systemDir);
+ ok(systemDir[wcslen(systemDir) - 1] != L'\\', "systemDir = %ls\n",
systemDir);
+ ok(wcschr(systemDir + 3, L'\\') != NULL, "systemDir = %ls\n",
systemDir);
+
+ /* NULL */
+ pidl = NULL;
+ StartSeh()
+ hr = SHParseDisplayName(NULL, NULL, &pidl, 0, NULL);
+ EndSeh(STATUS_SUCCESS);
+ ok(hr == E_OUTOFMEMORY || hr == E_INVALIDARG, "hr = %lx\n", hr);
+ ok(pidl == NULL, "pidl = %p\n", pidl);
+ if (pidl) CoTaskMemFree(pidl);
+
+ /* empty string */
+ pidl = NULL;
+ hr = SHParseDisplayName(L"", NULL, &pidl, 0, NULL);
+ ok(hr == S_OK, "hr = %lx\n", hr);
+ ok(pidl != NULL, "pidl = %p\n", pidl);
+ resultPath[0] = UNICODE_NULL;
+ SHGetPathFromIDListW(pidl, resultPath);
+ ok_wstr(resultPath, L"");
+ if (pidl) CoTaskMemFree(pidl);
+
+ /* C: */
+ path[0] = systemDir[0];
+ path[1] = L':';
+ path[2] = UNICODE_NULL;
+ pidl = NULL;
+ hr = SHParseDisplayName(path, NULL, &pidl, 0, NULL);
+ if (winv6)
+ {
+ /* Win7 accepts this and returns C:\ */
+ ok(hr == S_OK, "hr = %lx\n", hr);
+ ok(pidl != NULL, "pidl = %p\n", pidl);
+ resultPath[0] = UNICODE_NULL;
+ SHGetPathFromIDListW(pidl, resultPath);
+ path[2] = L'\\';
+ path[3] = UNICODE_NULL;
+ ok(!wcsicmp(resultPath, path), "Got %ls, expected %ls\n", resultPath,
path);
+ }
+ else
+ {
+ /* Win2003 fails this */
+ ok(hr == E_INVALIDARG, "hr = %lx\n", hr);
+ ok(pidl == NULL, "pidl = %p\n", pidl);
+ }
+ if (pidl) CoTaskMemFree(pidl);
+
+ /* C:\ */
+ path[0] = systemDir[0];
+ path[1] = L':';
+ path[2] = L'\\';
+ path[3] = UNICODE_NULL;
+ pidl = NULL;
+ hr = SHParseDisplayName(path, NULL, &pidl, 0, NULL);
+ ok(hr == S_OK, "hr = %lx\n", hr);
+ ok(pidl != NULL, "pidl = %p\n", pidl);
+ resultPath[0] = UNICODE_NULL;
+ SHGetPathFromIDListW(pidl, resultPath);
+ ok(!wcsicmp(resultPath, path), "Got %ls, expected %ls\n", resultPath,
path);
+ if (pidl) CoTaskMemFree(pidl);
+
+ /* C:\\ */
+ path[0] = systemDir[0];
+ path[1] = L':';
+ path[2] = L'\\';
+ path[3] = L'\\';
+ path[4] = UNICODE_NULL;
+ pidl = NULL;
+ hr = SHParseDisplayName(path, NULL, &pidl, 0, NULL);
+ ok(hr == E_INVALIDARG, "hr = %lx\n", hr);
+ ok(pidl == NULL, "pidl = %p\n", pidl);
+ if (pidl) CoTaskMemFree(pidl);
+
+ /* C:\ReactOS */
+ StringCbCopyW(path, sizeof(path), systemDir);
+ wcschr(path + 3, L'\\')[0] = UNICODE_NULL;
+ pidl = NULL;
+ hr = SHParseDisplayName(path, NULL, &pidl, 0, NULL);
+ ok(hr == S_OK, "hr = %lx\n", hr);
+ ok(pidl != NULL, "pidl = %p\n", pidl);
+ resultPath[0] = UNICODE_NULL;
+ SHGetPathFromIDListW(pidl, resultPath);
+ ok(!wcsicmp(resultPath, path), "Got %ls, expected %ls\n", resultPath,
path);
+ if (pidl) CoTaskMemFree(pidl);
+
+ /* C:\ReactOS\ */
+ StringCbCopyW(path, sizeof(path), systemDir);
+ wcschr(path + 3, L'\\')[1] = UNICODE_NULL;
+ pidl = NULL;
+ hr = SHParseDisplayName(path, NULL, &pidl, 0, NULL);
+ ok(hr == S_OK, "hr = %lx\n", hr);
+ ok(pidl != NULL, "pidl = %p\n", pidl);
+ resultPath[0] = UNICODE_NULL;
+ SHGetPathFromIDListW(pidl, resultPath);
+ path[wcslen(path) - 1] = UNICODE_NULL;
+ ok(!wcsicmp(resultPath, path), "Got %ls, expected %ls\n", resultPath,
path);
+ if (pidl) CoTaskMemFree(pidl);
+
+ /* C:\ReactOS\system32 */
+ StringCbCopyW(path, sizeof(path), systemDir);
+ pidl = NULL;
+ hr = SHParseDisplayName(path, NULL, &pidl, 0, NULL);
+ ok(hr == S_OK, "hr = %lx\n", hr);
+ ok(pidl != NULL, "pidl = %p\n", pidl);
+ resultPath[0] = UNICODE_NULL;
+ SHGetPathFromIDListW(pidl, resultPath);
+ ok(!wcsicmp(resultPath, path), "Got %ls, expected %ls\n", resultPath,
path);
+ if (pidl) CoTaskMemFree(pidl);
+
+ /* C:ntoskrnl.exe */
+ path[0] = systemDir[0];
+ path[1] = L':';
+ path[2] = UNICODE_NULL;
+ StringCbCatW(path, sizeof(path), L"ntoskrnl.exe");
+ pidl = NULL;
+ hr = SHParseDisplayName(path, NULL, &pidl, 0, NULL);
+ ok(hr == E_INVALIDARG, "hr = %lx\n", hr);
+ ok(pidl == NULL, "pidl = %p\n", pidl);
+ if (pidl) CoTaskMemFree(pidl);
+
+ /* ntoskrnl.exe */
+ StringCbCopyW(path, sizeof(path), L"ntoskrnl.exe");
+ pidl = NULL;
+ hr = SHParseDisplayName(path, NULL, &pidl, 0, NULL);
+ ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "hr = %lx\n", hr);
+ ok(pidl == NULL, "pidl = %p\n", pidl);
+ if (pidl) CoTaskMemFree(pidl);
+
+ CoUninitialize();
+}
Propchange: trunk/rostests/apitests/shell32/SHParseDisplayName.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/rostests/apitests/shell32/testlist.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/shell32/testlist…
==============================================================================
--- trunk/rostests/apitests/shell32/testlist.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/shell32/testlist.c [iso-8859-1] Sat Apr 30 15:06:57 2016
@@ -6,11 +6,13 @@
extern void func_CMyComputer(void);
extern void func_CShellDesktop(void);
extern void func_menu(void);
+extern void func_SHParseDisplayName(void);
const struct test winetest_testlist[] =
{
{ "CMyComputer", func_CMyComputer },
{ "CShellDesktop", func_CShellDesktop },
{ "menu", func_menu },
+ { "SHParseDisplayName", func_SHParseDisplayName },
{ 0, 0 }
};