[SHELL32_APITEST] Add SHSimpleIDListFromPath testcase (#6892)

Inspect the behavior of
shell32!SHSimpleIDListFromPath function.
JIRA issue: CORE-19591
This commit is contained in:
Katayama Hirofumi MZ 2024-05-15 17:01:41 +09:00 committed by GitHub
parent 0f81f46387
commit 48a0d8e012
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 46 additions and 0 deletions

View file

@ -32,6 +32,7 @@ list(APPEND SOURCE
SHCreateFileExtractIconW.cpp SHCreateFileExtractIconW.cpp
SHParseDisplayName.cpp SHParseDisplayName.cpp
SHRestricted.cpp SHRestricted.cpp
SHSimpleIDListFromPath.cpp
She.cpp She.cpp
ShellExecCmdLine.cpp ShellExecCmdLine.cpp
ShellExecuteEx.cpp ShellExecuteEx.cpp

View file

@ -0,0 +1,43 @@
/*
* PROJECT: ReactOS API tests
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
* PURPOSE: Test for SHSimpleIDListFromPath
* COPYRIGHT: Copyright 2024 Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
*/
#include "shelltest.h"
#include <shellutils.h>
START_TEST(SHSimpleIDListFromPath)
{
HRESULT hr;
WCHAR szPath[MAX_PATH];
GetWindowsDirectoryW(szPath, _countof(szPath));
// We compare pidl1 and pidl2
CComHeapPtr<ITEMIDLIST> pidl1(SHSimpleIDListFromPath(szPath));
CComHeapPtr<ITEMIDLIST> pidl2(ILCreateFromPathW(szPath));
// Yes, they are equal logically
LPITEMIDLIST pidl1Last = ILFindLastID(pidl1), pidl2Last = ILFindLastID(pidl2);
ok_int(ILIsEqual(pidl1, pidl2), TRUE);
ok_int(ILIsEqual(pidl1Last, pidl2Last), TRUE);
// Bind to parent
CComPtr<IShellFolder> psf1, psf2;
hr = SHBindToParent(pidl1, IID_PPV_ARG(IShellFolder, &psf1), NULL);
ok_long(hr, S_OK);
hr = SHBindToParent(pidl2, IID_PPV_ARG(IShellFolder, &psf2), NULL);
ok_long(hr, S_OK);
// Get attributes
DWORD attrs1 = SFGAO_FOLDER, attrs2 = SFGAO_FOLDER;
hr = (psf1 ? psf1->GetAttributesOf(1, &pidl1Last, &attrs1) : E_UNEXPECTED);
ok_long(hr, S_OK);
hr = (psf2 ? psf2->GetAttributesOf(1, &pidl2Last, &attrs2) : E_UNEXPECTED);
ok_long(hr, S_OK);
// There is the difference in attributes:
ok_long((attrs1 & SFGAO_FOLDER), 0);
ok_long((attrs2 & SFGAO_FOLDER), SFGAO_FOLDER);
}

View file

@ -40,6 +40,7 @@ extern void func_ShellState(void);
extern void func_SHGetAttributesFromDataObject(void); extern void func_SHGetAttributesFromDataObject(void);
extern void func_SHLimitInputEdit(void); extern void func_SHLimitInputEdit(void);
extern void func_SHParseDisplayName(void); extern void func_SHParseDisplayName(void);
extern void func_SHSimpleIDListFromPath(void);
extern void func_SHRestricted(void); extern void func_SHRestricted(void);
const struct test winetest_testlist[] = const struct test winetest_testlist[] =
@ -81,6 +82,7 @@ const struct test winetest_testlist[] =
{ "SHGetAttributesFromDataObject", func_SHGetAttributesFromDataObject }, { "SHGetAttributesFromDataObject", func_SHGetAttributesFromDataObject },
{ "SHLimitInputEdit", func_SHLimitInputEdit }, { "SHLimitInputEdit", func_SHLimitInputEdit },
{ "SHParseDisplayName", func_SHParseDisplayName }, { "SHParseDisplayName", func_SHParseDisplayName },
{ "SHSimpleIDListFromPath", func_SHSimpleIDListFromPath },
{ "SHRestricted", func_SHRestricted }, { "SHRestricted", func_SHRestricted },
{ 0, 0 } { 0, 0 }