ReactOS  0.4.14-dev-583-g2a1ba2c
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 112 of file imagelist.c.

◆ BMP_CX

#define BMP_CX   48

Definition at line 706 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 48 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 113 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 116 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)
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define e
Definition: ke_i.h:82
GLboolean GLboolean g
Definition: glext.h:6204
GLfloat f
Definition: glext.h:7540
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define d
Definition: ke_i.h:81
const GLubyte * c
Definition: glext.h:8905
#define ROW1(a, b, c, d, e, f, g, h)
Definition: imagelist.c:113
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

Definition at line 114 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)
#define ROW2(a, b, c, d, e, f, g, h, i, j, k, l)
Definition: imagelist.c:116
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define e
Definition: ke_i.h:82
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
r l[0]
Definition: byte_order.h:167
GLboolean GLboolean g
Definition: glext.h:6204
GLfloat f
Definition: glext.h:7540
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define d
Definition: ke_i.h:81
const GLubyte * c
Definition: glext.h:8905
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
int k
Definition: mpi.c:3369

Definition at line 117 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 861 of file imagelist.c.

863 {
864  const BITMAPFILEHEADER *bmfh = (const BITMAPFILEHEADER *)bm_data;
865  const BITMAPINFOHEADER *bmih = (const BITMAPINFOHEADER *)(bm_data + sizeof(*bmfh));
866  ULONG hdr_size, image_size;
867 
868  hdr_size = sizeof(*bmfh) + sizeof(*bmih);
869  if (bmih->biBitCount <= 8) hdr_size += (1 << bpp) * sizeof(RGBQUAD);
870 
871  ok(bmfh->bfType == (('M' << 8) | 'B'), "wrong bfType 0x%02x\n", bmfh->bfType);
872  ok(bmfh->bfSize == hdr_size, "wrong bfSize 0x%02x\n", bmfh->bfSize);
873  ok(bmfh->bfReserved1 == 0, "wrong bfReserved1 0x%02x\n", bmfh->bfReserved1);
874  ok(bmfh->bfReserved2 == 0, "wrong bfReserved2 0x%02x\n", bmfh->bfReserved2);
875  ok(bmfh->bfOffBits == hdr_size, "wrong bfOffBits 0x%02x\n", bmfh->bfOffBits);
876 
877  ok(bmih->biSize == sizeof(*bmih), "wrong biSize %d\n", bmih->biSize);
878  ok(bmih->biPlanes == 1, "wrong biPlanes %d\n", bmih->biPlanes);
879  ok(bmih->biBitCount == bpp, "wrong biBitCount %d\n", bmih->biBitCount);
880 
881  image_size = DIB_GetWidthBytes(bmih->biWidth, bmih->biBitCount) * bmih->biHeight;
882  ok(bmih->biSizeImage == image_size, "wrong biSizeImage %u\n", bmih->biSizeImage);
883  ok(bmih->biWidth == bmpsize->cx && bmih->biHeight == bmpsize->cy, "Unexpected bitmap size %d x %d, "
884  "expected %d x %d\n", bmih->biWidth, bmih->biHeight, bmpsize->cx, bmpsize->cy);
885 
886 if (0)
887 {
888  char fname[256];
889  FILE *f;
890  sprintf(fname, "bmp_%s.bmp", comment);
891  f = fopen(fname, "wb");
892  fwrite(bm_data, 1, bm_data_size, f);
893  fclose(f);
894 }
895 
896  return hdr_size + image_size;
897 }
_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 sprintf(buf, format,...)
Definition: sprintf.c:55
LONG cx
Definition: windef.h:334
GLfloat f
Definition: glext.h:7540
Definition: id3.c:18
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
#define f
Definition: ke_i.h:83
#define ok(value,...)
Definition: atltest.h:57
unsigned int ULONG
Definition: retypes.h:1
static INT DIB_GetWidthBytes(int width, int bpp)
Definition: imagelist.c:856
DWORD bpp
Definition: surface.c:181
LONG cy
Definition: windef.h:335
static GLint image_size(GLint width, GLint height, GLenum format, GLenum type)
Definition: mipmap.c:4856

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 249 of file imagelist.c.

251 {
252  BYTE bits[100*100/8];
253  COLORREF c;
254  HDC hdc;
255  int x, y, i = -1;
256 
257  if (!winetest_interactive || !himl) return;
258 
259  memset(bits, 0, sizeof(bits));
260  hdc = show_image(hwnd, himl, idx, size, loc, FALSE);
261 
262  c = GetPixel(hdc, 0, 0);
263 
264  for (y = 0; y < size; y ++)
265  {
266  for (x = 0; x < size; x++)
267  {
268  if (!(x & 0x7)) i++;
269  if (GetPixel(hdc, x, y) != c) bits[i] |= (0x80 >> (x & 0x7));
270  }
271  }
272 
273  BitBlt(hdc, 0, 0, size, size, hdc, size+1, size+1, SRCCOPY);
274  ReleaseDC(hwnd, hdc);
275 
276  ok (memcmp(bits, checkbits, (size * size)/8) == 0,
277  "%s: bits different\n", loc);
278  if (memcmp(bits, checkbits, (size * size)/8))
279  dump_bits(bits, checkbits, size);
280 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static void dump_bits(const BYTE *p, const BYTE *q, int size)
Definition: imagelist.c:228
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
static HDC
Definition: imagelist.c:92
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
int winetest_interactive
DWORD GetPixel(LPDIRECTDRAWSURFACE7 Surface, UINT x, UINT y)
Definition: blt.cpp:2
HIMAGELIST himl
static VOID NTAPI BitBlt(IN ULONG Left, IN ULONG Top, IN ULONG Width, IN ULONG Height, IN PUCHAR Buffer, IN ULONG BitsPerPixel, IN ULONG Delta)
Definition: vga.c:410
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
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
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
unsigned int idx
Definition: utils.c:41
GLsizeiptr size
Definition: glext.h:5919
DWORD COLORREF
Definition: windef.h:300
const GLubyte * c
Definition: glext.h:8905
HDC hdc
Definition: main.c:9
unsigned char BYTE
Definition: mem.h:68
#define ok(value,...)
Definition: atltest.h:57
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define c
Definition: ke_i.h:80
static HDC show_image(HWND hwnd, HIMAGELIST himl, int idx, int size, LPCSTR loc, BOOL clear)
Definition: imagelist.c:204
#define memset(x, y, z)
Definition: compat.h:39
#define SRCCOPY
Definition: wingdi.h:332

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 2025 of file imagelist.c.

2027 {
2028  IMAGEINFO info;
2029  INT ret;
2030 #ifdef __REACTOS__
2031  char bmi_buffer[FIELD_OFFSET(BITMAPINFO, bmiColors) + 256 * sizeof(RGBQUAD)];
2032 #else
2033  char bmi_buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )];
2034 #endif
2035  BITMAPINFO *bmi = (BITMAPINFO *)bmi_buffer;
2036  int i, depth = ilc & 0xfe;
2037 
2038  ret = pImageList_GetImageInfo(himl, 0, &info);
2039  ok(ret, "got %d\n", ret);
2040  ok(info.hbmImage != NULL, "got %p\n", info.hbmImage);
2041 
2042  memset(bmi_buffer, 0, sizeof(bmi_buffer));
2043  bmi->bmiHeader.biSize = sizeof(bmi->bmiHeader);
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  ret = GetDIBits(hdc, info.hbmImage, 0, 0, NULL, bmi, DIB_RGB_COLORS);
2049  ok(ret, "got %d\n", ret);
2050  ok(bmi->bmiHeader.biBitCount == depth, "got %d\n", bmi->bmiHeader.biBitCount);
2051 
2052  for (i = 0; i < (1 << depth); i++)
2053  ok((bmi->bmiColors[i].rgbRed == expect[i].rgbRed &&
2054  bmi->bmiColors[i].rgbGreen == expect[i].rgbGreen &&
2055  bmi->bmiColors[i].rgbBlue == expect[i].rgbBlue) ||
2056  (broken_expect && broken(bmi->bmiColors[i].rgbRed == broken_expect[i].rgbRed &&
2057  bmi->bmiColors[i].rgbGreen == broken_expect[i].rgbGreen &&
2058  bmi->bmiColors[i].rgbBlue == broken_expect[i].rgbBlue)),
2059  "%d: %s: got color[%d] %02x %02x %02x expect %02x %02x %02x\n", depth, name, i,
2060  bmi->bmiColors[i].rgbRed, bmi->bmiColors[i].rgbGreen, bmi->bmiColors[i].rgbBlue,
2061  expect[i].rgbRed, expect[i].rgbGreen, expect[i].rgbBlue);
2062 }
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1475
HIMAGELIST himl
int32_t INT
Definition: typedefs.h:56
UCHAR rgbBlue
Definition: inbv.c:170
struct _test_info info[]
Definition: SetCursorPos.c:19
UCHAR rgbGreen
Definition: inbv.c:171
UCHAR rgbRed
Definition: inbv.c:172
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
smooth NULL
Definition: ftsmooth.c:416
struct tagRGBQUAD RGBQUAD
RGBQUAD bmiColors[1]
Definition: wingdi.h:1476
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
int ret
HDC hdc
Definition: main.c:9
#define broken(x)
Definition: _sntprintf.h:21
#define ok(value,...)
Definition: atltest.h:57
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
#define expect(expected, got)
Definition: combo.c:36
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)
Definition: name.c:38
#define DIB_RGB_COLORS
Definition: wingdi.h:366
#define memset(x, y, z)
Definition: compat.h:39

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 904 of file imagelist.c.

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

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 1402 of file imagelist.c.

1404 {
1405  bits[0] = 0x00FFFFFF;
1406  pImageList_DrawIndirect(ildp);
1408  "ImageList_DrawIndirect: Pixel %08X, Expected a close match to %08X from line %d\n",
1409  bits[0] & 0x00FFFFFF, expected, line);
1410 }
static BOOL colour_match(UINT32 x, UINT32 y)
Definition: imagelist.c:1391
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
Definition: parser.c:48
#define ok(value,...)
Definition: atltest.h:57
BOOL expected
Definition: store.c:2063

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 1437 of file imagelist.c.

1440 {
1441  IMAGELISTDRAWPARAMS ildp = {sizeof(IMAGELISTDRAWPARAMS), himl, i, hdc,
1442  0, 0, 0, 0, 0, 0, CLR_NONE, CLR_NONE, fStyle, 0, fState, Frame, 0x00000000};
1443  bits[0] = 0x00FFFFFF;
1444  pImageList_DrawIndirect(&ildp);
1445  ok(colour_match(bits[0], expected) ||
1446  broken(colour_match(bits[0], broken_expected)),
1447  "ImageList_DrawIndirect: Pixel %08X, Expected a close match to %08X from line %d\n",
1448  bits[0] & 0x00FFFFFF, expected, line);
1449 }
static BOOL colour_match(UINT32 x, UINT32 y)
Definition: imagelist.c:1391
HIMAGELIST himl
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
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
Definition: parser.c:48
#define CLR_NONE
Definition: commctrl.h:315
HDC hdc
Definition: main.c:9
#define broken(x)
Definition: _sntprintf.h:21
#define ok(value,...)
Definition: atltest.h:57
struct _IMAGELISTDRAWPARAMS IMAGELISTDRAWPARAMS
BOOL expected
Definition: store.c:2063

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 1429 of file imagelist.c.

1431 {
1432  IMAGELISTDRAWPARAMS ildp = {sizeof(IMAGELISTDRAWPARAMS), himl, i, hdc,
1433  0, 0, 0, 0, 0, 0, CLR_NONE, CLR_NONE, fStyle, 0, fState, Frame, 0x00000000};
1435 }
HIMAGELIST himl
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
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
Definition: parser.c:48
#define CLR_NONE
Definition: commctrl.h:315
HDC hdc
Definition: main.c:9
static void check_ImageList_DrawIndirect(IMAGELISTDRAWPARAMS *ildp, UINT32 *bits, UINT32 expected, int line)
Definition: imagelist.c:1402
struct _IMAGELISTDRAWPARAMS IMAGELISTDRAWPARAMS
BOOL expected
Definition: store.c:2063

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 1413 of file imagelist.c.

1415 {
1416  IMAGELISTDRAWPARAMS ildp = {sizeof(IMAGELISTDRAWPARAMS), himl, i, hdc,
1417  0, 0, 0, 0, 0, 0, CLR_NONE, CLR_NONE, fStyle, 0, ILS_NORMAL, 0, 0x00000000};
1419 }
HIMAGELIST himl
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
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
Definition: parser.c:48
#define CLR_NONE
Definition: commctrl.h:315
HDC hdc
Definition: main.c:9
static void check_ImageList_DrawIndirect(IMAGELISTDRAWPARAMS *ildp, UINT32 *bits, UINT32 expected, int line)
Definition: imagelist.c:1402
#define ILS_NORMAL
Definition: commctrl.h:431
struct _IMAGELISTDRAWPARAMS IMAGELISTDRAWPARAMS
BOOL expected
Definition: store.c:2063

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 1421 of file imagelist.c.

1423 {
1424  IMAGELISTDRAWPARAMS ildp = {sizeof(IMAGELISTDRAWPARAMS), himl, i, hdc,
1425  0, 0, 0, 0, 0, 0, CLR_NONE, CLR_NONE, ILD_IMAGE | ILD_ROP, dwRop, ILS_NORMAL, 0, 0x00000000};
1427 }
HIMAGELIST himl
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
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
Definition: parser.c:48
#define CLR_NONE
Definition: commctrl.h:315
#define ILD_ROP
Definition: commctrl.h:417
#define ILD_IMAGE
Definition: commctrl.h:416
HDC hdc
Definition: main.c:9
static void check_ImageList_DrawIndirect(IMAGELISTDRAWPARAMS *ildp, UINT32 *bits, UINT32 expected, int line)
Definition: imagelist.c:1402
#define ILS_NORMAL
Definition: commctrl.h:431
struct _IMAGELISTDRAWPARAMS IMAGELISTDRAWPARAMS
BOOL expected
Definition: store.c:2063

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 990 of file imagelist.c.

992 {
993  INT ret, cxx, cyy, size;
994  struct memstream stream;
995  const ILHEAD *header;
996  LARGE_INTEGER mv;
997  HIMAGELIST himl2;
998  HGLOBAL hglobal;
999  STATSTG stat;
1000  char *data;
1001  HRESULT hr;
1002  SIZE bmpsize;
1003  BOOL b;
1004 
1005  ret = pImageList_GetImageCount(himl);
1006  ok(ret == cur, "%s: expected image count %d got %d\n", comment, cur, ret);
1007 
1008  ret = pImageList_GetIconSize(himl, &cxx, &cyy);
1009  ok(ret, "ImageList_GetIconSize failed\n");
1010  ok(cxx == cx, "%s: wrong cx %d (expected %d)\n", comment, cxx, cx);
1011  ok(cyy == cy, "%s: wrong cy %d (expected %d)\n", comment, cyy, cy);
1012 
1014  b = pImageList_Write(himl, &stream.IStream_iface);
1015  ok(b, "%s: ImageList_Write failed\n", comment);
1016 
1017  hr = GetHGlobalFromStream(stream.stream, &hglobal);
1018  ok(hr == S_OK, "%s: Failed to get hglobal, %#x\n", comment, hr);
1019 
1020  hr = IStream_Stat(stream.stream, &stat, STATFLAG_NONAME);
1021  ok(hr == S_OK, "Stat() failed, hr %#x.\n", hr);
1022 
1023  data = GlobalLock(hglobal);
1024 
1025  ok(data != 0, "%s: ImageList_Write didn't write any data\n", comment);
1026  ok(stat.cbSize.LowPart > sizeof(ILHEAD), "%s: ImageList_Write wrote not enough data\n", comment);
1027 
1028  header = (const ILHEAD *)data;
1029  check_ilhead_data(header, cx, cy, cur, max, grow, flags);
1030  imagelist_get_bitmap_size(header, &bmpsize);
1031  size = check_bitmap_data(header, data + sizeof(ILHEAD), stat.cbSize.LowPart - sizeof(ILHEAD),
1032  &bmpsize, flags & 0xfe, comment);
1033  if (!is_v6_header(header) && size < stat.cbSize.LowPart - sizeof(ILHEAD)) /* mask is present */
1034  {
1035  ok( flags & ILC_MASK, "%s: extra data %u/%u but mask not expected\n", comment, stat.cbSize.LowPart, size );
1036  check_bitmap_data(header, data + sizeof(ILHEAD) + size, stat.cbSize.LowPart - sizeof(ILHEAD) - size,
1037  &bmpsize, 1, comment);
1038  }
1039 
1040  /* rewind and reconstruct from stream */
1041  mv.QuadPart = 0;
1042  IStream_Seek(stream.stream, mv, STREAM_SEEK_SET, NULL);
1043  himl2 = pImageList_Read(&stream.IStream_iface);
1044  ok(himl2 != NULL, "%s: Failed to deserialize imagelist\n", comment);
1045  pImageList_Destroy(himl2);
1046 
1047  GlobalUnlock(hglobal);
1049 }
#define max(a, b)
Definition: svc.c:63
HRESULT WINAPI GetHGlobalFromStream(IStream *pstm, HGLOBAL *phglobal)
HRESULT hr
Definition: shlfolder.c:183
static void cleanup_memstream(struct memstream *stream)
Definition: imagelist.c:851
static void imagelist_get_bitmap_size(const ILHEAD *header, SIZE *sz)
Definition: imagelist.c:973
HIMAGELIST himl
int32_t INT
Definition: typedefs.h:56
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:861
unsigned int BOOL
Definition: ntddk_ex.h:94
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:581
smooth NULL
Definition: ftsmooth.c:416
#define b
Definition: ke_i.h:79
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLsizeiptr size
Definition: glext.h:5919
LONG HRESULT
Definition: typedefs.h:77
static BOOL is_v6_header(const ILHEAD *header)
Definition: imagelist.c:899
static void init_memstream(struct memstream *stream)
Definition: imagelist.c:842
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLbitfield flags
Definition: glext.h:7161
int ret
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
Definition: parse.h:22
Definition: id3.c:18
Definition: stat.h:55
#define ILC_MASK
Definition: commctrl.h:347
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
_Out_opt_ int * cx
Definition: commctrl.h:581
IStream IStream_iface
Definition: request.c:4377
static void check_ilhead_data(const ILHEAD *ilh, INT cx, INT cy, INT cur, INT max, INT grow, INT flags)
Definition: imagelist.c:904
struct CFHEADER header
Definition: fdi.c:101
LONGLONG QuadPart
Definition: typedefs.h:112

Referenced by image_list_init(), and test_imagelist_storage().

◆ cleanup_memstream()

static void cleanup_memstream ( struct memstream stream)
static

Definition at line 851 of file imagelist.c.

852 {
853  IStream_Release(stream->stream);
854 }
Definition: parse.h:22

Referenced by check_iml_data().

◆ colour_match()

static BOOL colour_match ( UINT32  x,
UINT32  y 
)
static

Definition at line 1391 of file imagelist.c.

1392 {
1393  const INT32 tolerance = 8;
1394 
1395  const INT32 dr = abs((INT32)(x & 0x000000FF) - (INT32)(y & 0x000000FF));
1396  const INT32 dg = abs((INT32)((x & 0x0000FF00) >> 8) - (INT32)((y & 0x0000FF00) >> 8));
1397  const INT32 db = abs((INT32)((x & 0x00FF0000) >> 16) - (INT32)((y & 0x00FF0000) >> 16));
1398 
1399  return (dr <= tolerance && dg <= tolerance && db <= tolerance);
1400 }
#define abs(i)
Definition: fconv.c:206
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
signed int INT32

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 940 of file imagelist.c.

941 {
942  HDC hdc;
943  BITMAPINFO bmi;
944  HBITMAP hbmp, hbmp_old;
945  HBRUSH hbrush;
946  RECT rc = { 0, 0, cx, cy };
947 
948  hdc = CreateCompatibleDC(0);
949 
950  memset(&bmi, 0, sizeof(bmi));
951  bmi.bmiHeader.biSize = sizeof(bmi.bmiHeader);
952  bmi.bmiHeader.biHeight = cx;
953  bmi.bmiHeader.biWidth = cy;
954  bmi.bmiHeader.biBitCount = 24;
955  bmi.bmiHeader.biPlanes = 1;
958 
959  hbmp_old = SelectObject(hdc, hbmp);
960 
962  FillRect(hdc, &rc, hbrush);
964 
966 
967  SelectObject(hdc, hbmp_old);
968  DeleteDC(hdc);
969 
970  return hbmp;
971 }
static HBRUSH hbrush
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1475
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
GLuint color
Definition: glext.h:6243
DWORD biCompression
Definition: amvideo.idl:35
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:581
smooth NULL
Definition: ftsmooth.c:416
#define DT_VCENTER
Definition: winuser.h:543
HBITMAP hbmp
HDC hdc
Definition: main.c:9
Definition: id3.c:18
static HBITMAP
Definition: imagelist.c:69
#define DT_SINGLELINE
Definition: winuser.h:540
INT WINAPI DrawTextA(HDC hdc, LPCSTR str, INT count, LPRECT rect, UINT flags)
Definition: font.c:373
BOOL WINAPI DeleteDC(_In_ HDC)
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:197
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
_Out_opt_ int * cx
Definition: commctrl.h:581
#define DT_CENTER
Definition: winuser.h:527
#define DIB_RGB_COLORS
Definition: wingdi.h:366
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
#define memset(x, y, z)
Definition: compat.h:39
#define BI_RGB
Definition: precomp.h:34

Referenced by BITMAP_LoadImageW(), image_list_add_bitmap(), and test_imagelist_storage().

◆ create_test_bitmap()

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

Definition at line 1369 of file imagelist.c.

1370 {
1371  HBITMAP hBitmap;
1372  UINT32 *buffer = NULL;
1373  BITMAPINFO bitmapInfo = {{sizeof(BITMAPINFOHEADER), 2, 1, 1, bpp, BI_RGB,
1374  0, 0, 0, 0, 0}};
1375 
1376  hBitmap = CreateDIBSection(hdc, &bitmapInfo, DIB_RGB_COLORS, (void**)&buffer, NULL, 0);
1377  ok(hBitmap != NULL && buffer != NULL, "CreateDIBSection failed.\n");
1378 
1379  if(!hBitmap || !buffer)
1380  {
1382  return NULL;
1383  }
1384 
1385  buffer[0] = pixel1;
1386  buffer[1] = pixel2;
1387 
1388  return hBitmap;
1389 }
struct tagBITMAPINFOHEADER BITMAPINFOHEADER
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
GLuint buffer
Definition: glext.h:5915
unsigned int UINT32
smooth NULL
Definition: ftsmooth.c:416
HDC hdc
Definition: main.c:9
static HBITMAP
Definition: imagelist.c:69
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:197
#define ok(value,...)
Definition: atltest.h:57
DWORD bpp
Definition: surface.c:181
#define DIB_RGB_COLORS
Definition: wingdi.h:366
#define BI_RGB
Definition: precomp.h:34
static HBITMAP hBitmap
Definition: timezone.c:35

Referenced by test_ImageList_DrawIndirect().

◆ create_window()

static HWND create_window ( void  )
static

Definition at line 163 of file imagelist.c.

