Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/comctl32/tests/imagelist.c | 259 +++++++++++++++++++++++-----------------
1 file changed, 148 insertions(+), 111 deletions(-)
diff --git a/dlls/comctl32/tests/imagelist.c b/dlls/comctl32/tests/imagelist.c
index 566b3b5a83..e0251a9601 100644
--- a/dlls/comctl32/tests/imagelist.c
+++ b/dlls/comctl32/tests/imagelist.c
@@ -98,6 +98,11 @@ static void force_redraw(HWND hwnd)
Sleep(1000);
}
+static BOOL is_v6_test(void)
+{
+ return pHIMAGELIST_QueryInterface != NULL;
+}
+
/* These macros build cursor/bitmap data in 4x4 pixel blocks */
#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)
@@ -739,11 +744,23 @@ static HRESULT STDMETHODCALLTYPE Test_Stream_Write(IStream *iface, const void *p
return IStream_Write(stream->stream, pv, cb, pcbWritten);
}
-static HRESULT STDMETHODCALLTYPE Test_Stream_Seek(IStream *iface, LARGE_INTEGER dlibMove,
- DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
+static HRESULT STDMETHODCALLTYPE Test_Stream_Seek(IStream *iface, LARGE_INTEGER offset, DWORD origin,
+ ULARGE_INTEGER *new_pos)
{
- ok(0, "unexpected call\n");
- return E_NOTIMPL;
+ struct memstream *stream = impl_from_IStream(iface);
+
+ if (is_v6_test())
+ {
+ ok(origin == STREAM_SEEK_CUR, "Unexpected origin %d.\n", origin);
+ ok(offset.QuadPart == 0, "Unexpected offset %s.\n", wine_dbgstr_longlong(offset.QuadPart));
+ ok(new_pos != NULL, "Unexpected out position pointer.\n");
+ return IStream_Seek(stream->stream, offset, origin, new_pos);
+ }
+ else
+ {
+ ok(0, "unexpected call\n");
+ return E_NOTIMPL;
+ }
}
static HRESULT STDMETHODCALLTYPE Test_Stream_SetSize(IStream *iface, ULARGE_INTEGER libNewSize)
@@ -828,15 +845,13 @@ static void cleanup_memstream(struct memstream *stream)
IStream_Release(stream->stream);
}
-
static INT DIB_GetWidthBytes( int width, int bpp )
{
return ((width * bpp + 31) / 8) & ~3;
}
-static ULONG check_bitmap_data(const char *bm_data, ULONG bm_data_size,
- INT width, INT height, INT bpp,
- const char *comment)
+static ULONG check_bitmap_data(const ILHEAD *header, const char *bm_data,
+ ULONG bm_data_size, const SIZE *bmpsize, INT bpp, const char *comment)
{
const BITMAPFILEHEADER *bmfh = (const BITMAPFILEHEADER *)bm_data;
const BITMAPINFOHEADER *bmih = (const BITMAPINFOHEADER *)(bm_data + sizeof(*bmfh));
@@ -852,13 +867,13 @@ static ULONG check_bitmap_data(const char *bm_data, ULONG bm_data_size,
ok(bmfh->bfOffBits == hdr_size, "wrong bfOffBits 0x%02x\n", bmfh->bfOffBits);
ok(bmih->biSize == sizeof(*bmih), "wrong biSize %d\n", bmih->biSize);
- ok(bmih->biWidth == width, "wrong biWidth %d (expected %d)\n", bmih->biWidth, width);
- ok(bmih->biHeight == height, "wrong biHeight %d (expected %d)\n", bmih->biHeight, height);
ok(bmih->biPlanes == 1, "wrong biPlanes %d\n", bmih->biPlanes);
ok(bmih->biBitCount == bpp, "wrong biBitCount %d\n", bmih->biBitCount);
image_size = DIB_GetWidthBytes(bmih->biWidth, bmih->biBitCount) * bmih->biHeight;
ok(bmih->biSizeImage == image_size, "wrong biSizeImage %u\n", bmih->biSizeImage);
+ ok(bmih->biWidth == bmpsize->cx && bmih->biHeight == bmpsize->cy, "Unexpected bitmap size %d x %d, "
+ "expected %d x %d\n", bmih->biWidth, bmih->biHeight, bmpsize->cx, bmpsize->cy);
if (0)
{
@@ -873,15 +888,23 @@ if (0)
return hdr_size + image_size;
}
-static void check_ilhead_data(const char *ilh_data, INT cx, INT cy, INT cur, INT max, INT grow, INT flags)
+static BOOL is_v6_header(const ILHEAD *header)
{
- const ILHEAD *ilh = (const ILHEAD *)ilh_data;
+ return (header->usVersion & 0xff00) == 0x600;
+}
+static void check_ilhead_data(const ILHEAD *ilh, INT cx, INT cy, INT cur, INT max, INT grow, INT flags)
+{
ok(ilh->usMagic == IMAGELIST_MAGIC, "wrong usMagic %4x (expected %02x)\n", ilh->usMagic, IMAGELIST_MAGIC);
- ok(ilh->usVersion == 0x101, "wrong usVersion %x (expected 0x101)\n", ilh->usVersion);
+ ok(ilh->usVersion == 0x101 ||
+ ilh->usVersion == 0x600 || /* WinXP/W2k3 */
+ ilh->usVersion == 0x620, "Unknown usVersion %#x.\n", ilh->usVersion);
ok(ilh->cCurImage == cur, "wrong cCurImage %d (expected %d)\n", ilh->cCurImage, cur);
- ok(ilh->cMaxImage == max, "wrong cMaxImage %d (expected %d)\n", ilh->cMaxImage, max);
- ok(ilh->cGrow == grow, "wrong cGrow %d (expected %d)\n", ilh->cGrow, grow);
+ if (!is_v6_header(ilh))
+ {
+ ok(ilh->cMaxImage == max, "wrong cMaxImage %d (expected %d)\n", ilh->cMaxImage, max);
+ ok(ilh->cGrow == grow, "Unexpected cGrow %d (expected %d)\n", ilh->cGrow, grow);
+ }
ok(ilh->cx == cx, "wrong cx %d (expected %d)\n", ilh->cx, cx);
ok(ilh->cy == cy, "wrong cy %d (expected %d)\n", ilh->cy, cy);
ok(ilh->bkcolor == CLR_NONE, "wrong bkcolor %x\n", ilh->bkcolor);
@@ -926,17 +949,36 @@ static HBITMAP create_bitmap(INT cx, INT cy, COLORREF color, const char *comment
return hbmp;
}
+static inline void imagelist_get_bitmap_size(const ILHEAD *header, SIZE *sz)
+{
+ const int tile_count = 4;
+
+ if (is_v6_header(header))
+ {
+ sz->cx = header->cx;
+ sz->cy = header->cMaxImage * header->cy;
+ }
+ else
+ {
+ sz->cx = header->cx * tile_count;
+ sz->cy = ((header->cMaxImage + tile_count - 1) / tile_count) * header->cy;
+ }
+}
+
static void check_iml_data(HIMAGELIST himl, INT cx, INT cy, INT cur, INT max, INT grow,
- INT width, INT height, INT flags, const char *comment)
+ INT flags, const char *comment)
{
INT ret, cxx, cyy, size;
struct memstream stream;
+ const ILHEAD *header;
LARGE_INTEGER mv;
HIMAGELIST himl2;
HGLOBAL hglobal;
STATSTG stat;
char *data;
HRESULT hr;
+ SIZE bmpsize;
+ BOOL b;
ret = pImageList_GetImageCount(himl);
ok(ret == cur, "%s: expected image count %d got %d\n", comment, cur, ret);
@@ -947,8 +989,8 @@ static void check_iml_data(HIMAGELIST himl, INT cx, INT cy, INT cur, INT max, IN
ok(cyy == cy, "%s: wrong cy %d (expected %d)\n", comment, cyy, cy);
init_memstream(&stream);
- ret = pImageList_Write(himl, &stream.IStream_iface);
- ok(ret, "%s: ImageList_Write failed\n", comment);
+ b = pImageList_Write(himl, &stream.IStream_iface);
+ ok(b, "%s: ImageList_Write failed\n", comment);
hr = GetHGlobalFromStream(stream.stream, &hglobal);
ok(hr == S_OK, "%s: Failed to get hglobal, %#x\n", comment, hr);
@@ -960,14 +1002,16 @@ static void check_iml_data(HIMAGELIST himl, INT cx, INT cy, INT cur, INT max, IN
ok(data != 0, "%s: ImageList_Write didn't write any data\n", comment);
ok(stat.cbSize.LowPart > sizeof(ILHEAD), "%s: ImageList_Write wrote not enough data\n", comment);
- check_ilhead_data(data, cx, cy, cur, max, grow, flags);
- size = check_bitmap_data(data + sizeof(ILHEAD), stat.cbSize.LowPart - sizeof(ILHEAD),
- width, height, flags & 0xfe, comment);
- if (size < stat.cbSize.LowPart - sizeof(ILHEAD)) /* mask is present */
+ header = (const ILHEAD *)data;
+ check_ilhead_data(header, cx, cy, cur, max, grow, flags);
+ imagelist_get_bitmap_size(header, &bmpsize);
+ size = check_bitmap_data(header, data + sizeof(ILHEAD), stat.cbSize.LowPart - sizeof(ILHEAD),
+ &bmpsize, flags & 0xfe, comment);
+ if (!is_v6_header(header) && size < stat.cbSize.LowPart - sizeof(ILHEAD)) /* mask is present */
{
ok( flags & ILC_MASK, "%s: extra data %u/%u but mask not expected\n", comment, stat.cbSize.LowPart, size );
- check_bitmap_data(data + sizeof(ILHEAD) + size, stat.cbSize.LowPart - sizeof(ILHEAD) - size,
- width, height, 1, comment);
+ check_bitmap_data(header, data + sizeof(ILHEAD) + size, stat.cbSize.LowPart - sizeof(ILHEAD) - size,
+ &bmpsize, 1, comment);
}
/* rewind and reconstruct from stream */
@@ -990,37 +1034,37 @@ static void image_list_init(HIMAGELIST himl)
static const struct test_data
{
BYTE grey;
- INT cx, cy, cur, max, grow, width, height, bpp;
+ INT cx, cy, cur, max, grow, bpp;
const char *comment;
} td[] =
{
- { 255, BMP_CX, BMP_CX, 1, 2, 4, BMP_CX * 4, BMP_CX * 1, 24, "total 1" },
- { 170, BMP_CX, BMP_CX, 2, 7, 4, BMP_CX * 4, BMP_CX * 2, 24, "total 2" },
- { 85, BMP_CX, BMP_CX, 3, 7, 4, BMP_CX * 4, BMP_CX * 2, 24, "total 3" },
- { 0, BMP_CX, BMP_CX, 4, 7, 4, BMP_CX * 4, BMP_CX * 2, 24, "total 4" },
- { 0, BMP_CX, BMP_CX, 5, 7, 4, BMP_CX * 4, BMP_CX * 2, 24, "total 5" },
- { 85, BMP_CX, BMP_CX, 6, 7, 4, BMP_CX * 4, BMP_CX * 2, 24, "total 6" },
- { 170, BMP_CX, BMP_CX, 7, 12, 4, BMP_CX * 4, BMP_CX * 3, 24, "total 7" },
- { 255, BMP_CX, BMP_CX, 8, 12, 4, BMP_CX * 4, BMP_CX * 3, 24, "total 8" },
- { 255, BMP_CX, BMP_CX, 9, 12, 4, BMP_CX * 4, BMP_CX * 3, 24, "total 9" },
- { 170, BMP_CX, BMP_CX, 10, 12, 4, BMP_CX * 4, BMP_CX * 3, 24, "total 10" },
- { 85, BMP_CX, BMP_CX, 11, 12, 4, BMP_CX * 4, BMP_CX * 3, 24, "total 11" },
- { 0, BMP_CX, BMP_CX, 12, 17, 4, BMP_CX * 4, BMP_CX * 5, 24, "total 12" },
- { 0, BMP_CX, BMP_CX, 13, 17, 4, BMP_CX * 4, BMP_CX * 5, 24, "total 13" },
- { 85, BMP_CX, BMP_CX, 14, 17, 4, BMP_CX * 4, BMP_CX * 5, 24, "total 14" },
- { 170, BMP_CX, BMP_CX, 15, 17, 4, BMP_CX * 4, BMP_CX * 5, 24, "total 15" },
- { 255, BMP_CX, BMP_CX, 16, 17, 4, BMP_CX * 4, BMP_CX * 5, 24, "total 16" },
- { 255, BMP_CX, BMP_CX, 17, 22, 4, BMP_CX * 4, BMP_CX * 6, 24, "total 17" },
- { 170, BMP_CX, BMP_CX, 18, 22, 4, BMP_CX * 4, BMP_CX * 6, 24, "total 18" },
- { 85, BMP_CX, BMP_CX, 19, 22, 4, BMP_CX * 4, BMP_CX * 6, 24, "total 19" },
- { 0, BMP_CX, BMP_CX, 20, 22, 4, BMP_CX * 4, BMP_CX * 6, 24, "total 20" },
- { 0, BMP_CX, BMP_CX, 21, 22, 4, BMP_CX * 4, BMP_CX * 6, 24, "total 21" },
- { 85, BMP_CX, BMP_CX, 22, 27, 4, BMP_CX * 4, BMP_CX * 7, 24, "total 22" },
- { 170, BMP_CX, BMP_CX, 23, 27, 4, BMP_CX * 4, BMP_CX * 7, 24, "total 23" },
- { 255, BMP_CX, BMP_CX, 24, 27, 4, BMP_CX * 4, BMP_CX * 7, 24, "total 24" }
+ { 255, BMP_CX, BMP_CX, 1, 2, 4, 24, "total 1" },
+ { 170, BMP_CX, BMP_CX, 2, 7, 4, 24, "total 2" },
+ { 85, BMP_CX, BMP_CX, 3, 7, 4, 24, "total 3" },
+ { 0, BMP_CX, BMP_CX, 4, 7, 4, 24, "total 4" },
+ { 0, BMP_CX, BMP_CX, 5, 7, 4, 24, "total 5" },
+ { 85, BMP_CX, BMP_CX, 6, 7, 4, 24, "total 6" },
+ { 170, BMP_CX, BMP_CX, 7, 12, 4, 24, "total 7" },
+ { 255, BMP_CX, BMP_CX, 8, 12, 4, 24, "total 8" },
+ { 255, BMP_CX, BMP_CX, 9, 12, 4, 24, "total 9" },
+ { 170, BMP_CX, BMP_CX, 10, 12, 4, 24, "total 10" },
+ { 85, BMP_CX, BMP_CX, 11, 12, 4, 24, "total 11" },
+ { 0, BMP_CX, BMP_CX, 12, 17, 4, 24, "total 12" },
+ { 0, BMP_CX, BMP_CX, 13, 17, 4, 24, "total 13" },
+ { 85, BMP_CX, BMP_CX, 14, 17, 4, 24, "total 14" },
+ { 170, BMP_CX, BMP_CX, 15, 17, 4, 24, "total 15" },
+ { 255, BMP_CX, BMP_CX, 16, 17, 4, 24, "total 16" },
+ { 255, BMP_CX, BMP_CX, 17, 22, 4, 24, "total 17" },
+ { 170, BMP_CX, BMP_CX, 18, 22, 4, 24, "total 18" },
+ { 85, BMP_CX, BMP_CX, 19, 22, 4, 24, "total 19" },
+ { 0, BMP_CX, BMP_CX, 20, 22, 4, 24, "total 20" },
+ { 0, BMP_CX, BMP_CX, 21, 22, 4, 24, "total 21" },
+ { 85, BMP_CX, BMP_CX, 22, 27, 4, 24, "total 22" },
+ { 170, BMP_CX, BMP_CX, 23, 27, 4, 24, "total 23" },
+ { 255, BMP_CX, BMP_CX, 24, 27, 4, 24, "total 24" }
};
- check_iml_data(himl, BMP_CX, BMP_CX, 0, 2, 4, BMP_CX * 4, BMP_CX * 1, ILC_COLOR24, "total 0");
+ check_iml_data(himl, BMP_CX, BMP_CX, 0, 2, 4, ILC_COLOR24, "total 0");
#define add_bitmap(grey) \
sprintf(comment, "%d", n++); \
@@ -1031,8 +1075,7 @@ static void image_list_init(HIMAGELIST himl)
for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
{
add_bitmap(td[i].grey);
- check_iml_data(himl, td[i].cx, td[i].cy, td[i].cur, td[i].max, td[i].grow,
- td[i].width, td[i].height, td[i].bpp, td[i].comment);
+ check_iml_data(himl, td[i].cx, td[i].cy, td[i].cur, td[i].max, td[i].grow, td[i].bpp, td[i].comment);
}
#undef add_bitmap
}
@@ -1047,38 +1090,38 @@ static void test_imagelist_storage(void)
himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR24, 1, 1);
ok(himl != 0, "ImageList_Create failed\n");
- check_iml_data(himl, BMP_CX, BMP_CX, 0, 2, 4, BMP_CX * 4, BMP_CX * 1, ILC_COLOR24, "empty");
+ check_iml_data(himl, BMP_CX, BMP_CX, 0, 2, 4, ILC_COLOR24, "empty");
image_list_init(himl);
- check_iml_data(himl, BMP_CX, BMP_CX, 24, 27, 4, BMP_CX * 4, BMP_CX * 7, ILC_COLOR24, "orig");
+ check_iml_data(himl, BMP_CX, BMP_CX, 24, 27, 4, ILC_COLOR24, "orig");
ret = pImageList_Remove(himl, 4);
ok(ret, "ImageList_Remove failed\n");
- check_iml_data(himl, BMP_CX, BMP_CX, 23, 27, 4, BMP_CX * 4, BMP_CX * 7, ILC_COLOR24, "1");
+ check_iml_data(himl, BMP_CX, BMP_CX, 23, 27, 4, ILC_COLOR24, "1");
ret = pImageList_Remove(himl, 5);
ok(ret, "ImageList_Remove failed\n");
- check_iml_data(himl, BMP_CX, BMP_CX, 22, 27, 4, BMP_CX * 4, BMP_CX * 7, ILC_COLOR24, "2");
+ check_iml_data(himl, BMP_CX, BMP_CX, 22, 27, 4, ILC_COLOR24, "2");
ret = pImageList_Remove(himl, 6);
ok(ret, "ImageList_Remove failed\n");
- check_iml_data(himl, BMP_CX, BMP_CX, 21, 27, 4, BMP_CX * 4, BMP_CX * 7, ILC_COLOR24, "3");
+ check_iml_data(himl, BMP_CX, BMP_CX, 21, 27, 4, ILC_COLOR24, "3");
ret = pImageList_Remove(himl, 7);
ok(ret, "ImageList_Remove failed\n");
- check_iml_data(himl, BMP_CX, BMP_CX, 20, 27, 4, BMP_CX * 4, BMP_CX * 7, ILC_COLOR24, "4");
+ check_iml_data(himl, BMP_CX, BMP_CX, 20, 27, 4, ILC_COLOR24, "4");
ret = pImageList_Remove(himl, -2);
ok(!ret, "ImageList_Remove(-2) should fail\n");
- check_iml_data(himl, BMP_CX, BMP_CX, 20, 27, 4, BMP_CX * 4, BMP_CX * 7, ILC_COLOR24, "5");
+ check_iml_data(himl, BMP_CX, BMP_CX, 20, 27, 4, ILC_COLOR24, "5");
ret = pImageList_Remove(himl, 20);
ok(!ret, "ImageList_Remove(20) should fail\n");
- check_iml_data(himl, BMP_CX, BMP_CX, 20, 27, 4, BMP_CX * 4, BMP_CX * 7, ILC_COLOR24, "6");
+ check_iml_data(himl, BMP_CX, BMP_CX, 20, 27, 4, ILC_COLOR24, "6");
ret = pImageList_Remove(himl, -1);
ok(ret, "ImageList_Remove(-1) failed\n");
- check_iml_data(himl, BMP_CX, BMP_CX, 0, 4, 4, BMP_CX * 4, BMP_CX * 1, ILC_COLOR24, "7");
+ check_iml_data(himl, BMP_CX, BMP_CX, 0, 4, 4, ILC_COLOR24, "7");
ret = pImageList_Destroy(himl);
ok(ret, "ImageList_Destroy failed\n");
@@ -1087,165 +1130,158 @@ static void test_imagelist_storage(void)
himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR24, 0, 32);
ok(himl != 0, "ImageList_Create failed\n");
- check_iml_data(himl, BMP_CX, BMP_CX, 0, 1, 32, BMP_CX * 4, BMP_CX * 1, ILC_COLOR24, "init 0 grow 32");
+ check_iml_data(himl, BMP_CX, BMP_CX, 0, 1, 32, ILC_COLOR24, "init 0 grow 32");
hbm = create_bitmap(BMP_CX * 9, BMP_CX, 0, "9");
ret = pImageList_Add(himl, hbm, NULL);
ok(ret == 0, "ImageList_Add returned %d, expected 0\n", ret);
- check_iml_data(himl, BMP_CX, BMP_CX, 1, 34, 32, BMP_CX * 4, BMP_CX * 9, ILC_COLOR24, "add 1 x 9");
+ check_iml_data(himl, BMP_CX, BMP_CX, 1, 34, 32, ILC_COLOR24, "add 1 x 9");
DeleteObject(hbm);
ret = pImageList_Destroy(himl);
ok(ret, "ImageList_Destroy failed\n");
himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR24, 4, 4);
ok(himl != 0, "ImageList_Create failed\n");
- check_iml_data(himl, BMP_CX, BMP_CX, 0, 5, 4, BMP_CX * 4, BMP_CX * 2, ILC_COLOR24, "init 4 grow 4");
+ check_iml_data(himl, BMP_CX, BMP_CX, 0, 5, 4, ILC_COLOR24, "init 4 grow 4");
hbm = create_bitmap(BMP_CX, BMP_CX * 9, 0, "9");
ret = pImageList_Add(himl, hbm, NULL);
ok(ret == 0, "ImageList_Add returned %d, expected 0\n", ret);
- check_iml_data(himl, BMP_CX, BMP_CX, 9, 15, 4, BMP_CX * 4, BMP_CX * 4, ILC_COLOR24, "add 9 x 1");
+ check_iml_data(himl, BMP_CX, BMP_CX, 9, 15, 4, ILC_COLOR24, "add 9 x 1");
ret = pImageList_Add(himl, hbm, NULL);
ok(ret == 9, "ImageList_Add returned %d, expected 9\n", ret);
- check_iml_data(himl, BMP_CX, BMP_CX, 18, 25, 4, BMP_CX * 4, BMP_CX * 7, ILC_COLOR24, "add 9 x 1");
+ check_iml_data(himl, BMP_CX, BMP_CX, 18, 25, 4, ILC_COLOR24, "add 9 x 1");
DeleteObject(hbm);
ret = pImageList_Destroy(himl);
ok(ret, "ImageList_Destroy failed\n");
himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR24, 207, 209);
ok(himl != 0, "ImageList_Create failed\n");
- check_iml_data(himl, BMP_CX, BMP_CX, 0, 208, 212, BMP_CX * 4, BMP_CX * 52, ILC_COLOR24, "init 207 grow 209");
+ check_iml_data(himl, BMP_CX, BMP_CX, 0, 208, 212, ILC_COLOR24, "init 207 grow 209");
ret = pImageList_Destroy(himl);
ok(ret, "ImageList_Destroy failed\n");
himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR24, 209, 207);
ok(himl != 0, "ImageList_Create failed\n");
- check_iml_data(himl, BMP_CX, BMP_CX, 0, 210, 208, BMP_CX * 4, BMP_CX * 53, ILC_COLOR24, "init 209 grow 207");
+ check_iml_data(himl, BMP_CX, BMP_CX, 0, 210, 208, ILC_COLOR24, "init 209 grow 207");
ret = pImageList_Destroy(himl);
ok(ret, "ImageList_Destroy failed\n");
himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR24, 14, 4);
ok(himl != 0, "ImageList_Create failed\n");
- check_iml_data(himl, BMP_CX, BMP_CX, 0, 15, 4, BMP_CX * 4, BMP_CX * 4, ILC_COLOR24, "init 14 grow 4");
+ check_iml_data(himl, BMP_CX, BMP_CX, 0, 15, 4, ILC_COLOR24, "init 14 grow 4");
ret = pImageList_Destroy(himl);
ok(ret, "ImageList_Destroy failed\n");
himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR24, 5, 9);
ok(himl != 0, "ImageList_Create failed\n");
- check_iml_data(himl, BMP_CX, BMP_CX, 0, 6, 12, BMP_CX * 4, BMP_CX * 2, ILC_COLOR24, "init 5 grow 9");
+ check_iml_data(himl, BMP_CX, BMP_CX, 0, 6, 12, ILC_COLOR24, "init 5 grow 9");
ret = pImageList_Destroy(himl);
ok(ret, "ImageList_Destroy failed\n");
himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR24, 9, 5);
ok(himl != 0, "ImageList_Create failed\n");
- check_iml_data(himl, BMP_CX, BMP_CX, 0, 10, 8, BMP_CX * 4, BMP_CX * 3, ILC_COLOR24, "init 9 grow 5");
+ check_iml_data(himl, BMP_CX, BMP_CX, 0, 10, 8, ILC_COLOR24, "init 9 grow 5");
ret = pImageList_Destroy(himl);
ok(ret, "ImageList_Destroy failed\n");
himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR24, 2, 4);
ok(himl != 0, "ImageList_Create failed\n");
- check_iml_data(himl, BMP_CX, BMP_CX, 0, 3, 4, BMP_CX * 4, BMP_CX * 1, ILC_COLOR24, "init 2 grow 4");
+ check_iml_data(himl, BMP_CX, BMP_CX, 0, 3, 4, ILC_COLOR24, "init 2 grow 4");
ret = pImageList_Destroy(himl);
ok(ret, "ImageList_Destroy failed\n");
himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR24, 4, 2);
ok(himl != 0, "ImageList_Create failed\n");
- check_iml_data(himl, BMP_CX, BMP_CX, 0, 5, 4, BMP_CX * 4, BMP_CX * 2, ILC_COLOR24, "init 4 grow 2");
+ check_iml_data(himl, BMP_CX, BMP_CX, 0, 5, 4, ILC_COLOR24, "init 4 grow 2");
ret = pImageList_Destroy(himl);
ok(ret, "ImageList_Destroy failed\n");
himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR8, 4, 2);
ok(himl != 0, "ImageList_Create failed\n");
- check_iml_data(himl, BMP_CX, BMP_CX, 0, 5, 4, BMP_CX * 4, BMP_CX * 2, ILC_COLOR8, "bpp 8");
+ check_iml_data(himl, BMP_CX, BMP_CX, 0, 5, 4, ILC_COLOR8, "bpp 8");
ret = pImageList_Destroy(himl);
ok(ret, "ImageList_Destroy failed\n");
himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR4, 4, 2);
ok(himl != 0, "ImageList_Create failed\n");
- check_iml_data(himl, BMP_CX, BMP_CX, 0, 5, 4, BMP_CX * 4, BMP_CX * 2, ILC_COLOR4, "bpp 4");
+ check_iml_data(himl, BMP_CX, BMP_CX, 0, 5, 4, ILC_COLOR4, "bpp 4");
ret = pImageList_Destroy(himl);
ok(ret, "ImageList_Destroy failed\n");
himl = pImageList_Create(BMP_CX, BMP_CX, 0, 4, 2);
ok(himl != 0, "ImageList_Create failed\n");
- check_iml_data(himl, BMP_CX, BMP_CX, 0, 5, 4, BMP_CX * 4, BMP_CX * 2, ILC_COLOR4, "bpp default");
+ check_iml_data(himl, BMP_CX, BMP_CX, 0, 5, 4, ILC_COLOR4, "bpp default");
icon = CreateIcon(hinst, 32, 32, 1, 1, icon_bits, icon_bits);
ok( pImageList_ReplaceIcon(himl, -1, icon) == 0, "Failed to add icon.\n");
ok( pImageList_ReplaceIcon(himl, -1, icon) == 1, "Failed to add icon.\n");
DestroyIcon( icon );
- check_iml_data(himl, BMP_CX, BMP_CX, 2, 5, 4, BMP_CX * 4, BMP_CX * 2, ILC_COLOR4, "bpp default");
+ check_iml_data(himl, BMP_CX, BMP_CX, 2, 5, 4, ILC_COLOR4, "bpp default");
ret = pImageList_Destroy(himl);
ok(ret, "ImageList_Destroy failed\n");
himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR24|ILC_MASK, 4, 2);
ok(himl != 0, "ImageList_Create failed\n");
- check_iml_data(himl, BMP_CX, BMP_CX, 0, 5, 4, BMP_CX * 4, BMP_CX * 2, ILC_COLOR24|ILC_MASK,
- "bpp 24 + mask");
+ check_iml_data(himl, BMP_CX, BMP_CX, 0, 5, 4, ILC_COLOR24|ILC_MASK, "bpp 24 + mask");
icon = CreateIcon(hinst, 32, 32, 1, 1, icon_bits, icon_bits);
ok( pImageList_ReplaceIcon(himl, -1, icon) == 0, "Failed to add icon.\n");
ok( pImageList_ReplaceIcon(himl, -1, icon) == 1, "Failed to add icon.\n");
DestroyIcon( icon );
- check_iml_data(himl, BMP_CX, BMP_CX, 2, 5, 4, BMP_CX * 4, BMP_CX * 2, ILC_COLOR24|ILC_MASK, "bpp 24 + mask");
+ check_iml_data(himl, BMP_CX, BMP_CX, 2, 5, 4, ILC_COLOR24|ILC_MASK, "bpp 24 + mask");
ret = pImageList_Destroy(himl);
ok(ret, "ImageList_Destroy failed\n");
himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR4|ILC_MASK, 4, 2);
ok(himl != 0, "ImageList_Create failed\n");
- check_iml_data(himl, BMP_CX, BMP_CX, 0, 5, 4, BMP_CX * 4, BMP_CX * 2, ILC_COLOR4|ILC_MASK, "bpp 4 + mask");
+ check_iml_data(himl, BMP_CX, BMP_CX, 0, 5, 4, ILC_COLOR4|ILC_MASK, "bpp 4 + mask");
icon = CreateIcon(hinst, 32, 32, 1, 1, icon_bits, icon_bits);
ok( pImageList_ReplaceIcon(himl, -1, icon) == 0, "Failed to add icon.\n");
ok( pImageList_ReplaceIcon(himl, -1, icon) == 1, "Failed to add icon.\n");
DestroyIcon( icon );
- check_iml_data(himl, BMP_CX, BMP_CX, 2, 5, 4, BMP_CX * 4, BMP_CX * 2, ILC_COLOR4|ILC_MASK, "bpp 4 + mask");
+ check_iml_data(himl, BMP_CX, BMP_CX, 2, 5, 4, ILC_COLOR4|ILC_MASK, "bpp 4 + mask");
ret = pImageList_Destroy(himl);
ok(ret, "ImageList_Destroy failed\n");
himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR4|ILC_MASK, 2, 99);
ok(himl != 0, "ImageList_Create failed\n");
- check_iml_data(himl, BMP_CX, BMP_CX, 0, 3, 100, BMP_CX * 4, BMP_CX, ILC_COLOR4|ILC_MASK,
- "init 2 grow 99");
+ check_iml_data(himl, BMP_CX, BMP_CX, 0, 3, 100, ILC_COLOR4|ILC_MASK, "init 2 grow 99");
icon = CreateIcon(hinst, 32, 32, 1, 1, icon_bits, icon_bits);
ok( pImageList_ReplaceIcon(himl, -1, icon) == 0, "Failed to add icon.\n");
ok( pImageList_ReplaceIcon(himl, -1, icon) == 1, "Failed to add icon.\n");
- check_iml_data(himl, BMP_CX, BMP_CX, 2, 3, 100, BMP_CX * 4, BMP_CX, ILC_COLOR4|ILC_MASK,
- "init 2 grow 99 2 icons");
+ check_iml_data(himl, BMP_CX, BMP_CX, 2, 3, 100, ILC_COLOR4|ILC_MASK, "init 2 grow 99 2 icons");
ok( pImageList_ReplaceIcon(himl, -1, icon) == 2, "Failed to add icon\n");
DestroyIcon( icon );
- check_iml_data(himl, BMP_CX, BMP_CX, 3, 104, 100, BMP_CX * 4, BMP_CX * 104/4, ILC_COLOR4|ILC_MASK,
- "init 2 grow 99 3 icons");
+ check_iml_data(himl, BMP_CX, BMP_CX, 3, 104, 100, ILC_COLOR4|ILC_MASK, "init 2 grow 99 3 icons");
ok( pImageList_Remove(himl, -1) == TRUE, "Failed to remove icon.\n");
- check_iml_data(himl, BMP_CX, BMP_CX, 0, 100, 100, BMP_CX * 4, BMP_CX * 100/4, ILC_COLOR4|ILC_MASK,
- "init 2 grow 99 empty");
+ check_iml_data(himl, BMP_CX, BMP_CX, 0, 100, 100, ILC_COLOR4|ILC_MASK, "init 2 grow 99 empty");
ok( pImageList_SetImageCount(himl, 22) == TRUE, "Failed to set image count.\n");
- check_iml_data(himl, BMP_CX, BMP_CX, 22, 23, 100, BMP_CX * 4, BMP_CX * 24/4, ILC_COLOR4|ILC_MASK,
- "init 2 grow 99 set count 22");
+ check_iml_data(himl, BMP_CX, BMP_CX, 22, 23, 100, ILC_COLOR4|ILC_MASK, "init 2 grow 99 set count 22");
ok( pImageList_SetImageCount(himl, 0) == TRUE, "Failed to set image count.\n");
- check_iml_data(himl, BMP_CX, BMP_CX, 0, 1, 100, BMP_CX * 4, BMP_CX, ILC_COLOR4|ILC_MASK,
- "init 2 grow 99 set count 0");
+ check_iml_data(himl, BMP_CX, BMP_CX, 0, 1, 100, ILC_COLOR4|ILC_MASK, "init 2 grow 99 set count 0");
ok( pImageList_SetImageCount(himl, 42) == TRUE, "Failed to set image count.\n");
- check_iml_data(himl, BMP_CX, BMP_CX, 42, 43, 100, BMP_CX * 4, BMP_CX * 44/4, ILC_COLOR4|ILC_MASK,
- "init 2 grow 99 set count 42");
+ check_iml_data(himl, BMP_CX, BMP_CX, 42, 43, 100, ILC_COLOR4|ILC_MASK, "init 2 grow 99 set count 42");
ret = pImageList_Destroy(himl);
ok(ret, "ImageList_Destroy failed\n");
- himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR4|ILC_MASK, 2, 65536+12);
+ himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR4|ILC_MASK, 2, -20);
ok(himl != 0, "ImageList_Create failed\n");
- check_iml_data(himl, BMP_CX, BMP_CX, 0, 3, 12, BMP_CX * 4, BMP_CX, ILC_COLOR4|ILC_MASK,
- "init 2 grow 65536+12");
+ check_iml_data(himl, BMP_CX, BMP_CX, 0, 3, 4, ILC_COLOR4|ILC_MASK, "init 2 grow -20");
ret = pImageList_Destroy(himl);
ok(ret, "ImageList_Destroy failed\n");
- himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR4|ILC_MASK, 2, 65535);
- ok(himl != 0, "ImageList_Create failed\n");
- check_iml_data(himl, BMP_CX, BMP_CX, 0, 3, 0, BMP_CX * 4, BMP_CX, ILC_COLOR4|ILC_MASK,
- "init 2 grow 65535");
- ret = pImageList_Destroy(himl);
- ok(ret, "ImageList_Destroy failed\n");
+ /* Version 6 implementation hangs on large grow values. */
+ if (!is_v6_test())
+ {
+ himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR4|ILC_MASK, 2, 65536+12);
+ ok(himl != 0, "ImageList_Create failed\n");
+ check_iml_data(himl, BMP_CX, BMP_CX, 0, 3, 12, ILC_COLOR4|ILC_MASK, "init 2 grow 65536+12");
+ ret = pImageList_Destroy(himl);
+ ok(ret, "ImageList_Destroy failed\n");
- himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR4|ILC_MASK, 2, -20);
- ok(himl != 0, "ImageList_Create failed\n");
- check_iml_data(himl, BMP_CX, BMP_CX, 0, 3, 4, BMP_CX * 4, BMP_CX, ILC_COLOR4|ILC_MASK,
- "init 2 grow -20");
- ret = pImageList_Destroy(himl);
- ok(ret, "ImageList_Destroy failed\n");
+ himl = pImageList_Create(BMP_CX, BMP_CX, ILC_COLOR4|ILC_MASK, 2, 65535);
+ ok(himl != 0, "ImageList_Create failed\n");
+ check_iml_data(himl, BMP_CX, BMP_CX, 0, 3, 0, ILC_COLOR4|ILC_MASK, "init 2 grow 65535");
+ ret = pImageList_Destroy(himl);
+ ok(ret, "ImageList_Destroy failed\n");
+ }
}
static void test_shell_imagelist(void)
@@ -2390,6 +2426,7 @@ START_TEST(imagelist)
test_imagecount();
test_DrawIndirect();
test_merge();
+ test_imagelist_storage();
test_iconsize();
test_color_table(ILC_COLOR4);
test_color_table(ILC_COLOR8);
--
2.15.1