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

Alexandre Julliard julliard at wine.codeweavers.com
Tue Apr 24 07:23:59 CDT 2007


Module: wine
Branch: master
Commit: 83f51d08df8a642e58a55950f758bd5011c4f60e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=83f51d08df8a642e58a55950f758bd5011c4f60e

Author: Dmitry Timoshkov <dmitry at codeweavers.com>
Date:   Tue Apr 24 18:33:59 2007 +0900

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 a49ac45..0c23d19 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 7a3d7ec..8b7cd6a 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");
 




More information about the wine-cvs mailing list