ReactOS  0.4.15-dev-2771-g6d441f7
SHAreIconsEqual.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS api tests
3  * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4  * PURPOSE: Tests for SHAreIconsEqual
5  * COPYRIGHT: Copyright 2018 Mark Jansen (mark.jansen@reactos.org)
6  */
7 
8 #include <apitest.h>
9 #include <shlwapi.h>
10 #include "resource.h"
11 
12 #include <pseh/pseh2.h>
13 
14 static BOOL (WINAPI *pSHAreIconsEqual)(HICON hIcon1, HICON hIcon2);
15 
16 static const char* names[] =
17 {
18  "16_8_black",
19  "16_8_red",
20  "16_32_black",
21  "16_32_red",
22  "32_8",
23  "32_32",
24 };
25 
26 void compare_icons_imp(int id1, int id2, BOOL expected)
27 {
30 
31  BOOL result = pSHAreIconsEqual(icon1, icon2);
32 
33  winetest_ok(icon1 != icon2, "Expected two different handles for %s==%s\n", names[id1-1], names[id2-1]);
34  winetest_ok(result == expected, "Expected %d, got %d for %s==%s\n", expected, result, names[id1-1], names[id2-1]);
35 
36  DestroyIcon(icon1);
37  DestroyIcon(icon2);
38 }
39 
40 #define compare_icons (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : compare_icons_imp
41 
42 
43 
45 {
46  HMODULE module = LoadLibraryA("shlwapi.dll");
48  pSHAreIconsEqual = (void*)GetProcAddress(module, MAKEINTRESOURCEA(548));
49  if (!pSHAreIconsEqual)
50  {
51  skip("SHAreIconsEqual not exported\n");
52  return;
53  }
54 
55  _SEH2_TRY
56  {
57  pSHAreIconsEqual((HICON)IDC_APPSTARTING, (HICON)IDC_APPSTARTING);
58  Continue = TRUE;
59  }
61  {
62  Continue = FALSE;
63  trace("SHAreIconsEqual not implemented?\n");
64  }
65  _SEH2_END;
66 
67  if (!Continue)
68  {
69  return;
70  }
71 
72  ok(pSHAreIconsEqual((HICON)NULL, (HICON)NULL) == FALSE, "NULL\n");
73  ok(pSHAreIconsEqual((HICON)IDC_APPSTARTING, (HICON)IDC_APPSTARTING) == FALSE, "IDC_APPSTARTING\n");
74  ok(pSHAreIconsEqual((HICON)IDC_ARROW, (HICON)IDC_ARROW) == FALSE, "IDC_ARROW\n");
75  ok(pSHAreIconsEqual((HICON)IDC_SIZENESW, (HICON)IDC_SIZENESW) == FALSE, "IDC_SIZENESW\n");
76 
83 }
#define ICON_16_8_BLACK
Definition: resource.h:2
static HICON
Definition: imagelist.c:84
#define IMAGE_ICON
Definition: winuser.h:212
GLuint64EXT * result
Definition: glext.h:11304
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
#define TRUE
Definition: types.h:120
BOOL WINAPI SHAreIconsEqual(HICON hIcon1, HICON hIcon2)
Definition: rosordinal.c:43
void compare_icons_imp(int id1, int id2, BOOL expected)
#define MAKEINTRESOURCEA(i)
Definition: winuser.h:581
#define IDC_SIZENESW
Definition: winuser.h:688
_SEH2_TRY
Definition: create.c:4226
GLuint GLuint * names
Definition: glext.h:11545
#define FALSE
Definition: types.h:117
static BOOL(WINAPI *pSHAreIconsEqual)(HICON hIcon1
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ICON_32_32
Definition: resource.h:7
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
#define trace
Definition: atltest.h:70
void __winetest_cdecl winetest_ok(int condition, const char *msg,...)
#define IDC_APPSTARTING
Definition: winuser.h:694
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
static HICON hIcon2
#define WINAPI
Definition: msvc.h:6
#define ICON_16_8_RED
Definition: resource.h:3
#define ICON_16_32_BLACK
Definition: resource.h:4
volatile int Continue
Definition: gdblib.c:102
#define compare_icons
_SEH2_END
Definition: create.c:4400
HANDLE WINAPI LoadImageA(_In_opt_ HINSTANCE, _In_ LPCSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2147
#define GetModuleHandle
Definition: winbase.h:3683
#define ICON_16_32_RED
Definition: resource.h:5
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
#define skip(...)
Definition: atltest.h:64
#define IDC_ARROW
Definition: winuser.h:682
START_TEST(SHAreIconsEqual)
#define GetProcAddress(x, y)
Definition: compat.h:612
#define ICON_32_8
Definition: resource.h:6
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:40
BOOL expected
Definition: store.c:2063