From: Kun Yang <yangkun@uniontech.com> Logs: test ImageList_CreateImage for a large cInitial and determine the value of cMaxImage. Signed-off-by: Kun Yang <yangkun@uniontech.com> --- dlls/comctl32/tests/imagelist.c | 35 +++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/dlls/comctl32/tests/imagelist.c b/dlls/comctl32/tests/imagelist.c index 68ad0ce7a4c..01dd0481705 100644 --- a/dlls/comctl32/tests/imagelist.c +++ b/dlls/comctl32/tests/imagelist.c @@ -2207,6 +2207,12 @@ static void test_create_destroy(void) INT cx, cy; BOOL rc; INT ret; + HDC hdc; + HBITMAP hbm; + BITMAPINFO bmi; + void *bits; + IMAGEINFO info; + BOOL result; /* list with zero or negative image dimensions */ himl = pImageList_Create(0, 0, ILC_COLOR16, 0, 3); @@ -2263,6 +2269,35 @@ static void test_create_destroy(void) ok(himl == NULL, "got %p\n", himl); himl = pImageList_Create(1, -1, ILC_COLORDDB, 4, 4); ok(himl == NULL, "got %p\n", himl); + + /* Test create large cInitial image count */ + himl = pImageList_Create(32, 32, ILC_COLOR32 | ILC_MASK, 0xc0c0c0, 1); + hdc = CreateCompatibleDC(NULL); + memset(&bmi, 0, sizeof(bmi)); + bmi.bmiHeader.biSize = sizeof(bmi.bmiHeader); + bmi.bmiHeader.biWidth = 32; + bmi.bmiHeader.biHeight = -32; + bmi.bmiHeader.biPlanes = 1; + bmi.bmiHeader.biBitCount = 32; + bmi.bmiHeader.biCompression = BI_RGB; + hbm = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, &bits, NULL, 0); + ret = pImageList_AddMasked(himl, hbm, RGB(0, 0, 0)); + ret = pImageList_GetImageInfo(himl, 0, &info); + ok(ret, "got %d\n", ret); + todo_wine + ok(info.hbmImage != NULL, "got %p\n", info.hbmImage); + ok(info.hbmMask != NULL, "got %p\n", info.hbmMask); + + /* Test cMaxImage = 1 when created by large cInitial image count */ + result = pImageList_Replace(himl, 0, hbm, NULL); + ok(result == TRUE, "failed to replace bitmap 1\n"); + result = pImageList_Replace(himl, 1, hbm, NULL); + todo_wine + ok(result == FALSE, "succesffuly replaced bitmap 2, wrong\n"); + + DeleteDC(hdc); + DeleteObject(hbm); + pImageList_Destroy(himl); } static void check_color_table(const char *name, HDC hdc, HIMAGELIST himl, UINT ilc, -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10059