Commit 89f537dd authored by Mikołaj Zalewski's avatar Mikołaj Zalewski Committed by Alexandre Julliard

comctl32: imagelist: SetImageCount can be used to decrease image count (with testcase).

parent 80664def
......@@ -2546,11 +2546,12 @@ ImageList_SetImageCount (HIMAGELIST himl, UINT iImageCount)
if (!is_valid(himl))
return FALSE;
if (himl->cCurImage >= iImageCount)
return FALSE;
if (iImageCount < 0)
return FALSE;
if (himl->cMaxImage > iImageCount)
{
himl->cCurImage = iImageCount;
/* TODO: shrink the bitmap when cMaxImage-cCurImage>cGrow ? */
return TRUE;
}
......
......@@ -327,6 +327,14 @@ static BOOL DoTest1(void)
/* remove one extra */
ok(!ImageList_Remove(himl,0),"removed nonexistent icon\n");
/* check SetImageCount/GetImageCount */
ok(ImageList_SetImageCount(himl, 3), "couldn't increase image count\n");
ok(ImageList_GetImageCount(himl) == 3, "invalid image count after increase\n");
ok(ImageList_SetImageCount(himl, 1), "couldn't decrease image count\n");
ok(ImageList_GetImageCount(himl) == 1, "invalid image count after decrease to 1\n");
ok(ImageList_SetImageCount(himl, 0), "couldn't decrease image count\n");
ok(ImageList_GetImageCount(himl) == 0, "invalid image count after decrease to 0\n");
/* destroy it */
ok(ImageList_Destroy(himl),"destroy imagelist failed\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment