mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 07:56:59 +00:00
[USER32_APITEST] Add a test for PrivateExtractIcons(A/W) that shows that this API can accept unexpanded file paths.
CORE-15150
This commit is contained in:
parent
cd473963f4
commit
57a9fca04b
3 changed files with 54 additions and 0 deletions
|
@ -22,6 +22,7 @@ list(APPEND SOURCE
|
||||||
LoadImage.c
|
LoadImage.c
|
||||||
LookupIconIdFromDirectoryEx.c
|
LookupIconIdFromDirectoryEx.c
|
||||||
NextDlgItem.c
|
NextDlgItem.c
|
||||||
|
PrivateExtractIcons.c
|
||||||
RealGetWindowClass.c
|
RealGetWindowClass.c
|
||||||
RedrawWindow.c
|
RedrawWindow.c
|
||||||
RegisterClassEx.c
|
RegisterClassEx.c
|
||||||
|
|
51
modules/rostests/apitests/user32/PrivateExtractIcons.c
Normal file
51
modules/rostests/apitests/user32/PrivateExtractIcons.c
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
/*
|
||||||
|
* PROJECT: ReactOS api tests
|
||||||
|
* LICENSE: LGPLv2.1+ - See COPYING.LIB in the top level directory
|
||||||
|
* PURPOSE: Test for PrivateExtractIcons
|
||||||
|
* PROGRAMMER: Hermes Belusca-Maito
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "precomp.h"
|
||||||
|
|
||||||
|
static struct
|
||||||
|
{
|
||||||
|
PCWSTR FilePath;
|
||||||
|
UINT cIcons; // Return value from PrivateExtractIconsW
|
||||||
|
BOOL bhIconValid; // Whether or not the returned icon handle is not NULL.
|
||||||
|
} IconTests[] =
|
||||||
|
{
|
||||||
|
/* Executables with icons */
|
||||||
|
{L"notepad.exe", 1, TRUE},
|
||||||
|
{L"%SystemRoot%\\System32\\cmd.exe", 1, TRUE},
|
||||||
|
|
||||||
|
/* Executable without icon */
|
||||||
|
{L"%SystemRoot%\\System32\\autochk.exe", 0, FALSE},
|
||||||
|
|
||||||
|
/* Existing file */
|
||||||
|
{L"%SystemRoot%\\System32\\shell32.dll", 1, TRUE},
|
||||||
|
|
||||||
|
/* Non-existing files */
|
||||||
|
{L"%SystemRoot%\\non-existent-file.sdf", 0xFFFFFFFF, FALSE},
|
||||||
|
};
|
||||||
|
|
||||||
|
START_TEST(PrivateExtractIcons)
|
||||||
|
{
|
||||||
|
HICON ahIcon;
|
||||||
|
UINT i, aIconId, cIcons;
|
||||||
|
|
||||||
|
for (i = 0; i < _countof(IconTests); ++i)
|
||||||
|
{
|
||||||
|
/* Always test extraction of the FIRST icon (index 0) */
|
||||||
|
ahIcon = (HICON)0xdeadbeef;
|
||||||
|
aIconId = 0xdeadbeef;
|
||||||
|
cIcons = PrivateExtractIconsW(IconTests[i].FilePath, 0, 16, 16, &ahIcon, &aIconId, 1, 0);
|
||||||
|
ok(cIcons == IconTests[i].cIcons, "PrivateExtractIconsW(%u): got %u, expected %u\n", i, cIcons, IconTests[i].cIcons);
|
||||||
|
ok(ahIcon != (HICON)0xdeadbeef, "PrivateExtractIconsW(%u): icon not set\n", i);
|
||||||
|
ok((IconTests[i].bhIconValid && ahIcon) || (!IconTests[i].bhIconValid && !ahIcon),
|
||||||
|
"PrivateExtractIconsW(%u): icon expected to be %s, but got 0x%p\n",
|
||||||
|
i, IconTests[i].bhIconValid ? "valid" : "not valid", ahIcon);
|
||||||
|
ok(aIconId != 0xdeadbeef, "PrivateExtractIconsW(%u): id not set\n", i);
|
||||||
|
if (ahIcon && ahIcon != (HICON)0xdeadbeef)
|
||||||
|
DestroyIcon(ahIcon);
|
||||||
|
}
|
||||||
|
}
|
|
@ -24,6 +24,7 @@ extern void func_InitializeLpkHooks(void);
|
||||||
extern void func_LoadImage(void);
|
extern void func_LoadImage(void);
|
||||||
extern void func_LookupIconIdFromDirectoryEx(void);
|
extern void func_LookupIconIdFromDirectoryEx(void);
|
||||||
extern void func_NextDlgItem(void);
|
extern void func_NextDlgItem(void);
|
||||||
|
extern void func_PrivateExtractIcons(void);
|
||||||
extern void func_RealGetWindowClass(void);
|
extern void func_RealGetWindowClass(void);
|
||||||
extern void func_RedrawWindow(void);
|
extern void func_RedrawWindow(void);
|
||||||
extern void func_RegisterHotKey(void);
|
extern void func_RegisterHotKey(void);
|
||||||
|
@ -65,6 +66,7 @@ const struct test winetest_testlist[] =
|
||||||
{ "LoadImage", func_LoadImage },
|
{ "LoadImage", func_LoadImage },
|
||||||
{ "LookupIconIdFromDirectoryEx", func_LookupIconIdFromDirectoryEx },
|
{ "LookupIconIdFromDirectoryEx", func_LookupIconIdFromDirectoryEx },
|
||||||
{ "NextDlgItem", func_NextDlgItem },
|
{ "NextDlgItem", func_NextDlgItem },
|
||||||
|
{ "PrivateExtractIcons", func_PrivateExtractIcons },
|
||||||
{ "RealGetWindowClass", func_RealGetWindowClass },
|
{ "RealGetWindowClass", func_RealGetWindowClass },
|
||||||
{ "RedrawWindow", func_RedrawWindow },
|
{ "RedrawWindow", func_RedrawWindow },
|
||||||
{ "RegisterHotKey", func_RegisterHotKey },
|
{ "RegisterHotKey", func_RegisterHotKey },
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue