Module: wine Branch: master Commit: 89f537dd57bf98a24a6c80ac6c436927b1ac4da4 URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=89f537dd57bf98a24a6c80ac...
Author: Mikołaj Zalewski mikolaj@zalewski.pl Date: Wed Sep 20 17:42:29 2006 +0200
comctl32: imagelist: SetImageCount can be used to decrease image count (with testcase).
---
dlls/comctl32/imagelist.c | 5 +++-- dlls/comctl32/tests/imagelist.c | 8 ++++++++ 2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c index cc3078e..faf5371 100644 --- a/dlls/comctl32/imagelist.c +++ b/dlls/comctl32/imagelist.c @@ -2546,11 +2546,12 @@ ImageList_SetImageCount (HIMAGELIST himl
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; }
diff --git a/dlls/comctl32/tests/imagelist.c b/dlls/comctl32/tests/imagelist.c index 0ecb03a..6278adc 100644 --- a/dlls/comctl32/tests/imagelist.c +++ b/dlls/comctl32/tests/imagelist.c @@ -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");