From: Zhiyi Zhang <zzhang@codeweavers.com> --- dlls/comctl32/tests/imagelist.c | 34 +++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/dlls/comctl32/tests/imagelist.c b/dlls/comctl32/tests/imagelist.c index c8a1a25b71d..4c9084bab85 100644 --- a/dlls/comctl32/tests/imagelist.c +++ b/dlls/comctl32/tests/imagelist.c @@ -2466,9 +2466,18 @@ static void test_color_table(UINT ilc) static void test_copy(void) { + /* each line is a 1x1 bitmap */ + static const UINT32 test_bitmaps[] = + { + 0x00654321, + 0x00ABCDEF, + }; HIMAGELIST dst, src; + HBITMAP hbm; + UINT32 bits; BOOL ret; int count; + HDC hdc; dst = pImageList_Create(5, 11, ILC_COLOR, 1, 1); count = pImageList_GetImageCount(dst); @@ -2485,6 +2494,31 @@ static void test_copy(void) pImageList_Destroy(dst); pImageList_Destroy(src); + + /* Test swapping images */ + src = pImageList_Create(1, 1, ILC_COLOR32 | ILC_MASK, 2, 1); + + hdc = CreateCompatibleDC(0); + hbm = create_test_bitmap(hdc, 1, 1, 32, &test_bitmaps[0]); + ret = pImageList_AddMasked(src, hbm, RGB(0xff, 0x00, 0x00)); + ok(ret == 0, "ImageList_AddMasked() returned %d, expected %d.\n", ret, 0); + DeleteObject(hbm); + hbm = create_test_bitmap(hdc, 1, 1, 32, &test_bitmaps[1]); + ret = pImageList_AddMasked(src, hbm, RGB(0xff, 0x00, 0x00)); + ok(ret == 1, "ImageList_AddMasked() returned %d, expected %d.\n", ret, 1); + DeleteObject(hbm); + DeleteDC(hdc); + + ret = pImageList_Copy(src, 0, src, 1, ILCF_SWAP); + ok(ret, "ImageList_Copy() failed.\n"); + + image_list_get_image_bits_by_bitmap(src, 0, &bits); + ok(colour_match(bits, test_bitmaps[1]), "Got unexpected color %08x.\n", bits); + image_list_get_image_bits_by_bitmap(src, 1, &bits); + todo_wine + ok(colour_match(bits, test_bitmaps[0]), "Got unexpected color %08x.\n", bits); + + pImageList_Destroy(src); } static void test_loadimage(void) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10037