comctl32: Add more image list tests, fix one problem found.

This commit is contained in:
Dmitry Timoshkov 2007-04-24 18:33:59 +09:00 committed by Alexandre Julliard
parent 4c90bbd6f7
commit 83f51d08df
2 changed files with 22 additions and 2 deletions

View File

@ -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;

View File

@ -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");