#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)
{
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);
+}
extern void func_GetDisplayNameOf(void);
extern void func_GUIDFromString(void);
extern void func_ILCreateFromPath(void);
+extern void func_ILIsEqual(void);
extern void func_Int64ToString(void);
extern void func_IShellFolderViewCB(void);
extern void func_menu(void);
{ "GetDisplayNameOf", func_GetDisplayNameOf },
{ "GUIDFromString", func_GUIDFromString },
{ "ILCreateFromPath", func_ILCreateFromPath },
+ { "ILIsEqual", func_ILIsEqual },
{ "Int64ToString", func_Int64ToString },
{ "IShellFolderViewCB", func_IShellFolderViewCB },
{ "menu", func_menu },