https://git.reactos.org/?p=reactos.git;a=commitdiff;h=754a2fa8724a3efdd5055…
commit 754a2fa8724a3efdd5055bff7e369604ac7e5205
Author: Mark Jansen <mark.jansen(a)reactos.org>
AuthorDate: Mon Mar 5 22:18:21 2018 +0100
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Mon Mar 5 22:43:17 2018 +0100
[SHLWAPI_APITEST] Add test for SHAreIconsEqual
---
modules/rostests/apitests/shlwapi/16_32_black.ico | Bin 0 -> 1150 bytes
modules/rostests/apitests/shlwapi/16_32_red.ico | Bin 0 -> 1150 bytes
modules/rostests/apitests/shlwapi/16_8_black.ico | Bin 0 -> 1406 bytes
modules/rostests/apitests/shlwapi/16_8_red.ico | Bin 0 -> 1406 bytes
modules/rostests/apitests/shlwapi/32_32.ico | Bin 0 -> 4286 bytes
modules/rostests/apitests/shlwapi/32_8.ico | Bin 0 -> 2238 bytes
modules/rostests/apitests/shlwapi/CMakeLists.txt | 4 +-
.../rostests/apitests/shlwapi/SHAreIconsEqual.c | 81 +++++++++++++++++++++
modules/rostests/apitests/shlwapi/resource.h | 9 +++
modules/rostests/apitests/shlwapi/testdata.rc | 10 +++
modules/rostests/apitests/shlwapi/testlist.c | 2 +
11 files changed, 105 insertions(+), 1 deletion(-)
diff --git a/modules/rostests/apitests/shlwapi/16_32_black.ico
b/modules/rostests/apitests/shlwapi/16_32_black.ico
new file mode 100644
index 0000000000..f93cf06c1d
Binary files /dev/null and b/modules/rostests/apitests/shlwapi/16_32_black.ico differ
diff --git a/modules/rostests/apitests/shlwapi/16_32_red.ico
b/modules/rostests/apitests/shlwapi/16_32_red.ico
new file mode 100644
index 0000000000..f6aadcd483
Binary files /dev/null and b/modules/rostests/apitests/shlwapi/16_32_red.ico differ
diff --git a/modules/rostests/apitests/shlwapi/16_8_black.ico
b/modules/rostests/apitests/shlwapi/16_8_black.ico
new file mode 100644
index 0000000000..5efc283ce2
Binary files /dev/null and b/modules/rostests/apitests/shlwapi/16_8_black.ico differ
diff --git a/modules/rostests/apitests/shlwapi/16_8_red.ico
b/modules/rostests/apitests/shlwapi/16_8_red.ico
new file mode 100644
index 0000000000..5b73a5ddee
Binary files /dev/null and b/modules/rostests/apitests/shlwapi/16_8_red.ico differ
diff --git a/modules/rostests/apitests/shlwapi/32_32.ico
b/modules/rostests/apitests/shlwapi/32_32.ico
new file mode 100644
index 0000000000..e49a3e219c
Binary files /dev/null and b/modules/rostests/apitests/shlwapi/32_32.ico differ
diff --git a/modules/rostests/apitests/shlwapi/32_8.ico
b/modules/rostests/apitests/shlwapi/32_8.ico
new file mode 100644
index 0000000000..e098f7fab7
Binary files /dev/null and b/modules/rostests/apitests/shlwapi/32_8.ico differ
diff --git a/modules/rostests/apitests/shlwapi/CMakeLists.txt
b/modules/rostests/apitests/shlwapi/CMakeLists.txt
index 104f50bf86..da4c6a808f 100644
--- a/modules/rostests/apitests/shlwapi/CMakeLists.txt
+++ b/modules/rostests/apitests/shlwapi/CMakeLists.txt
@@ -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)
diff --git a/modules/rostests/apitests/shlwapi/SHAreIconsEqual.c
b/modules/rostests/apitests/shlwapi/SHAreIconsEqual.c
new file mode 100644
index 0000000000..27592325c7
--- /dev/null
+++ b/modules/rostests/apitests/shlwapi/SHAreIconsEqual.c
@@ -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(a)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);
+}
diff --git a/modules/rostests/apitests/shlwapi/resource.h
b/modules/rostests/apitests/shlwapi/resource.h
new file mode 100644
index 0000000000..1e22985bdd
--- /dev/null
+++ b/modules/rostests/apitests/shlwapi/resource.h
@@ -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
+
+
diff --git a/modules/rostests/apitests/shlwapi/testdata.rc
b/modules/rostests/apitests/shlwapi/testdata.rc
new file mode 100644
index 0000000000..b6aa19173e
--- /dev/null
+++ b/modules/rostests/apitests/shlwapi/testdata.rc
@@ -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"
+
diff --git a/modules/rostests/apitests/shlwapi/testlist.c
b/modules/rostests/apitests/shlwapi/testlist.c
index 1f3fc39498..793385e1a2 100644
--- a/modules/rostests/apitests/shlwapi/testlist.c
+++ b/modules/rostests/apitests/shlwapi/testlist.c
@@ -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 }
};