[USER32][APITESTS] Use the correct user32 icon resource ids (#7807)

This commit is contained in:
Whindmar Saksit 2025-07-06 15:24:25 +02:00 committed by GitHub
parent 2a901a72f3
commit c0ea1c0e9f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 65 additions and 13 deletions

View file

@ -48,12 +48,8 @@ static BOOL IL_AddImagesForTest(HIMAGELIST himl)
HINSTANCE hInst = LoadLibraryW(L"USER32");
if (!hInst)
return FALSE;
HICON hIco = (HICON)LoadImage(hInst, MAKEINTRESOURCE(100), /* Windows */
HICON hIco = (HICON)LoadImage(hInst, MAKEINTRESOURCE(100),
IMAGE_ICON, IL_IMGSIZE, IL_IMGSIZE, 0);
if (!hIco)
hIco = (HICON)LoadImage(hInst, MAKEINTRESOURCE(32512), /* ReactOS */
IMAGE_ICON, IL_IMGSIZE, IL_IMGSIZE, 0);
if (hIco)
{
idx = ImageList_AddIcon(himl, hIco);

View file

@ -45,6 +45,42 @@ static void test_LoadImage_DataFile(void)
}
}
static void test_LoadIcon_SystemIds(void)
{
static const WORD icomap[][2] = {
{ 100, (WORD)(SIZE_T)IDI_APPLICATION },
{ 101, (WORD)(SIZE_T)IDI_WARNING },
{ 102, (WORD)(SIZE_T)IDI_QUESTION },
{ 103, (WORD)(SIZE_T)IDI_ERROR },
{ 104, (WORD)(SIZE_T)IDI_INFORMATION },
{ 105, (WORD)(SIZE_T)IDI_WINLOGO }
};
HINSTANCE hInst = GetModuleHandleW(L"USER32");
typedef BOOL (WINAPI*SHAIE)(HICON, HICON);
SHAIE pfnSHAreIconsEqual;
HMODULE hSHLWAPI = LoadLibraryA("SHLWAPI");
if (!hSHLWAPI)
{
skip("Could not initialize\n");
return;
}
pfnSHAreIconsEqual = (SHAIE)GetProcAddress(hSHLWAPI, MAKEINTRESOURCEA(548));
if (!pfnSHAreIconsEqual)
{
FreeLibrary(hSHLWAPI);
skip("Could not initialize\n");
return;
}
for (UINT i = 0; i < _countof(icomap); i++)
{
HICON hIcoRes = LoadIconW(hInst, MAKEINTRESOURCEW(icomap[i][0]));
HICON hIcoSys = LoadIconW(NULL, MAKEINTRESOURCEW(icomap[i][1]));
ok(hIcoRes && pfnSHAreIconsEqual(hIcoRes, hIcoSys), "SysIcon %d must be resource %d\n", icomap[i][1], icomap[i][0]);
}
FreeLibrary(hSHLWAPI);
}
START_TEST(LoadImage)
{
char path[MAX_PATH];
@ -133,4 +169,6 @@ START_TEST(LoadImage)
si.cb = sizeof(si);
CreateProcessA( NULL, path, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi );
WaitForSingleObject (pi.hProcess, INFINITE);
test_LoadIcon_SystemIds();
}