From 83f51d08df8a642e58a55950f758bd5011c4f60e Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Tue, 24 Apr 2007 18:33:59 +0900 Subject: [PATCH] comctl32: Add more image list tests, fix one problem found. --- dlls/comctl32/imagelist.c | 2 +- dlls/comctl32/tests/imagelist.c | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c index a49ac45c1f1..0c23d19d0a7 100644 --- a/dlls/comctl32/imagelist.c +++ b/dlls/comctl32/imagelist.c @@ -2070,7 +2070,7 @@ ImageList_Remove (HIMAGELIST himl, INT i) return TRUE; } - himl->cMaxImage = himl->cInitial + 1; + himl->cMaxImage = himl->cInitial + himl->cGrow - 1; himl->cCurImage = 0; for (nCount = 0; nCount < MAX_OVERLAYIMAGE; nCount++) himl->nOvlIdx[nCount] = -1; diff --git a/dlls/comctl32/tests/imagelist.c b/dlls/comctl32/tests/imagelist.c index 7a3d7ec6e04..8b7cd6a08be 100644 --- a/dlls/comctl32/tests/imagelist.c +++ b/dlls/comctl32/tests/imagelist.c @@ -897,7 +897,15 @@ static void image_list_init(HIMAGELIST himl) static void check_iml_data(HIMAGELIST himl, INT cx, INT cy, INT cur, INT max, INT width, INT height, INT bpp, const char *comment) { - BOOL ret; + INT ret, cxx, cyy; + + ret = ImageList_GetImageCount(himl); + ok(ret == cur, "expected cur %d got %d\n", cur, ret); + + ret = ImageList_GetIconSize(himl, &cxx, &cyy); + ok(ret, "ImageList_GetIconSize failed\n"); + ok(cxx == cx, "wrong cx %d (expected %d)\n", cxx, cx); + ok(cyy == cy, "wrong cy %d (expected %d)\n", cyy, cy); iml_clear_stream_data(); ret = ImageList_Write(himl, &Test_Stream.is); @@ -941,6 +949,18 @@ static void test_imagelist_storage(void) ok(ret, "ImageList_Remove failed\n"); check_iml_data(himl, BMP_CX, BMP_CX, 20, 27, BMP_CX * 4, BMP_CX * 7, 24, "4"); + ret = ImageList_Remove(himl, -2); + ok(!ret, "ImageList_Remove(-2) should fail\n"); + check_iml_data(himl, BMP_CX, BMP_CX, 20, 27, BMP_CX * 4, BMP_CX * 7, 24, "5"); + + ret = ImageList_Remove(himl, 20); + ok(!ret, "ImageList_Remove(20) should fail\n"); + check_iml_data(himl, BMP_CX, BMP_CX, 20, 27, BMP_CX * 4, BMP_CX * 7, 24, "6"); + + ret = ImageList_Remove(himl, -1); + ok(ret, "ImageList_Remove(-1) failed\n"); + check_iml_data(himl, BMP_CX, BMP_CX, 0, 4, BMP_CX * 4, BMP_CX * 1, 24, "7"); + ret = ImageList_Destroy(himl); ok(ret, "ImageList_Destroy failed\n");