164 {
165  char className[] = "bmwnd";
166  char winName[] = "Test Bitmap";
167  HWND hWnd;
168  static BOOL registered = FALSE;
169 
170  if (!registered)
171  {
172  WNDCLASSA cls;
173 
176  cls.cbClsExtra = 0;
177  cls.cbWndExtra = 0;
178  cls.hInstance = 0;
180  cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
182  cls.lpszMenuName = 0;
183  cls.lpszClassName = className;
184 
185  RegisterClassA (&cls);
186  registered = TRUE;
187  }
188 
189  /* Setup window */
190  hWnd = CreateWindowA (className, winName,
192  CW_USEDEFAULT, CW_USEDEFAULT, 300, 300, 0,
193  0, hinst, 0);
194 
196  {
198  force_redraw (hWnd);
199  }
200 
201  return hWnd;
202 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define TRUE
Definition: types.h:120
HWND hWnd
Definition: settings.c:17
int cbClsExtra
Definition: winuser.h:3140
#define CS_HREDRAW
Definition: winuser.h:648
LPCSTR lpszMenuName
Definition: winuser.h:3146
#define WHITE_BRUSH
Definition: wingdi.h:901
#define IDI_APPLICATION
Definition: winuser.h:699
HBRUSH hbrBackground
Definition: winuser.h:3145
int winetest_interactive
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
HICON WINAPI LoadIconA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2029
static void force_redraw(HWND hwnd)
Definition: imagelist.c:97
int cbWndExtra
Definition: winuser.h:3141
unsigned int BOOL
Definition: ntddk_ex.h:94
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4290
HCURSOR hCursor
Definition: winuser.h:3144
#define CW_USEDEFAULT
Definition: winuser.h:225
const char * LPCSTR
Definition: xmlstorage.h:183
#define SW_SHOW
Definition: winuser.h:769
#define CS_VREDRAW
Definition: winuser.h:653
#define CS_GLOBALCLASS
Definition: winuser.h:647
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LPCSTR lpszClassName
Definition: winuser.h:3147
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2059
static HINSTANCE hinst
Definition: imagelist.c:94
UINT style
Definition: winuser.h:3138
HINSTANCE hInstance
Definition: winuser.h:3142
WNDPROC lpfnWndProc
Definition: winuser.h:3139
#define IDC_ARROW
Definition: winuser.h:682
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
HICON hIcon
Definition: winuser.h:3143

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

◆ createImageList()

static HIMAGELIST createImageList ( int  cx,
int  cy 
)
static

Definition at line 151 of file imagelist.c.

152 {
153  /* Create an ImageList and put an image into it */
154  HIMAGELIST himl = pImageList_Create(cx, cy, ILC_COLOR, 1, 1);
155  HBITMAP hbm = CreateBitmap(48, 48, 1, 1, bitmap_bits);
156 
157  ok(himl != NULL, "Failed to create image list, %d x %d.\n", cx, cy);
158  pImageList_Add(himl, hbm, NULL);
159  DeleteObject(hbm);
160  return himl;
161 }
static const BYTE bitmap_bits[48 *48/8]
Definition: imagelist.c:135
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HIMAGELIST himl
#define ILC_COLOR
Definition: commctrl.h:348
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:581
smooth NULL
Definition: ftsmooth.c:416
static HBITMAP
Definition: imagelist.c:69
_In_ HBITMAP hbm
Definition: ntgdi.h:2776
#define ok(value,...)
Definition: atltest.h:57
_Out_opt_ int * cx
Definition: commctrl.h:581
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 856 of file imagelist.c.

857 {
858  return ((width * bpp + 31) / 8) & ~3;
859 }
GLint GLint GLsizei width
Definition: gl.h:1546
DWORD bpp
Definition: surface.c:181

Referenced by check_bitmap_data().

◆ dump_bits()

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

Definition at line 228 of file imagelist.c.

229 {
230  int i, j;
231 
232  size /= 8;
233 
234  for (i = 0; i < size * 2; i++)
235  {
236  printf("|");
237  for (j = 0; j < size; j++)
238  printf("%c%c", p[j] & 0xf0 ? 'X' : ' ', p[j] & 0xf ? 'X' : ' ');
239  printf(" -- ");
240  for (j = 0; j < size; j++)
241  printf("%c%c", q[j] & 0xf0 ? 'X' : ' ', q[j] & 0xf ? 'X' : ' ');
242  printf("|\n");
243  p += size * 4;
244  q += size * 4;
245  }
246  printf("\n");
247 }
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
GLsizeiptr size
Definition: glext.h:5919
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
GLfloat GLfloat p
Definition: glext.h:8902
#define printf
Definition: config.h:203

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 97 of file imagelist.c.

98 {
100  return;
101 
103  Sleep(1000);
104 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
BOOL WINAPI RedrawWindow(_In_opt_ HWND, _In_opt_ LPCRECT, _In_opt_ HRGN, _In_ UINT)
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
int winetest_interactive
smooth NULL
Definition: ftsmooth.c:416
#define RDW_UPDATENOW
Definition: winuser.h:1206

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 564 of file imagelist.c.

565 {
566  BITMAPINFO bmi;
568  HBITMAP hOldBmp = SelectObject(hdc, bmp);
569  int ret;
570 
571  memset(&bmi, 0, sizeof(bmi));
572  bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
573  ret = GetDIBits(hdc, bmp, 0, 0, 0, &bmi, DIB_RGB_COLORS);
574  ok(ret, "GetDIBits failed\n");
575 
576  SelectObject(hdc, hOldBmp);
577  DeleteDC(hdc);
578  return bmi.bmiHeader.biBitCount;
579 }
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1475
struct tagBITMAPINFOHEADER BITMAPINFOHEADER
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
BITMAP bmp
Definition: alphablend.c:62
int ret
HDC hdc
Definition: main.c:9
static HBITMAP
Definition: imagelist.c:69
BOOL WINAPI DeleteDC(_In_ HDC)
#define ok(value,...)
Definition: atltest.h:57
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)
#define DIB_RGB_COLORS
Definition: wingdi.h:366
#define memset(x, y, z)
Definition: compat.h:39

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 2064 of file imagelist.c.

2065 {
2066 #ifdef __REACTOS__
2067  char bmi_buffer[FIELD_OFFSET(BITMAPINFO, bmiColors) + 256 * sizeof(RGBQUAD)];
2068 #else
2069  char bmi_buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )];
2070 #endif
2071  BITMAPINFO *bmi = (BITMAPINFO *)bmi_buffer;
2072  HBITMAP tmp;
2073  int i;
2074  HPALETTE pal;
2075  PALETTEENTRY entries[256];
2076 
2077  switch (bpp)
2078  {
2079  case 4:
2080  tmp = CreateBitmap( 1, 1, 1, 1, NULL );
2081  memset(bmi_buffer, 0, sizeof(bmi_buffer));
2082  bmi->bmiHeader.biSize = sizeof(bmi->bmiHeader);
2083  bmi->bmiHeader.biHeight = 1;
2084  bmi->bmiHeader.biWidth = 1;
2085  bmi->bmiHeader.biBitCount = bpp;
2086  bmi->bmiHeader.biPlanes = 1;
2088  GetDIBits( hdc, tmp, 0, 0, NULL, bmi, DIB_RGB_COLORS );
2089 
2090  memcpy(table, bmi->bmiColors, (1 << bpp) * sizeof(RGBQUAD));
2091  table[7] = bmi->bmiColors[8];
2092  table[8] = bmi->bmiColors[7];
2093  DeleteObject( tmp );
2094  break;
2095 
2096  case 8:
2097  pal = CreateHalftonePalette(hdc);
2098  GetPaletteEntries(pal, 0, 256, entries);
2099  for (i = 0; i < 256; i++)
2100  {
2101  table[i].rgbRed = entries[i].peRed;
2102  table[i].rgbGreen = entries[i].peGreen;
2103  table[i].rgbBlue = entries[i].peBlue;
2104  table[i].rgbReserved = 0;
2105  }
2106  DeleteObject(pal);
2107  break;
2108 
2109  default:
2110  ok(0, "unhandled depth %d\n", bpp);
2111  }
2112 }
UINT WINAPI GetPaletteEntries(HPALETTE hpal, UINT iStartIndex, UINT cEntries, LPPALETTEENTRY ppe)
Definition: palette.c:64
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1475
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
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
DWORD biCompression
Definition: amvideo.idl:35
smooth NULL
Definition: ftsmooth.c:416
struct tagRGBQUAD RGBQUAD
RGBQUAD bmiColors[1]
Definition: wingdi.h:1476
HDC hdc
Definition: main.c:9
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static HBITMAP
Definition: imagelist.c:69
#define ok(value,...)
Definition: atltest.h:57
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
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)
DWORD bpp
Definition: surface.c:181
#define DIB_RGB_COLORS
Definition: wingdi.h:366
#define memset(x, y, z)
Definition: compat.h:39
#define BI_RGB
Definition: precomp.h:34
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)
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

Referenced by test_shell_imagelist().

◆ image_list_add_bitmap()

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

Definition at line 1051 of file imagelist.c.

1052 {
1053  char comment[16];
1054  HBITMAP hbm;
1055  int ret;
1056 
1057  sprintf(comment, "%d", i);
1058  hbm = create_bitmap(BMP_CX, BMP_CX, RGB(grey, grey, grey), comment);
1059  ret = pImageList_Add(himl, hbm, NULL);
1060  ok(ret != -1, "Failed to add image to imagelist.\n");
1061  DeleteObject(hbm);
1062 }
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HIMAGELIST himl
#define sprintf(buf, format,...)
Definition: sprintf.c:55
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
smooth NULL
Definition: ftsmooth.c:416
#define RGB(r, g, b)
Definition: wingdi.h:2939
int ret
#define BMP_CX
Definition: imagelist.c:706
Definition: id3.c:18
static HBITMAP
Definition: imagelist.c:69
_In_ HBITMAP hbm
Definition: ntgdi.h:2776
#define ok(value,...)
Definition: atltest.h:57
static HBITMAP create_bitmap(INT cx, INT cy, COLORREF color, const char *comment)
Definition: imagelist.c:940

Referenced by image_list_init().

◆ image_list_init()

static void image_list_init ( HIMAGELIST  himl,
INT  grow 
)
static

Definition at line 1064 of file imagelist.c.

1065 {
1066  unsigned int i;
1067  static const struct test_data
1068  {
1069  BYTE grey;
1070  INT cx, cy, cur, max, bpp;
1071  const char *comment;
1072  } td[] =
1073  {
1074  { 255, BMP_CX, BMP_CX, 1, 2, 24, "total 1" },
1075  { 170, BMP_CX, BMP_CX, 2, 7, 24, "total 2" },
1076  { 85, BMP_CX, BMP_CX, 3, 7, 24, "total 3" },
1077  { 0, BMP_CX, BMP_CX, 4, 7, 24, "total 4" },
1078  { 0, BMP_CX, BMP_CX, 5, 7, 24, "total 5" },
1079  { 85, BMP_CX, BMP_CX, 6, 7, 24, "total 6" },
1080  { 170, BMP_CX, BMP_CX, 7, 12, 24, "total 7" },
1081  { 255, BMP_CX, BMP_CX, 8, 12, 24, "total 8" },
1082  { 255, BMP_CX, BMP_CX, 9, 12, 24, "total 9" },
1083  { 170, BMP_CX, BMP_CX, 10, 12, 24, "total 10" },
1084  { 85, BMP_CX, BMP_CX, 11, 12, 24, "total 11" },
1085  { 0, BMP_CX, BMP_CX, 12, 17, 24, "total 12" },
1086  { 0, BMP_CX, BMP_CX, 13, 17, 24, "total 13" },
1087  { 85, BMP_CX, BMP_CX, 14, 17, 24, "total 14" },
1088  { 170, BMP_CX, BMP_CX, 15, 17, 24, "total 15" },
1089  { 255, BMP_CX, BMP_CX, 16, 17, 24, "total 16" },
1090  { 255, BMP_CX, BMP_CX, 17, 22, 24, "total 17" },
1091  { 170, BMP_CX, BMP_CX, 18, 22, 24, "total 18" },
1092  { 85, BMP_CX, BMP_CX, 19, 22, 24, "total 19" },
1093  { 0, BMP_CX, BMP_CX, 20, 22, 24, "total 20" },
1094  { 0, BMP_CX, BMP_CX, 21, 22, 24, "total 21" },
1095  { 85, BMP_CX, BMP_CX, 22, 27, 24, "total 22" },
1096  { 170, BMP_CX, BMP_CX, 23, 27, 24, "total 23" },
1097  { 255, BMP_CX, BMP_CX, 24, 27, 24, "total 24" }
1098  };
1099 
1100  check_iml_data(himl, BMP_CX, BMP_CX, 0, 2, grow, ILC_COLOR24, "total 0");
1101 
1102  for (i = 0; i < ARRAY_SIZE(td); i++)
1103  {
1104  image_list_add_bitmap(himl, td[i].grey, i + 1);
1105  check_iml_data(himl, td[i].cx, td[i].cy, td[i].cur, td[i].max, grow, td[i].bpp, td[i].comment);
1106  }
1107 }
#define max(a, b)
Definition: svc.c:63
HIMAGELIST himl
int32_t INT
Definition: typedefs.h:56
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
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:990
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:581
#define ILC_COLOR24
Definition: commctrl.h:353
#define BMP_CX
Definition: imagelist.c:706
Definition: id3.c:18
unsigned char BYTE
Definition: mem.h:68
#define ARRAY_SIZE(a)
Definition: main.h:24
_Out_opt_ int * cx
Definition: commctrl.h:581
DWORD bpp
Definition: surface.c:181
static void image_list_add_bitmap(HIMAGELIST himl, BYTE grey, int i)
Definition: imagelist.c:1051

Referenced by test_imagelist_storage().

◆ imagelist_get_bitmap_size()

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

Definition at line 973 of file imagelist.c.

974 {
975  const int tile_count = 4;
976 
977  if (is_v6_header(header))
978  {
979  sz->cx = header->cx;
980  sz->cy = header->cMaxImage * header->cy;
981  }
982  else
983  {
984  sz->cx = header->cx * tile_count;
985  sz->cy = ((header->cMaxImage + tile_count - 1) / tile_count) * header->cy;
986  }
987 }
LONG cx
Definition: windef.h:334
static BOOL is_v6_header(const ILHEAD *header)
Definition: imagelist.c:899
LONG cy
Definition: windef.h:335

Referenced by check_iml_data().

◆ impl_from_IStream()

static struct memstream* impl_from_IStream ( IStream iface)
static

Definition at line 714 of file imagelist.c.

715 {
716  return CONTAINING_RECORD(iface, struct memstream, IStream_iface);
717 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

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

◆ init_functions()

static void init_functions ( void  )
static

Definition at line 2401 of file imagelist.c.

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

Referenced by START_TEST().

◆ init_memstream()

static void init_memstream ( struct memstream stream)
static

Definition at line 842 of file imagelist.c.

843 {
844  HRESULT hr;
845 
847  hr = CreateStreamOnHGlobal(NULL, TRUE, &stream->stream);
848  ok(hr == S_OK, "Failed to create a stream, hr %#x.\n", hr);
849 }
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
static const IStreamVtbl Test_Stream_Vtbl
Definition: imagelist.c:824
Definition: parse.h:22
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
IStream IStream_iface
Definition: request.c:4377

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 899 of file imagelist.c.

900 {
901  return (header->usVersion & 0xff00) == 0x600;
902 }

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 106 of file imagelist.c.

107 {
108  return pHIMAGELIST_QueryInterface != NULL;
109 }
smooth NULL
Definition: ftsmooth.c:416

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 204 of file imagelist.c.

206 {
207  HDC hdc;
208 
209  if (!winetest_interactive || !himl) return NULL;
210 
211  SetWindowTextA(hwnd, loc);
212  hdc = GetDC(hwnd);
213  pImageList_Draw(himl, idx, hdc, 0, 0, ILD_TRANSPARENT);
214 
216 
217  if (clear)
218  {
219  BitBlt(hdc, 0, 0, size, size, hdc, size+1, size+1, SRCCOPY);
220  ReleaseDC(hwnd, hdc);
221  hdc = NULL;
222  }
223 
224  return hdc;
225 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HDC WINAPI GetDC(_In_opt_ HWND)
static HDC
Definition: imagelist.c:92
int winetest_interactive
HIMAGELIST himl
static VOID NTAPI BitBlt(IN ULONG Left, IN ULONG Top, IN ULONG Width, IN ULONG Height, IN PUCHAR Buffer, IN ULONG BitsPerPixel, IN ULONG Delta)
Definition: vga.c:410
static void force_redraw(HWND hwnd)
Definition: imagelist.c:97
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
unsigned int idx
Definition: utils.c:41
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
BOOL WINAPI SetWindowTextA(_In_ HWND, _In_opt_ LPCSTR)
HDC hdc
Definition: main.c:9
#define ILD_TRANSPARENT
Definition: commctrl.h:414
#define SRCCOPY
Definition: wingdi.h:332

Referenced by check_bits(), and test_hotspot().

◆ START_TEST()

START_TEST ( imagelist  )

Definition at line 2437 of file imagelist.c.

2438 {
2439  ULONG_PTR ctx_cookie;
2440  HANDLE hCtx;
2441 
2442  init_functions();
2443 
2445 
2447  test_begindrag();
2448  test_hotspot();
2449  test_add_remove();
2450  test_imagecount();
2452  test_merge();
2455  test_iconsize();
2458  test_copy();
2459  test_loadimage();
2460 
2461  /* Now perform v6 tests */
2462  if (!load_v6_module(&ctx_cookie, &hCtx))
2463  return;
2464 
2465  init_functions();
2466 
2468 
2469  /* Do v6.0 tests */
2470  test_add_remove();
2471  test_imagecount();
2473  test_merge();
2475  test_iconsize();
2478  test_copy();
2479  test_loadimage();
2480 
2483  test_iimagelist();
2484 
2494 
2495  CoUninitialize();
2496 
2497  unload_v6_module(ctx_cookie, hCtx);
2498 }
static void test_imagecount(void)
Definition: imagelist.c:452
static void test_IImageList_GetImageCount(void)
Definition: imagelist.c:2355
static void test_color_table(UINT ilc)
Definition: imagelist.c:2114
static void unload_v6_module(ULONG_PTR cookie, HANDLE hCtx)
Definition: v6util.h:63
static void test_IImageList_Merge(void)
Definition: imagelist.c:1847
static void test_IImageList_Clone(void)
Definition: imagelist.c:2279
static void test_iimagelist(void)
Definition: imagelist.c:1587
#define ILC_COLOR4
Definition: commctrl.h:350
static void test_iconsize(void)
Definition: imagelist.c:1933
uint32_t ULONG_PTR
Definition: typedefs.h:63
static BOOL load_v6_module(ULONG_PTR *pcookie, HANDLE *hCtx)
Definition: v6util.h:71
smooth NULL
Definition: ftsmooth.c:416
static void test_merge(void)
Definition: imagelist.c:628
static void test_create_destroy(void)
Definition: imagelist.c:1961
static void test_DrawIndirect(void)
Definition: imagelist.c:477
static void init_functions(void)
Definition: imagelist.c:2401
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
static void test_IImageList_GetIconSize(void)
Definition: imagelist.c:2379
static void test_IImageList_Add_Remove(void)
Definition: imagelist.c:1667
static void test_IImageList_Get_SetImageCount(void)
Definition: imagelist.c:1726
static void test_hotspot(void)
Definition: imagelist.c:327
static HINSTANCE hinst
Definition: imagelist.c:94
static void test_IImageList_SetBkColor(void)
Definition: imagelist.c:2325
static void test_shell_imagelist(void)
Definition: imagelist.c:1322
static void test_merge_colors(void)
Definition: imagelist.c:581
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
Definition: compobj.c:2002
static void test_ImageList_DrawIndirect(void)
Definition: imagelist.c:1451
static void test_begindrag(void)
Definition: imagelist.c:282
static void test_IImageList_Draw(void)
Definition: imagelist.c:1759
#define ILC_COLOR8
Definition: commctrl.h:351
static void test_loadimage(void)
Definition: imagelist.c:2259
static void test_IImageList_GetBkColor(void)
Definition: imagelist.c:2303
static void test_add_remove(void)
Definition: imagelist.c:401
static void test_imagelist_storage(void)
Definition: imagelist.c:1109
static void test_copy(void)
Definition: imagelist.c:2236

◆ test_add_remove()

static void test_add_remove ( void  )
static

Definition at line 401 of file imagelist.c.

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

Referenced by START_TEST().

◆ test_begindrag()

static void test_begindrag ( void  )
static

Definition at line 282 of file imagelist.c.

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

Referenced by START_TEST().

◆ test_color_table()

static void test_color_table ( UINT  ilc)
static

Definition at line 2114 of file imagelist.c.

2115 {
2116  HIMAGELIST himl;
2117  INT ret;
2118 #ifdef __REACTOS__
2119  char bmi_buffer[FIELD_OFFSET(BITMAPINFO, bmiColors) + 256 * sizeof(RGBQUAD)];
2120 #else
2121  char bmi_buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )];
2122 #endif
2123  BITMAPINFO *bmi = (BITMAPINFO *)bmi_buffer;
2124  HDC hdc = CreateCompatibleDC(0);
2125  HBITMAP dib4, dib8, dib32;
2126  RGBQUAD rgb[256], default_table[256];
2127 
2128  get_default_color_table(hdc, ilc & 0xfe, default_table);
2129 
2130  himl = pImageList_Create(16, 16, ilc, 0, 3);
2131  ok(himl != NULL, "got %p\n", himl);
2132 
2133  memset(bmi_buffer, 0, sizeof(bmi_buffer));
2134  bmi->bmiHeader.biSize = sizeof(bmi->bmiHeader);
2135  bmi->bmiHeader.biHeight = 16;
2136  bmi->bmiHeader.biWidth = 16;
2137  bmi->bmiHeader.biBitCount = 8;
2138  bmi->bmiHeader.biPlanes = 1;
2140  bmi->bmiColors[0].rgbRed = 0xff;
2141  bmi->bmiColors[1].rgbGreen = 0xff;
2142  bmi->bmiColors[2].rgbBlue = 0xff;
2143 
2144  dib8 = CreateDIBSection(hdc, bmi, DIB_RGB_COLORS, NULL, NULL, 0);
2145 
2146  bmi->bmiHeader.biBitCount = 4;
2147  bmi->bmiColors[0].rgbRed = 0xff;
2148  bmi->bmiColors[0].rgbGreen = 0x00;
2149  bmi->bmiColors[0].rgbBlue = 0xff;
2150  bmi->bmiColors[1].rgbRed = 0xff;
2151  bmi->bmiColors[1].rgbGreen = 0xff;
2152  bmi->bmiColors[1].rgbBlue = 0x00;
2153  bmi->bmiColors[2].rgbRed = 0x00;
2154  bmi->bmiColors[2].rgbGreen = 0xff;
2155  bmi->bmiColors[2].rgbBlue = 0xff;
2156 
2157  dib4 = CreateDIBSection(hdc, bmi, DIB_RGB_COLORS, NULL, NULL, 0);
2158 
2159  bmi->bmiHeader.biBitCount = 32;
2160 
2161  dib32 = CreateDIBSection(hdc, bmi, DIB_RGB_COLORS, NULL, NULL, 0);
2162 
2163  /* add 32 first then 8. This won't set the color table */
2164  ret = pImageList_Add(himl, dib32, NULL);
2165  ok(ret == 0, "got %d\n", ret);
2166  ret = pImageList_Add(himl, dib8, NULL);
2167  ok(ret == 1, "got %d\n", ret);
2168 
2169  check_color_table("add 32, 8", hdc, himl, ilc, default_table, NULL);
2170 
2171  /* since the previous _Adds didn't set the color table, this one will */
2172  ret = pImageList_Remove(himl, -1);
2173  ok(ret, "got %d\n", ret);
2174  ret = pImageList_Add(himl, dib8, NULL);
2175  ok(ret == 0, "got %d\n", ret);
2176 
2177  memset(rgb, 0, sizeof(rgb));
2178  rgb[0].rgbRed = 0xff;
2179  rgb[1].rgbGreen = 0xff;
2180  rgb[2].rgbBlue = 0xff;
2181  check_color_table("remove all, add 8", hdc, himl, ilc, rgb, default_table);
2182 
2183  /* remove all, add 4. Color table remains the same since it's implicitly
2184  been set by the previous _Add */
2185  ret = pImageList_Remove(himl, -1);
2186  ok(ret, "got %d\n", ret);
2187  ret = pImageList_Add(himl, dib4, NULL);
2188  ok(ret == 0, "got %d\n", ret);
2189  check_color_table("remove all, add 4", hdc, himl, ilc, rgb, default_table);
2190 
2191  pImageList_Destroy(himl);
2192  himl = pImageList_Create(16, 16, ilc, 0, 3);
2193  ok(himl != NULL, "got %p\n", himl);
2194 
2195  /* add 4 */
2196  ret = pImageList_Add(himl, dib4, NULL);
2197  ok(ret == 0, "got %d\n", ret);
2198 
2199  memset(rgb, 0, 16 * sizeof(rgb[0]));
2200  rgb[0].rgbRed = 0xff;
2201  rgb[0].rgbBlue = 0xff;
2202  rgb[1].rgbRed = 0xff;
2203  rgb[1].rgbGreen = 0xff;
2204  rgb[2].rgbGreen = 0xff;
2205  rgb[2].rgbBlue = 0xff;
2206  memcpy(rgb + 16, default_table + 16, 240 * sizeof(rgb[0]));
2207 
2208  check_color_table("add 4", hdc, himl, ilc, rgb, default_table);
2209 
2210  pImageList_Destroy(himl);
2211  himl = pImageList_Create(16, 16, ilc, 0, 3);
2212  ok(himl != NULL, "got %p\n", himl);
2213 
2214  /* set color table, add 8 */
2215  ret = pImageList_Remove(himl, -1);
2216  ok(ret, "got %d\n", ret);
2217  memset(rgb, 0, sizeof(rgb));
2218  rgb[0].rgbRed = 0xcc;
2219  rgb[1].rgbBlue = 0xcc;
2220  ret = pImageList_SetColorTable(himl, 0, 2, rgb);
2221  ok(ret == 2, "got %d\n", ret);
2222  /* the table is set, so this doesn't change it */
2223  ret = pImageList_Add(himl, dib8, NULL);
2224  ok(ret == 0, "got %d\n", ret);
2225 
2226  memcpy(rgb + 2, default_table + 2, 254 * sizeof(rgb[0]));
2227  check_color_table("SetColorTable", hdc, himl, ilc, rgb, NULL);
2228 
2229  DeleteObject(dib32);
2230  DeleteObject(dib8);
2231  DeleteObject(dib4);
2232  DeleteDC(hdc);
2233  pImageList_Destroy(himl);
2234 }
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1475
static HDC
Definition: imagelist.c:92
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
HIMAGELIST himl
int32_t INT
Definition: typedefs.h:56
static void check_color_table(const char *name, HDC hdc, HIMAGELIST himl, UINT ilc, RGBQUAD *expect, RGBQUAD *broken_expect)
Definition: imagelist.c:2025
UCHAR rgbBlue
Definition: inbv.c:170
UCHAR rgbGreen
Definition: inbv.c:171
UCHAR rgbRed
Definition: inbv.c:172
DWORD biCompression
Definition: amvideo.idl:35
smooth NULL
Definition: ftsmooth.c:416
struct tagRGBQUAD RGBQUAD
RGBQUAD bmiColors[1]
Definition: wingdi.h:1476
int ret
HDC hdc
Definition: main.c:9
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static HBITMAP
Definition: imagelist.c:69
static void get_default_color_table(HDC hdc, int bpp, RGBQUAD *table)
Definition: imagelist.c:2064
_In_ ULONG _In_ ULONG rgb
Definition: winddi.h:3520
BOOL WINAPI DeleteDC(_In_ HDC)
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:197
#define ok(value,...)
Definition: atltest.h:57
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
#define DIB_RGB_COLORS
Definition: wingdi.h:366
#define memset(x, y, z)
Definition: compat.h:39
#define BI_RGB
Definition: precomp.h:34

Referenced by START_TEST().

◆ test_copy()

static void test_copy ( void  )
static

Definition at line 2236 of file imagelist.c.

2237 {
2238  HIMAGELIST dst, src;
2239  BOOL ret;
2240  int count;
2241 
2242  dst = pImageList_Create(5, 11, ILC_COLOR, 1, 1);
2243  count = pImageList_GetImageCount(dst);
2244  ok(!count, "ImageList not empty.\n");
2245  src = createImageList(7, 13);
2246  count = pImageList_GetImageCount(src);
2247  ok(count > 2, "Tests need an ImageList with more than 2 images\n");
2248 
2249  /* ImageList_Copy() cannot copy between two ImageLists */
2250  ret = pImageList_Copy(dst, 0, src, 2, ILCF_MOVE);
2251  ok(!ret, "ImageList_Copy() should have returned FALSE\n");
2252  count = pImageList_GetImageCount(dst);
2253  ok(count == 0, "Expected no image in dst ImageList, got %d\n", count);
2254 
2255  pImageList_Destroy(dst);
2256  pImageList_Destroy(src);
2257 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define ILCF_MOVE
Definition: commctrl.h:506
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ILC_COLOR
Definition: commctrl.h:348
static HIMAGELIST createImageList(int cx, int cy)
Definition: imagelist.c:151
int ret
GLenum src
Definition: glext.h:6340
#define ok(value,...)
Definition: atltest.h:57
GLenum GLenum dst
Definition: glext.h:6340

Referenced by START_TEST().

◆ test_create_destroy()

static void test_create_destroy ( void  )
static

Definition at line 1961 of file imagelist.c.

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

Referenced by START_TEST().

◆ test_DrawIndirect()

static void test_DrawIndirect ( void  )
static

Definition at line 477 of file imagelist.c.

478 {
480 
481  HBITMAP hbm1;
482  HBITMAP hbm2;
483  HBITMAP hbm3;
484 
485  IMAGELISTDRAWPARAMS imldp;
486  HDC hdc;
487  HWND hwndfortest;
488 
489  if (!pImageList_DrawIndirect)
490  {
491  win_skip("ImageList_DrawIndirect not available, skipping test\n");
492  return;
493  }
494 
495  hwndfortest = create_window();
496  hdc = GetDC(hwndfortest);
497  ok(hdc!=NULL, "couldn't get DC\n");
498 
499  /* create an imagelist to play with */
500  himl = pImageList_Create(48, 48, ILC_COLOR16, 0, 3);
501  ok(himl != 0, "Failed to create imagelist.\n");
502 
503  /* load the icons to add to the image list */
504  hbm1 = CreateBitmap(48, 48, 1, 1, bitmap_bits);
505  ok(hbm1 != 0, "no bitmap 1\n");
506  hbm2 = CreateBitmap(48, 48, 1, 1, bitmap_bits);
507  ok(hbm2 != 0, "no bitmap 2\n");
508  hbm3 = CreateBitmap(48, 48, 1, 1, bitmap_bits);
509  ok(hbm3 != 0, "no bitmap 3\n");
510 
511  /* add three */
512  ok(0 == pImageList_Add(himl, hbm1, 0),"failed to add bitmap 1\n");
513  ok(1 == pImageList_Add(himl, hbm2, 0),"failed to add bitmap 2\n");
514 
515  if (pImageList_SetImageCount)
516  {
517  ok(pImageList_SetImageCount(himl,3),"Setimage count failed\n");
518  /*ok(2==ImageList_Add(himl, hbm3, NULL),"failed to add bitmap 3\n"); */
519  ok(pImageList_Replace(himl, 2, hbm3, 0),"failed to replace bitmap 3\n");
520  }
521 
522  memset(&imldp, 0, sizeof (imldp));
523  ok(!pImageList_DrawIndirect(&imldp), "zero data succeeded!\n");
525  ok(!pImageList_DrawIndirect(&imldp), "zero hdc succeeded!\n");
526  imldp.hdcDst = hdc;
527  ok(!pImageList_DrawIndirect(&imldp),"zero himl succeeded!\n");
528  imldp.himl = (HIMAGELIST)0xdeadbeef;
529  ok(!pImageList_DrawIndirect(&imldp),"bad himl succeeded!\n");
530  imldp.himl = himl;
531 
532  force_redraw(hwndfortest);
533 
534  imldp.fStyle = SRCCOPY;
535  imldp.rgbBk = CLR_DEFAULT;
536  imldp.rgbFg = CLR_DEFAULT;
537  imldp.y = 100;
538  imldp.x = 100;
539  ok(pImageList_DrawIndirect(&imldp),"should succeed\n");
540  imldp.i ++;
541  ok(pImageList_DrawIndirect(&imldp),"should succeed\n");
542  imldp.i ++;
543  ok(pImageList_DrawIndirect(&imldp),"should succeed\n");
544  imldp.i ++;
545  ok(!pImageList_DrawIndirect(&imldp),"should fail\n");
546 
547  /* remove three */
548  ok(pImageList_Remove(himl, 0), "removing 1st bitmap\n");
549  ok(pImageList_Remove(himl, 0), "removing 2nd bitmap\n");
550  ok(pImageList_Remove(himl, 0), "removing 3rd bitmap\n");
551 
552  /* destroy it */
553  ok(pImageList_Destroy(himl), "Failed to destroy imagelist.\n");
554 
555  /* bitmaps should not be deleted by the imagelist */
556  ok(DeleteObject(hbm1),"bitmap 1 can't be deleted\n");
557  ok(DeleteObject(hbm2),"bitmap 2 can't be deleted\n");
558  ok(DeleteObject(hbm3),"bitmap 3 can't be deleted\n");
559 
560  ReleaseDC(hwndfortest, hdc);
561  DestroyWindow(hwndfortest);
562 }
#define ILC_COLOR16
Definition: commctrl.h:352
static HIMAGELIST
Definition: imagelist.c:86
HDC WINAPI GetDC(_In_opt_ HWND)
static const BYTE bitmap_bits[48 *48/8]
Definition: imagelist.c:135
static HDC
Definition: imagelist.c:92
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HIMAGELIST himl
BOOL WINAPI DestroyWindow(_In_ HWND)
static void force_redraw(HWND hwnd)
Definition: imagelist.c:97
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
smooth NULL
Definition: ftsmooth.c:416
static HWND create_window(void)
Definition: imagelist.c:163
HDC hdc
Definition: main.c:9
static HBITMAP
Definition: imagelist.c:69
#define ok(value,...)
Definition: atltest.h:57
#define IMAGELISTDRAWPARAMS_V3_SIZE
Definition: commctrl.h:344
#define CLR_DEFAULT
Definition: commctrl.h:316
#define memset(x, y, z)
Definition: compat.h:39
#define win_skip
Definition: test.h:150
#define SRCCOPY
Definition: wingdi.h:332
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)

Referenced by START_TEST().

◆ test_hotspot()

static void test_hotspot ( void  )
static

Definition at line 327 of file imagelist.c.

328 {
329  struct hotspot {
330  int dx;
331  int dy;
332  };
333 
334 #define SIZEX1 47
335 #define SIZEY1 31
336 #define SIZEX2 11
337 #define SIZEY2 17
338 #define HOTSPOTS_MAX 4 /* Number of entries in hotspots */
339  static const struct hotspot hotspots[HOTSPOTS_MAX] = {
340  { 10, 7 },
341  { SIZEX1, SIZEY1 },
342  { -9, -8 },
343  { -7, 35 }
344  };
345  int i, j, ret;
348  HWND hwnd = create_window();
349 
350 
351  for (i = 0; i < HOTSPOTS_MAX; i++) {
352  for (j = 0; j < HOTSPOTS_MAX; j++) {
353  int dx1 = hotspots[i].dx;
354  int dy1 = hotspots[i].dy;
355  int dx2 = hotspots[j].dx;
356  int dy2 = hotspots[j].dy;
357  int correctx, correcty, newx, newy;
358  char loc[256];
359  HIMAGELIST himlNew;
360  POINT ppt;
361 
362  ret = pImageList_BeginDrag(himl1, 0, dx1, dy1);
363  ok(ret != 0, "BeginDrag failed for { %d, %d }\n", dx1, dy1);
364  sprintf(loc, "BeginDrag (%d,%d)\n", i, j);
365  show_image(hwnd, himl1, 0, max(SIZEX1, SIZEY1), loc, TRUE);
366 
367  /* check merging the dragged image with a second image */
368  ret = pImageList_SetDragCursorImage(himl2, 0, dx2, dy2);
369  ok(ret != 0, "SetDragCursorImage failed for {%d, %d}{%d, %d}\n",
370  dx1, dy1, dx2, dy2);
371  sprintf(loc, "SetDragCursorImage (%d,%d)\n", i, j);
372  show_image(hwnd, himl2, 0, max(SIZEX2, SIZEY2), loc, TRUE);
373 
374  /* check new hotspot, it should be the same like the old one */
375  himlNew = pImageList_GetDragImage(NULL, &ppt);
376  ok(ppt.x == dx1 && ppt.y == dy1,
377  "Expected drag hotspot [%d,%d] got [%d,%d]\n",
378  dx1, dy1, ppt.x, ppt.y);
379  /* check size of new dragged image */
380  pImageList_GetIconSize(himlNew, &newx, &newy);
381  correctx = max(SIZEX1, max(SIZEX2 + dx2, SIZEX1 - dx2));
382  correcty = max(SIZEY1, max(SIZEY2 + dy2, SIZEY1 - dy2));
383  ok(newx == correctx && newy == correcty,
384  "Expected drag image size [%d,%d] got [%d,%d]\n",
385  correctx, correcty, newx, newy);
386  sprintf(loc, "GetDragImage (%d,%d)\n", i, j);
387  show_image(hwnd, himlNew, 0, max(correctx, correcty), loc, TRUE);
388  pImageList_EndDrag();
389  }
390  }
391 #undef SIZEX1
392 #undef SIZEY1
393 #undef SIZEX2
394 #undef SIZEY2
395 #undef HOTSPOTS_MAX
396  pImageList_Destroy(himl2);
397  pImageList_Destroy(himl1);
399 }
#define HOTSPOTS_MAX
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define max(a, b)
Definition: svc.c:63
#define TRUE
Definition: types.h:120
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
GLint dy
Definition: linetemp.h:97
BOOL WINAPI DestroyWindow(_In_ HWND)
#define sprintf(buf, format,...)
Definition: sprintf.c:55
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define SIZEX2
smooth NULL
Definition: ftsmooth.c:416
static HIMAGELIST createImageList(int cx, int cy)
Definition: imagelist.c:151
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
static HWND create_window(void)
Definition: imagelist.c:163
int ret
#define SIZEX1
#define SIZEY2
#define ok(value,...)
Definition: atltest.h:57
GLint dx
Definition: linetemp.h:97
static HDC show_image(HWND hwnd, HIMAGELIST himl, int idx, int size, LPCSTR loc, BOOL clear)
Definition: imagelist.c:204
#define SIZEY1

Referenced by START_TEST().

◆ test_iconsize()

static void test_iconsize ( void  )
static

Definition at line 1933 of file imagelist.c.

1934 {
1935  HIMAGELIST himl;
1936  INT cx, cy;
1937  BOOL ret;
1938 
1939  himl = pImageList_Create(16, 16, ILC_COLOR16, 0, 3);
1940  /* null pointers, not zero imagelist dimensions */
1941  ret = pImageList_GetIconSize(himl, NULL, NULL);
1942  ok(!ret, "got %d\n", ret);
1943 
1944  /* doesn't touch return pointers */
1945  cx = 0x1abe11ed;
1946  ret = pImageList_GetIconSize(himl, &cx, NULL);
1947  ok(!ret, "got %d\n", ret);
1948  ok(cx == 0x1abe11ed, "got %d\n", cx);
1949 
1950  cy = 0x1abe11ed;
1951  ret = pImageList_GetIconSize(himl, NULL, &cy);
1952  ok(!ret, "got %d\n", ret);
1953  ok(cy == 0x1abe11ed, "got %d\n", cy);
1954 
1955  pImageList_Destroy(himl);
1956 
1957  ret = pImageList_GetIconSize((HIMAGELIST)0xdeadbeef, &cx, &cy);
1958  ok(!ret, "got %d\n", ret);
1959 }
#define ILC_COLOR16
Definition: commctrl.h:352
HIMAGELIST himl
int32_t INT
Definition: typedefs.h:56
unsigned int BOOL
Definition: ntddk_ex.h:94
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:581
smooth NULL
Definition: ftsmooth.c:416
int ret
#define ok(value,...)
Definition: atltest.h:57
_Out_opt_ int * cx
Definition: commctrl.h:581

Referenced by START_TEST().

◆ test_iimagelist()

static void test_iimagelist ( void  )
static

Definition at line 1587 of file imagelist.c.

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

Referenced by START_TEST().

◆ test_IImageList_Add_Remove()

static void test_IImageList_Add_Remove ( void  )
static

Definition at line 1667 of file imagelist.c.

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

Referenced by START_TEST().

◆ test_IImageList_Clone()

static void test_IImageList_Clone ( void  )
static

Definition at line 2279 of file imagelist.c.

2280 {
2281  IImageList *imgl, *imgl2;
2282  HIMAGELIST himl;
2283  HRESULT hr;
2284  ULONG ref;
2285 
2286  himl = pImageList_Create(16, 16, ILC_COLOR16, 0, 3);
2287  imgl = (IImageList*)himl;
2288 
2289 if (0)
2290 {
2291  /* crashes on native */
2292  IImageList_Clone(imgl, &IID_IImageList, NULL);
2293 }
2294 
2295  hr = IImageList_Clone(imgl, &IID_IImageList, (void**)&imgl2);
2296  ok(hr == S_OK, "got 0x%08x\n", hr);
2297  ref = IImageList_Release(imgl2);
2298  ok(ref == 0, "got %u\n", ref);
2299 
2300  IImageList_Release(imgl);
2301 }
#define ILC_COLOR16
Definition: commctrl.h:352
HRESULT hr
Definition: shlfolder.c:183
HIMAGELIST himl
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
unsigned int ULONG
Definition: retypes.h:1

Referenced by START_TEST().

◆ test_IImageList_Draw()

static void test_IImageList_Draw ( void  )
static

Definition at line 1759 of file imagelist.c.

1760 {
1761  IImageList *imgl;
1762  HIMAGELIST himl;
1763 
1764  HBITMAP hbm1;
1765  HBITMAP hbm2;
1766  HBITMAP hbm3;
1767 
1768  IMAGELISTDRAWPARAMS imldp;
1769  HWND hwndfortest;
1770  HRESULT hr;
1771  HDC hdc;
1772  int ret;
1773 
1774  hwndfortest = create_window();
1775  hdc = GetDC(hwndfortest);
1776  ok(hdc!=NULL, "couldn't get DC\n");
1777 
1778  /* create an imagelist to play with */
1779  himl = pImageList_Create(48, 48, ILC_COLOR16, 0, 3);
1780  ok(himl!=0,"failed to create imagelist\n");
1781 
1782  imgl = (IImageList *) himl;
1783 
1784  /* load the icons to add to the image list */
1785  hbm1 = CreateBitmap(48, 48, 1, 1, bitmap_bits);
1786  ok(hbm1 != 0, "no bitmap 1\n");
1787  hbm2 = CreateBitmap(48, 48, 1, 1, bitmap_bits);
1788  ok(hbm2 != 0, "no bitmap 2\n");
1789  hbm3 = CreateBitmap(48, 48, 1, 1, bitmap_bits);
1790  ok(hbm3 != 0, "no bitmap 3\n");
1791 
1792  /* add three */
1793  ret = -1;
1794  ok( IImageList_Add(imgl, hbm1, 0, &ret) == S_OK && (ret == 0), "failed to add bitmap 1\n");
1795  ret = -1;
1796  ok( IImageList_Add(imgl, hbm2, 0, &ret) == S_OK && (ret == 1), "failed to add bitmap 2\n");
1797 
1798  ok( IImageList_SetImageCount(imgl, 3) == S_OK, "Setimage count failed\n");
1799  ok( IImageList_Replace(imgl, 2, hbm3, 0) == S_OK, "failed to replace bitmap 3\n");
1800 
1801 if (0)
1802 {
1803  /* crashes on native */
1804  IImageList_Draw(imgl, NULL);
1805 }
1806 
1807  memset(&imldp, 0, sizeof (imldp));
1808  hr = IImageList_Draw(imgl, &imldp);
1809  ok( hr == E_INVALIDARG, "got 0x%08x\n", hr);
1810 
1812  imldp.hdcDst = hdc;
1813  imldp.himl = himl;
1814 
1815  force_redraw(hwndfortest);
1816 
1817  imldp.fStyle = SRCCOPY;
1818  imldp.rgbBk = CLR_DEFAULT;
1819  imldp.rgbFg = CLR_DEFAULT;
1820  imldp.y = 100;
1821  imldp.x = 100;
1822  ok( IImageList_Draw(imgl, &imldp) == S_OK, "should succeed\n");
1823  imldp.i ++;
1824  ok( IImageList_Draw(imgl, &imldp) == S_OK, "should succeed\n");
1825  imldp.i ++;
1826  ok( IImageList_Draw(imgl, &imldp) == S_OK, "should succeed\n");
1827  imldp.i ++;
1828  ok( IImageList_Draw(imgl, &imldp) == E_INVALIDARG, "should fail\n");
1829 
1830  /* remove three */
1831  ok( IImageList_Remove(imgl, 0) == S_OK, "removing 1st bitmap\n");
1832  ok( IImageList_Remove(imgl, 0) == S_OK, "removing 2nd bitmap\n");
1833  ok( IImageList_Remove(imgl, 0) == S_OK, "removing 3rd bitmap\n");
1834 
1835  /* destroy it */
1836  IImageList_Release(imgl);
1837 
1838  /* bitmaps should not be deleted by the imagelist */
1839  ok(DeleteObject(hbm1),"bitmap 1 can't be deleted\n");
1840  ok(DeleteObject(hbm2),"bitmap 2 can't be deleted\n");
1841  ok(DeleteObject(hbm3),"bitmap 3 can't be deleted\n");
1842 
1843  ReleaseDC(hwndfortest, hdc);
1844  DestroyWindow(hwndfortest);
1845 }
#define ILC_COLOR16
Definition: commctrl.h:352
HRESULT hr
Definition: shlfolder.c:183
HDC WINAPI GetDC(_In_opt_ HWND)
static const BYTE bitmap_bits[48 *48/8]
Definition: imagelist.c:135
static HDC
Definition: imagelist.c:92
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HIMAGELIST himl
BOOL WINAPI DestroyWindow(_In_ HWND)
static void force_redraw(HWND hwnd)
Definition: imagelist.c:97
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
static HWND create_window(void)
Definition: imagelist.c:163
int ret
HDC hdc
Definition: main.c:9
static HBITMAP
Definition: imagelist.c:69
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
#define IMAGELISTDRAWPARAMS_V3_SIZE
Definition: commctrl.h:344
#define CLR_DEFAULT
Definition: commctrl.h:316
#define memset(x, y, z)
Definition: compat.h:39
#define SRCCOPY
Definition: wingdi.h:332
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)

