mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 20:05:41 +00:00
[SHELL32_APITEST] Basic ILIsEqual tests (#7438)
This commit is contained in:
parent
439e67d1d8
commit
654c59a5f8
2 changed files with 61 additions and 1 deletions
|
@ -9,7 +9,10 @@
|
|||
#include "shelltest.h"
|
||||
#include <shellutils.h>
|
||||
|
||||
enum { DIRBIT = 1, FILEBIT = 2 };
|
||||
enum {
|
||||
DIRBIT = 1, FILEBIT = 2,
|
||||
PT_COMPUTER_REGITEM = 0x2E,
|
||||
};
|
||||
|
||||
static BYTE GetPIDLType(LPCITEMIDLIST pidl)
|
||||
{
|
||||
|
@ -202,3 +205,58 @@ START_TEST(PIDL)
|
|||
skip("?\n");
|
||||
ILFree(pidl);
|
||||
}
|
||||
|
||||
START_TEST(ILIsEqual)
|
||||
{
|
||||
LPITEMIDLIST p1, p2, pidl;
|
||||
|
||||
p1 = p2 = NULL;
|
||||
ok_int(ILIsEqual(p1, p2), TRUE);
|
||||
|
||||
ITEMIDLIST emptyitem = {}, emptyitem2 = {};
|
||||
ok_int(ILIsEqual(&emptyitem, &emptyitem2), TRUE);
|
||||
|
||||
ok_int(ILIsEqual(NULL, &emptyitem), FALSE); // These two are not equal for some reason
|
||||
|
||||
p1 = SHCloneSpecialIDList(NULL, CSIDL_DRIVES, FALSE);
|
||||
p2 = SHCloneSpecialIDList(NULL, CSIDL_DRIVES, FALSE);
|
||||
if (p1 && p2)
|
||||
{
|
||||
ok_int(ILIsEqual(p1, p2), TRUE);
|
||||
p1->mkid.abID[0] = PT_COMPUTER_REGITEM; // RegItem in wrong parent
|
||||
ok_int(ILIsEqual(p1, p2), FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
skip("Unable to initialize test\n");
|
||||
}
|
||||
ILFree(p1);
|
||||
ILFree(p2);
|
||||
|
||||
// ILIsParent must compare like ILIsEqual
|
||||
p1 = SHSimpleIDListFromPath(L"c:\\");
|
||||
p2 = SHSimpleIDListFromPath(L"c:\\dir\\file");
|
||||
if (p1 && p2)
|
||||
{
|
||||
ok_int(ILIsParent(NULL, p1, FALSE), FALSE); // NULL is always false
|
||||
ok_int(ILIsParent(p1, NULL, FALSE), FALSE); // NULL is always false
|
||||
ok_int(ILIsParent(NULL, NULL, FALSE), FALSE); // NULL is always false
|
||||
ok_int(ILIsParent(p1, p1, FALSE), TRUE); // I'm my own parent
|
||||
ok_int(ILIsParent(p1, p1, TRUE), FALSE); // Self is not immediate
|
||||
ok_int(ILIsParent(p1, p2, FALSE), TRUE); // Grandchild
|
||||
ok_int(ILIsParent(p1, p2, TRUE), FALSE); // Grandchild is not immediate
|
||||
ok_ptr(ILFindChild(p1, p2), ILGetNext(ILGetNext(p2))); // Child is "dir\\file", skip MyComputer and C:
|
||||
ok_int(ILIsEmpty(pidl = ILFindChild(p1, p1)) && pidl, TRUE); // Self
|
||||
ILRemoveLastID(p2);
|
||||
ok_int(ILIsParent(p1, p2, TRUE), TRUE); // Immediate child
|
||||
|
||||
p1->mkid.abID[0] = PT_COMPUTER_REGITEM; // RegItem in wrong parent
|
||||
ok_int(ILIsParent(p1, p2, FALSE), FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
skip("Unable to initialize test\n");
|
||||
}
|
||||
ILFree(p1);
|
||||
ILFree(p2);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue