mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 04:43:21 +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 "shelltest.h"
|
||||||
#include <shellutils.h>
|
#include <shellutils.h>
|
||||||
|
|
||||||
enum { DIRBIT = 1, FILEBIT = 2 };
|
enum {
|
||||||
|
DIRBIT = 1, FILEBIT = 2,
|
||||||
|
PT_COMPUTER_REGITEM = 0x2E,
|
||||||
|
};
|
||||||
|
|
||||||
static BYTE GetPIDLType(LPCITEMIDLIST pidl)
|
static BYTE GetPIDLType(LPCITEMIDLIST pidl)
|
||||||
{
|
{
|
||||||
|
@ -202,3 +205,58 @@ START_TEST(PIDL)
|
||||||
skip("?\n");
|
skip("?\n");
|
||||||
ILFree(pidl);
|
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);
|
||||||
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ extern void func_FindExecutable(void);
|
||||||
extern void func_GetDisplayNameOf(void);
|
extern void func_GetDisplayNameOf(void);
|
||||||
extern void func_GUIDFromString(void);
|
extern void func_GUIDFromString(void);
|
||||||
extern void func_ILCreateFromPath(void);
|
extern void func_ILCreateFromPath(void);
|
||||||
|
extern void func_ILIsEqual(void);
|
||||||
extern void func_Int64ToString(void);
|
extern void func_Int64ToString(void);
|
||||||
extern void func_IShellFolderViewCB(void);
|
extern void func_IShellFolderViewCB(void);
|
||||||
extern void func_menu(void);
|
extern void func_menu(void);
|
||||||
|
@ -63,6 +64,7 @@ const struct test winetest_testlist[] =
|
||||||
{ "GetDisplayNameOf", func_GetDisplayNameOf },
|
{ "GetDisplayNameOf", func_GetDisplayNameOf },
|
||||||
{ "GUIDFromString", func_GUIDFromString },
|
{ "GUIDFromString", func_GUIDFromString },
|
||||||
{ "ILCreateFromPath", func_ILCreateFromPath },
|
{ "ILCreateFromPath", func_ILCreateFromPath },
|
||||||
|
{ "ILIsEqual", func_ILIsEqual },
|
||||||
{ "Int64ToString", func_Int64ToString },
|
{ "Int64ToString", func_Int64ToString },
|
||||||
{ "IShellFolderViewCB", func_IShellFolderViewCB },
|
{ "IShellFolderViewCB", func_IShellFolderViewCB },
|
||||||
{ "menu", func_menu },
|
{ "menu", func_menu },
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue