ReactOS 0.4.16-dev-109-gf4cb10f
imagelist.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "objbase.h"
#include "commctrl.h"
#include "initguid.h"
#include "commoncontrols.h"
#include "shellapi.h"
#include "wine/test.h"
#include "v6util.h"
#include "resources.h"
#include "pshpack2.h"
#include "poppack.h"
Include dependency graph for imagelist.c:

Go to the source code of this file.

Classes

struct  _ILHEAD
 
struct  memstream
 

Macros

#define COBJMACROS
 
#define CONST_VTABLE
 
#define IMAGELIST_MAGIC   (('L' << 8) | 'I')
 
#define B(x, y)   ((x?0xf0:0)|(y?0xf:0))
 
#define ROW1(a, b, c, d, e, f, g, h)   B(a,b),B(c,d),B(e,f),B(g,h)
 
#define ROW32(a, b, c, d, e, f, g, h)
 
#define ROW2(a, b, c, d, e, f, g, h, i, j, k, l)   ROW1(a,b,c,d,e,f,g,h),B(i,j),B(k,l)
 
#define ROW48(a, b, c, d, e, f, g, h, i, j, k, l)
 
#define SIZEX1   47
 
#define SIZEY1   31
 
#define SIZEX2   11
 
#define SIZEY2   17
 
#define HOTSPOTS_MAX   4 /* Number of entries in hotspots */
 
#define BMP_CX   48
 
#define X(f)   p##f = (void*)GetProcAddress(hComCtl32, #f);
 
#define X2(f, ord)   p##f = (void*)GetProcAddress(hComCtl32, (const char *)ord);
 

Typedefs

typedef struct _ILHEAD ILHEAD
 

Functions

static HIMAGELIST (WINAPI *pImageList_Create)(int
 
static BOOL (WINAPI *pImageList_Destroy)(HIMAGELIST)
 
static int (WINAPI *pImageList_Add)(HIMAGELIST
 
static HRESULT (WINAPI *pImageList_CoCreateInstance)(REFCLSID
 
static const IUnknown void **static void **static RGBQUAD *static DWORD (WINAPI *pImageList_GetFlags)(HIMAGELIST)
 
static POINT *static void (WINAPI *pImageList_EndDrag)(void)
 
static INT (WINAPI *pImageList_GetImageCount)(HIMAGELIST)
 
static void force_redraw (HWND hwnd)
 
static BOOL is_v6_test (void)
 
static HIMAGELIST createImageList (int cx, int cy)
 
static HWND create_window (void)
 
static HDC show_image (HWND hwnd, HIMAGELIST himl, int idx, int size, LPCSTR loc, BOOL clear)
 
static void dump_bits (const BYTE *p, const BYTE *q, int size)
 
static void check_bits (HWND hwnd, HIMAGELIST himl, int idx, int size, const BYTE *checkbits, LPCSTR loc)
 
static void test_begindrag (void)
 
static void test_hotspot (void)
 
static void test_add_remove (void)
 
static void test_imagecount (void)
 
static void test_DrawIndirect (void)
 
static int get_color_format (HBITMAP bmp)
 
static void test_merge_colors (void)
 
static void test_merge (void)
 
static struct memstreamimpl_from_IStream (IStream *iface)
 
static HRESULT STDMETHODCALLTYPE Test_Stream_QueryInterface (IStream *iface, REFIID riid, void **ppvObject)
 
static ULONG STDMETHODCALLTYPE Test_Stream_AddRef (IStream *iface)
 
static ULONG STDMETHODCALLTYPE Test_Stream_Release (IStream *iface)
 
static HRESULT STDMETHODCALLTYPE Test_Stream_Read (IStream *iface, void *pv, ULONG cb, ULONG *pcbRead)
 
static HRESULT STDMETHODCALLTYPE Test_Stream_Write (IStream *iface, const void *pv, ULONG cb, ULONG *pcbWritten)
 
static HRESULT STDMETHODCALLTYPE Test_Stream_Seek (IStream *iface, LARGE_INTEGER offset, DWORD origin, ULARGE_INTEGER *new_pos)
 
static HRESULT STDMETHODCALLTYPE Test_Stream_SetSize (IStream *iface, ULARGE_INTEGER libNewSize)
 
static HRESULT STDMETHODCALLTYPE Test_Stream_CopyTo (IStream *iface, IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten)
 
static HRESULT STDMETHODCALLTYPE Test_Stream_Commit (IStream *iface, DWORD grfCommitFlags)
 
static HRESULT STDMETHODCALLTYPE Test_Stream_Revert (IStream *iface)
 
static HRESULT STDMETHODCALLTYPE Test_Stream_LockRegion (IStream *iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
 
static HRESULT STDMETHODCALLTYPE Test_Stream_UnlockRegion (IStream *iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
 
static HRESULT STDMETHODCALLTYPE Test_Stream_Stat (IStream *iface, STATSTG *pstatstg, DWORD grfStatFlag)
 
static HRESULT STDMETHODCALLTYPE Test_Stream_Clone (IStream *iface, IStream **ppstm)
 
static void init_memstream (struct memstream *stream)
 
static void cleanup_memstream (struct memstream *stream)
 
static INT DIB_GetWidthBytes (int width, int bpp)
 
static ULONG check_bitmap_data (const ILHEAD *header, const char *bm_data, ULONG bm_data_size, const SIZE *bmpsize, INT bpp, const char *comment)
 
static BOOL is_v6_header (const ILHEAD *header)
 
static void check_ilhead_data (const ILHEAD *ilh, INT cx, INT cy, INT cur, INT max, INT grow, INT flags)
 
static HBITMAP create_bitmap (INT cx, INT cy, COLORREF color, const char *comment)
 
static void imagelist_get_bitmap_size (const ILHEAD *header, SIZE *sz)
 
static void check_iml_data (HIMAGELIST himl, INT cx, INT cy, INT cur, INT max, INT grow, INT flags, const char *comment)
 
static void image_list_add_bitmap (HIMAGELIST himl, BYTE grey, int i)
 
static void image_list_init (HIMAGELIST himl, INT grow)
 
static void test_imagelist_storage (void)
 
static void test_shell_imagelist (void)
 
static HBITMAP create_test_bitmap (HDC hdc, int bpp, UINT32 pixel1, UINT32 pixel2)
 
static BOOL colour_match (UINT32 x, UINT32 y)
 
static void check_ImageList_DrawIndirect (IMAGELISTDRAWPARAMS *ildp, UINT32 *bits, UINT32 expected, int line)
 
static void check_ImageList_DrawIndirect_fStyle (HDC hdc, HIMAGELIST himl, UINT32 *bits, int i, UINT fStyle, UINT32 expected, int line)
 
static void check_ImageList_DrawIndirect_ILD_ROP (HDC hdc, HIMAGELIST himl, UINT32 *bits, int i, DWORD dwRop, UINT32 expected, int line)
 
static void check_ImageList_DrawIndirect_fState (HDC hdc, HIMAGELIST himl, UINT32 *bits, int i, UINT fStyle, UINT fState, DWORD Frame, UINT32 expected, int line)
 
static void check_ImageList_DrawIndirect_broken (HDC hdc, HIMAGELIST himl, UINT32 *bits, int i, UINT fStyle, UINT fState, DWORD Frame, UINT32 expected, UINT32 broken_expected, int line)
 
static void test_ImageList_DrawIndirect (void)
 
static void test_iimagelist (void)
 
static void test_IImageList_Add_Remove (void)
 
static void test_IImageList_Get_SetImageCount (void)
 
static void test_IImageList_Draw (void)
 
static void test_IImageList_Merge (void)
 
static void test_iconsize (void)
 
static void test_create_destroy (void)
 
static void check_color_table (const char *name, HDC hdc, HIMAGELIST himl, UINT ilc, RGBQUAD *expect, RGBQUAD *broken_expect)
 
static void get_default_color_table (HDC hdc, int bpp, RGBQUAD *table)
 
static void test_color_table (UINT ilc)
 
static void test_copy (void)
 
static void test_loadimage (void)
 
static void test_IImageList_Clone (void)
 
static void test_IImageList_GetBkColor (void)
 
static void test_IImageList_SetBkColor (void)
 
static void test_IImageList_GetImageCount (void)
 
static void test_IImageList_GetIconSize (void)
 
static void init_functions (void)
 
 START_TEST (imagelist)
 

Variables

static int
 
static UINT
 
static HBITMAP
 
static const IUnknown REFIID
 
static HICON
 
static HIMAGELIST
 
static LPCWSTR
 
static COLORREF
 
static INT
 
static HDC
 
static HINSTANCE hinst
 
static const BYTE empty_bits [48 *48/8]
 
static const BYTE icon_bits [32 *32/8]
 
static const BYTE bitmap_bits [48 *48/8]
 
static const IStreamVtbl Test_Stream_Vtbl
 

Macro Definition Documentation

◆ B

#define B (   x,
  y 
)    ((x?0xf0:0)|(y?0xf:0))

Definition at line 108 of file imagelist.c.

◆ BMP_CX

#define BMP_CX   48

Definition at line 702 of file imagelist.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 24 of file imagelist.c.

◆ CONST_VTABLE

#define CONST_VTABLE

Definition at line 25 of file imagelist.c.

◆ HOTSPOTS_MAX

#define HOTSPOTS_MAX   4 /* Number of entries in hotspots */

◆ IMAGELIST_MAGIC

#define IMAGELIST_MAGIC   (('L' << 8) | 'I')

Definition at line 44 of file imagelist.c.

◆ ROW1

#define ROW1 (   a,
  b,
  c,
  d,
  e,
  f,
  g,
  h 
)    B(a,b),B(c,d),B(e,f),B(g,h)

Definition at line 109 of file imagelist.c.

◆ ROW2

#define ROW2 (   a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
  i,
  j,
  k,
  l 
)    ROW1(a,b,c,d,e,f,g,h),B(i,j),B(k,l)

Definition at line 112 of file imagelist.c.

◆ ROW32

#define ROW32 (   a,
  b,
  c,
  d,
  e,
  f,
  g,
  h 
)
Value:
ROW1(a,b,c,d,e,f,g,h), ROW1(a,b,c,d,e,f,g,h), \
ROW1(a,b,c,d,e,f,g,h), ROW1(a,b,c,d,e,f,g,h)
const GLubyte * c
Definition: glext.h:8905
GLfloat f
Definition: glext.h:7540
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean g
Definition: glext.h:6204
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define d
Definition: ke_i.h:81
#define e
Definition: ke_i.h:82
#define ROW1(a, b, c, d, e, f, g, h)
Definition: imagelist.c:109

Definition at line 110 of file imagelist.c.

◆ ROW48

#define ROW48 (   a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
  i,
  j,
  k,
  l 
)
Value:
ROW2(a,b,c,d,e,f,g,h,i,j,k,l), \
ROW2(a,b,c,d,e,f,g,h,i,j,k,l), ROW2(a,b,c,d,e,f,g,h,i,j,k,l), \
ROW2(a,b,c,d,e,f,g,h,i,j,k,l)
r l[0]
Definition: byte_order.h:168
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
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 GLint GLint j
Definition: glfuncs.h:250
#define ROW2(a, b, c, d, e, f, g, h, i, j, k, l)
Definition: imagelist.c:112
int k
Definition: mpi.c:3369

Definition at line 113 of file imagelist.c.

◆ SIZEX1

#define SIZEX1   47

◆ SIZEX2

#define SIZEX2   11

◆ SIZEY1

#define SIZEY1   31

◆ SIZEY2

#define SIZEY2   17

◆ X

#define X (   f)    p##f = (void*)GetProcAddress(hComCtl32, #f);

◆ X2

#define X2 (   f,
  ord 
)    p##f = (void*)GetProcAddress(hComCtl32, (const char *)ord);

Typedef Documentation

◆ ILHEAD

Function Documentation

◆ BOOL()

static BOOL ( WINAPI pImageList_Destroy)
static

◆ check_bitmap_data()

static ULONG check_bitmap_data ( const ILHEAD header,
const char bm_data,
ULONG  bm_data_size,
const SIZE bmpsize,
INT  bpp,
const char comment 
)
static

Definition at line 857 of file imagelist.c.

859{
860 const BITMAPFILEHEADER *bmfh = (const BITMAPFILEHEADER *)bm_data;
861 const BITMAPINFOHEADER *bmih = (const BITMAPINFOHEADER *)(bm_data + sizeof(*bmfh));
862 ULONG hdr_size, image_size;
863
864 hdr_size = sizeof(*bmfh) + sizeof(*bmih);
865 if (bmih->biBitCount <= 8) hdr_size += (1 << bpp) * sizeof(RGBQUAD);
866
867 ok(bmfh->bfType == (('M' << 8) | 'B'), "wrong bfType 0x%02x\n", bmfh->bfType);
868 ok(bmfh->bfSize == hdr_size, "wrong bfSize 0x%02x\n", bmfh->bfSize);
869 ok(bmfh->bfReserved1 == 0, "wrong bfReserved1 0x%02x\n", bmfh->bfReserved1);
870 ok(bmfh->bfReserved2 == 0, "wrong bfReserved2 0x%02x\n", bmfh->bfReserved2);
871 ok(bmfh->bfOffBits == hdr_size, "wrong bfOffBits 0x%02x\n", bmfh->bfOffBits);
872
873 ok(bmih->biSize == sizeof(*bmih), "wrong biSize %d\n", bmih->biSize);
874 ok(bmih->biPlanes == 1, "wrong biPlanes %d\n", bmih->biPlanes);
875 ok(bmih->biBitCount == bpp, "wrong biBitCount %d\n", bmih->biBitCount);
876
877 image_size = DIB_GetWidthBytes(bmih->biWidth, bmih->biBitCount) * bmih->biHeight;
878 ok(bmih->biSizeImage == image_size, "wrong biSizeImage %u\n", bmih->biSizeImage);
879 ok(bmih->biWidth == bmpsize->cx && bmih->biHeight == bmpsize->cy, "Unexpected bitmap size %d x %d, "
880 "expected %d x %d\n", bmih->biWidth, bmih->biHeight, bmpsize->cx, bmpsize->cy);
881
882if (0)
883{
884 char fname[256];
885 FILE *f;
886 sprintf(fname, "bmp_%s.bmp", comment);
887 f = fopen(fname, "wb");
888 fwrite(bm_data, 1, bm_data_size, f);
889 fclose(f);
890}
891
892 return hdr_size + image_size;
893}
#define ok(value,...)
Definition: atltest.h:57
DWORD bpp
Definition: surface.c:185
ULONG RGBQUAD
Definition: precomp.h:59
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
_Check_return_opt_ _CRTIMP size_t __cdecl fwrite(_In_reads_bytes_(_Size *_Count) const void *_Str, _In_ size_t _Size, _In_ size_t _Count, _Inout_ FILE *_File)
#define f
Definition: ke_i.h:83
static GLint image_size(GLint width, GLint height, GLenum format, GLenum type)
Definition: mipmap.c:4858
#define sprintf(buf, format,...)
Definition: sprintf.c:55
static INT DIB_GetWidthBytes(int width, int bpp)
Definition: imagelist.c:852
#define comment(fmt, arg1)
Definition: rebar.c:843
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28
uint32_t ULONG
Definition: typedefs.h:59

Referenced by check_iml_data().

◆ check_bits()

static void check_bits ( HWND  hwnd,
HIMAGELIST  himl,
int  idx,
int  size,
const BYTE checkbits,
LPCSTR  loc 
)
static

Definition at line 245 of file imagelist.c.

247{
248 BYTE bits[100*100/8];
249 COLORREF c;
250 HDC hdc;
251 int x, y, i = -1;
252
253 if (!winetest_interactive || !himl) return;
254
255 memset(bits, 0, sizeof(bits));
256 hdc = show_image(hwnd, himl, idx, size, loc, FALSE);
257
258 c = GetPixel(hdc, 0, 0);
259
260 for (y = 0; y < size; y ++)
261 {
262 for (x = 0; x < size; x++)
263 {
264 if (!(x & 0x7)) i++;
265 if (GetPixel(hdc, x, y) != c) bits[i] |= (0x80 >> (x & 0x7));
266 }
267 }
268
269 BitBlt(hdc, 0, 0, size, size, hdc, size+1, size+1, SRCCOPY);
271
272 ok (memcmp(bits, checkbits, (size * size)/8) == 0,
273 "%s: bits different\n", loc);
274 if (memcmp(bits, checkbits, (size * size)/8))
275 dump_bits(bits, checkbits, size);
276}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
DWORD GetPixel(LPDIRECTDRAWSURFACE7 Surface, UINT x, UINT y)
Definition: blt.cpp:2
HIMAGELIST himl
#define FALSE
Definition: types.h:117
unsigned int idx
Definition: utils.c:41
static VOID BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Delta *Height) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Delta)
Definition: common.c:57
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLsizeiptr size
Definition: glext.h:5919
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
#define c
Definition: ke_i.h:80
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:88
static HDC show_image(HWND hwnd, HIMAGELIST himl, int idx, int size, LPCSTR loc, BOOL clear)
Definition: imagelist.c:200
static void dump_bits(const BYTE *p, const BYTE *q, int size)
Definition: imagelist.c:224
int winetest_interactive
#define memset(x, y, z)
Definition: compat.h:39
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
DWORD COLORREF
Definition: windef.h:300
#define SRCCOPY
Definition: wingdi.h:333
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
unsigned char BYTE
Definition: xxhash.c:193

Referenced by test_merge().

◆ check_color_table()

static void check_color_table ( const char name,
HDC  hdc,
HIMAGELIST  himl,
UINT  ilc,
RGBQUAD expect,
RGBQUAD broken_expect 
)
static

Definition at line 2021 of file imagelist.c.

2023{
2025 INT ret;
2026#ifdef __REACTOS__
2027 char bmi_buffer[FIELD_OFFSET(BITMAPINFO, bmiColors) + 256 * sizeof(RGBQUAD)];
2028#else
2029 char bmi_buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )];
2030#endif
2031 BITMAPINFO *bmi = (BITMAPINFO *)bmi_buffer;
2032 int i, depth = ilc & 0xfe;
2033
2034 ret = pImageList_GetImageInfo(himl, 0, &info);
2035 ok(ret, "got %d\n", ret);
2036 ok(info.hbmImage != NULL, "got %p\n", info.hbmImage);
2037
2038 memset(bmi_buffer, 0, sizeof(bmi_buffer));
2039 bmi->bmiHeader.biSize = sizeof(bmi->bmiHeader);
2040 ret = GetDIBits(hdc, info.hbmImage, 0, 0, NULL, bmi, DIB_RGB_COLORS);
2041 ok(ret, "got %d\n", ret);
2042 ok(bmi->bmiHeader.biBitCount == depth, "got %d\n", bmi->bmiHeader.biBitCount);
2043
2044 ret = GetDIBits(hdc, info.hbmImage, 0, 0, NULL, bmi, DIB_RGB_COLORS);
2045 ok(ret, "got %d\n", ret);
2046 ok(bmi->bmiHeader.biBitCount == depth, "got %d\n", bmi->bmiHeader.biBitCount);
2047
2048 for (i = 0; i < (1 << depth); i++)
2049 ok((bmi->bmiColors[i].rgbRed == expect[i].rgbRed &&
2050 bmi->bmiColors[i].rgbGreen == expect[i].rgbGreen &&
2051 bmi->bmiColors[i].rgbBlue == expect[i].rgbBlue) ||
2052 (broken_expect && broken(bmi->bmiColors[i].rgbRed == broken_expect[i].rgbRed &&
2053 bmi->bmiColors[i].rgbGreen == broken_expect[i].rgbGreen &&
2054 bmi->bmiColors[i].rgbBlue == broken_expect[i].rgbBlue)),
2055 "%d: %s: got color[%d] %02x %02x %02x expect %02x %02x %02x\n", depth, name, i,
2056 bmi->bmiColors[i].rgbRed, bmi->bmiColors[i].rgbGreen, bmi->bmiColors[i].rgbBlue,
2057 expect[i].rgbRed, expect[i].rgbGreen, expect[i].rgbBlue);
2058}
#define expect(EXPECTED, GOT)
Definition: SystemMenu.c:483
#define broken(x)
Definition: atltest.h:178
#define NULL
Definition: types.h:112
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
Definition: name.c:39
USHORT biBitCount
Definition: precomp.h:46
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1476
RGBQUAD bmiColors[1]
Definition: wingdi.h:1477
UCHAR rgbBlue
Definition: bootanim.c:103
UCHAR rgbRed
Definition: bootanim.c:105
UCHAR rgbGreen
Definition: bootanim.c:104
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
int32_t INT
Definition: typedefs.h:58
int ret
#define DIB_RGB_COLORS
Definition: wingdi.h:367
int WINAPI GetDIBits(_In_ HDC hdc, _In_ HBITMAP hbm, _In_ UINT start, _In_ UINT cLines, _Out_opt_ LPVOID lpvBits, _At_((LPBITMAPINFOHEADER) lpbmi, _Inout_) LPBITMAPINFO lpbmi, _In_ UINT usage)

Referenced by test_color_table().

◆ check_ilhead_data()

static void check_ilhead_data ( const ILHEAD ilh,
INT  cx,
INT  cy,
INT  cur,
INT  max,
INT  grow,
INT  flags 
)
static

Definition at line 900 of file imagelist.c.

901{
902 INT grow_aligned;
903
904 ok(ilh->usMagic == IMAGELIST_MAGIC, "wrong usMagic %4x (expected %02x)\n", ilh->usMagic, IMAGELIST_MAGIC);
905 ok(ilh->usVersion == 0x101 ||
906 ilh->usVersion == 0x600 || /* WinXP/W2k3 */
907 ilh->usVersion == 0x620, "Unknown usVersion %#x.\n", ilh->usVersion);
908 ok(ilh->cCurImage == cur, "wrong cCurImage %d (expected %d)\n", ilh->cCurImage, cur);
909
910 grow = max(grow, 1);
911 grow_aligned = (WORD)(grow + 3) & ~3;
912
913 if (is_v6_header(ilh))
914 {
915 grow = (WORD)(grow + 2 + 3) & ~3;
916 ok(ilh->cGrow == grow || broken(ilh->cGrow == grow_aligned) /* XP/Vista */,
917 "Unexpected cGrow %d, expected %d\n", ilh->cGrow, grow);
918 }
919 else
920 {
921 ok(ilh->cMaxImage == max, "wrong cMaxImage %d (expected %d)\n", ilh->cMaxImage, max);
922 ok(ilh->cGrow == grow_aligned, "Unexpected cGrow %d, expected %d\n", ilh->cGrow, grow_aligned);
923 }
924
925 ok(ilh->cx == cx, "wrong cx %d (expected %d)\n", ilh->cx, cx);
926 ok(ilh->cy == cy, "wrong cy %d (expected %d)\n", ilh->cy, cy);
927 ok(ilh->bkcolor == CLR_NONE, "wrong bkcolor %x\n", ilh->bkcolor);
928 ok(ilh->flags == flags || broken(!(ilh->flags & 0xfe) && (flags & 0xfe) == ILC_COLOR4), /* <= w2k */
929 "wrong flags %04x\n", ilh->flags);
930 ok(ilh->ovls[0] == -1, "wrong ovls[0] %04x\n", ilh->ovls[0]);
931 ok(ilh->ovls[1] == -1, "wrong ovls[1] %04x\n", ilh->ovls[1]);
932 ok(ilh->ovls[2] == -1, "wrong ovls[2] %04x\n", ilh->ovls[2]);
933 ok(ilh->ovls[3] == -1, "wrong ovls[3] %04x\n", ilh->ovls[3]);
934}
#define IMAGELIST_MAGIC
Definition: imagelist.c:117
unsigned short WORD
Definition: ntddk_ex.h:93
FxCollectionEntry * cur
GLbitfield flags
Definition: glext.h:7161
static BOOL is_v6_header(const ILHEAD *header)
Definition: imagelist.c:895
#define ILC_COLOR4
Definition: commctrl.h:354
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
#define CLR_NONE
Definition: commctrl.h:319
_Out_opt_ int * cx
Definition: commctrl.h:585
WORD cCurImage
Definition: imagelist.c:128
WORD flags
Definition: imagelist.c:134
WORD cy
Definition: imagelist.c:132
SHORT ovls[4]
Definition: imagelist.c:135
WORD cMaxImage
Definition: imagelist.c:129
USHORT usMagic
Definition: imagelist.c:126
WORD cGrow
Definition: imagelist.c:130
COLORREF bkcolor
Definition: imagelist.c:133
USHORT usVersion
Definition: imagelist.c:127
WORD cx
Definition: imagelist.c:131
#define max(a, b)
Definition: svc.c:63

Referenced by check_iml_data().

◆ check_ImageList_DrawIndirect()

static void check_ImageList_DrawIndirect ( IMAGELISTDRAWPARAMS ildp,
UINT32 bits,
UINT32  expected,
int  line 
)
static

Definition at line 1398 of file imagelist.c.

1400{
1401 bits[0] = 0x00FFFFFF;
1402 pImageList_DrawIndirect(ildp);
1404 "ImageList_DrawIndirect: Pixel %08X, Expected a close match to %08X from line %d\n",
1405 bits[0] & 0x00FFFFFF, expected, line);
1406}
static BOOL colour_match(UINT32 x, UINT32 y)
Definition: imagelist.c:1387
BOOL expected
Definition: store.c:2063
Definition: parser.c:49

Referenced by check_ImageList_DrawIndirect_fState(), check_ImageList_DrawIndirect_fStyle(), and check_ImageList_DrawIndirect_ILD_ROP().

◆ check_ImageList_DrawIndirect_broken()

static void check_ImageList_DrawIndirect_broken ( HDC  hdc,
HIMAGELIST  himl,
UINT32 bits,
int  i,
UINT  fStyle,
UINT  fState,
DWORD  Frame,
UINT32  expected,
UINT32  broken_expected,
int  line 
)
static

Definition at line 1433 of file imagelist.c.

1436{
1438 0, 0, 0, 0, 0, 0, CLR_NONE, CLR_NONE, fStyle, 0, fState, Frame, 0x00000000};
1439 bits[0] = 0x00FFFFFF;
1440 pImageList_DrawIndirect(&ildp);
1442 broken(colour_match(bits[0], broken_expected)),
1443 "ImageList_DrawIndirect: Pixel %08X, Expected a close match to %08X from line %d\n",
1444 bits[0] & 0x00FFFFFF, expected, line);
1445}

Referenced by test_ImageList_DrawIndirect().

◆ check_ImageList_DrawIndirect_fState()

static void check_ImageList_DrawIndirect_fState ( HDC  hdc,
HIMAGELIST  himl,
UINT32 bits,
int  i,
UINT  fStyle,
UINT  fState,
DWORD  Frame,
UINT32  expected,
int  line 
)
static

Definition at line 1425 of file imagelist.c.

1427{
1429 0, 0, 0, 0, 0, 0, CLR_NONE, CLR_NONE, fStyle, 0, fState, Frame, 0x00000000};
1431}
static void check_ImageList_DrawIndirect(IMAGELISTDRAWPARAMS *ildp, UINT32 *bits, UINT32 expected, int line)
Definition: imagelist.c:1398

Referenced by test_ImageList_DrawIndirect().

◆ check_ImageList_DrawIndirect_fStyle()

static void check_ImageList_DrawIndirect_fStyle ( HDC  hdc,
HIMAGELIST  himl,
UINT32 bits,
int  i,
UINT  fStyle,
UINT32  expected,
int  line 
)
static

Definition at line 1409 of file imagelist.c.

1411{
1413 0, 0, 0, 0, 0, 0, CLR_NONE, CLR_NONE, fStyle, 0, ILS_NORMAL, 0, 0x00000000};
1415}
#define ILS_NORMAL
Definition: commctrl.h:435

Referenced by test_ImageList_DrawIndirect().

◆ check_ImageList_DrawIndirect_ILD_ROP()

static void check_ImageList_DrawIndirect_ILD_ROP ( HDC  hdc,
HIMAGELIST  himl,
UINT32 bits,
int  i,
DWORD  dwRop,
UINT32  expected,
int  line 
)
static

Definition at line 1417 of file imagelist.c.

1419{
1421 0, 0, 0, 0, 0, 0, CLR_NONE, CLR_NONE, ILD_IMAGE | ILD_ROP, dwRop, ILS_NORMAL, 0, 0x00000000};
1423}
#define ILD_ROP
Definition: commctrl.h:421
#define ILD_IMAGE
Definition: commctrl.h:420

Referenced by test_ImageList_DrawIndirect().

◆ check_iml_data()

static void check_iml_data ( HIMAGELIST  himl,
INT  cx,
INT  cy,
INT  cur,
INT  max,
INT  grow,
INT  flags,
const char comment 
)
static

Definition at line 986 of file imagelist.c.

988{
989 INT ret, cxx, cyy, size;
990 struct memstream stream;
991 const ILHEAD *header;
992 LARGE_INTEGER mv;
993 HIMAGELIST himl2;
994 HGLOBAL hglobal;
995 STATSTG stat;
996 char *data;
997 HRESULT hr;
998 SIZE bmpsize;
999 BOOL b;
1000
1001 ret = pImageList_GetImageCount(himl);
1002 ok(ret == cur, "%s: expected image count %d got %d\n", comment, cur, ret);
1003
1004 ret = pImageList_GetIconSize(himl, &cxx, &cyy);
1005 ok(ret, "ImageList_GetIconSize failed\n");
1006 ok(cxx == cx, "%s: wrong cx %d (expected %d)\n", comment, cxx, cx);
1007 ok(cyy == cy, "%s: wrong cy %d (expected %d)\n", comment, cyy, cy);
1008
1010 b = pImageList_Write(himl, &stream.IStream_iface);
1011 ok(b, "%s: ImageList_Write failed\n", comment);
1012
1013 hr = GetHGlobalFromStream(stream.stream, &hglobal);
1014 ok(hr == S_OK, "%s: Failed to get hglobal, %#x\n", comment, hr);
1015
1016 hr = IStream_Stat(stream.stream, &stat, STATFLAG_NONAME);
1017 ok(hr == S_OK, "Stat() failed, hr %#x.\n", hr);
1018
1019 data = GlobalLock(hglobal);
1020
1021 ok(data != 0, "%s: ImageList_Write didn't write any data\n", comment);
1022 ok(stat.cbSize.LowPart > sizeof(ILHEAD), "%s: ImageList_Write wrote not enough data\n", comment);
1023
1024 header = (const ILHEAD *)data;
1027 size = check_bitmap_data(header, data + sizeof(ILHEAD), stat.cbSize.LowPart - sizeof(ILHEAD),
1028 &bmpsize, flags & 0xfe, comment);
1029 if (!is_v6_header(header) && size < stat.cbSize.LowPart - sizeof(ILHEAD)) /* mask is present */
1030 {
1031 ok( flags & ILC_MASK, "%s: extra data %u/%u but mask not expected\n", comment, stat.cbSize.LowPart, size );
1032 check_bitmap_data(header, data + sizeof(ILHEAD) + size, stat.cbSize.LowPart - sizeof(ILHEAD) - size,
1033 &bmpsize, 1, comment);
1034 }
1035
1036 /* rewind and reconstruct from stream */
1037 mv.QuadPart = 0;
1038 IStream_Seek(stream.stream, mv, STREAM_SEEK_SET, NULL);
1039 himl2 = pImageList_Read(&stream.IStream_iface);
1040 ok(himl2 != NULL, "%s: Failed to deserialize imagelist\n", comment);
1041 pImageList_Destroy(himl2);
1042
1043 GlobalUnlock(hglobal);
1045}
#define stat
Definition: acwin.h:99
static void imagelist_get_bitmap_size(HIMAGELIST himl, UINT count, SIZE *sz)
Definition: imagelist.c:192
HRESULT WINAPI GetHGlobalFromStream(IStream *pstm, HGLOBAL *phglobal)
unsigned int BOOL
Definition: ntddk_ex.h:94
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
#define S_OK
Definition: intsafe.h:52
#define b
Definition: ke_i.h:79
static void cleanup_memstream(struct memstream *stream)
Definition: imagelist.c:847
static void init_memstream(struct memstream *stream)
Definition: imagelist.c:838
static ULONG check_bitmap_data(const ILHEAD *header, const char *bm_data, ULONG bm_data_size, const SIZE *bmpsize, INT bpp, const char *comment)
Definition: imagelist.c:857
static void check_ilhead_data(const ILHEAD *ilh, INT cx, INT cy, INT cur, INT max, INT grow, INT flags)
Definition: imagelist.c:900
#define ILC_MASK
Definition: commctrl.h:351
HRESULT hr
Definition: shlfolder.c:183
Definition: stat.h:55
Definition: parse.h:23
IStream IStream_iface
Definition: request.c:4377
LONGLONG QuadPart
Definition: typedefs.h:114

Referenced by image_list_init(), and test_imagelist_storage().

◆ cleanup_memstream()

static void cleanup_memstream ( struct memstream stream)
static

Definition at line 847 of file imagelist.c.

848{
849 IStream_Release(stream->stream);
850}

Referenced by check_iml_data().

◆ colour_match()

static BOOL colour_match ( UINT32  x,
UINT32  y 
)
static

Definition at line 1387 of file imagelist.c.

1388{
1389 const INT32 tolerance = 8;
1390
1391 const INT32 dr = abs((INT32)(x & 0x000000FF) - (INT32)(y & 0x000000FF));
1392 const INT32 dg = abs((INT32)((x & 0x0000FF00) >> 8) - (INT32)((y & 0x0000FF00) >> 8));
1393 const INT32 db = abs((INT32)((x & 0x00FF0000) >> 16) - (INT32)((y & 0x00FF0000) >> 16));
1394
1395 return (dr <= tolerance && dg <= tolerance && db <= tolerance);
1396}
signed int INT32
#define abs(i)
Definition: fconv.c:206

Referenced by check_ImageList_DrawIndirect(), and check_ImageList_DrawIndirect_broken().

◆ create_bitmap()

static HBITMAP create_bitmap ( INT  cx,
INT  cy,
COLORREF  color,
const char comment 
)
static

Definition at line 936 of file imagelist.c.

937{
938 HDC hdc;
939 BITMAPINFO bmi;
940 HBITMAP hbmp, hbmp_old;
941 HBRUSH hbrush;
942 RECT rc = { 0, 0, cx, cy };
943
945
946 memset(&bmi, 0, sizeof(bmi));
947 bmi.bmiHeader.biSize = sizeof(bmi.bmiHeader);
948 bmi.bmiHeader.biHeight = cx;
949 bmi.bmiHeader.biWidth = cy;
950 bmi.bmiHeader.biBitCount = 24;
951 bmi.bmiHeader.biPlanes = 1;
954
955 hbmp_old = SelectObject(hdc, hbmp);
956
958 FillRect(hdc, &rc, hbrush);
960
962
963 SelectObject(hdc, hbmp_old);
964 DeleteDC(hdc);
965
966 return hbmp;
967}
static HBRUSH hbrush
HBITMAP hbmp
#define BI_RGB
Definition: precomp.h:56
pKey DeleteObject()
GLuint color
Definition: glext.h:6243
static HBITMAP
Definition: button.c:44
ULONG biCompression
Definition: precomp.h:47
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:245
INT WINAPI DrawTextA(HDC hdc, LPCSTR str, INT count, LPRECT rect, UINT flags)
Definition: font.c:373
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
BOOL WINAPI DeleteDC(_In_ HDC)
#define DT_CENTER
Definition: winuser.h:527
#define DT_SINGLELINE
Definition: winuser.h:540
#define DT_VCENTER
Definition: winuser.h:543

◆ create_test_bitmap()

static HBITMAP create_test_bitmap ( HDC  hdc,
int  bpp,
UINT32  pixel1,
UINT32  pixel2 
)
static

Definition at line 1365 of file imagelist.c.

1366{
1368 UINT32 *buffer = NULL;
1369 BITMAPINFO bitmapInfo = {{sizeof(BITMAPINFOHEADER), 2, 1, 1, bpp, BI_RGB,
1370 0, 0, 0, 0, 0}};
1371
1372 hBitmap = CreateDIBSection(hdc, &bitmapInfo, DIB_RGB_COLORS, (void**)&buffer, NULL, 0);
1373 ok(hBitmap != NULL && buffer != NULL, "CreateDIBSection failed.\n");
1374
1375 if(!hBitmap || !buffer)
1376 {
1378 return NULL;
1379 }
1380
1381 buffer[0] = pixel1;
1382 buffer[1] = pixel2;
1383
1384 return hBitmap;
1385}
unsigned int UINT32
static HBITMAP hBitmap
Definition: timezone.c:26
GLuint buffer
Definition: glext.h:5915

Referenced by test_ImageList_DrawIndirect().

◆ create_window()

static HWND create_window ( void  )
static

Definition at line 159 of file imagelist.c.

160{
161 char className[] = "bmwnd";
162 char winName[] = "Test Bitmap";
163 HWND hWnd;
164 static BOOL registered = FALSE;
165
166 if (!registered)
167 {
168 WNDCLASSA cls;
169
172 cls.cbClsExtra = 0;
173 cls.cbWndExtra = 0;
174 cls.hInstance = 0;
178 cls.lpszMenuName = 0;
179 cls.lpszClassName = className;
180
181 RegisterClassA (&cls);
182 registered = TRUE;
183 }
184
185 /* Setup window */
186 hWnd = CreateWindowA (className, winName,
188 CW_USEDEFAULT, CW_USEDEFAULT, 300, 300, 0,
189 0, hinst, 0);
190
192 {
195 }
196
197 return hWnd;
198}
HWND hWnd
Definition: settings.c:17
#define TRUE
Definition: types.h:120
static void force_redraw(HWND hwnd)
Definition: imagelist.c:93
static HINSTANCE hinst
Definition: imagelist.c:90
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
HBRUSH hbrBackground
Definition: winuser.h:3173
HICON hIcon
Definition: winuser.h:3171
HINSTANCE hInstance
Definition: winuser.h:3170
HCURSOR hCursor
Definition: winuser.h:3172
int cbWndExtra
Definition: winuser.h:3169
UINT style
Definition: winuser.h:3166
LPCSTR lpszMenuName
Definition: winuser.h:3174
LPCSTR lpszClassName
Definition: winuser.h:3175
WNDPROC lpfnWndProc
Definition: winuser.h:3167
int cbClsExtra
Definition: winuser.h:3168
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define WHITE_BRUSH
Definition: wingdi.h:902
#define CS_VREDRAW
Definition: winuser.h:658
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4318
#define CS_HREDRAW
Definition: winuser.h:653
#define IDC_ARROW
Definition: winuser.h:687
#define IDI_APPLICATION
Definition: winuser.h:704
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
HICON WINAPI LoadIconA(_In_opt_ HINSTANCE hInstance, _In_ LPCSTR lpIconName)
Definition: cursoricon.c:2112
#define CW_USEDEFAULT
Definition: winuser.h:225
#define CS_GLOBALCLASS
Definition: winuser.h:652
#define SW_SHOW
Definition: winuser.h:778
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2142
const char * LPCSTR
Definition: xmlstorage.h:183

Referenced by OLEACC_DllGetClassObject(), test_DrawIndirect(), test_foregroundwindow(), test_hotspot(), test_IImageList_Draw(), test_IImageList_Merge(), and test_merge().

◆ createImageList()

static HIMAGELIST createImageList ( int  cx,
int  cy 
)
static

Definition at line 147 of file imagelist.c.

148{
149 /* Create an ImageList and put an image into it */
150 HIMAGELIST himl = pImageList_Create(cx, cy, ILC_COLOR, 1, 1);
151 HBITMAP hbm = CreateBitmap(48, 48, 1, 1, bitmap_bits);
152
153 ok(himl != NULL, "Failed to create image list, %d x %d.\n", cx, cy);
154 pImageList_Add(himl, hbm, NULL);
156 return himl;
157}
static const BYTE bitmap_bits[48 *48/8]
Definition: imagelist.c:131
_In_ HBITMAP hbm
Definition: ntgdi.h:2776
#define ILC_COLOR
Definition: commctrl.h:352
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)

Referenced by test_begindrag(), test_copy(), test_hotspot(), and test_iimagelist().

◆ DIB_GetWidthBytes()

static INT DIB_GetWidthBytes ( int  width,
int  bpp 
)
static

Definition at line 852 of file imagelist.c.

853{
854 return ((width * bpp + 31) / 8) & ~3;
855}
GLint GLint GLsizei width
Definition: gl.h:1546

Referenced by check_bitmap_data().

◆ dump_bits()

static void dump_bits ( const BYTE p,
const BYTE q,
int  size 
)
static

Definition at line 224 of file imagelist.c.

225{
226 int i, j;
227
228 size /= 8;
229
230 for (i = 0; i < size * 2; i++)
231 {
232 printf("|");
233 for (j = 0; j < size; j++)
234 printf("%c%c", p[j] & 0xf0 ? 'X' : ' ', p[j] & 0xf ? 'X' : ' ');
235 printf(" -- ");
236 for (j = 0; j < size; j++)
237 printf("%c%c", q[j] & 0xf0 ? 'X' : ' ', q[j] & 0xf ? 'X' : ' ');
238 printf("|\n");
239 p += size * 4;
240 q += size * 4;
241 }
242 printf("\n");
243}
#define printf
Definition: freeldr.h:97
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by check_bits().

◆ DWORD()

static const IUnknown void **static void **static RGBQUAD *static DWORD ( WINAPI pImageList_GetFlags)
static

◆ force_redraw()

static void force_redraw ( HWND  hwnd)
static

Definition at line 93 of file imagelist.c.

94{
96 return;
97
99 Sleep(1000);
100}
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
BOOL WINAPI RedrawWindow(_In_opt_ HWND, _In_opt_ LPCRECT, _In_opt_ HRGN, _In_ UINT)
#define RDW_UPDATENOW
Definition: winuser.h:1223

Referenced by create_window(), show_image(), test_DrawIndirect(), and test_IImageList_Draw().

◆ get_color_format()

static int get_color_format ( HBITMAP  bmp)
static

Definition at line 560 of file imagelist.c.

561{
562 BITMAPINFO bmi;
564 HBITMAP hOldBmp = SelectObject(hdc, bmp);
565 int ret;
566
567 memset(&bmi, 0, sizeof(bmi));
568 bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
569 ret = GetDIBits(hdc, bmp, 0, 0, 0, &bmi, DIB_RGB_COLORS);
570 ok(ret, "GetDIBits failed\n");
571
572 SelectObject(hdc, hOldBmp);
573 DeleteDC(hdc);
574 return bmi.bmiHeader.biBitCount;
575}
BITMAP bmp
Definition: alphablend.c:62

Referenced by test_merge_colors().

◆ get_default_color_table()

static void get_default_color_table ( HDC  hdc,
int  bpp,
RGBQUAD table 
)
static

Definition at line 2060 of file imagelist.c.

2061{
2062#ifdef __REACTOS__
2063 char bmi_buffer[FIELD_OFFSET(BITMAPINFO, bmiColors) + 256 * sizeof(RGBQUAD)];
2064#else
2065 char bmi_buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )];
2066#endif
2067 BITMAPINFO *bmi = (BITMAPINFO *)bmi_buffer;
2068 HBITMAP tmp;
2069 int i;
2070 HPALETTE pal;
2071 PALETTEENTRY entries[256];
2072
2073 switch (bpp)
2074 {
2075 case 4:
2076 tmp = CreateBitmap( 1, 1, 1, 1, NULL );
2077 memset(bmi_buffer, 0, sizeof(bmi_buffer));
2078 bmi->bmiHeader.biSize = sizeof(bmi->bmiHeader);
2079 bmi->bmiHeader.biHeight = 1;
2080 bmi->bmiHeader.biWidth = 1;
2081 bmi->bmiHeader.biBitCount = bpp;
2082 bmi->bmiHeader.biPlanes = 1;
2084 GetDIBits( hdc, tmp, 0, 0, NULL, bmi, DIB_RGB_COLORS );
2085
2086 memcpy(table, bmi->bmiColors, (1 << bpp) * sizeof(RGBQUAD));
2087 table[7] = bmi->bmiColors[8];
2088 table[8] = bmi->bmiColors[7];
2089 DeleteObject( tmp );
2090 break;
2091
2092 case 8:
2094 GetPaletteEntries(pal, 0, 256, entries);
2095 for (i = 0; i < 256; i++)
2096 {
2097 table[i].rgbRed = entries[i].peRed;
2098 table[i].rgbGreen = entries[i].peGreen;
2099 table[i].rgbBlue = entries[i].peBlue;
2100 table[i].rgbReserved = 0;
2101 }
2102 DeleteObject(pal);
2103 break;
2104
2105 default:
2106 ok(0, "unhandled depth %d\n", bpp);
2107 }
2108}
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
UINT WINAPI GetPaletteEntries(HPALETTE hpal, UINT iStartIndex, UINT cEntries, LPPALETTEENTRY ppe)
Definition: palette.c:64
HPALETTE WINAPI CreateHalftonePalette(_In_opt_ HDC)

Referenced by test_color_table().

◆ HIMAGELIST()

static HIMAGELIST ( WINAPI pImageList_Create)
static

◆ HRESULT()

static HRESULT ( WINAPI pImageList_CoCreateInstance)
static

◆ image_list_add_bitmap()

static void image_list_add_bitmap ( HIMAGELIST  himl,
BYTE  grey,
int  i 
)
static

Definition at line 1047 of file imagelist.c.

1048{
1049 char comment[16];
1050 HBITMAP hbm;
1051 int ret;
1052
1053 sprintf(comment, "%d", i);
1054 hbm = create_bitmap(BMP_CX, BMP_CX, RGB(grey, grey, grey), comment);
1055 ret = pImageList_Add(himl, hbm, NULL);
1056 ok(ret != -1, "Failed to add image to imagelist.\n");
1058}
#define RGB(r, g, b)
Definition: precomp.h:71
#define BMP_CX
Definition: imagelist.c:702
static HBITMAP create_bitmap(void)
Definition: clipboard.c:534

Referenced by image_list_init().

◆ image_list_init()

static void image_list_init ( HIMAGELIST  himl,
INT  grow 
)
static

Definition at line 1060 of file imagelist.c.

1061{
1062 unsigned int i;
1063 static const struct test_data
1064 {
1065 BYTE grey;
1066 INT cx, cy, cur, max, bpp;
1067 const char *comment;
1068 } td[] =
1069 {
1070 { 255, BMP_CX, BMP_CX, 1, 2, 24, "total 1" },
1071 { 170, BMP_CX, BMP_CX, 2, 7, 24, "total 2" },
1072 { 85, BMP_CX, BMP_CX, 3, 7, 24, "total 3" },
1073 { 0, BMP_CX, BMP_CX, 4, 7, 24, "total 4" },
1074 { 0, BMP_CX, BMP_CX, 5, 7, 24, "total 5" },
1075 { 85, BMP_CX, BMP_CX, 6, 7, 24, "total 6" },
1076 { 170, BMP_CX, BMP_CX, 7, 12, 24, "total 7" },
1077 { 255, BMP_CX, BMP_CX, 8, 12, 24, "total 8" },
1078 { 255, BMP_CX, BMP_CX, 9, 12, 24, "total 9" },
1079 { 170, BMP_CX, BMP_CX, 10, 12, 24, "total 10" },
1080 { 85, BMP_CX, BMP_CX, 11, 12, 24, "total 11" },
1081 { 0, BMP_CX, BMP_CX, 12, 17, 24, "total 12" },
1082 { 0, BMP_CX, BMP_CX, 13, 17, 24, "total 13" },
1083 { 85, BMP_CX, BMP_CX, 14, 17, 24, "total 14" },
1084 { 170, BMP_CX, BMP_CX, 15, 17, 24, "total 15" },
1085 { 255, BMP_CX, BMP_CX, 16, 17, 24, "total 16" },
1086 { 255, BMP_CX, BMP_CX, 17, 22, 24, "total 17" },
1087 { 170, BMP_CX, BMP_CX, 18, 22, 24, "total 18" },
1088 { 85, BMP_CX, BMP_CX, 19, 22, 24, "total 19" },
1089 { 0, BMP_CX, BMP_CX, 20, 22, 24, "total 20" },
1090 { 0, BMP_CX, BMP_CX, 21, 22, 24, "total 21" },
1091 { 85, BMP_CX, BMP_CX, 22, 27, 24, "total 22" },
1092 { 170, BMP_CX, BMP_CX, 23, 27, 24, "total 23" },
1093 { 255, BMP_CX, BMP_CX, 24, 27, 24, "total 24" }
1094 };
1095
1096 check_iml_data(himl, BMP_CX, BMP_CX, 0, 2, grow, ILC_COLOR24, "total 0");
1097
1098 for (i = 0; i < ARRAY_SIZE(td); i++)
1099 {
1100 image_list_add_bitmap(himl, td[i].grey, i + 1);
1101 check_iml_data(himl, td[i].cx, td[i].cy, td[i].cur, td[i].max, grow, td[i].bpp, td[i].comment);
1102 }
1103}
#define ARRAY_SIZE(A)
Definition: main.h:20
static void check_iml_data(HIMAGELIST himl, INT cx, INT cy, INT cur, INT max, INT grow, INT flags, const char *comment)
Definition: imagelist.c:986
static void image_list_add_bitmap(HIMAGELIST himl, BYTE grey, int i)
Definition: imagelist.c:1047
#define ILC_COLOR24
Definition: commctrl.h:357

Referenced by test_imagelist_storage().

◆ imagelist_get_bitmap_size()

static void imagelist_get_bitmap_size ( const ILHEAD header,
SIZE sz 
)
inlinestatic

Definition at line 969 of file imagelist.c.

970{
971 const int tile_count = 4;
972
973 if (is_v6_header(header))
974 {
975 sz->cx = header->cx;
976 sz->cy = header->cMaxImage * header->cy;
977 }
978 else
979 {
980 sz->cx = header->cx * tile_count;
981 sz->cy = ((header->cMaxImage + tile_count - 1) / tile_count) * header->cy;
982 }
983}

◆ impl_from_IStream()

static struct memstream * impl_from_IStream ( IStream iface)
static

Definition at line 710 of file imagelist.c.

711{
712 return CONTAINING_RECORD(iface, struct memstream, IStream_iface);
713}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by Test_Stream_Read(), Test_Stream_Seek(), and Test_Stream_Write().

◆ init_functions()

static void init_functions ( void  )
static

Definition at line 2397 of file imagelist.c.

2398{
2399 HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
2400
2401#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
2402#define X2(f, ord) p##f = (void*)GetProcAddress(hComCtl32, (const char *)ord);
2429#undef X
2430#undef X2
2431}
BOOL WINAPI ImageList_Draw(HIMAGELIST himl, INT i, HDC hdc, INT x, INT y, UINT fStyle)
Definition: imagelist.c:1228
HRESULT WINAPI HIMAGELIST_QueryInterface(HIMAGELIST himl, REFIID riid, void **ppv)
Definition: imagelist.c:4038
BOOL WINAPI ImageList_Remove(HIMAGELIST himl, INT i)
Definition: imagelist.c:2568
INT WINAPI ImageList_Add(HIMAGELIST himl, HBITMAP hbmImage, HBITMAP hbmMask)
Definition: imagelist.c:448
BOOL WINAPI ImageList_Replace(HIMAGELIST himl, INT i, HBITMAP hbmImage, HBITMAP hbmMask)
Definition: imagelist.c:2703
INT WINAPI ImageList_ReplaceIcon(HIMAGELIST himl, INT nIndex, HICON hIcon)
Definition: imagelist.c:2779
BOOL WINAPI ImageList_GetImageInfo(HIMAGELIST himl, INT i, IMAGEINFO *pImageInfo)
Definition: imagelist.c:2088
VOID WINAPI ImageList_EndDrag(void)
Definition: imagelist.c:1847
HRESULT WINAPI ImageList_CoCreateInstance(REFCLSID rclsid, const IUnknown *punkOuter, REFIID riid, void **ppv)
Definition: imagelist.c:3430
BOOL WINAPI ImageList_DrawIndirect(IMAGELISTDRAWPARAMS *pimldp)
Definition: imagelist.c:1525
HIMAGELIST WINAPI ImageList_GetDragImage(POINT *ppt, POINT *pptHotspot)
Definition: imagelist.c:1900
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928
UINT WINAPI ImageList_SetColorTable(HIMAGELIST himl, UINT uStartIndex, UINT cEntries, const RGBQUAD *prgb)
Definition: imagelist.c:3403
HIMAGELIST WINAPI ImageList_LoadImageW(HINSTANCE hi, LPCWSTR lpbmp, INT cx, INT cGrow, COLORREF clrMask, UINT uType, UINT uFlags)
Definition: imagelist.c:2208
HIMAGELIST WINAPI ImageList_Merge(HIMAGELIST himl1, INT i1, HIMAGELIST himl2, INT i2, INT dx, INT dy)
Definition: imagelist.c:2300
BOOL WINAPI ImageList_Write(HIMAGELIST himl, IStream *pstm)
Definition: imagelist.c:3283
BOOL WINAPI ImageList_Copy(HIMAGELIST himlDst, INT iDst, HIMAGELIST himlSrc, INT iSrc, UINT uFlags)
Definition: imagelist.c:706
BOOL WINAPI ImageList_BeginDrag(HIMAGELIST himlTrack, INT iTrack, INT dxHotspot, INT dyHotspot)
Definition: imagelist.c:638
INT WINAPI ImageList_GetImageCount(HIMAGELIST himl)
Definition: imagelist.c:2063
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
BOOL WINAPI ImageList_SetImageCount(HIMAGELIST himl, UINT iImageCount)
Definition: imagelist.c:3089
BOOL WINAPI ImageList_GetIconSize(HIMAGELIST himl, INT *cx, INT *cy)
Definition: imagelist.c:2037
DWORD WINAPI ImageList_GetFlags(HIMAGELIST himl)
Definition: imagelist.c:1934
BOOL WINAPI ImageList_SetDragCursorImage(HIMAGELIST himlDrag, INT iDrag, INT dxHotspot, INT dyHotspot)
Definition: imagelist.c:2928
HIMAGELIST WINAPI ImageList_Read(IStream *pstm)
Definition: imagelist.c:2463
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
#define X2(f, ord)
#define X(f)

Referenced by START_TEST().

◆ init_memstream()

static void init_memstream ( struct memstream stream)
static

Definition at line 838 of file imagelist.c.

839{
840 HRESULT hr;
841
844 ok(hr == S_OK, "Failed to create a stream, hr %#x.\n", hr);
845}
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
static const IStreamVtbl Test_Stream_Vtbl
Definition: imagelist.c:820

Referenced by check_iml_data().

◆ int()

static int ( WINAPI pImageList_Add)
static

◆ INT()

static INT ( WINAPI pImageList_GetImageCount)
static

◆ is_v6_header()

static BOOL is_v6_header ( const ILHEAD header)
static

Definition at line 895 of file imagelist.c.

896{
897 return (header->usVersion & 0xff00) == 0x600;
898}

Referenced by check_ilhead_data(), check_iml_data(), and imagelist_get_bitmap_size().

◆ is_v6_test()

static BOOL is_v6_test ( void  )
static

Definition at line 102 of file imagelist.c.

103{
104 return pHIMAGELIST_QueryInterface != NULL;
105}

Referenced by test_imagelist_storage(), and Test_Stream_Seek().

◆ show_image()

static HDC show_image ( HWND  hwnd,
HIMAGELIST  himl,
int  idx,
int  size,
LPCSTR  loc,
BOOL  clear 
)
static

Definition at line 200 of file imagelist.c.

202{
203 HDC hdc;
204
205 if (!winetest_interactive || !himl) return NULL;
206
207 SetWindowTextA(hwnd, loc);
208 hdc = GetDC(hwnd);
209 pImageList_Draw(himl, idx, hdc, 0, 0, ILD_TRANSPARENT);
210
212
213 if (clear)
214 {
215 BitBlt(hdc, 0, 0, size, size, hdc, size+1, size+1, SRCCOPY);
217 hdc = NULL;
218 }
219
220 return hdc;
221}
#define ILD_TRANSPARENT
Definition: commctrl.h:418
BOOL WINAPI SetWindowTextA(_In_ HWND, _In_opt_ LPCSTR)
HDC WINAPI GetDC(_In_opt_ HWND)

Referenced by check_bits(), and test_hotspot().

◆ START_TEST()

START_TEST ( imagelist  )

Definition at line 2433 of file imagelist.c.

2434{
2435 ULONG_PTR ctx_cookie;
2436 HANDLE hCtx;
2437
2439
2441
2444 test_hotspot();
2448 test_merge();
2451 test_iconsize();
2454 test_copy();
2456
2457 /* Now perform v6 tests */
2458 if (!load_v6_module(&ctx_cookie, &hCtx))
2459 return;
2460
2462
2464
2465 /* Do v6.0 tests */
2469 test_merge();
2471 test_iconsize();
2474 test_copy();
2476
2480
2490
2492
2493 unload_v6_module(ctx_cookie, hCtx);
2494}
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
Definition: compobj.c:2002
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
static void test_create_destroy(void)
Definition: imagelist.c:1957
static void test_DrawIndirect(void)
Definition: imagelist.c:473
static void test_IImageList_Merge(void)
Definition: imagelist.c:1843
static void test_IImageList_GetBkColor(void)
Definition: imagelist.c:2299
static void test_IImageList_Add_Remove(void)
Definition: imagelist.c:1663
static void test_hotspot(void)
Definition: imagelist.c:323
static void test_IImageList_GetImageCount(void)
Definition: imagelist.c:2351
static void test_iimagelist(void)
Definition: imagelist.c:1583
static void test_IImageList_GetIconSize(void)
Definition: imagelist.c:2375
static void test_shell_imagelist(void)
Definition: imagelist.c:1318
static void test_copy(void)
Definition: imagelist.c:2232
static void test_IImageList_Get_SetImageCount(void)
Definition: imagelist.c:1722
static void test_IImageList_SetBkColor(void)
Definition: imagelist.c:2321
static void test_imagelist_storage(void)
Definition: imagelist.c:1105
static void test_imagecount(void)
Definition: imagelist.c:448
static void test_ImageList_DrawIndirect(void)
Definition: imagelist.c:1447
static void test_IImageList_Clone(void)
Definition: imagelist.c:2275
static void init_functions(void)
Definition: imagelist.c:2397
static void test_add_remove(void)
Definition: imagelist.c:397
static void test_iconsize(void)
Definition: imagelist.c:1929
static void test_color_table(UINT ilc)
Definition: imagelist.c:2110
static void test_loadimage(void)
Definition: imagelist.c:2255
static void test_begindrag(void)
Definition: imagelist.c:278
static void test_merge(void)
Definition: imagelist.c:624
static void test_IImageList_Draw(void)
Definition: imagelist.c:1755
static void test_merge_colors(void)
Definition: imagelist.c:577
@ COINIT_APARTMENTTHREADED
Definition: objbase.h:278
#define ILC_COLOR8
Definition: commctrl.h:355
uint32_t ULONG_PTR
Definition: typedefs.h:65
static BOOL load_v6_module(ULONG_PTR *pcookie, HANDLE *hCtx)
Definition: v6util.h:73
static void unload_v6_module(ULONG_PTR cookie, HANDLE hCtx)
Definition: v6util.h:65

◆ test_add_remove()

static void test_add_remove ( void  )
static

Definition at line 397 of file imagelist.c.

398{
400
401 HICON hicon1 ;
402 HICON hicon2 ;
403 HICON hicon3 ;
404
405 /* create an imagelist to play with */
406 himl = pImageList_Create(84, 84, ILC_COLOR16, 0, 3);
407 ok(himl!=0,"failed to create imagelist\n");
408
409 /* load the icons to add to the image list */
410 hicon1 = CreateIcon(hinst, 32, 32, 1, 1, icon_bits, icon_bits);
411 ok(hicon1 != 0, "no hicon1\n");
412 hicon2 = CreateIcon(hinst, 32, 32, 1, 1, icon_bits, icon_bits);
413 ok(hicon2 != 0, "no hicon2\n");
414 hicon3 = CreateIcon(hinst, 32, 32, 1, 1, icon_bits, icon_bits);
415 ok(hicon3 != 0, "no hicon3\n");
416
417 /* remove when nothing exists */
418 ok(!pImageList_Remove(himl, 0), "Removed nonexistent icon.\n");
419 /* removing everything from an empty imagelist should succeed */
420 ok(pImageList_Remove(himl, -1), "Removed nonexistent icon\n");
421
422 /* add three */
423 ok(0 == pImageList_ReplaceIcon(himl, -1, hicon1), "Failed to add icon1.\n");
424 ok(1 == pImageList_ReplaceIcon(himl, -1, hicon2), "Failed to add icon2.\n");
425 ok(2 == pImageList_ReplaceIcon(himl, -1, hicon3), "Failed to add icon3.\n");
426
427 /* remove an index out of range */
428 ok(!pImageList_Remove(himl, 4711), "removed nonexistent icon\n");
429
430 /* remove three */
431 ok(pImageList_Remove(himl, 0), "Can't remove 0\n");
432 ok(pImageList_Remove(himl, 0), "Can't remove 0\n");
433 ok(pImageList_Remove(himl, 0), "Can't remove 0\n");
434
435 /* remove one extra */
436 ok(!pImageList_Remove(himl, 0), "Removed nonexistent icon.\n");
437
438 /* destroy it */
439 ok(pImageList_Destroy(himl), "Failed to destroy imagelist.\n");
440
441 ok(-1 == pImageList_ReplaceIcon((HIMAGELIST)0xdeadbeef, -1, hicon1), "Don't crash on bad handle\n");
442
443 ok(DestroyIcon(hicon1), "Failed to destroy icon 1.\n");
444 ok(DestroyIcon(hicon2), "Failed to destroy icon 2.\n");
445 ok(DestroyIcon(hicon3), "Failed to destroy icon 3.\n");
446}
static HICON
Definition: imagelist.c:80
static const BYTE icon_bits[32 *32/8]
Definition: imagelist.c:119
#define ILC_COLOR16
Definition: commctrl.h:356
HICON WINAPI CreateIcon(_In_opt_ HINSTANCE, _In_ int, _In_ int, _In_ BYTE, _In_ BYTE, _In_ const BYTE *, _In_ const BYTE *)
Definition: cursoricon.c:2447
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2105

Referenced by START_TEST().

◆ test_begindrag()

static void test_begindrag ( void  )
static

Definition at line 278 of file imagelist.c.

279{
281 HIMAGELIST drag;
282 BOOL ret;
283 int count;
284 POINT hotspot;
285
286 count = pImageList_GetImageCount(himl);
287 ok(count > 2, "Tests need an ImageList with more than 2 images\n");
288
289 /* Two BeginDrag() without EndDrag() in between */
290 ret = pImageList_BeginDrag(himl, 1, 0, 0);
291 drag = pImageList_GetDragImage(NULL, NULL);
292 ok(ret && drag, "ImageList_BeginDrag() failed\n");
293 ret = pImageList_BeginDrag(himl, 0, 3, 5);
294 ok(!ret, "ImageList_BeginDrag() returned TRUE\n");
295 drag = pImageList_GetDragImage(NULL, &hotspot);
296 ok(!!drag, "No active ImageList drag left\n");
297 ok(hotspot.x == 0 && hotspot.y == 0, "New ImageList drag was created\n");
298 pImageList_EndDrag();
299 drag = pImageList_GetDragImage(NULL, NULL);
300 ok(!drag, "ImageList drag was not destroyed\n");
301
302 /* Invalid image index */
303 pImageList_BeginDrag(himl, 0, 0, 0);
304 ret = pImageList_BeginDrag(himl, count, 3, 5);
305 ok(!ret, "ImageList_BeginDrag() returned TRUE\n");
306 drag = pImageList_GetDragImage(NULL, &hotspot);
307 ok(drag && hotspot.x == 0 && hotspot.y == 0, "Active drag should not have been canceled\n");
308 pImageList_EndDrag();
309 drag = pImageList_GetDragImage(NULL, NULL);
310 ok(!drag, "ImageList drag was not destroyed\n");
311 /* Invalid negative image indexes succeed */
312 ret = pImageList_BeginDrag(himl, -17, 0, 0);
313 drag = pImageList_GetDragImage(NULL, NULL);
314 ok(ret && drag, "ImageList drag was created\n");
315 pImageList_EndDrag();
316 ret = pImageList_BeginDrag(himl, -1, 0, 0);
317 drag = pImageList_GetDragImage(NULL, NULL);
318 ok(ret && drag, "ImageList drag was created\n");
319 pImageList_EndDrag();
320 pImageList_Destroy(himl);
321}
GLuint GLuint GLsizei count
Definition: gl.h:1545
static HIMAGELIST createImageList(int cx, int cy)
Definition: imagelist.c:147
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48

Referenced by START_TEST().

◆ test_color_table()

static void test_color_table ( UINT  ilc)
static

Definition at line 2110 of file imagelist.c.

2111{
2113 INT ret;
2114#ifdef __REACTOS__
2115 char bmi_buffer[FIELD_OFFSET(BITMAPINFO, bmiColors) + 256 * sizeof(RGBQUAD)];
2116#else
2117 char bmi_buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )];
2118#endif
2119 BITMAPINFO *bmi = (BITMAPINFO *)bmi_buffer;
2121 HBITMAP dib4, dib8, dib32;
2122 RGBQUAD rgb[256], default_table[256];
2123
2124 get_default_color_table(hdc, ilc & 0xfe, default_table);
2125
2126 himl = pImageList_Create(16, 16, ilc, 0, 3);
2127 ok(himl != NULL, "got %p\n", himl);
2128
2129 memset(bmi_buffer, 0, sizeof(bmi_buffer));
2130 bmi->bmiHeader.biSize = sizeof(bmi->bmiHeader);
2131 bmi->bmiHeader.biHeight = 16;
2132 bmi->bmiHeader.biWidth = 16;
2133 bmi->bmiHeader.biBitCount = 8;
2134 bmi->bmiHeader.biPlanes = 1;
2136 bmi->bmiColors[0].rgbRed = 0xff;
2137 bmi->bmiColors[1].rgbGreen = 0xff;
2138 bmi->bmiColors[2].rgbBlue = 0xff;
2139
2140 dib8 = CreateDIBSection(hdc, bmi, DIB_RGB_COLORS, NULL, NULL, 0);
2141
2142 bmi->bmiHeader.biBitCount = 4;
2143 bmi->bmiColors[0].rgbRed = 0xff;
2144 bmi->bmiColors[0].rgbGreen = 0x00;
2145 bmi->bmiColors[0].rgbBlue = 0xff;
2146 bmi->bmiColors[1].rgbRed = 0xff;
2147 bmi->bmiColors[1].rgbGreen = 0xff;
2148 bmi->bmiColors[1].rgbBlue = 0x00;
2149 bmi->bmiColors[2].rgbRed = 0x00;
2150 bmi->bmiColors[2].rgbGreen = 0xff;
2151 bmi->bmiColors[2].rgbBlue = 0xff;
2152
2153 dib4 = CreateDIBSection(hdc, bmi, DIB_RGB_COLORS, NULL, NULL, 0);
2154
2155 bmi->bmiHeader.biBitCount = 32;
2156
2157 dib32 = CreateDIBSection(hdc, bmi, DIB_RGB_COLORS, NULL, NULL, 0);
2158
2159 /* add 32 first then 8. This won't set the color table */
2160 ret = pImageList_Add(himl, dib32, NULL);
2161 ok(ret == 0, "got %d\n", ret);
2162 ret = pImageList_Add(himl, dib8, NULL);
2163 ok(ret == 1, "got %d\n", ret);
2164
2165 check_color_table("add 32, 8", hdc, himl, ilc, default_table, NULL);
2166
2167 /* since the previous _Adds didn't set the color table, this one will */
2168 ret = pImageList_Remove(himl, -1);
2169 ok(ret, "got %d\n", ret);
2170 ret = pImageList_Add(himl, dib8, NULL);
2171 ok(ret == 0, "got %d\n", ret);
2172
2173 memset(rgb, 0, sizeof(rgb));
2174 rgb[0].rgbRed = 0xff;
2175 rgb[1].rgbGreen = 0xff;
2176 rgb[2].rgbBlue = 0xff;
2177 check_color_table("remove all, add 8", hdc, himl, ilc, rgb, default_table);
2178
2179 /* remove all, add 4. Color table remains the same since it's implicitly
2180 been set by the previous _Add */
2181 ret = pImageList_Remove(himl, -1);
2182 ok(ret, "got %d\n", ret);
2183 ret = pImageList_Add(himl, dib4, NULL);
2184 ok(ret == 0, "got %d\n", ret);
2185 check_color_table("remove all, add 4", hdc, himl, ilc, rgb, default_table);
2186
2187 pImageList_Destroy(himl);
2188 himl = pImageList_Create(16, 16, ilc, 0, 3);
2189 ok(himl != NULL, "got %p\n", himl);
2190
2191 /* add 4 */
2192 ret = pImageList_Add(himl, dib4, NULL);
2193 ok(ret == 0, "got %d\n", ret);
2194
2195 memset(rgb, 0, 16 * sizeof(rgb[0]));
2196 rgb[0].rgbRed = 0xff;
2197 rgb[0].rgbBlue = 0xff;
2198 rgb[1].rgbRed = 0xff;
2199 rgb[1].rgbGreen = 0xff;
2200 rgb[2].rgbGreen = 0xff;
2201 rgb[2].rgbBlue = 0xff;
2202 memcpy(rgb + 16, default_table + 16, 240 * sizeof(rgb[0]));
2203
2204 check_color_table("add 4", hdc, himl, ilc, rgb, default_table);
2205
2206 pImageList_Destroy(himl);
2207 himl = pImageList_Create(16, 16, ilc, 0, 3);
2208 ok(himl != NULL, "got %p\n", himl);
2209
2210 /* set color table, add 8 */
2211 ret = pImageList_Remove(himl, -1);
2212 ok(ret, "got %d\n", ret);
2213 memset(rgb, 0, sizeof(rgb));
2214 rgb[0].rgbRed = 0xcc;
2215 rgb[1].rgbBlue = 0xcc;
2216 ret = pImageList_SetColorTable(himl, 0, 2, rgb);
2217 ok(ret == 2, "got %d\n", ret);
2218 /* the table is set, so this doesn't change it */
2219 ret = pImageList_Add(himl, dib8, NULL);
2220 ok(ret == 0, "got %d\n", ret);
2221
2222 memcpy(rgb + 2, default_table + 2, 254 * sizeof(rgb[0]));
2223 check_color_table("SetColorTable", hdc, himl, ilc, rgb, NULL);
2224
2225 DeleteObject(dib32);
2226 DeleteObject(dib8);
2227 DeleteObject(dib4);
2228 DeleteDC(hdc);
2229 pImageList_Destroy(himl);
2230}
static void get_default_color_table(HDC hdc, int bpp, RGBQUAD *table)
Definition: imagelist.c:2060
static void check_color_table(const char *name, HDC hdc, HIMAGELIST himl, UINT ilc, RGBQUAD *expect, RGBQUAD *broken_expect)
Definition: imagelist.c:2021
_In_ ULONG _In_ ULONG rgb
Definition: winddi.h:3521

Referenced by START_TEST().

◆ test_copy()

static void test_copy ( void  )
static

Definition at line 2232 of file imagelist.c.

2233{
2235 BOOL ret;
2236 int count;
2237
2238 dst = pImageList_Create(5, 11, ILC_COLOR, 1, 1);
2239 count = pImageList_GetImageCount(dst);
2240 ok(!count, "ImageList not empty.\n");
2241 src = createImageList(7, 13);
2242 count = pImageList_GetImageCount(src);
2243 ok(count > 2, "Tests need an ImageList with more than 2 images\n");
2244
2245 /* ImageList_Copy() cannot copy between two ImageLists */
2246 ret = pImageList_Copy(dst, 0, src, 2, ILCF_MOVE);
2247 ok(!ret, "ImageList_Copy() should have returned FALSE\n");
2248 count = pImageList_GetImageCount(dst);
2249 ok(count == 0, "Expected no image in dst ImageList, got %d\n", count);
2250
2251 pImageList_Destroy(dst);
2252 pImageList_Destroy(src);
2253}
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
#define ILCF_MOVE
Definition: commctrl.h:510

Referenced by START_TEST().

◆ test_create_destroy()

static void test_create_destroy ( void  )
static

Definition at line 1957 of file imagelist.c.

1958{
1960 INT cx, cy;
1961 BOOL rc;
1962 INT ret;
1963
1964 /* list with zero or negative image dimensions */
1965 himl = pImageList_Create(0, 0, ILC_COLOR16, 0, 3);
1966 ok(himl == NULL, "got %p\n", himl);
1967
1968 himl = pImageList_Create(0, 16, ILC_COLOR16, 0, 3);
1969 ok(himl == NULL, "got %p\n", himl);
1970
1971 himl = pImageList_Create(16, 0, ILC_COLOR16, 0, 3);
1972 ok(himl == NULL, "got %p\n", himl);
1973
1974 himl = pImageList_Create(16, -1, ILC_COLOR16, 0, 3);
1975 ok(himl == NULL, "got %p\n", himl);
1976
1977 himl = pImageList_Create(-1, 16, ILC_COLOR16, 0, 3);
1978 ok(himl == NULL, "got %p\n", himl);
1979
1980 rc = pImageList_Destroy((HIMAGELIST)0xdeadbeef);
1981 ok(rc == FALSE, "ImageList_Destroy(0xdeadbeef) should fail and not crash\n");
1982
1983 /* DDB image lists */
1984 himl = pImageList_Create(0, 14, ILC_COLORDDB, 4, 4);
1985 ok(himl != NULL, "got %p\n", himl);
1986
1987 pImageList_GetIconSize(himl, &cx, &cy);
1988 ok (cx == 0, "Wrong cx (%i)\n", cx);
1989 ok (cy == 14, "Wrong cy (%i)\n", cy);
1990 pImageList_Destroy(himl);
1991
1992 himl = pImageList_Create(0, 0, ILC_COLORDDB, 4, 4);
1993 ok(himl != NULL, "got %p\n", himl);
1994 pImageList_GetIconSize(himl, &cx, &cy);
1995 ok (cx == 0, "Wrong cx (%i)\n", cx);
1996 ok (cy == 0, "Wrong cy (%i)\n", cy);
1997 pImageList_Destroy(himl);
1998
1999 himl = pImageList_Create(0, 0, ILC_COLORDDB, 0, 4);
2000 ok(himl != NULL, "got %p\n", himl);
2001 pImageList_GetIconSize(himl, &cx, &cy);
2002 ok (cx == 0, "Wrong cx (%i)\n", cx);
2003 ok (cy == 0, "Wrong cy (%i)\n", cy);
2004
2005 pImageList_SetImageCount(himl, 3);
2006 ret = pImageList_GetImageCount(himl);
2007 ok(ret == 3, "Unexpected image count after increase\n");
2008
2009 /* Trying to actually add an image causes a crash on Windows */
2010 pImageList_Destroy(himl);
2011
2012 /* Negative values fail */
2013 himl = pImageList_Create(-1, -1, ILC_COLORDDB, 4, 4);
2014 ok(himl == NULL, "got %p\n", himl);
2015 himl = pImageList_Create(-1, 1, ILC_COLORDDB, 4, 4);
2016 ok(himl == NULL, "got %p\n", himl);
2017 himl = pImageList_Create(1, -1, ILC_COLORDDB, 4, 4);
2018 ok(himl == NULL, "got %p\n", himl);
2019}
#define ILC_COLORDDB
Definition: commctrl.h:353

Referenced by START_TEST().

◆ test_DrawIndirect()

static void test_DrawIndirect ( void  )
static

Definition at line 473 of file imagelist.c.

474{
476
477 HBITMAP hbm1;
478 HBITMAP hbm2;
479 HBITMAP hbm3;
480
482 HDC hdc;
483 HWND hwndfortest;
484
485 if (!pImageList_DrawIndirect)
486 {
487 win_skip("ImageList_DrawIndirect not available, skipping test\n");
488 return;
489 }
490
491 hwndfortest = create_window();
492 hdc = GetDC(hwndfortest);
493 ok(hdc!=NULL, "couldn't get DC\n");
494
495 /* create an imagelist to play with */
496 himl = pImageList_Create(48, 48, ILC_COLOR16, 0, 3);
497 ok(himl != 0, "Failed to create imagelist.\n");
498
499 /* load the icons to add to the image list */
500 hbm1 = CreateBitmap(48, 48, 1, 1, bitmap_bits);
501 ok(hbm1 != 0, "no bitmap 1\n");
502 hbm2 = CreateBitmap(48, 48, 1, 1, bitmap_bits);
503 ok(hbm2 != 0, "no bitmap 2\n");
504 hbm3 = CreateBitmap(48, 48, 1, 1, bitmap_bits);
505 ok(hbm3 != 0, "no bitmap 3\n");
506
507 /* add three */
508 ok(0 == pImageList_Add(himl, hbm1, 0),"failed to add bitmap 1\n");
509 ok(1 == pImageList_Add(himl, hbm2, 0),"failed to add bitmap 2\n");
510
511 if (pImageList_SetImageCount)
512 {
513 ok(pImageList_SetImageCount(himl,3),"Setimage count failed\n");
514 /*ok(2==ImageList_Add(himl, hbm3, NULL),"failed to add bitmap 3\n"); */
515 ok(pImageList_Replace(himl, 2, hbm3, 0),"failed to replace bitmap 3\n");
516 }
517
518 memset(&imldp, 0, sizeof (imldp));
519 ok(!pImageList_DrawIndirect(&imldp), "zero data succeeded!\n");
521 ok(!pImageList_DrawIndirect(&imldp), "zero hdc succeeded!\n");
522 imldp.hdcDst = hdc;
523 ok(!pImageList_DrawIndirect(&imldp),"zero himl succeeded!\n");
524 imldp.himl = (HIMAGELIST)0xdeadbeef;
525 ok(!pImageList_DrawIndirect(&imldp),"bad himl succeeded!\n");
526 imldp.himl = himl;
527
528 force_redraw(hwndfortest);
529
530 imldp.fStyle = SRCCOPY;
531 imldp.rgbBk = CLR_DEFAULT;
532 imldp.rgbFg = CLR_DEFAULT;
533 imldp.y = 100;
534 imldp.x = 100;
535 ok(pImageList_DrawIndirect(&imldp),"should succeed\n");
536 imldp.i ++;
537 ok(pImageList_DrawIndirect(&imldp),"should succeed\n");
538 imldp.i ++;
539 ok(pImageList_DrawIndirect(&imldp),"should succeed\n");
540 imldp.i ++;
541 ok(!pImageList_DrawIndirect(&imldp),"should fail\n");
542
543 /* remove three */
544 ok(pImageList_Remove(himl, 0), "removing 1st bitmap\n");
545 ok(pImageList_Remove(himl, 0), "removing 2nd bitmap\n");
546 ok(pImageList_Remove(himl, 0), "removing 3rd bitmap\n");
547
548 /* destroy it */
549 ok(pImageList_Destroy(himl), "Failed to destroy imagelist.\n");
550
551 /* bitmaps should not be deleted by the imagelist */
552 ok(DeleteObject(hbm1),"bitmap 1 can't be deleted\n");
553 ok(DeleteObject(hbm2),"bitmap 2 can't be deleted\n");
554 ok(DeleteObject(hbm3),"bitmap 3 can't be deleted\n");
555
556 ReleaseDC(hwndfortest, hdc);
557 DestroyWindow(hwndfortest);
558}
static HIMAGELIST
Definition: imagelist.c:82
static HWND create_window(void)
Definition: imagelist.c:159
#define IMAGELISTDRAWPARAMS_V3_SIZE
Definition: commctrl.h:348
#define CLR_DEFAULT
Definition: commctrl.h:320
#define win_skip
Definition: test.h:163
BOOL WINAPI DestroyWindow(_In_ HWND)

Referenced by START_TEST().

◆ test_hotspot()

static void test_hotspot ( void  )
static

Definition at line 323 of file imagelist.c.

324{
325 struct hotspot {
326 int dx;
327 int dy;
328 };
329
330#define SIZEX1 47
331#define SIZEY1 31
332#define SIZEX2 11
333#define SIZEY2 17
334#define HOTSPOTS_MAX 4 /* Number of entries in hotspots */
335 static const struct hotspot hotspots[HOTSPOTS_MAX] = {
336 { 10, 7 },
337 { SIZEX1, SIZEY1 },
338 { -9, -8 },
339 { -7, 35 }
340 };
341 int i, j, ret;
345
346
347 for (i = 0; i < HOTSPOTS_MAX; i++) {
348 for (j = 0; j < HOTSPOTS_MAX; j++) {
349 int dx1 = hotspots[i].dx;
350 int dy1 = hotspots[i].dy;
351 int dx2 = hotspots[j].dx;
352 int dy2 = hotspots[j].dy;
353 int correctx, correcty, newx, newy;
354 char loc[256];
355 HIMAGELIST himlNew;
356 POINT ppt;
357
358 ret = pImageList_BeginDrag(himl1, 0, dx1, dy1);
359 ok(ret != 0, "BeginDrag failed for { %d, %d }\n", dx1, dy1);
360 sprintf(loc, "BeginDrag (%d,%d)\n", i, j);
361 show_image(hwnd, himl1, 0, max(SIZEX1, SIZEY1), loc, TRUE);
362
363 /* check merging the dragged image with a second image */
364 ret = pImageList_SetDragCursorImage(himl2, 0, dx2, dy2);
365 ok(ret != 0, "SetDragCursorImage failed for {%d, %d}{%d, %d}\n",
366 dx1, dy1, dx2, dy2);
367 sprintf(loc, "SetDragCursorImage (%d,%d)\n", i, j);
368 show_image(hwnd, himl2, 0, max(SIZEX2, SIZEY2), loc, TRUE);
369
370 /* check new hotspot, it should be the same like the old one */
371 himlNew = pImageList_GetDragImage(NULL, &ppt);
372 ok(ppt.x == dx1 && ppt.y == dy1,
373 "Expected drag hotspot [%d,%d] got [%d,%d]\n",
374 dx1, dy1, ppt.x, ppt.y);
375 /* check size of new dragged image */
376 pImageList_GetIconSize(himlNew, &newx, &newy);
377 correctx = max(SIZEX1, max(SIZEX2 + dx2, SIZEX1 - dx2));
378 correcty = max(SIZEY1, max(SIZEY2 + dy2, SIZEY1 - dy2));
379 ok(newx == correctx && newy == correcty,
380 "Expected drag image size [%d,%d] got [%d,%d]\n",
381 correctx, correcty, newx, newy);
382 sprintf(loc, "GetDragImage (%d,%d)\n", i, j);
383 show_image(hwnd, himlNew, 0, max(correctx, correcty), loc, TRUE);
384 pImageList_EndDrag();
385 }
386 }
387#undef SIZEX1
388#undef SIZEY1
389#undef SIZEX2
390#undef SIZEY2
391#undef HOTSPOTS_MAX
392 pImageList_Destroy(himl2);
393 pImageList_Destroy(himl1);
395}
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97
#define SIZEY2
#define SIZEY1
#define SIZEX2
#define HOTSPOTS_MAX
#define SIZEX1

Referenced by START_TEST().

◆ test_iconsize()

static void test_iconsize ( void  )
static

Definition at line 1929 of file imagelist.c.

1930{
1932 INT cx, cy;
1933 BOOL ret;
1934
1935 himl = pImageList_Create(16, 16, ILC_COLOR16, 0, 3);
1936 /* null pointers, not zero imagelist dimensions */
1937 ret = pImageList_GetIconSize(himl, NULL, NULL);
1938 ok(!ret, "got %d\n", ret);
1939
1940 /* doesn't touch return pointers */
1941 cx = 0x1abe11ed;
1942 ret = pImageList_GetIconSize(himl, &cx, NULL);
1943 ok(!ret, "got %d\n", ret);
1944 ok(cx == 0x1abe11ed, "got %d\n", cx);
1945
1946 cy = 0x1abe11ed;
1947 ret = pImageList_GetIconSize(himl, NULL, &cy);
1948 ok(!ret, "got %d\n", ret);
1949 ok(cy == 0x1abe11ed, "got %d\n", cy);
1950
1951 pImageList_Destroy(himl);
1952
1953 ret = pImageList_GetIconSize((HIMAGELIST)0xdeadbeef, &cx, &cy);
1954 ok(!ret, "got %d\n", ret);
1955}

Referenced by START_TEST().

◆ test_iimagelist()

static void test_iimagelist ( void  )
static

Definition at line 1583 of file imagelist.c.

1584{
1585 IImageList *imgl, *imgl2;
1586 IImageList2 *imagelist;
1588 HRESULT hr;
1589 ULONG ret;
1590
1591 if (!pHIMAGELIST_QueryInterface)
1592 {
1593 win_skip("XP imagelist functions not available\n");
1594 return;
1595 }
1596
1597 /* test reference counting on destruction */
1598 imgl = (IImageList*)createImageList(32, 32);
1599 ret = IImageList_AddRef(imgl);
1600 ok(ret == 2, "Expected 2, got %d\n", ret);
1601 ret = pImageList_Destroy((HIMAGELIST)imgl);
1602 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
1603 ret = pImageList_Destroy((HIMAGELIST)imgl);
1604 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
1605 ret = pImageList_Destroy((HIMAGELIST)imgl);
1606 ok(ret == FALSE, "Expected FALSE, got %d\n", ret);
1607
1608 imgl = (IImageList*)createImageList(32, 32);
1609 ret = IImageList_AddRef(imgl);
1610 ok(ret == 2, "Expected 2, got %d\n", ret);
1611 ret = pImageList_Destroy((HIMAGELIST)imgl);
1612 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
1613 ret = IImageList_Release(imgl);
1614 ok(ret == 0, "Expected 0, got %d\n", ret);
1615 ret = pImageList_Destroy((HIMAGELIST)imgl);
1616 ok(ret == FALSE, "Expected FALSE, got %d\n", ret);
1617
1618 /* ref counting, HIMAGELIST_QueryInterface adds a reference */
1619 imgl = (IImageList*)createImageList(32, 32);
1620 hr = pHIMAGELIST_QueryInterface((HIMAGELIST)imgl, &IID_IImageList, (void**)&imgl2);
1621 ok(hr == S_OK, "got 0x%08x\n", hr);
1622 ok(imgl2 == imgl, "got different pointer\n");
1623 ret = IImageList_Release(imgl);
1624 ok(ret == 1, "got %u\n", ret);
1625 IImageList_Release(imgl);
1626
1627 if (!pImageList_CoCreateInstance)
1628 {
1629 win_skip("Vista imagelist functions not available\n");
1630 return;
1631 }
1632
1633 hr = pImageList_CoCreateInstance(&CLSID_ImageList, NULL, &IID_IImageList, (void **) &imgl);
1634 ok(SUCCEEDED(hr), "ImageList_CoCreateInstance failed, hr=%x\n", hr);
1635
1636 if (hr == S_OK)
1637 IImageList_Release(imgl);
1638
1639 himl = createImageList(32, 32);
1640
1641 if (!himl)
1642 return;
1643
1644 hr = (pHIMAGELIST_QueryInterface)(himl, &IID_IImageList, (void **) &imgl);
1645 ok(SUCCEEDED(hr), "HIMAGELIST_QueryInterface failed, hr=%x\n", hr);
1646
1647 if (hr == S_OK)
1648 IImageList_Release(imgl);
1649
1650 pImageList_Destroy(himl);
1651
1652 /* IImageList2 */
1653 hr = pImageList_CoCreateInstance(&CLSID_ImageList, NULL, &IID_IImageList2, (void**)&imagelist);
1654 if (hr != S_OK)
1655 {
1656 win_skip("IImageList2 is not supported.\n");
1657 return;
1658 }
1659 ok(hr == S_OK, "got 0x%08x\n", hr);
1660 IImageList2_Release(imagelist);
1661}
#define SUCCEEDED(hr)
Definition: intsafe.h:50

Referenced by START_TEST().

◆ test_IImageList_Add_Remove()

static void test_IImageList_Add_Remove ( void  )
static

Definition at line 1663 of file imagelist.c.

1664{
1665 IImageList *imgl;
1667 HRESULT hr;
1668
1669 HICON hicon1;
1670 HICON hicon2;
1671 HICON hicon3;
1672
1673 int ret;
1674
1675 /* create an imagelist to play with */
1676 himl = pImageList_Create(84, 84, ILC_COLOR16, 0, 3);
1677 ok(himl != 0,"failed to create imagelist\n");
1678
1679 imgl = (IImageList *) himl;
1680
1681 /* load the icons to add to the image list */
1682 hicon1 = CreateIcon(hinst, 32, 32, 1, 1, icon_bits, icon_bits);
1683 ok(hicon1 != 0, "no hicon1\n");
1684 hicon2 = CreateIcon(hinst, 32, 32, 1, 1, icon_bits, icon_bits);
1685 ok(hicon2 != 0, "no hicon2\n");
1686 hicon3 = CreateIcon(hinst, 32, 32, 1, 1, icon_bits, icon_bits);
1687 ok(hicon3 != 0, "no hicon3\n");
1688
1689 /* remove when nothing exists */
1690 hr = IImageList_Remove(imgl, 0);
1691 ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
1692
1693 /* removing everything from an empty imagelist should succeed */
1694 hr = IImageList_Remove(imgl, -1);
1695 ok(hr == S_OK, "removed nonexistent icon\n");
1696
1697 /* add three */
1698 ret = -1;
1699 ok( IImageList_ReplaceIcon(imgl, -1, hicon1, &ret) == S_OK && (ret == 0),"failed to add icon1\n");
1700 ret = -1;
1701 ok( IImageList_ReplaceIcon(imgl, -1, hicon2, &ret) == S_OK && (ret == 1),"failed to add icon2\n");
1702 ret = -1;
1703 ok( IImageList_ReplaceIcon(imgl, -1, hicon3, &ret) == S_OK && (ret == 2),"failed to add icon3\n");
1704
1705 /* remove an index out of range */
1706 ok( IImageList_Remove(imgl, 4711) == E_INVALIDARG, "got 0x%08x\n", hr);
1707
1708 /* remove three */
1709 ok( IImageList_Remove(imgl,0) == S_OK, "can't remove 0\n");
1710 ok( IImageList_Remove(imgl,0) == S_OK, "can't remove 0\n");
1711 ok( IImageList_Remove(imgl,0) == S_OK, "can't remove 0\n");
1712
1713 /* remove one extra */
1714 ok( IImageList_Remove(imgl, 0) == E_INVALIDARG, "got 0x%08x\n", hr);
1715
1716 IImageList_Release(imgl);
1717 ok(DestroyIcon(hicon1),"icon 1 wasn't deleted\n");
1718 ok(DestroyIcon(hicon2),"icon 2 wasn't deleted\n");
1719 ok(DestroyIcon(hicon3),"icon 3 wasn't deleted\n");
1720}
#define E_INVALIDARG
Definition: ddrawi.h:101

Referenced by START_TEST().

◆ test_IImageList_Clone()

static void test_IImageList_Clone ( void  )
static

Definition at line 2275 of file imagelist.c.

2276{
2277 IImageList *imgl, *imgl2;
2279 HRESULT hr;
2280 ULONG ref;
2281
2282 himl = pImageList_Create(16, 16, ILC_COLOR16, 0, 3);
2283 imgl = (IImageList*)himl;
2284
2285if (0)
2286{
2287 /* crashes on native */
2288 IImageList_Clone(imgl, &IID_IImageList, NULL);
2289}
2290
2291 hr = IImageList_Clone(imgl, &IID_IImageList, (void**)&imgl2);
2292 ok(hr == S_OK, "got 0x%08x\n", hr);
2293 ref = IImageList_Release(imgl2);
2294 ok(ref == 0, "got %u\n", ref);
2295
2296 IImageList_Release(imgl);
2297}
Definition: send.c:48

Referenced by START_TEST().

◆ test_IImageList_Draw()

static void test_IImageList_Draw ( void  )
static

Definition at line 1755 of file imagelist.c.

1756{
1757 IImageList *imgl;
1759
1760 HBITMAP hbm1;
1761 HBITMAP hbm2;
1762 HBITMAP hbm3;
1763
1764 IMAGELISTDRAWPARAMS imldp;
1765 HWND hwndfortest;
1766 HRESULT hr;
1767 HDC hdc;
1768 int ret;
1769
1770 hwndfortest = create_window();
1771 hdc = GetDC(hwndfortest);
1772 ok(hdc!=NULL, "couldn't get DC\n");
1773
1774 /* create an imagelist to play with */
1775 himl = pImageList_Create(48, 48, ILC_COLOR16, 0, 3);
1776 ok(himl!=0,"failed to create imagelist\n");
1777
1778 imgl = (IImageList *) himl;
1779
1780 /* load the icons to add to the image list */
1781 hbm1 = CreateBitmap(48, 48, 1, 1, bitmap_bits);
1782 ok(hbm1 != 0, "no bitmap 1\n");
1783 hbm2 = CreateBitmap(48, 48, 1, 1, bitmap_bits);
1784 ok(hbm2 != 0, "no bitmap 2\n");
1785 hbm3 = CreateBitmap(48, 48, 1, 1, bitmap_bits);
1786 ok(hbm3 != 0, "no bitmap 3\n");
1787
1788 /* add three */
1789 ret = -1;
1790 ok( IImageList_Add(imgl, hbm1, 0, &ret) == S_OK && (ret == 0), "failed to add bitmap 1\n");
1791 ret = -1;
1792 ok( IImageList_Add(imgl, hbm2, 0, &ret) == S_OK && (ret == 1), "failed to add bitmap 2\n");
1793
1794 ok( IImageList_SetImageCount(imgl, 3) == S_OK, "Setimage count failed\n");
1795 ok( IImageList_Replace(imgl, 2, hbm3, 0) == S_OK, "failed to replace bitmap 3\n");
1796
1797if (0)
1798{
1799 /* crashes on native */
1800 IImageList_Draw(imgl, NULL);
1801}
1802
1803 memset(&imldp, 0, sizeof (imldp));
1804 hr = IImageList_Draw(imgl, &imldp);
1805 ok( hr == E_INVALIDARG, "got 0x%08x\n", hr);
1806
1808 imldp.hdcDst = hdc;
1809 imldp.himl = himl;
1810
1811 force_redraw(hwndfortest);
1812
1813 imldp.fStyle = SRCCOPY;
1814 imldp.rgbBk = CLR_DEFAULT;
1815 imldp.rgbFg = CLR_DEFAULT;
1816 imldp.y = 100;
1817 imldp.x = 100;
1818 ok( IImageList_Draw(imgl, &imldp) == S_OK, "should succeed\n");
1819 imldp.i ++;
1820 ok( IImageList_Draw(imgl, &imldp) == S_OK, "should succeed\n");
1821 imldp.i ++;
1822 ok( IImageList_Draw(imgl, &imldp) == S_OK, "should succeed\n");
1823 imldp.i ++;
1824 ok( IImageList_Draw(imgl, &imldp) == E_INVALIDARG, "should fail\n");
1825
1826 /* remove three */
1827 ok( IImageList_Remove(imgl, 0) == S_OK, "removing 1st bitmap\n");
1828 ok( IImageList_Remove(imgl, 0) == S_OK, "removing 2nd bitmap\n");
1829 ok( IImageList_Remove(imgl, 0) == S_OK, "removing 3rd bitmap\n");
1830
1831 /* destroy it */
1832 IImageList_Release(imgl);
1833
1834 /* bitmaps should not be deleted by the imagelist */
1835 ok(DeleteObject(hbm1),"bitmap 1 can't be deleted\n");
1836 ok(DeleteObject(hbm2),"bitmap 2 can't be deleted\n");
1837 ok(DeleteObject(hbm3),"bitmap 3 can't be deleted\n");
1838
1839 ReleaseDC(hwndfortest, hdc);
1840 DestroyWindow(hwndfortest);
1841}

Referenced by START_TEST().

◆ test_IImageList_Get_SetImageCount()

static void test_IImageList_Get_SetImageCount ( void  )
static

Definition at line 1722 of file imagelist.c.

1723{
1724 IImageList *imgl;
1726 HRESULT hr;
1727 INT ret;
1728
1729 /* create an imagelist to play with */
1730 himl = pImageList_Create(84, 84, ILC_COLOR16, 0, 3);
1731 ok(himl != 0,"failed to create imagelist\n");
1732
1733 imgl = (IImageList *) himl;
1734
1735 /* check SetImageCount/GetImageCount */
1736 hr = IImageList_SetImageCount(imgl, 3);
1737 ok(hr == S_OK, "got 0x%08x\n", hr);
1738 ret = 0;
1739 hr = IImageList_GetImageCount(imgl, &ret);
1740 ok(hr == S_OK && ret == 3, "invalid image count after increase\n");
1741 hr = IImageList_SetImageCount(imgl, 1);
1742 ok(hr == S_OK, "got 0x%08x\n", hr);
1743 ret = 0;
1744 hr = IImageList_GetImageCount(imgl, &ret);
1745 ok(hr == S_OK && ret == 1, "invalid image count after decrease to 1\n");
1746 hr = IImageList_SetImageCount(imgl, 0);
1747 ok(hr == S_OK, "got 0x%08x\n", hr);
1748 ret = -1;
1749 hr = IImageList_GetImageCount(imgl, &ret);
1750 ok(hr == S_OK && ret == 0, "invalid image count after decrease to 0\n");
1751
1752 IImageList_Release(imgl);
1753}

Referenced by START_TEST().

◆ test_IImageList_GetBkColor()

static void test_IImageList_GetBkColor ( void  )
static

Definition at line 2299 of file imagelist.c.

2300{
2301 IImageList *imgl;
2304 HRESULT hr;
2305
2306 himl = pImageList_Create(16, 16, ILC_COLOR16, 0, 3);
2307 imgl = (IImageList*)himl;
2308
2309if (0)
2310{
2311 /* crashes on native */
2312 IImageList_GetBkColor(imgl, NULL);
2313}
2314
2315 hr = IImageList_GetBkColor(imgl, &color);
2316 ok(hr == S_OK, "got 0x%08x\n", hr);
2317
2318 IImageList_Release(imgl);
2319}

Referenced by START_TEST().

◆ test_IImageList_GetIconSize()

static void test_IImageList_GetIconSize ( void  )
static

Definition at line 2375 of file imagelist.c.

2376{
2377 IImageList *imgl;
2379 int cx, cy;
2380 HRESULT hr;
2381
2382 himl = pImageList_Create(16, 16, ILC_COLOR16, 0, 3);
2383 imgl = (IImageList*)himl;
2384
2385 hr = IImageList_GetIconSize(imgl, NULL, NULL);
2386 ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
2387
2388 hr = IImageList_GetIconSize(imgl, &cx, NULL);
2389 ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
2390
2391 hr = IImageList_GetIconSize(imgl, NULL, &cy);
2392 ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
2393
2394 IImageList_Release(imgl);
2395}

Referenced by START_TEST().

◆ test_IImageList_GetImageCount()

static void test_IImageList_GetImageCount ( void  )
static

Definition at line 2351 of file imagelist.c.

2352{
2353 IImageList *imgl;
2355 int count;
2356 HRESULT hr;
2357
2358 himl = pImageList_Create(16, 16, ILC_COLOR16, 0, 3);
2359 imgl = (IImageList*)himl;
2360
2361if (0)
2362{
2363 /* crashes on native */
2364 IImageList_GetImageCount(imgl, NULL);
2365}
2366
2367 count = -1;
2368 hr = IImageList_GetImageCount(imgl, &count);
2369 ok(hr == S_OK, "got 0x%08x\n", hr);
2370 ok(count == 0, "got %d\n", count);
2371
2372 IImageList_Release(imgl);
2373}

Referenced by START_TEST().

◆ test_IImageList_Merge()

static void test_IImageList_Merge ( void  )
static

Definition at line 1843 of file imagelist.c.

1844{
1845 HIMAGELIST himl1, himl2;
1846 IImageList *imgl1, *imgl2, *merge;
1847 HICON hicon1;
1849 HRESULT hr;
1850 int ret;
1851
1852 himl1 = pImageList_Create(32,32,0,0,3);
1853 ok(himl1 != NULL,"failed to create himl1\n");
1854
1855 himl2 = pImageList_Create(32,32,0,0,3);
1856 ok(himl2 != NULL,"failed to create himl2\n");
1857
1858 hicon1 = CreateIcon(hinst, 32, 32, 1, 1, icon_bits, icon_bits);
1859 ok(hicon1 != NULL, "failed to create hicon1\n");
1860
1861 if (!himl1 || !himl2 || !hicon1)
1862 return;
1863
1864 /* cast to IImageList */
1865 imgl1 = (IImageList *) himl1;
1866 imgl2 = (IImageList *) himl2;
1867
1868 ret = -1;
1869 ok( IImageList_ReplaceIcon(imgl2, -1, hicon1, &ret) == S_OK && (ret == 0),"add icon1 to himl2 failed\n");
1870
1871if (0)
1872{
1873 /* null cases that crash on native */
1874 IImageList_Merge(imgl1, -1, NULL, 0, 0, 0, &IID_IImageList, (void**)&merge);
1875 IImageList_Merge(imgl1, -1, (IUnknown*) imgl2, 0, 0, 0, &IID_IImageList, NULL);
1876}
1877
1878 /* If himl1 has no images, merge still succeeds */
1879 hr = IImageList_Merge(imgl1, -1, (IUnknown *) imgl2, 0, 0, 0, &IID_IImageList, (void **) &merge);
1880 ok(hr == S_OK, "merge himl1,-1 failed\n");
1881 if (hr == S_OK) IImageList_Release(merge);
1882
1883 hr = IImageList_Merge(imgl1, 0, (IUnknown *) imgl2, 0, 0, 0, &IID_IImageList, (void **) &merge);
1884 ok(hr == S_OK, "merge himl1,0 failed\n");
1885 if (hr == S_OK) IImageList_Release(merge);
1886
1887 /* Same happens if himl2 is empty */
1888 IImageList_Release(imgl2);
1889 himl2 = pImageList_Create(32,32,0,0,3);
1890 ok(himl2 != NULL,"failed to recreate himl2\n");
1891
1892 imgl2 = (IImageList *) himl2;
1893
1894 hr = IImageList_Merge(imgl1, -1, (IUnknown *) imgl2, -1, 0, 0, &IID_IImageList, (void **) &merge);
1895 ok(hr == S_OK, "merge himl2,-1 failed\n");
1896 if (hr == S_OK) IImageList_Release(merge);
1897
1898 hr = IImageList_Merge(imgl1, -1, (IUnknown *) imgl2, 0, 0, 0, &IID_IImageList, (void **) &merge);
1899 ok(hr == S_OK, "merge himl2,0 failed\n");
1900 if (hr == S_OK) IImageList_Release(merge);
1901
1902 /* Now try merging an image with itself */
1903 ret = -1;
1904 ok( IImageList_ReplaceIcon(imgl2, -1, hicon1, &ret) == S_OK && (ret == 0),"re-add icon1 to himl2 failed\n");
1905
1906 hr = IImageList_Merge(imgl2, 0, (IUnknown *) imgl2, 0, 0, 0, &IID_IImageList, (void **) &merge);
1907 ok(hr == S_OK, "merge himl2 with itself failed\n");
1908 if (hr == S_OK) IImageList_Release(merge);
1909
1910 /* Try merging 2 different image lists */
1911 ret = -1;
1912 ok( IImageList_ReplaceIcon(imgl1, -1, hicon1, &ret) == S_OK && (ret == 0),"add icon1 to himl1 failed\n");
1913
1914 hr = IImageList_Merge(imgl1, 0, (IUnknown *) imgl2, 0, 0, 0, &IID_IImageList, (void **) &merge);
1915 ok(hr == S_OK, "merge himl1 with himl2 failed\n");
1916 if (hr == S_OK) IImageList_Release(merge);
1917
1918 hr = IImageList_Merge(imgl1, 0, (IUnknown *) imgl2, 0, 8, 16, &IID_IImageList, (void **) &merge);
1919 ok(hr == S_OK, "merge himl1 with himl2 8,16 failed\n");
1920 if (hr == S_OK) IImageList_Release(merge);
1921
1922 IImageList_Release(imgl1);
1923 IImageList_Release(imgl2);
1924
1925 DestroyIcon(hicon1);
1927}
_STLP_MOVE_TO_STD_NAMESPACE _OutputIter merge(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _InputIter2 __last2, _OutputIter __result)
Definition: _algo.c:1419

Referenced by START_TEST().

◆ test_IImageList_SetBkColor()

static void test_IImageList_SetBkColor ( void  )
static

Definition at line 2321 of file imagelist.c.

2322{
2323 IImageList *imgl;
2326 HRESULT hr;
2327
2328 himl = pImageList_Create(16, 16, ILC_COLOR16, 0, 3);
2329 imgl = (IImageList*)himl;
2330
2331if (0)
2332{
2333 /* crashes on native */
2334 IImageList_SetBkColor(imgl, RGB(0, 0, 0), NULL);
2335}
2336
2337 hr = IImageList_SetBkColor(imgl, CLR_NONE, &color);
2338 ok(hr == S_OK, "got 0x%08x\n", hr);
2339
2340 hr = IImageList_SetBkColor(imgl, CLR_NONE, &color);
2341 ok(hr == S_OK, "got 0x%08x\n", hr);
2342
2343 color = 0xdeadbeef;
2344 hr = IImageList_GetBkColor(imgl, &color);
2345 ok(hr == S_OK, "got 0x%08x\n", hr);
2346 ok(color == CLR_NONE, "got %x\n", color);
2347
2348 IImageList_Release(imgl);
2349}

Referenced by START_TEST().

◆ test_imagecount()

static void test_imagecount ( void  )
static

Definition at line 448 of file imagelist.c.

449{
451
452 ok(0 == pImageList_GetImageCount((HIMAGELIST)0xdeadbeef), "don't crash on bad handle\n");
453
454 if (!pImageList_SetImageCount)
455 {
456 win_skip("ImageList_SetImageCount not available\n");
457 return;
458 }
459
460 himl = pImageList_Create(84, 84, ILC_COLOR16, 0, 3);
461 ok(himl != 0, "Failed to create imagelist.\n");
462
463 ok(pImageList_SetImageCount(himl, 3), "couldn't increase image count\n");
464 ok(pImageList_GetImageCount(himl) == 3, "invalid image count after increase\n");
465 ok(pImageList_SetImageCount(himl, 1), "couldn't decrease image count\n");
466 ok(pImageList_GetImageCount(himl) == 1, "invalid image count after decrease to 1\n");
467 ok(pImageList_SetImageCount(himl, 0), "couldn't decrease image count\n");
468 ok(pImageList_GetImageCount(himl) == 0, "invalid image count after decrease to 0\n");
469
470 ok(pImageList_Destroy(himl), "Failed to destroy imagelist.\n");
471}

Referenced by START_TEST().

◆ test_ImageList_DrawIndirect()

static void test_ImageList_DrawIndirect ( void  )
static

Definition at line 1447 of file imagelist.c.

1448{
1450 int ret;
1451 HDC hdcDst = NULL;
1452 HBITMAP hbmOld = NULL, hbmDst = NULL;
1453 HBITMAP hbmMask = NULL, hbmInverseMask = NULL;
1454 HBITMAP hbmImage = NULL, hbmAlphaImage = NULL, hbmTransparentImage = NULL;
1455 int iImage = -1, iAlphaImage = -1, iTransparentImage = -1;
1456 UINT32 *bits = 0;
1457 UINT32 maskBits = 0x00000000, inverseMaskBits = 0xFFFFFFFF;
1458 int bpp, broken_value;
1459
1460 BITMAPINFO bitmapInfo = {{sizeof(BITMAPINFOHEADER), 2, 1, 1, 32, BI_RGB,
1461 0, 0, 0, 0, 0}};
1462
1464 ok(hdcDst != 0, "CreateCompatibleDC(0) failed to return a valid DC\n");
1465 if (!hdcDst)
1466 return;
1468
1469 hbmMask = CreateBitmap(2, 1, 1, 1, &maskBits);
1470 ok(hbmMask != 0, "CreateBitmap failed\n");
1471 if(!hbmMask) goto cleanup;
1472
1473 hbmInverseMask = CreateBitmap(2, 1, 1, 1, &inverseMaskBits);
1474 ok(hbmInverseMask != 0, "CreateBitmap failed\n");
1475 if(!hbmInverseMask) goto cleanup;
1476
1477 himl = pImageList_Create(2, 1, ILC_COLOR32, 0, 1);
1478 ok(himl != 0, "ImageList_Create failed\n");
1479 if(!himl) goto cleanup;
1480
1481 /* Add a no-alpha image */
1482 hbmImage = create_test_bitmap(hdcDst, 32, 0x00ABCDEF, 0x00ABCDEF);
1483 if(!hbmImage) goto cleanup;
1484
1485 iImage = pImageList_Add(himl, hbmImage, hbmMask);
1486 ok(iImage != -1, "ImageList_Add failed\n");
1487 if(iImage == -1) goto cleanup;
1488
1489 /* Add an alpha image */
1490 hbmAlphaImage = create_test_bitmap(hdcDst, 32, 0x89ABCDEF, 0x89ABCDEF);
1491 if(!hbmAlphaImage) goto cleanup;
1492
1493 iAlphaImage = pImageList_Add(himl, hbmAlphaImage, hbmMask);
1494 ok(iAlphaImage != -1, "ImageList_Add failed\n");
1495 if(iAlphaImage == -1) goto cleanup;
1496
1497 /* Add a transparent alpha image */
1498 hbmTransparentImage = create_test_bitmap(hdcDst, 32, 0x00ABCDEF, 0x89ABCDEF);
1499 if(!hbmTransparentImage) goto cleanup;
1500
1501 iTransparentImage = pImageList_Add(himl, hbmTransparentImage, hbmMask);
1502 ok(iTransparentImage != -1, "ImageList_Add failed\n");
1503 if(iTransparentImage == -1) goto cleanup;
1504
1505 /* 32-bit Tests */
1506 bitmapInfo.bmiHeader.biBitCount = 32;
1507 hbmDst = CreateDIBSection(hdcDst, &bitmapInfo, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
1508 ok (hbmDst && bits, "CreateDIBSection failed to return a valid bitmap and buffer\n");
1509 if (!hbmDst || !bits)
1510 goto cleanup;
1511 hbmOld = SelectObject(hdcDst, hbmDst);
1512
1513 check_ImageList_DrawIndirect_fStyle(hdcDst, himl, bits, iImage, ILD_NORMAL, 0x00ABCDEF, __LINE__);
1514 check_ImageList_DrawIndirect_fStyle(hdcDst, himl, bits, iImage, ILD_TRANSPARENT, 0x00ABCDEF, __LINE__);
1515 todo_wine check_ImageList_DrawIndirect_broken(hdcDst, himl, bits, iAlphaImage, ILD_BLEND25, ILS_NORMAL, 0, 0x00E8F1FA, 0x00D4D9DD, __LINE__);
1516 if (bpp == 16 || bpp == 24) broken_value = 0x00D4D9DD;
1517 else broken_value = 0x00B4BDC4;
1518 todo_wine check_ImageList_DrawIndirect_broken(hdcDst, himl, bits, iAlphaImage, ILD_BLEND50, ILS_NORMAL, 0, 0x00E8F1FA, broken_value, __LINE__);
1519 check_ImageList_DrawIndirect_fStyle(hdcDst, himl, bits, iImage, ILD_MASK, 0x00ABCDEF, __LINE__);
1520 check_ImageList_DrawIndirect_fStyle(hdcDst, himl, bits, iImage, ILD_IMAGE, 0x00ABCDEF, __LINE__);
1521 check_ImageList_DrawIndirect_fStyle(hdcDst, himl, bits, iImage, ILD_PRESERVEALPHA, 0x00ABCDEF, __LINE__);
1522
1523 check_ImageList_DrawIndirect_fStyle(hdcDst, himl, bits, iAlphaImage, ILD_NORMAL, 0x00D3E5F7, __LINE__);
1524 check_ImageList_DrawIndirect_fStyle(hdcDst, himl, bits, iAlphaImage, ILD_TRANSPARENT, 0x00D3E5F7, __LINE__);
1525
1526 if (bpp == 16 || bpp == 24) broken_value = 0x00D4D9DD;
1527 else broken_value = 0x009DA8B1;
1528 todo_wine check_ImageList_DrawIndirect_broken(hdcDst, himl, bits, iAlphaImage, ILD_BLEND25, ILS_NORMAL, 0, 0x00E8F1FA, broken_value, __LINE__);
1529 if (bpp == 16 || bpp == 24) broken_value = 0x00D4D9DD;
1530 else broken_value = 0x008C99A3;
1531 todo_wine check_ImageList_DrawIndirect_broken(hdcDst, himl, bits, iAlphaImage, ILD_BLEND50, ILS_NORMAL, 0, 0x00E8F1FA, broken_value, __LINE__);
1532 check_ImageList_DrawIndirect_fStyle(hdcDst, himl, bits, iAlphaImage, ILD_MASK, 0x00D3E5F7, __LINE__);
1533 check_ImageList_DrawIndirect_fStyle(hdcDst, himl, bits, iAlphaImage, ILD_IMAGE, 0x00D3E5F7, __LINE__);
1534 todo_wine check_ImageList_DrawIndirect_fStyle(hdcDst, himl, bits, iAlphaImage, ILD_PRESERVEALPHA, 0x005D6F81, __LINE__);
1535
1536 check_ImageList_DrawIndirect_fStyle(hdcDst, himl, bits, iTransparentImage, ILD_NORMAL, 0x00FFFFFF, __LINE__);
1537
1538 check_ImageList_DrawIndirect_ILD_ROP(hdcDst, himl, bits, iImage, SRCCOPY, 0x00ABCDEF, __LINE__);
1539 check_ImageList_DrawIndirect_ILD_ROP(hdcDst, himl, bits, iImage, SRCINVERT, 0x00543210, __LINE__);
1540
1541 /* ILD_ROP is ignored when the image has an alpha channel */
1542 check_ImageList_DrawIndirect_ILD_ROP(hdcDst, himl, bits, iAlphaImage, SRCCOPY, 0x00D3E5F7, __LINE__);
1543 check_ImageList_DrawIndirect_ILD_ROP(hdcDst, himl, bits, iAlphaImage, SRCINVERT, 0x00D3E5F7, __LINE__);
1544
1546 todo_wine check_ImageList_DrawIndirect_broken(hdcDst, himl, bits, iAlphaImage, ILD_NORMAL, ILS_SATURATE, 0, 0x00AFAFAF, 0x00F0F0F0, __LINE__);
1547
1548 check_ImageList_DrawIndirect_fState(hdcDst, himl, bits, iImage, ILD_NORMAL, ILS_GLOW, 0, 0x00ABCDEF, __LINE__);
1549 check_ImageList_DrawIndirect_fState(hdcDst, himl, bits, iImage, ILD_NORMAL, ILS_SHADOW, 0, 0x00ABCDEF, __LINE__);
1550
1551 check_ImageList_DrawIndirect_fState(hdcDst, himl, bits, iImage, ILD_NORMAL, ILS_ALPHA, 127, 0x00D5E6F7, __LINE__);
1552 check_ImageList_DrawIndirect_broken(hdcDst, himl, bits, iAlphaImage, ILD_NORMAL, ILS_ALPHA, 127, 0x00E9F2FB, 0x00AEB7C0, __LINE__);
1553 todo_wine check_ImageList_DrawIndirect_broken(hdcDst, himl, bits, iAlphaImage, ILD_NORMAL, ILS_NORMAL, 127, 0x00E9F2FB, 0x00D3E5F7, __LINE__);
1554
1555cleanup:
1556
1557 if(hbmOld)
1558 SelectObject(hdcDst, hbmOld);
1559 if(hbmDst)
1560 DeleteObject(hbmDst);
1561
1563
1564 if(hbmMask)
1565 DeleteObject(hbmMask);
1566 if(hbmInverseMask)
1567 DeleteObject(hbmInverseMask);
1568
1569 if(hbmImage)
1570 DeleteObject(hbmImage);
1571 if(hbmAlphaImage)
1572 DeleteObject(hbmAlphaImage);
1573 if(hbmTransparentImage)
1574 DeleteObject(hbmTransparentImage);
1575
1576 if(himl)
1577 {
1578 ret = pImageList_Destroy(himl);
1579 ok(ret, "ImageList_Destroy failed\n");
1580 }
1581}
static void cleanup(void)
Definition: main.c:1335
static void check_ImageList_DrawIndirect_fState(HDC hdc, HIMAGELIST himl, UINT32 *bits, int i, UINT fStyle, UINT fState, DWORD Frame, UINT32 expected, int line)
Definition: imagelist.c:1425
static void check_ImageList_DrawIndirect_broken(HDC hdc, HIMAGELIST himl, UINT32 *bits, int i, UINT fStyle, UINT fState, DWORD Frame, UINT32 expected, UINT32 broken_expected, int line)
Definition: imagelist.c:1433
static void check_ImageList_DrawIndirect_fStyle(HDC hdc, HIMAGELIST himl, UINT32 *bits, int i, UINT fStyle, UINT32 expected, int line)
Definition: imagelist.c:1409
static void check_ImageList_DrawIndirect_ILD_ROP(HDC hdc, HIMAGELIST himl, UINT32 *bits, int i, DWORD dwRop, UINT32 expected, int line)
Definition: imagelist.c:1417
static HBITMAP create_test_bitmap(HDC hdc, int bpp, UINT32 pixel1, UINT32 pixel2)
Definition: imagelist.c:1365
#define todo_wine
Definition: custom.c:89
#define ILD_NORMAL
Definition: commctrl.h:417
#define ILD_BLEND25
Definition: commctrl.h:422
#define ILS_SHADOW
Definition: commctrl.h:437
#define ILC_COLOR32
Definition: commctrl.h:358
#define ILS_ALPHA
Definition: commctrl.h:439
#define ILS_SATURATE
Definition: commctrl.h:438
#define ILS_GLOW
Definition: commctrl.h:436
#define ILD_MASK
Definition: commctrl.h:419
#define ILD_PRESERVEALPHA
Definition: commctrl.h:426
#define ILD_BLEND50
Definition: commctrl.h:423
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define SRCINVERT
Definition: wingdi.h:329
#define BITSPIXEL
Definition: wingdi.h:720
static HDC hdcDst
Definition: xlate.c:32

Referenced by START_TEST().

◆ test_imagelist_storage()

static void test_imagelist_storage ( void  )
static

Definition at line 1105 of file imagelist.c.

1106{
1108 INT ret, grow;
1109 HBITMAP hbm;
1110 HICON icon;
1111
1112 himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR24, 1, 1);
1113 ok(himl != 0, "ImageList_Create failed\n");
1114
1115 check_iml_data(himl, BMP_CX, BMP_CX, 0, 2, 1, ILC_COLOR24, "empty");
1116
1118 check_iml_data(himl, BMP_CX, BMP_CX, 24, 27, 1, ILC_COLOR24, "orig");
1119
1120 ret = pImageList_Remove(himl, 4);
1121 ok(ret, "ImageList_Remove failed\n");
1122 check_iml_data(himl, BMP_CX, BMP_CX, 23, 27, 1, ILC_COLOR24, "1");
1123
1124 ret = pImageList_Remove(himl, 5);
1125 ok(ret, "ImageList_Remove failed\n");
1126 check_iml_data(himl, BMP_CX, BMP_CX, 22, 27, 1, ILC_COLOR24, "2");
1127
1128 ret = pImageList_Remove(himl, 6);
1129 ok(ret, "ImageList_Remove failed\n");
1130 check_iml_data(himl, BMP_CX, BMP_CX, 21, 27, 1, ILC_COLOR24, "3");
1131
1132 ret = pImageList_Remove(himl, 7);
1133 ok(ret, "ImageList_Remove failed\n");
1134 check_iml_data(himl, BMP_CX, BMP_CX, 20, 27, 1, ILC_COLOR24, "4");
1135
1136 ret = pImageList_Remove(himl, -2);
1137 ok(!ret, "ImageList_Remove(-2) should fail\n");
1138 check_iml_data(himl, BMP_CX, BMP_CX, 20, 27, 1, ILC_COLOR24, "5");
1139
1140 ret = pImageList_Remove(himl, 20);
1141 ok(!ret, "ImageList_Remove(20) should fail\n");
1142 check_iml_data(himl, BMP_CX, BMP_CX, 20, 27, 1, ILC_COLOR24, "6");
1143
1144 ret = pImageList_Remove(himl, -1);
1145 ok(ret, "ImageList_Remove(-1) failed\n");
1146 check_iml_data(himl, BMP_CX, BMP_CX, 0, 4, 1, ILC_COLOR24, "7");
1147
1148 ret = pImageList_Destroy(himl);
1149 ok(ret, "ImageList_Destroy failed\n");
1150
1151 /* test ImageList_Create storage allocation */
1152
1153 himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR24, 0, 32);
1154 ok(himl != 0, "ImageList_Create failed\n");
1155 check_iml_data(himl, BMP_CX, BMP_CX, 0, 1, 32, ILC_COLOR24, "init 0 grow 32");
1156 hbm = create_bitmap(BMP_CX * 9, BMP_CX, 0, "9");
1157 ret = pImageList_Add(himl, hbm, NULL);
1158 ok(ret == 0, "ImageList_Add returned %d, expected 0\n", ret);
1159 check_iml_data(himl, BMP_CX, BMP_CX, 1, 34, 32, ILC_COLOR24, "add 1 x 9");
1161 ret = pImageList_Destroy(himl);
1162 ok(ret, "ImageList_Destroy failed\n");
1163
1164 himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR24, 4, 4);
1165 ok(himl != 0, "ImageList_Create failed\n");
1166 check_iml_data(himl, BMP_CX, BMP_CX, 0, 5, 4, ILC_COLOR24, "init 4 grow 4");
1167 hbm = create_bitmap(BMP_CX, BMP_CX * 9, 0, "9");
1168 ret = pImageList_Add(himl, hbm, NULL);
1169 ok(ret == 0, "ImageList_Add returned %d, expected 0\n", ret);
1170 check_iml_data(himl, BMP_CX, BMP_CX, 9, 15, 4, ILC_COLOR24, "add 9 x 1");
1171 ret = pImageList_Add(himl, hbm, NULL);
1172 ok(ret == 9, "ImageList_Add returned %d, expected 9\n", ret);
1173 check_iml_data(himl, BMP_CX, BMP_CX, 18, 25, 4, ILC_COLOR24, "add 9 x 1");
1175 ret = pImageList_Destroy(himl);
1176 ok(ret, "ImageList_Destroy failed\n");
1177
1178 himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR24, 207, 209);
1179 ok(himl != 0, "ImageList_Create failed\n");
1180 check_iml_data(himl, BMP_CX, BMP_CX, 0, 208, 209, ILC_COLOR24, "init 207 grow 209");
1181 ret = pImageList_Destroy(himl);
1182 ok(ret, "ImageList_Destroy failed\n");
1183
1184 himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR24, 209, 207);
1185 ok(himl != 0, "ImageList_Create failed\n");
1186 check_iml_data(himl, BMP_CX, BMP_CX, 0, 210, 207, ILC_COLOR24, "init 209 grow 207");
1187 ret = pImageList_Destroy(himl);
1188 ok(ret, "ImageList_Destroy failed\n");
1189
1190 himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR24, 14, 4);
1191 ok(himl != 0, "ImageList_Create failed\n");
1192 check_iml_data(himl, BMP_CX, BMP_CX, 0, 15, 4, ILC_COLOR24, "init 14 grow 4");
1193 ret = pImageList_Destroy(himl);
1194 ok(ret, "ImageList_Destroy failed\n");
1195
1196 himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR24, 5, 9);
1197 ok(himl != 0, "ImageList_Create failed\n");
1198 check_iml_data(himl, BMP_CX, BMP_CX, 0, 6, 9, ILC_COLOR24, "init 5 grow 9");
1199 ret = pImageList_Destroy(himl);
1200 ok(ret, "ImageList_Destroy failed\n");
1201
1202 himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR24, 9, 5);
1203 ok(himl != 0, "ImageList_Create failed\n");
1204 check_iml_data(himl, BMP_CX, BMP_CX, 0, 10, 5, ILC_COLOR24, "init 9 grow 5");
1205 ret = pImageList_Destroy(himl);
1206 ok(ret, "ImageList_Destroy failed\n");
1207
1208 himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR24, 2, 4);
1209 ok(himl != 0, "ImageList_Create failed\n");
1210 check_iml_data(himl, BMP_CX, BMP_CX, 0, 3, 4, ILC_COLOR24, "init 2 grow 4");
1211 ret = pImageList_Destroy(himl);
1212 ok(ret, "ImageList_Destroy failed\n");
1213
1214 himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR24, 4, 2);
1215 ok(himl != 0, "ImageList_Create failed\n");
1216 check_iml_data(himl, BMP_CX, BMP_CX, 0, 5, 2, ILC_COLOR24, "init 4 grow 2");
1217 ret = pImageList_Destroy(himl);
1218 ok(ret, "ImageList_Destroy failed\n");
1219
1220 himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR8, 4, 2);
1221 ok(himl != 0, "ImageList_Create failed\n");
1222 check_iml_data(himl, BMP_CX, BMP_CX, 0, 5, 2, ILC_COLOR8, "bpp 8");
1223 ret = pImageList_Destroy(himl);
1224 ok(ret, "ImageList_Destroy failed\n");
1225
1226 himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR4, 4, 2);
1227 ok(himl != 0, "ImageList_Create failed\n");
1228 check_iml_data(himl, BMP_CX, BMP_CX, 0, 5, 2, ILC_COLOR4, "bpp 4");
1229 ret = pImageList_Destroy(himl);
1230 ok(ret, "ImageList_Destroy failed\n");
1231
1232 himl = pImageList_Create(BMP_CX, BMP_CX, 0, 4, 2);
1233 ok(himl != 0, "ImageList_Create failed\n");
1234 check_iml_data(himl, BMP_CX, BMP_CX, 0, 5, 2, ILC_COLOR4, "bpp default");
1235 icon = CreateIcon(hinst, 32, 32, 1, 1, icon_bits, icon_bits);
1236 ok( pImageList_ReplaceIcon(himl, -1, icon) == 0, "Failed to add icon.\n");
1237 ok( pImageList_ReplaceIcon(himl, -1, icon) == 1, "Failed to add icon.\n");
1238 DestroyIcon( icon );
1239 check_iml_data(himl, BMP_CX, BMP_CX, 2, 5, 2, ILC_COLOR4, "bpp default");
1240 ret = pImageList_Destroy(himl);
1241 ok(ret, "ImageList_Destroy failed\n");
1242
1243 himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR24|ILC_MASK, 4, 2);
1244 ok(himl != 0, "ImageList_Create failed\n");
1245 check_iml_data(himl, BMP_CX, BMP_CX, 0, 5, 2, ILC_COLOR24|ILC_MASK, "bpp 24 + mask");
1246 icon = CreateIcon(hinst, 32, 32, 1, 1, icon_bits, icon_bits);
1247 ok( pImageList_ReplaceIcon(himl, -1, icon) == 0, "Failed to add icon.\n");
1248 ok( pImageList_ReplaceIcon(himl, -1, icon) == 1, "Failed to add icon.\n");
1249 DestroyIcon( icon );
1250 check_iml_data(himl, BMP_CX, BMP_CX, 2, 5, 2, ILC_COLOR24|ILC_MASK, "bpp 24 + mask");
1251 ret = pImageList_Destroy(himl);
1252 ok(ret, "ImageList_Destroy failed\n");
1253
1254 himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR4|ILC_MASK, 4, 2);
1255 ok(himl != 0, "ImageList_Create failed\n");
1256 check_iml_data(himl, BMP_CX, BMP_CX, 0, 5, 2, ILC_COLOR4|ILC_MASK, "bpp 4 + mask");
1257 icon = CreateIcon(hinst, 32, 32, 1, 1, icon_bits, icon_bits);
1258 ok( pImageList_ReplaceIcon(himl, -1, icon) == 0, "Failed to add icon.\n");
1259 ok( pImageList_ReplaceIcon(himl, -1, icon) == 1, "Failed to add icon.\n");
1260 DestroyIcon( icon );
1261 check_iml_data(himl, BMP_CX, BMP_CX, 2, 5, 2, ILC_COLOR4|ILC_MASK, "bpp 4 + mask");
1262 ret = pImageList_Destroy(himl);
1263 ok(ret, "ImageList_Destroy failed\n");
1264
1265 himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR4|ILC_MASK, 2, 99);
1266 ok(himl != 0, "ImageList_Create failed\n");
1267 check_iml_data(himl, BMP_CX, BMP_CX, 0, 3, 99, ILC_COLOR4|ILC_MASK, "init 2 grow 99");
1268 icon = CreateIcon(hinst, 32, 32, 1, 1, icon_bits, icon_bits);
1269 ok( pImageList_ReplaceIcon(himl, -1, icon) == 0, "Failed to add icon.\n");
1270 ok( pImageList_ReplaceIcon(himl, -1, icon) == 1, "Failed to add icon.\n");
1271 check_iml_data(himl, BMP_CX, BMP_CX, 2, 3, 99, ILC_COLOR4|ILC_MASK, "init 2 grow 99 2 icons");
1272 ok( pImageList_ReplaceIcon(himl, -1, icon) == 2, "Failed to add icon\n");
1273 DestroyIcon( icon );
1274 check_iml_data(himl, BMP_CX, BMP_CX, 3, 104, 99, ILC_COLOR4|ILC_MASK, "init 2 grow 99 3 icons");
1275 ok( pImageList_Remove(himl, -1) == TRUE, "Failed to remove icon.\n");
1276 check_iml_data(himl, BMP_CX, BMP_CX, 0, 100, 99, ILC_COLOR4|ILC_MASK, "init 2 grow 99 empty");
1277 ok( pImageList_SetImageCount(himl, 22) == TRUE, "Failed to set image count.\n");
1278 check_iml_data(himl, BMP_CX, BMP_CX, 22, 23, 99, ILC_COLOR4|ILC_MASK, "init 2 grow 99 set count 22");
1279 ok( pImageList_SetImageCount(himl, 0) == TRUE, "Failed to set image count.\n");
1280 check_iml_data(himl, BMP_CX, BMP_CX, 0, 1, 99, ILC_COLOR4|ILC_MASK, "init 2 grow 99 set count 0");
1281 ok( pImageList_SetImageCount(himl, 42) == TRUE, "Failed to set image count.\n");
1282 check_iml_data(himl, BMP_CX, BMP_CX, 42, 43, 99, ILC_COLOR4|ILC_MASK, "init 2 grow 99 set count 42");
1283 ret = pImageList_Destroy(himl);
1284 ok(ret, "ImageList_Destroy failed\n");
1285
1286 for (grow = 1; grow <= 16; grow++)
1287 {
1288 himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR4|ILC_MASK, 2, grow);
1289 ok(himl != 0, "ImageList_Create failed\n");
1290 check_iml_data(himl, BMP_CX, BMP_CX, 0, 3, grow, ILC_COLOR4|ILC_MASK, "grow test");
1291 ret = pImageList_Destroy(himl);
1292 ok(ret, "ImageList_Destroy failed\n");
1293 }
1294
1295 himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR4|ILC_MASK, 2, -20);
1296 ok(himl != 0, "ImageList_Create failed\n");
1297 check_iml_data(himl, BMP_CX, BMP_CX, 0, 3, -20, ILC_COLOR4|ILC_MASK, "init 2 grow -20");
1298 ret = pImageList_Destroy(himl);
1299 ok(ret, "ImageList_Destroy failed\n");
1300
1301 /* Version 6 implementation hangs on large grow values. */
1302 if (!is_v6_test())
1303 {
1304 himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR4|ILC_MASK, 2, 65536+12);
1305 ok(himl != 0, "ImageList_Create failed\n");
1306 check_iml_data(himl, BMP_CX, BMP_CX, 0, 3, 65536+12, ILC_COLOR4|ILC_MASK, "init 2 grow 65536+12");
1307 ret = pImageList_Destroy(himl);
1308 ok(ret, "ImageList_Destroy failed\n");
1309
1310 himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR4|ILC_MASK, 2, 65535);
1311 ok(himl != 0, "ImageList_Create failed\n");
1312 check_iml_data(himl, BMP_CX, BMP_CX, 0, 3, 65535, ILC_COLOR4|ILC_MASK, "init 2 grow 65535");
1313 ret = pImageList_Destroy(himl);
1314 ok(ret, "ImageList_Destroy failed\n");
1315 }
1316}
static BOOL is_v6_test(void)
Definition: imagelist.c:102
static void image_list_init(HIMAGELIST himl, INT grow)
Definition: imagelist.c:1060

Referenced by START_TEST().

◆ test_loadimage()

static void test_loadimage ( void  )
static

Definition at line 2255 of file imagelist.c.

2256{
2258 DWORD flags;
2259
2260 list = pImageList_LoadImageW( hinst, MAKEINTRESOURCEW(IDB_BITMAP_128x15), 16, 1, CLR_DEFAULT,
2262 ok( list != NULL, "got %p\n", list );
2263 flags = pImageList_GetFlags( list );
2264 ok( flags == (ILC_COLOR4 | ILC_MASK), "got %08x\n", flags );
2265 pImageList_Destroy( list );
2266
2267 list = pImageList_LoadImageW( hinst, MAKEINTRESOURCEW(IDB_BITMAP_128x15), 16, 1, CLR_NONE,
2269 ok( list != NULL, "got %p\n", list );
2270 flags = pImageList_GetFlags( list );
2271 ok( flags == ILC_COLOR4, "got %08x\n", flags );
2272 pImageList_Destroy( list );
2273}
Definition: list.h:37
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IDB_BITMAP_128x15
Definition: resources.h:24
#define list
Definition: rosglue.h:35
#define IMAGE_BITMAP
Definition: winuser.h:211
#define LR_CREATEDIBSECTION
Definition: winuser.h:1101
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

Referenced by START_TEST().

◆ test_merge()

static void test_merge ( void  )
static

Definition at line 624 of file imagelist.c.

625{
626 HIMAGELIST himl1, himl2, hmerge;
627 HICON hicon1;
629
630 himl1 = pImageList_Create(32, 32, 0, 0, 3);
631 ok(himl1 != NULL,"failed to create himl1\n");
632
633 himl2 = pImageList_Create(32, 32, 0, 0, 3);
634 ok(himl2 != NULL,"failed to create himl2\n");
635
636 hicon1 = CreateIcon(hinst, 32, 32, 1, 1, icon_bits, icon_bits);
637 ok(hicon1 != NULL, "failed to create hicon1\n");
638
639 if (!himl1 || !himl2 || !hicon1)
640 return;
641
642 ok(0 == pImageList_ReplaceIcon(himl2, -1, hicon1), "Failed to add icon1 to himl2.\n");
643 check_bits(hwnd, himl2, 0, 32, icon_bits, "add icon1 to himl2");
644
645 /* If himl1 has no images, merge still succeeds */
646 hmerge = pImageList_Merge(himl1, -1, himl2, 0, 0, 0);
647 ok(hmerge != NULL, "merge himl1,-1 failed\n");
648 check_bits(hwnd, hmerge, 0, 32, empty_bits, "merge himl1,-1");
649 pImageList_Destroy(hmerge);
650
651 hmerge = pImageList_Merge(himl1, 0, himl2, 0, 0, 0);
652 ok(hmerge != NULL,"merge himl1,0 failed\n");
653 check_bits(hwnd, hmerge, 0, 32, empty_bits, "merge himl1,0");
654 pImageList_Destroy(hmerge);
655
656 /* Same happens if himl2 is empty */
657 pImageList_Destroy(himl2);
658 himl2 = pImageList_Create(32, 32, 0, 0, 3);
659 ok(himl2 != NULL,"failed to recreate himl2\n");
660 if (!himl2)
661 return;
662
663 hmerge = pImageList_Merge(himl1, -1, himl2, -1, 0, 0);
664 ok(hmerge != NULL, "merge himl2,-1 failed\n");
665 check_bits(hwnd, hmerge, 0, 32, empty_bits, "merge himl2,-1");
666 pImageList_Destroy(hmerge);
667
668 hmerge = pImageList_Merge(himl1, -1, himl2, 0, 0, 0);
669 ok(hmerge != NULL, "merge himl2,0 failed\n");
670 check_bits(hwnd, hmerge, 0, 32, empty_bits, "merge himl2,0");
671 pImageList_Destroy(hmerge);
672
673 /* Now try merging an image with itself */
674 ok(0 == pImageList_ReplaceIcon(himl2, -1, hicon1), "Failed to re-add icon1 to himl2.\n");
675
676 hmerge = pImageList_Merge(himl2, 0, himl2, 0, 0, 0);
677 ok(hmerge != NULL, "merge himl2 with itself failed\n");
678 check_bits(hwnd, hmerge, 0, 32, empty_bits, "merge himl2 with itself");
679 pImageList_Destroy(hmerge);
680
681 /* Try merging 2 different image lists */
682 ok(0 == pImageList_ReplaceIcon(himl1, -1, hicon1), "Failed to add icon1 to himl1.\n");
683
684 hmerge = pImageList_Merge(himl1, 0, himl2, 0, 0, 0);
685 ok(hmerge != NULL, "merge himl1 with himl2 failed\n");
686 check_bits(hwnd, hmerge, 0, 32, empty_bits, "merge himl1 with himl2");
687 pImageList_Destroy(hmerge);
688
689 hmerge = pImageList_Merge(himl1, 0, himl2, 0, 8, 16);
690 ok(hmerge != NULL, "merge himl1 with himl2 8,16 failed\n");
691 check_bits(hwnd, hmerge, 0, 32, empty_bits, "merge himl1 with himl2, 8,16");
692 pImageList_Destroy(hmerge);
693
694 pImageList_Destroy(himl1);
695 pImageList_Destroy(himl2);
696 DestroyIcon(hicon1);
698}
static void check_bits(HWND hwnd, HIMAGELIST himl, int idx, int size, const BYTE *checkbits, LPCSTR loc)
Definition: imagelist.c:245
static const BYTE empty_bits[48 *48/8]
Definition: imagelist.c:117

Referenced by START_TEST().

◆ test_merge_colors()

static void test_merge_colors ( void  )
static

Definition at line 577 of file imagelist.c.

578{
579 HIMAGELIST himl[8], hmerge;
581 HICON hicon1;
583 int bpp, i, j;
584
585 hicon1 = CreateIcon(hinst, 32, 32, 1, 1, icon_bits, icon_bits);
586 ok(hicon1 != NULL, "failed to create hicon1\n");
587
588 for (i = 0; i < 8; i++)
589 {
590 himl[i] = pImageList_Create(32, 32, sizes[i], 0, 3);
591 ok(himl[i] != NULL, "failed to create himl[%d]\n", i);
592 ok(0 == pImageList_ReplaceIcon(himl[i], -1, hicon1), "Failed to add icon1 to himl[%d].\n", i);
593 if (i == 0 || i == 1 || i == 7)
594 {
595 pImageList_GetImageInfo(himl[i], 0, &info);
596 sizes[i] = get_color_format(info.hbmImage);
597 }
598 }
599 DestroyIcon(hicon1);
600 for (i = 0; i < 8; i++)
601 for (j = 0; j < 8; j++)
602 {
603 hmerge = pImageList_Merge(himl[i], 0, himl[j], 0, 0, 0);
604 ok(hmerge != NULL, "merge himl[%d], himl[%d] failed\n", i, j);
605
606 pImageList_GetImageInfo(hmerge, 0, &info);
607 bpp = get_color_format(info.hbmImage);
608 /* ILC_COLOR[X] is defined as [X] */
609 if (i == 4 && j == 7)
610 ok(bpp == 16, /* merging ILC_COLOR16 with ILC_COLORDDB seems to be a special case */
611 "wrong biBitCount %d when merging lists %d (%d) and %d (%d)\n", bpp, i, sizes[i], j, sizes[j]);
612 else
613 ok(bpp == (i > j ? sizes[i] : sizes[j]),
614 "wrong biBitCount %d when merging lists %d (%d) and %d (%d)\n", bpp, i, sizes[i], j, sizes[j]);
615 ok(info.hbmMask != 0, "Imagelist merged from %d and %d had no mask\n", i, j);
616
617 pImageList_Destroy(hmerge);
618 }
619
620 for (i = 0; i < 8; i++)
621 pImageList_Destroy(himl[i]);
622}
static int get_color_format(HBITMAP bmp)
Definition: imagelist.c:560
static const struct @541 sizes[]

Referenced by START_TEST().

◆ test_shell_imagelist()

static void test_shell_imagelist ( void  )
static

Definition at line 1318 of file imagelist.c.

1319{
1320 HRESULT (WINAPI *pSHGetImageList)(INT, REFIID, void**);
1321 IImageList *iml = NULL;
1323 HRESULT hr;
1324 int out = 0;
1325 RECT rect;
1326 int cx, cy;
1327
1328 /* Try to load function from shell32 */
1329 hShell32 = LoadLibraryA("shell32.dll");
1330 pSHGetImageList = (void*)GetProcAddress(hShell32, (LPCSTR) 727);
1331
1332 if (!pSHGetImageList)
1333 {
1334 win_skip("SHGetImageList not available, skipping test\n");
1336 return;
1337 }
1338
1339 /* Get system image list */
1340 hr = pSHGetImageList(SHIL_SYSSMALL, &IID_IImageList, (void**)&iml);
1341 ok(SUCCEEDED(hr), "SHGetImageList failed, hr=%x\n", hr);
1342
1343 if (hr != S_OK) {
1345 return;
1346 }
1347
1348 IImageList_GetImageCount(iml, &out);
1349 ok(out > 0, "IImageList_GetImageCount returned out <= 0\n");
1350
1351 /* Fetch the small icon size */
1354
1355 /* Check icon size matches */
1356 IImageList_GetImageRect(iml, 0, &rect);
1357 ok(((rect.right == cx) && (rect.bottom == cy)),
1358 "IImageList_GetImageRect returned r:%d,b:%d\n",
1359 rect.right, rect.bottom);
1360
1361 IImageList_Release(iml);
1363}
#define GetProcAddress(x, y)
Definition: compat.h:753
#define FreeLibrary(x)
Definition: compat.h:748
static INT
Definition: imagelist.c:88
static const IUnknown REFIID
Definition: imagelist.c:68
static HMODULE hShell32
Definition: string.c:34
static FILE * out
Definition: regtests2xml.c:44
#define SHIL_SYSSMALL
Definition: shellapi.h:187
& rect
Definition: startmenu.cpp:1413
#define HRESULT
Definition: msvc.h:7
#define WINAPI
Definition: msvc.h:6
#define SM_CYSMICON
Definition: winuser.h:1016
#define SM_CXSMICON
Definition: winuser.h:1015
int WINAPI GetSystemMetrics(_In_ int)

Referenced by START_TEST().

◆ Test_Stream_AddRef()

static ULONG STDMETHODCALLTYPE Test_Stream_AddRef ( IStream iface)
static

Definition at line 722 of file imagelist.c.

723{
724 ok(0, "unexpected call\n");
725 return 2;
726}

◆ Test_Stream_Clone()

static HRESULT STDMETHODCALLTYPE Test_Stream_Clone ( IStream iface,
IStream **  ppstm 
)
static

Definition at line 814 of file imagelist.c.

815{
816 ok(0, "unexpected call\n");
817 return E_NOTIMPL;
818}
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Test_Stream_Commit()

static HRESULT STDMETHODCALLTYPE Test_Stream_Commit ( IStream iface,
DWORD  grfCommitFlags 
)
static

Definition at line 781 of file imagelist.c.

782{
783 ok(0, "unexpected call\n");
784 return E_NOTIMPL;
785}

◆ Test_Stream_CopyTo()

static HRESULT STDMETHODCALLTYPE Test_Stream_CopyTo ( IStream iface,
IStream pstm,
ULARGE_INTEGER  cb,
ULARGE_INTEGER pcbRead,
ULARGE_INTEGER pcbWritten 
)
static

Definition at line 773 of file imagelist.c.

776{
777 ok(0, "unexpected call\n");
778 return E_NOTIMPL;
779}

◆ Test_Stream_LockRegion()

static HRESULT STDMETHODCALLTYPE Test_Stream_LockRegion ( IStream iface,
ULARGE_INTEGER  libOffset,
ULARGE_INTEGER  cb,
DWORD  dwLockType 
)
static

Definition at line 793 of file imagelist.c.

795{
796 ok(0, "unexpected call\n");
797 return E_NOTIMPL;
798}

◆ Test_Stream_QueryInterface()

static HRESULT STDMETHODCALLTYPE Test_Stream_QueryInterface ( IStream iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 715 of file imagelist.c.

717{
718 ok(0, "unexpected call\n");
719 return E_NOTIMPL;
720}

◆ Test_Stream_Read()

static HRESULT STDMETHODCALLTYPE Test_Stream_Read ( IStream iface,
void pv,
ULONG  cb,
ULONG pcbRead 
)
static

Definition at line 734 of file imagelist.c.

736{
737 struct memstream *stream = impl_from_IStream(iface);
738 return IStream_Read(stream->stream, pv, cb, pcbRead);
739}
static struct memstream * impl_from_IStream(IStream *iface)
Definition: imagelist.c:710
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33

◆ Test_Stream_Release()

static ULONG STDMETHODCALLTYPE Test_Stream_Release ( IStream iface)
static

Definition at line 728 of file imagelist.c.

729{
730 ok(0, "unexpected call\n");
731 return 1;
732}

◆ Test_Stream_Revert()

static HRESULT STDMETHODCALLTYPE Test_Stream_Revert ( IStream iface)
static

Definition at line 787 of file imagelist.c.

788{
789 ok(0, "unexpected call\n");
790 return E_NOTIMPL;
791}

◆ Test_Stream_Seek()

static HRESULT STDMETHODCALLTYPE Test_Stream_Seek ( IStream iface,
LARGE_INTEGER  offset,
DWORD  origin,
ULARGE_INTEGER new_pos 
)
static

Definition at line 748 of file imagelist.c.

750{
751 struct memstream *stream = impl_from_IStream(iface);
752
753 if (is_v6_test())
754 {
755 ok(origin == STREAM_SEEK_CUR, "Unexpected origin %d.\n", origin);
756 ok(offset.QuadPart == 0, "Unexpected offset %s.\n", wine_dbgstr_longlong(offset.QuadPart));
757 ok(new_pos != NULL, "Unexpected out position pointer.\n");
758 return IStream_Seek(stream->stream, offset, origin, new_pos);
759 }
760 else
761 {
762 ok(0, "unexpected call\n");
763 return E_NOTIMPL;
764 }
765}
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49
GLintptr offset
Definition: glext.h:5920
voidpf uLong int origin
Definition: ioapi.h:144

◆ Test_Stream_SetSize()

static HRESULT STDMETHODCALLTYPE Test_Stream_SetSize ( IStream iface,
ULARGE_INTEGER  libNewSize 
)
static

Definition at line 767 of file imagelist.c.

768{
769 ok(0, "unexpected call\n");
770 return E_NOTIMPL;
771}

◆ Test_Stream_Stat()

static HRESULT STDMETHODCALLTYPE Test_Stream_Stat ( IStream iface,
STATSTG *  pstatstg,
DWORD  grfStatFlag 
)
static

Definition at line 807 of file imagelist.c.

809{
810 ok(0, "unexpected call\n");
811 return E_NOTIMPL;
812}

◆ Test_Stream_UnlockRegion()

static HRESULT STDMETHODCALLTYPE Test_Stream_UnlockRegion ( IStream iface,
ULARGE_INTEGER  libOffset,
ULARGE_INTEGER  cb,
DWORD  dwLockType 
)
static

Definition at line 800 of file imagelist.c.

802{
803 ok(0, "unexpected call\n");
804 return E_NOTIMPL;