Referenced by START_TEST().

◆ test_IImageList_Get_SetImageCount()

static void test_IImageList_Get_SetImageCount ( void  )
static

Definition at line 1726 of file imagelist.c.

1727 {
1728  IImageList *imgl;
1729  HIMAGELIST himl;
1730  HRESULT hr;
1731  INT ret;
1732 
1733  /* create an imagelist to play with */
1734  himl = pImageList_Create(84, 84, ILC_COLOR16, 0, 3);
1735  ok(himl != 0,"failed to create imagelist\n");
1736 
1737  imgl = (IImageList *) himl;
1738 
1739  /* check SetImageCount/GetImageCount */
1740  hr = IImageList_SetImageCount(imgl, 3);
1741  ok(hr == S_OK, "got 0x%08x\n", hr);
1742  ret = 0;
1743  hr = IImageList_GetImageCount(imgl, &ret);
1744  ok(hr == S_OK && ret == 3, "invalid image count after increase\n");
1745  hr = IImageList_SetImageCount(imgl, 1);
1746  ok(hr == S_OK, "got 0x%08x\n", hr);
1747  ret = 0;
1748  hr = IImageList_GetImageCount(imgl, &ret);
1749  ok(hr == S_OK && ret == 1, "invalid image count after decrease to 1\n");
1750  hr = IImageList_SetImageCount(imgl, 0);
1751  ok(hr == S_OK, "got 0x%08x\n", hr);
1752  ret = -1;
1753  hr = IImageList_GetImageCount(imgl, &ret);
1754  ok(hr == S_OK && ret == 0, "invalid image count after decrease to 0\n");
1755 
1756  IImageList_Release(imgl);
1757 }
#define ILC_COLOR16
Definition: commctrl.h:352
HRESULT hr
Definition: shlfolder.c:183
HIMAGELIST himl
int32_t INT
Definition: typedefs.h:56
LONG HRESULT
Definition: typedefs.h:77
int ret
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57

Referenced by START_TEST().

◆ test_IImageList_GetBkColor()

static void test_IImageList_GetBkColor ( void  )
static

Definition at line 2303 of file imagelist.c.

2304 {
2305  IImageList *imgl;
2306  HIMAGELIST himl;
2307  COLORREF color;
2308  HRESULT hr;
2309 
2310  himl = pImageList_Create(16, 16, ILC_COLOR16, 0, 3);
2311  imgl = (IImageList*)himl;
2312 
2313 if (0)
2314 {
2315  /* crashes on native */
2316  IImageList_GetBkColor(imgl, NULL);
2317 }
2318 
2319  hr = IImageList_GetBkColor(imgl, &color);
2320  ok(hr == S_OK, "got 0x%08x\n", hr);
2321 
2322  IImageList_Release(imgl);
2323 }
#define ILC_COLOR16
Definition: commctrl.h:352
HRESULT hr
Definition: shlfolder.c:183
HIMAGELIST himl
GLuint color
Definition: glext.h:6243
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
DWORD COLORREF
Definition: windef.h:300
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57

Referenced by START_TEST().

◆ test_IImageList_GetIconSize()

static void test_IImageList_GetIconSize ( void  )
static

Definition at line 2379 of file imagelist.c.

2380 {
2381  IImageList *imgl;
2382  HIMAGELIST himl;
2383  int cx, cy;
2384  HRESULT hr;
2385 
2386  himl = pImageList_Create(16, 16, ILC_COLOR16, 0, 3);
2387  imgl = (IImageList*)himl;
2388 
2389  hr = IImageList_GetIconSize(imgl, NULL, NULL);
2390  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
2391 
2392  hr = IImageList_GetIconSize(imgl, &cx, NULL);
2393  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
2394 
2395  hr = IImageList_GetIconSize(imgl, NULL, &cy);
2396  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
2397 
2398  IImageList_Release(imgl);
2399 }
#define ILC_COLOR16
Definition: commctrl.h:352
HRESULT hr
Definition: shlfolder.c:183
HIMAGELIST himl
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:581
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
#define ok(value,...)
Definition: atltest.h:57
_Out_opt_ int * cx
Definition: commctrl.h:581

Referenced by START_TEST().

◆ test_IImageList_GetImageCount()

static void test_IImageList_GetImageCount ( void  )
static

Definition at line 2355 of file imagelist.c.

2356 {
2357  IImageList *imgl;
2358  HIMAGELIST himl;
2359  int count;
2360  HRESULT hr;
2361 
2362  himl = pImageList_Create(16, 16, ILC_COLOR16, 0, 3);
2363  imgl = (IImageList*)himl;
2364 
2365 if (0)
2366 {
2367  /* crashes on native */
2368  IImageList_GetImageCount(imgl, NULL);
2369 }
2370 
2371  count = -1;
2372  hr = IImageList_GetImageCount(imgl, &count);
2373  ok(hr == S_OK, "got 0x%08x\n", hr);
2374  ok(count == 0, "got %d\n", count);
2375 
2376  IImageList_Release(imgl);
2377 }
#define ILC_COLOR16
Definition: commctrl.h:352
HRESULT hr
Definition: shlfolder.c:183
GLuint GLuint GLsizei count
Definition: gl.h:1545
HIMAGELIST himl
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57

Referenced by START_TEST().

◆ test_IImageList_Merge()

static void test_IImageList_Merge ( void  )
static

Definition at line 1847 of file imagelist.c.

