mirror of
https://github.com/reactos/reactos.git
synced 2024-09-28 05:26:58 +00:00
[SHLWAPI_APITEST] Add test for SHAreIconsEqual
This commit is contained in:
parent
1f7cb06c22
commit
754a2fa872
BIN
modules/rostests/apitests/shlwapi/16_32_black.ico
Normal file
BIN
modules/rostests/apitests/shlwapi/16_32_black.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
modules/rostests/apitests/shlwapi/16_32_red.ico
Normal file
BIN
modules/rostests/apitests/shlwapi/16_32_red.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
modules/rostests/apitests/shlwapi/16_8_black.ico
Normal file
BIN
modules/rostests/apitests/shlwapi/16_8_black.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
BIN
modules/rostests/apitests/shlwapi/16_8_red.ico
Normal file
BIN
modules/rostests/apitests/shlwapi/16_8_red.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
BIN
modules/rostests/apitests/shlwapi/32_32.ico
Normal file
BIN
modules/rostests/apitests/shlwapi/32_32.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
BIN
modules/rostests/apitests/shlwapi/32_8.ico
Normal file
BIN
modules/rostests/apitests/shlwapi/32_8.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
|
@ -5,11 +5,13 @@ list(APPEND SOURCE
|
|||
PathIsUNCServer.c
|
||||
PathIsUNCServerShare.c
|
||||
PathUnExpandEnvStrings.c
|
||||
SHAreIconsEqual.c
|
||||
StrFormatByteSizeW.c
|
||||
testdata.rc
|
||||
testlist.c)
|
||||
|
||||
add_executable(shlwapi_apitest ${SOURCE})
|
||||
set_module_type(shlwapi_apitest win32cui)
|
||||
target_link_libraries(shlwapi_apitest ${PSEH_LIB})
|
||||
add_importlibs(shlwapi_apitest shlwapi msvcrt kernel32)
|
||||
add_importlibs(shlwapi_apitest shlwapi user32 msvcrt kernel32)
|
||||
add_rostests_file(TARGET shlwapi_apitest)
|
||||
|
|
81
modules/rostests/apitests/shlwapi/SHAreIconsEqual.c
Normal file
81
modules/rostests/apitests/shlwapi/SHAreIconsEqual.c
Normal file
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
|
||||
* PURPOSE: Tests for SHAreIconsEqual
|
||||
* COPYRIGHT: Copyright 2018 Mark Jansen (mark.jansen@reactos.org)
|
||||
*/
|
||||
|
||||
#include <apitest.h>
|
||||
#include <shlwapi.h>
|
||||
#include "resource.h"
|
||||
|
||||
static BOOL (WINAPI *pSHAreIconsEqual)(HICON hIcon1, HICON hIcon2);
|
||||
|
||||
static const char* names[] =
|
||||
{
|
||||
"16_8_black",
|
||||
"16_8_red",
|
||||
"16_32_black",
|
||||
"16_32_red",
|
||||
"32_8",
|
||||
"32_32",
|
||||
};
|
||||
|
||||
void compare_icons_imp(int id1, int id2, BOOL expected)
|
||||
{
|
||||
HICON icon1 = LoadImageA(GetModuleHandle(NULL), MAKEINTRESOURCEA(id1), IMAGE_ICON, 0, 0, 0);
|
||||
HICON icon2 = LoadImageA(GetModuleHandle(NULL), MAKEINTRESOURCEA(id2), IMAGE_ICON, 0, 0, 0);
|
||||
|
||||
BOOL result = pSHAreIconsEqual(icon1, icon2);
|
||||
|
||||
winetest_ok(icon1 != icon2, "Expected two different handles for %s==%s\n", names[id1-1], names[id2-1]);
|
||||
winetest_ok(result == expected, "Expected %d, got %d for %s==%s\n", expected, result, names[id1-1], names[id2-1]);
|
||||
|
||||
DestroyIcon(icon1);
|
||||
DestroyIcon(icon2);
|
||||
}
|
||||
|
||||
#define compare_icons (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : compare_icons_imp
|
||||
|
||||
|
||||
|
||||
START_TEST(SHAreIconsEqual)
|
||||
{
|
||||
HMODULE module = LoadLibraryA("shlwapi.dll");
|
||||
BOOL Continue = FALSE;
|
||||
pSHAreIconsEqual = (void*)GetProcAddress(module, MAKEINTRESOURCEA(548));
|
||||
if (!pSHAreIconsEqual)
|
||||
{
|
||||
skip("SHAreIconsEqual not exported\n");
|
||||
return;
|
||||
}
|
||||
|
||||
_SEH2_TRY
|
||||
{
|
||||
pSHAreIconsEqual((HICON)IDC_APPSTARTING, (HICON)IDC_APPSTARTING);
|
||||
Continue = TRUE;
|
||||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
Continue = FALSE;
|
||||
trace("SHAreIconsEqual not implemented?\n");
|
||||
}
|
||||
_SEH2_END;
|
||||
|
||||
if (!Continue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ok(pSHAreIconsEqual((HICON)NULL, (HICON)NULL) == FALSE, "NULL\n");
|
||||
ok(pSHAreIconsEqual((HICON)IDC_APPSTARTING, (HICON)IDC_APPSTARTING) == FALSE, "IDC_APPSTARTING\n");
|
||||
ok(pSHAreIconsEqual((HICON)IDC_ARROW, (HICON)IDC_ARROW) == FALSE, "IDC_ARROW\n");
|
||||
ok(pSHAreIconsEqual((HICON)IDC_SIZENESW, (HICON)IDC_SIZENESW) == FALSE, "IDC_SIZENESW\n");
|
||||
|
||||
compare_icons(ICON_16_8_BLACK, ICON_16_8_BLACK, TRUE);
|
||||
compare_icons(ICON_16_8_BLACK, ICON_16_8_RED, FALSE);
|
||||
compare_icons(ICON_16_8_BLACK, ICON_16_32_BLACK, FALSE);
|
||||
compare_icons(ICON_16_8_BLACK, ICON_16_32_RED, FALSE);
|
||||
compare_icons(ICON_16_8_BLACK, ICON_32_8, FALSE);
|
||||
compare_icons(ICON_16_8_BLACK, ICON_32_32, FALSE);
|
||||
}
|
9
modules/rostests/apitests/shlwapi/resource.h
Normal file
9
modules/rostests/apitests/shlwapi/resource.h
Normal file
|
@ -0,0 +1,9 @@
|
|||
|
||||
#define ICON_16_8_BLACK 1
|
||||
#define ICON_16_8_RED 2
|
||||
#define ICON_16_32_BLACK 3
|
||||
#define ICON_16_32_RED 4
|
||||
#define ICON_32_8 5
|
||||
#define ICON_32_32 6
|
||||
|
||||
|
10
modules/rostests/apitests/shlwapi/testdata.rc
Normal file
10
modules/rostests/apitests/shlwapi/testdata.rc
Normal file
|
@ -0,0 +1,10 @@
|
|||
|
||||
#include "resource.h"
|
||||
|
||||
ICON_16_8_BLACK ICON "16_8_black.ico"
|
||||
ICON_16_8_RED ICON "16_8_red.ico"
|
||||
ICON_16_32_BLACK ICON "16_32_black.ico"
|
||||
ICON_16_32_RED ICON "16_32_red.ico"
|
||||
ICON_32_8 ICON "32_8.ico"
|
||||
ICON_32_32 ICON "32_32.ico"
|
||||
|
|
@ -6,6 +6,7 @@ extern void func_isuncpath(void);
|
|||
extern void func_isuncpathserver(void);
|
||||
extern void func_isuncpathservershare(void);
|
||||
extern void func_PathUnExpandEnvStrings(void);
|
||||
extern void func_SHAreIconsEqual(void);
|
||||
extern void func_StrFormatByteSizeW(void);
|
||||
|
||||
const struct test winetest_testlist[] =
|
||||
|
@ -15,6 +16,7 @@ const struct test winetest_testlist[] =
|
|||
{ "PathIsUNCServer", func_isuncpathserver },
|
||||
{ "PathIsUNCServerShare", func_isuncpathservershare },
|
||||
{ "PathUnExpandEnvStrings", func_PathUnExpandEnvStrings },
|
||||
{ "SHAreIconsEqual", func_SHAreIconsEqual },
|
||||
{ "StrFormatByteSizeW", func_StrFormatByteSizeW },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue