ReactOS  0.4.15-dev-1374-g8d3e80e
LookupIconIdFromDirectoryEx.c File Reference
#include "precomp.h"
Include dependency graph for LookupIconIdFromDirectoryEx.c:

Go to the source code of this file.

Functions

 START_TEST (LookupIconIdFromDirectoryEx)
 

Function Documentation

◆ START_TEST()

START_TEST ( LookupIconIdFromDirectoryEx  )

Definition at line 4 of file LookupIconIdFromDirectoryEx.c.

5 {
6  HRSRC hResource;
7  HGLOBAL hMem;
8  HMODULE hMod;
9  int wResId;
10  DEVMODEW dm;
11  DWORD dwOrigBpp;
12  UINT i;
13  BYTE* lpResource;
14 
15  /* This tests assumes that default icon size is 32x32 */
16 
17  struct
18  {
19  DWORD bpp;
20  int wResId;
21  int cxDesired;
22  int cyDesired;
23  UINT flags;
24  }
25  TestData[] =
26  {
27  {8, 1, 0, 0, 0},
28  {8, 1, 48, 48, 0},
29  {8, 2, 32, 32, 0},
30  {8, 3, 24, 24, 0},
31  {8, 4, 16, 16, 0},
32  {8, 1, 0, 0, LR_MONOCHROME},
33  {8, 1, 48, 48, LR_MONOCHROME},
34  {8, 2, 32, 32, LR_MONOCHROME},
35  {8, 3, 24, 24, LR_MONOCHROME},
36  {8, 4, 16, 16, LR_MONOCHROME},
37  {8, 2, 0, 0, LR_DEFAULTSIZE},
38  {8, 1, 48, 48, LR_DEFAULTSIZE},
39  /* Non exact sizes */
40  {8, 1, 41, 41, 0},
41  {8, 1, 40, 40, 0},
42  /* Non square sizes */
43  {8, 1, 16, 48, 0},
44  {8, 1, 48, 16, 0},
45  {16, 5, 0, 0, 0},
46  {16, 5, 48, 48, 0},
47  {16, 6, 32, 32, 0},
48  {16, 7, 24, 24, 0},
49  {16, 1, 0, 0, LR_MONOCHROME},
50  {16, 1, 48, 48, LR_MONOCHROME},
51  {16, 2, 32, 32, LR_MONOCHROME},
52  {16, 3, 24, 24, LR_MONOCHROME},
53  {16, 4, 16, 16, LR_MONOCHROME},
54  {16, 6, 0, 0, LR_DEFAULTSIZE},
55  {16, 5, 48, 48, LR_DEFAULTSIZE},
56  {24, 5, 0, 0, 0},
57  {24, 5, 48, 48, 0},
58  {24, 6, 32, 32, 0},
59  {24, 7, 24, 24, 0},
60  {24, 8, 16, 16, 0},
61  {16, 8, 16, 16, 0},
62  {24, 1, 0, 0, LR_MONOCHROME},
63  {24, 1, 48, 48, LR_MONOCHROME},
64  {24, 2, 32, 32, LR_MONOCHROME},
65  {24, 3, 24, 24, LR_MONOCHROME},
66  {24, 4, 16, 16, LR_MONOCHROME},
67  {24, 6, 0, 0, LR_DEFAULTSIZE},
68  {24, 5, 48, 48, LR_DEFAULTSIZE},
69  {32, 9, 0, 0, 0},
70  {32, 9, 48, 48, 0},
71  {32, 10, 32, 32, 0},
72  {32, 11, 24, 24, 0},
73  {32, 12, 16, 16, 0},
74  {32, 1, 0, 0, LR_MONOCHROME},
75  {32, 1, 48, 48, LR_MONOCHROME},
76  {32, 2, 32, 32, LR_MONOCHROME},
77  {32, 3, 24, 24, LR_MONOCHROME},
78  {32, 4, 16, 16, LR_MONOCHROME},
79  {32, 10, 0, 0, LR_DEFAULTSIZE},
80  {32, 9, 48, 48, LR_DEFAULTSIZE},
81  };
82 
83  hMod = GetModuleHandle(NULL);
84  ok(hMod != NULL, "\n");
85  /* Find our cursor directory resource */
86  hResource = FindResourceA(hMod,
89  ok(hResource != NULL, "\n");
90 
91  hMem = LoadResource(hMod, hResource);
92  ok(hMem != NULL, "\n");
93 
94  lpResource = LockResource(hMem);
95  ok(lpResource != NULL, "\n");
96 
97  dm.dmSize = sizeof(dm);
98  dm.dmDriverExtra = 0;
99 
101 
102  dwOrigBpp = dm.dmBitsPerPel;
103 
104  for (i = 0; i < sizeof(TestData)/sizeof(TestData[0]); i++)
105  {
106  dm.dmBitsPerPel = TestData[i].bpp;
108  {
109  skip("Unable to change bpp to %lu.\n", dm.dmBitsPerPel);
110  continue;
111  }
112  wResId = LookupIconIdFromDirectoryEx(lpResource, TRUE, TestData[i].cxDesired, TestData[i].cyDesired, TestData[i].flags);
113  ok(wResId == TestData[i].wResId, "Got %d, expected %d for %dx%dx%lu, flags %x.\n",
114  wResId,
115  TestData[i].wResId,
116  TestData[i].cxDesired,
117  TestData[i].cyDesired,
118  TestData[i].bpp,
119  TestData[i].flags);
120  }
121 
122  /* Restore */
123  dm.dmBitsPerPel = dwOrigBpp;
125 
126  FreeResource(hMem);
127 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define RT_GROUP_ICON
Definition: pedump.c:375
int WINAPI LookupIconIdFromDirectoryEx(_In_reads_bytes_(sizeof(NEWHEADER)) PBYTE, _In_ BOOL, _In_ int, _In_ int, _In_ UINT)
#define TRUE
Definition: types.h:120
#define IDI_TEST
Definition: resource.h:2
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
Definition: res.c:155
WORD dmDriverExtra
Definition: wingdi.h:1620
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
DWORD dmBitsPerPel
Definition: wingdi.h:1646
#define ENUM_CURRENT_SETTINGS
Definition: winuser.h:179
LONG WINAPI ChangeDisplaySettingsExW(LPCWSTR lpszDeviceName, LPDEVMODEW lpDevMode, HWND hwnd, DWORD dwflags, LPVOID lParam)
Definition: display.c:585
BOOL WINAPI FreeResource(HGLOBAL handle)
Definition: res.c:559
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
BOOL WINAPI EnumDisplaySettingsW(LPCWSTR lpszDeviceName, DWORD iModeNum, LPDEVMODEW lpDevMode)
Definition: display.c:408
#define LR_DEFAULTSIZE
Definition: winuser.h:1084
WORD dmSize
Definition: wingdi.h:1619
#define DISP_CHANGE_SUCCESSFUL
Definition: winuser.h:190
struct _TestData TestData
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161
unsigned char BYTE
Definition: xxhash.c:193
#define LR_MONOCHROME
Definition: winuser.h:1078
#define GetModuleHandle
Definition: winbase.h:3667
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define skip(...)
Definition: atltest.h:64
DWORD bpp
Definition: surface.c:182