Author: hbelusca
Date: Mon Jan 16 18:02:43 2017
New Revision: 73563
URL:
http://svn.reactos.org/svn/reactos?rev=73563&view=rev
Log:
[SHELL32_APITEST]
- Use smart COM pointers (thanks Mark ;)
- Add other tests for testing non-existing files in existing directories.
Modified:
trunk/rostests/apitests/shell32/CShellLink.cpp
Modified: trunk/rostests/apitests/shell32/CShellLink.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/shell32/CShellLi…
==============================================================================
--- trunk/rostests/apitests/shell32/CShellLink.cpp [iso-8859-1] (original)
+++ trunk/rostests/apitests/shell32/CShellLink.cpp [iso-8859-1] Mon Jan 16 18:02:43 2017
@@ -77,6 +77,11 @@
L"%comspec%", SLGP_RAWPATH, S_OK, TRUE
},
{
+ L"%systemroot%\\non-existent-file", S_OK,
+ L"%systemroot%\\non-existent-file", SLGP_SHORTPATH, S_OK, TRUE,
+ L"%systemroot%\\non-existent-file", SLGP_RAWPATH, S_OK, FALSE
+ },
+ {
L"c:\\non-existent-path\\non-existent-file", S_OK,
L"c:\\non-existent-path\\non-existent-file", SLGP_SHORTPATH, S_OK,
FALSE,
L"c:\\non-existent-path\\non-existent-file", SLGP_RAWPATH, S_OK,
FALSE
@@ -98,7 +103,7 @@
WCHAR wPathOut[MAX_PATH];
BOOL expandPathOut;
PCWSTR expectedPathOut;
- IShellLinkW *psl;
+ CComPtr<IShellLinkW> psl;
UINT i1;
DWORD flags;
@@ -150,8 +155,6 @@
"IShellLink::GetPath(%d), flags 0x%lx, in %S, got %S, expected
%S\n",
i, flags, testDef->pathIn, wPathOut, expectedPathOut);
}
-
- psl->Release();
}
static
@@ -177,7 +180,7 @@
TestDescription(void)
{
HRESULT hr;
- IShellLinkW *psl;
+ CComPtr<IShellLinkW> psl;
WCHAR buffer[64];
PCWSTR testDescription = L"This is a test description";
@@ -217,8 +220,6 @@
ok(hr == S_OK, "IShellLink::GetDescription returned hr = 0x%lx\n", hr);
ok(buffer[0] == 0, "buffer[0] = %x\n", buffer[0]);
ok(buffer[1] == 0x5555, "buffer[1] = %x\n", buffer[1]);
-
- psl->Release();
}
@@ -250,7 +251,9 @@
{L"%SystemRoot%\\system32\\shell32.dll", S_FALSE, E_INVALIDARG,
S_OK, L"*", GIL_NOTFILENAME | GIL_PERCLASS},
- /* Non-existing file */
+ /* Non-existing files */
+ {L"%SystemRoot%\\non-existent-file.sdf", S_FALSE, E_INVALIDARG,
+ S_OK, L"*", GIL_NOTFILENAME | GIL_PERCLASS},
{L"c:\\non-existent-path\\non-existent-file.sdf", S_FALSE, E_INVALIDARG,
S_OK, L"*", GIL_NOTFILENAME | GIL_PERCLASS},
};
@@ -260,8 +263,8 @@
test_iconlocation(UINT i, TEST_SHELL_ICON* testDef)
{
HRESULT hr;
- IShellLinkW *psl;
- IExtractIconW *pei;
+ CComPtr<IShellLinkW> psl;
+ CComPtr<IExtractIconW> pei;
INT iIcon;
UINT wFlags;
PCWSTR pszExplorer = L"%SystemRoot%\\explorer.exe";
@@ -301,7 +304,6 @@
if (!pei)
{
win_skip("No IExtractIconW interface\n");
- psl->Release();
return;
}
@@ -386,10 +388,6 @@
// ok(*szPath == L'\0', "IExtractIcon::GetIconLocation returned
'%S'\n", szPath);
// ok(iIcon == 0, "IExtractIcon::GetIconLocation returned %d\n", iIcon);
// ok(FALSE, "hr = 0x%lx, szPath = '%S', iIcon = %d, wFlags =
%d\n", hr, szPath, iIcon, wFlags);
-
- /* Release the interfaces */
- pei->Release();
- psl->Release();
}
static