Nikolay Sivov : comctl32/tests: Add a helper to replace macro.
Alexandre Julliard
julliard at winehq.org
Tue Jan 23 16:09:50 CST 2018
Module: wine
Branch: master
Commit: f09deaca43a0da3a72169940c29cc47d3083f635
URL: https://source.winehq.org/git/wine.git/?a=commit;h=f09deaca43a0da3a72169940c29cc47d3083f635
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Tue Jan 23 14:44:20 2018 +0300
comctl32/tests: Add a helper to replace macro.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/comctl32/tests/imagelist.c | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
diff --git a/dlls/comctl32/tests/imagelist.c b/dlls/comctl32/tests/imagelist.c
index d72e22a..958c82f 100644
--- a/dlls/comctl32/tests/imagelist.c
+++ b/dlls/comctl32/tests/imagelist.c
@@ -1029,12 +1029,22 @@ static void check_iml_data(HIMAGELIST himl, INT cx, INT cy, INT cur, INT max, IN
cleanup_memstream(&stream);
}
-static void image_list_init(HIMAGELIST himl)
+static void image_list_add_bitmap(HIMAGELIST himl, BYTE grey, int i)
{
- HBITMAP hbm;
char comment[16];
- INT n = 1;
- DWORD i;
+ HBITMAP hbm;
+ int ret;
+
+ sprintf(comment, "%d", i);
+ hbm = create_bitmap(BMP_CX, BMP_CX, RGB(grey, grey, grey), comment);
+ ret = pImageList_Add(himl, hbm, NULL);
+ ok(ret != -1, "Failed to add image to imagelist.\n");
+ DeleteObject(hbm);
+}
+
+static void image_list_init(HIMAGELIST himl)
+{
+ unsigned int i;
static const struct test_data
{
BYTE grey;
@@ -1070,18 +1080,11 @@ static void image_list_init(HIMAGELIST himl)
check_iml_data(himl, BMP_CX, BMP_CX, 0, 2, 4, ILC_COLOR24, "total 0");
-#define add_bitmap(grey) \
- sprintf(comment, "%d", n++); \
- hbm = create_bitmap(BMP_CX, BMP_CX, RGB((grey),(grey),(grey)), comment); \
- ImageList_Add(himl, hbm, NULL); \
- DeleteObject(hbm);
-
for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
{
- add_bitmap(td[i].grey);
+ image_list_add_bitmap(himl, td[i].grey, i + 1);
check_iml_data(himl, td[i].cx, td[i].cy, td[i].cur, td[i].max, td[i].grow, td[i].bpp, td[i].comment);
}
-#undef add_bitmap
}
static void test_imagelist_storage(void)
More information about the wine-cvs
mailing list