1848 {
1849  HIMAGELIST himl1, himl2;
1850  IImageList *imgl1, *imgl2, *merge;
1851  HICON hicon1;
1852  HWND hwnd = create_window();
1853  HRESULT hr;
1854  int ret;
1855 
1856  himl1 = pImageList_Create(32,32,0,0,3);
1857  ok(himl1 != NULL,"failed to create himl1\n");
1858 
1859  himl2 = pImageList_Create(32,32,0,0,3);
1860  ok(himl2 != NULL,"failed to create himl2\n");
1861 
1862  hicon1 = CreateIcon(hinst, 32, 32, 1, 1, icon_bits, icon_bits);
1863  ok(hicon1 != NULL, "failed to create hicon1\n");
1864 
1865  if (!himl1 || !himl2 || !hicon1)
1866  return;
1867 
1868  /* cast to IImageList */
1869  imgl1 = (IImageList *) himl1;
1870  imgl2 = (IImageList *) himl2;
1871 
1872  ret = -1;
1873  ok( IImageList_ReplaceIcon(imgl2, -1, hicon1, &ret) == S_OK && (ret == 0),"add icon1 to himl2 failed\n");
1874 
1875 if (0)
1876 {
1877  /* null cases that crash on native */
1878  IImageList_Merge(imgl1, -1, NULL, 0, 0, 0, &IID_IImageList, (void**)&merge);
1879  IImageList_Merge(imgl1, -1, (IUnknown*) imgl2, 0, 0, 0, &IID_IImageList, NULL);
1880 }
1881 
1882  /* If himl1 has no images, merge still succeeds */
1883  hr = IImageList_Merge(imgl1, -1, (IUnknown *) imgl2, 0, 0, 0, &IID_IImageList, (void **) &merge);
1884  ok(hr == S_OK, "merge himl1,-1 failed\n");
1885  if (hr == S_OK) IImageList_Release(merge);
1886 
1887  hr = IImageList_Merge(imgl1, 0, (IUnknown *) imgl2, 0, 0, 0, &IID_IImageList, (void **) &merge);
1888  ok(hr == S_OK, "merge himl1,0 failed\n");
1889  if (hr == S_OK) IImageList_Release(merge);
1890 
1891  /* Same happens if himl2 is empty */
1892  IImageList_Release(imgl2);
1893  himl2 = pImageList_Create(32,32,0,0,3);
1894  ok(himl2 != NULL,"failed to recreate himl2\n");
1895 
1896  imgl2 = (IImageList *) himl2;
1897 
1898  hr = IImageList_Merge(imgl1, -1, (IUnknown *) imgl2, -1, 0, 0, &IID_IImageList, (void **) &merge);
1899  ok(hr == S_OK, "merge himl2,-1 failed\n");
1900  if (hr == S_OK) IImageList_Release(merge);
1901 
1902  hr = IImageList_Merge(imgl1, -1, (IUnknown *) imgl2, 0, 0, 0, &IID_IImageList, (void **) &merge);
1903  ok(hr == S_OK, "merge himl2,0 failed\n");
1904  if (hr == S_OK) IImageList_Release(merge);
1905 
1906  /* Now try merging an image with itself */
1907  ret = -1;
1908  ok( IImageList_ReplaceIcon(imgl2, -1, hicon1, &ret) == S_OK && (ret == 0),"re-add icon1 to himl2 failed\n");
1909 
1910  hr = IImageList_Merge(imgl2, 0, (IUnknown *) imgl2, 0, 0, 0, &IID_IImageList, (void **) &merge);
1911  ok(hr == S_OK, "merge himl2 with itself failed\n");
1912  if (hr == S_OK) IImageList_Release(merge);
1913 
1914  /* Try merging 2 different image lists */
1915  ret = -1;
1916  ok( IImageList_ReplaceIcon(imgl1, -1, hicon1, &ret) == S_OK && (ret == 0),"add icon1 to himl1 failed\n");
1917 
1918  hr = IImageList_Merge(imgl1, 0, (IUnknown *) imgl2, 0, 0, 0, &IID_IImageList, (void **) &merge);
1919  ok(hr == S_OK, "merge himl1 with himl2 failed\n");
1920  if (hr == S_OK) IImageList_Release(merge);
1921 
1922  hr = IImageList_Merge(imgl1, 0, (IUnknown *) imgl2, 0, 8, 16, &IID_IImageList, (void **) &merge);
1923  ok(hr == S_OK, "merge himl1 with himl2 8,16 failed\n");
1924  if (hr == S_OK) IImageList_Release(merge);
1925 
1926  IImageList_Release(imgl1);
1927  IImageList_Release(imgl2);
1928 
1929  DestroyIcon(hicon1);
1931 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static HICON
Definition: imagelist.c:84
HRESULT hr
Definition: shlfolder.c:183
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
BOOL WINAPI DestroyWindow(_In_ HWND)
_STLP_MOVE_TO_STD_NAMESPACE _OutputIter merge(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _InputIter2 __last2, _OutputIter __result)
Definition: _algo.c:1419
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
HICON WINAPI CreateIcon(_In_opt_ HINSTANCE, _In_ int, _In_ int, _In_ BYTE, _In_ BYTE, _In_ const BYTE *, _In_ const BYTE *)
Definition: cursoricon.c:2364
static HWND create_window(void)
Definition: imagelist.c:163
int ret
static const BYTE icon_bits[32 *32/8]
Definition: imagelist.c:123
static HINSTANCE hinst
Definition: imagelist.c:94
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57

Referenced by START_TEST().

◆ test_IImageList_SetBkColor()

static void test_IImageList_SetBkColor ( void  )
static

Definition at line 2325 of file imagelist.c.

2326 {
2327  IImageList *imgl;
2328  HIMAGELIST himl;
2329  COLORREF color;
2330  HRESULT hr;
2331 
2332  himl = pImageList_Create(16, 16, ILC_COLOR16, 0, 3);
2333  imgl = (IImageList*)himl;
2334 
2335 if (0)
2336 {
2337  /* crashes on native */
2338  IImageList_SetBkColor(imgl, RGB(0, 0, 0), NULL);
2339 }
2340 
2341  hr = IImageList_SetBkColor(imgl, CLR_NONE, &color);
2342  ok(hr == S_OK, "got 0x%08x\n", hr);
2343 
2344  hr = IImageList_SetBkColor(imgl, CLR_NONE, &color);
2345  ok(hr == S_OK, "got 0x%08x\n", hr);
2346 
2347  color = 0xdeadbeef;
2348  hr = IImageList_GetBkColor(imgl, &color);
2349  ok(hr == S_OK, "got 0x%08x\n", hr);
2350  ok(color == CLR_NONE, "got %x\n", color);
2351 
2352  IImageList_Release(imgl);
2353 }
#define ILC_COLOR16
Definition: commctrl.h:352
HRESULT hr
Definition: shlfolder.c:183
HIMAGELIST himl
GLuint color
Definition: glext.h:6243
smooth NULL
Definition: ftsmooth.c:416
#define CLR_NONE
Definition: commctrl.h:315
LONG HRESULT
Definition: typedefs.h:77
DWORD COLORREF
Definition: windef.h:300
#define RGB(r, g, b)
Definition: wingdi.h:2939
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57

Referenced by START_TEST().

◆ test_imagecount()

static void test_imagecount ( void  )
static

Definition at line 452 of file imagelist.c.

453 {
455 
456  ok(0 == pImageList_GetImageCount((HIMAGELIST)0xdeadbeef), "don't crash on bad handle\n");
457 
458  if (!pImageList_SetImageCount)
459  {
460  win_skip("ImageList_SetImageCount not available\n");
461  return;
462  }
463 
464  himl = pImageList_Create(84, 84, ILC_COLOR16, 0, 3);
465  ok(himl != 0, "Failed to create imagelist.\n");
466 
467  ok(pImageList_SetImageCount(himl, 3), "couldn't increase image count\n");
468  ok(pImageList_GetImageCount(himl) == 3, "invalid image count after increase\n");
469  ok(pImageList_SetImageCount(himl, 1), "couldn't decrease image count\n");
470  ok(pImageList_GetImageCount(himl) == 1, "invalid image count after decrease to 1\n");
471  ok(pImageList_SetImageCount(himl, 0), "couldn't decrease image count\n");
472  ok(pImageList_GetImageCount(himl) == 0, "invalid image count after decrease to 0\n");
473 
474  ok(pImageList_Destroy(himl), "Failed to destroy imagelist.\n");
475 }
#define ILC_COLOR16
Definition: commctrl.h:352
HIMAGELIST himl
#define ok(value,...)
Definition: atltest.h:57
#define win_skip
Definition: test.h:150

Referenced by START_TEST().

◆ test_ImageList_DrawIndirect()

static void test_ImageList_DrawIndirect ( void  )
static

Definition at line 1451 of file imagelist.c.

1452 {
1453  HIMAGELIST himl = NULL;
1454  int ret;
1455  HDC hdcDst = NULL;
1456  HBITMAP hbmOld = NULL, hbmDst = NULL;
1457  HBITMAP hbmMask = NULL, hbmInverseMask = NULL;
1458  HBITMAP hbmImage = NULL, hbmAlphaImage = NULL, hbmTransparentImage = NULL;
1459  int iImage = -1, iAlphaImage = -1, iTransparentImage = -1;
1460  UINT32 *bits = 0;
1461  UINT32 maskBits = 0x00000000, inverseMaskBits = 0xFFFFFFFF;
1462  int bpp, broken_value;
1463 
1464  BITMAPINFO bitmapInfo = {{sizeof(BITMAPINFOHEADER), 2, 1, 1, 32, BI_RGB,
1465  0, 0, 0, 0, 0}};
1466 
1468  ok(hdcDst != 0, "CreateCompatibleDC(0) failed to return a valid DC\n");
1469  if (!hdcDst)
1470  return;
1472 
1473  hbmMask = CreateBitmap(2, 1, 1, 1, &maskBits);
1474  ok(hbmMask != 0, "CreateBitmap failed\n");
1475  if(!hbmMask) goto cleanup;
1476 
1477  hbmInverseMask = CreateBitmap(2, 1, 1, 1, &inverseMaskBits);
1478  ok(hbmInverseMask != 0, "CreateBitmap failed\n");
1479  if(!hbmInverseMask) goto cleanup;
1480 
1481  himl = pImageList_Create(2, 1, ILC_COLOR32, 0, 1);
1482  ok(himl != 0, "ImageList_Create failed\n");
1483  if(!himl) goto cleanup;
1484 
1485  /* Add a no-alpha image */
1486  hbmImage = create_test_bitmap(hdcDst, 32, 0x00ABCDEF, 0x00ABCDEF);
1487  if(!hbmImage) goto cleanup;
1488 
1489  iImage = pImageList_Add(himl, hbmImage, hbmMask);
1490  ok(iImage != -1, "ImageList_Add failed\n");
1491  if(iImage == -1) goto cleanup;
1492 
1493  /* Add an alpha image */
1494  hbmAlphaImage = create_test_bitmap(hdcDst, 32, 0x89ABCDEF, 0x89ABCDEF);
1495  if(!hbmAlphaImage) goto cleanup;
1496 
1497  iAlphaImage = pImageList_Add(himl, hbmAlphaImage, hbmMask);
1498  ok(iAlphaImage != -1, "ImageList_Add failed\n");
1499  if(iAlphaImage == -1) goto cleanup;
1500 
1501  /* Add a transparent alpha image */
1502  hbmTransparentImage = create_test_bitmap(hdcDst, 32, 0x00ABCDEF, 0x89ABCDEF);
1503  if(!hbmTransparentImage) goto cleanup;
1504 
1505  iTransparentImage = pImageList_Add(himl, hbmTransparentImage, hbmMask);
1506  ok(iTransparentImage != -1, "ImageList_Add failed\n");
1507  if(iTransparentImage == -1) goto cleanup;
1508 
1509  /* 32-bit Tests */
1510  bitmapInfo.bmiHeader.biBitCount = 32;
1511  hbmDst = CreateDIBSection(hdcDst, &bitmapInfo, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
1512  ok (hbmDst && bits, "CreateDIBSection failed to return a valid bitmap and buffer\n");
1513  if (!hbmDst || !bits)
1514  goto cleanup;
1515  hbmOld = SelectObject(hdcDst, hbmDst);
1516 
1517  check_ImageList_DrawIndirect_fStyle(hdcDst, himl, bits, iImage, ILD_NORMAL, 0x00ABCDEF, __LINE__);
1518  check_ImageList_DrawIndirect_fStyle(hdcDst, himl, bits, iImage, ILD_TRANSPARENT, 0x00ABCDEF, __LINE__);
1519  todo_wine check_ImageList_DrawIndirect_broken(hdcDst, himl, bits, iAlphaImage, ILD_BLEND25, ILS_NORMAL, 0, 0x00E8F1FA, 0x00D4D9DD, __LINE__);
1520  if (bpp == 16 || bpp == 24) broken_value = 0x00D4D9DD;
1521  else broken_value = 0x00B4BDC4;
1522  todo_wine check_ImageList_DrawIndirect_broken(hdcDst, himl, bits, iAlphaImage, ILD_BLEND50, ILS_NORMAL, 0, 0x00E8F1FA, broken_value, __LINE__);
1523  check_ImageList_DrawIndirect_fStyle(hdcDst, himl, bits, iImage, ILD_MASK, 0x00ABCDEF, __LINE__);
1524  check_ImageList_DrawIndirect_fStyle(hdcDst, himl, bits, iImage, ILD_IMAGE, 0x00ABCDEF, __LINE__);
1525  check_ImageList_DrawIndirect_fStyle(hdcDst, himl, bits, iImage, ILD_PRESERVEALPHA, 0x00ABCDEF, __LINE__);
1526 
1527  check_ImageList_DrawIndirect_fStyle(hdcDst, himl, bits, iAlphaImage, ILD_NORMAL, 0x00D3E5F7, __LINE__);
1528  check_ImageList_DrawIndirect_fStyle(hdcDst, himl, bits, iAlphaImage, ILD_TRANSPARENT, 0x00D3E5F7, __LINE__);
1529 
1530  if (bpp == 16 || bpp == 24) broken_value = 0x00D4D9DD;
1531  else broken_value = 0x009DA8B1;
1532  todo_wine check_ImageList_DrawIndirect_broken(hdcDst, himl, bits, iAlphaImage, ILD_BLEND25, ILS_NORMAL, 0, 0x00E8F1FA, broken_value, __LINE__);
1533  if (bpp == 16 || bpp == 24) broken_value = 0x00D4D9DD;
1534  else broken_value = 0x008C99A3;
1535  todo_wine check_ImageList_DrawIndirect_broken(hdcDst, himl, bits, iAlphaImage, ILD_BLEND50, ILS_NORMAL, 0, 0x00E8F1FA, broken_value, __LINE__);
1536  check_ImageList_DrawIndirect_fStyle(hdcDst, himl, bits, iAlphaImage, ILD_MASK, 0x00D3E5F7, __LINE__);
1537  check_ImageList_DrawIndirect_fStyle(hdcDst, himl, bits, iAlphaImage, ILD_IMAGE, 0x00D3E5F7, __LINE__);
1538  todo_wine check_ImageList_DrawIndirect_fStyle(hdcDst, himl, bits, iAlphaImage, ILD_PRESERVEALPHA, 0x005D6F81, __LINE__);
1539 
1540  check_ImageList_DrawIndirect_fStyle(hdcDst, himl, bits, iTransparentImage, ILD_NORMAL, 0x00FFFFFF, __LINE__);
1541 
1542  check_ImageList_DrawIndirect_ILD_ROP(hdcDst, himl, bits, iImage, SRCCOPY, 0x00ABCDEF, __LINE__);
1543  check_ImageList_DrawIndirect_ILD_ROP(hdcDst, himl, bits, iImage, SRCINVERT, 0x00543210, __LINE__);
1544 
1545  /* ILD_ROP is ignored when the image has an alpha channel */
1546  check_ImageList_DrawIndirect_ILD_ROP(hdcDst, himl, bits, iAlphaImage, SRCCOPY, 0x00D3E5F7, __LINE__);
1547  check_ImageList_DrawIndirect_ILD_ROP(hdcDst, himl, bits, iAlphaImage, SRCINVERT, 0x00D3E5F7, __LINE__);
1548 
1550  todo_wine check_ImageList_DrawIndirect_broken(hdcDst, himl, bits, iAlphaImage, ILD_NORMAL, ILS_SATURATE, 0, 0x00AFAFAF, 0x00F0F0F0, __LINE__);
1551 
1552  check_ImageList_DrawIndirect_fState(hdcDst, himl, bits, iImage, ILD_NORMAL, ILS_GLOW, 0, 0x00ABCDEF, __LINE__);
1553  check_ImageList_DrawIndirect_fState(hdcDst, himl, bits, iImage, ILD_NORMAL, ILS_SHADOW, 0, 0x00ABCDEF, __LINE__);
1554 
1555  check_ImageList_DrawIndirect_fState(hdcDst, himl, bits, iImage, ILD_NORMAL, ILS_ALPHA, 127, 0x00D5E6F7, __LINE__);
1556  check_ImageList_DrawIndirect_broken(hdcDst, himl, bits, iAlphaImage, ILD_NORMAL, ILS_ALPHA, 127, 0x00E9F2FB, 0x00AEB7C0, __LINE__);
1557  todo_wine check_ImageList_DrawIndirect_broken(hdcDst, himl, bits, iAlphaImage, ILD_NORMAL, ILS_NORMAL, 127, 0x00E9F2FB, 0x00D3E5F7, __LINE__);
1558 
1559 cleanup:
1560 
1561  if(hbmOld)
1562  SelectObject(hdcDst, hbmOld);
1563  if(hbmDst)
1564  DeleteObject(hbmDst);
1565 
1566  DeleteDC(hdcDst);
1567 
1568  if(hbmMask)
1569  DeleteObject(hbmMask);
1570  if(hbmInverseMask)
1571