[PATCH 0/2] MR7855: comctl32/tests: Add a column width test for LVSCW_AUTOSIZE with a state imagelist.
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> -- https://gitlab.winehq.org/wine/wine/-/merge_requests/7855
From: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> --- dlls/comctl32/tests/listview.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c index a0340dbd5c3..0b52678a496 100644 --- a/dlls/comctl32/tests/listview.c +++ b/dlls/comctl32/tests/listview.c @@ -6973,7 +6973,9 @@ static void test_state_image(void) static void test_LVSCW_AUTOSIZE(void) { - int width, width2; + int r, width, width2; + HIMAGELIST himl; + HBITMAP hbmp; HWND hwnd; BOOL ret; @@ -7009,9 +7011,31 @@ static void test_LVSCW_AUTOSIZE(void) ok(ret, "Failed to set column width.\n"); width = SendMessageA(hwnd, LVM_GETCOLUMNWIDTH, 0, 0); - ok(width > 0, "Unexpected column width %d.\n", width2); + ok(width > 0, "Unexpected column width %d.\n", width); ok(width2 > width, "Expected reduced column width.\n"); + /* With a state imagelist */ + himl = pImageList_Create(48, 48, 0, 4, 4); + ok(!!himl, "Failed to create an imagelist.\n"); + hbmp = CreateBitmap(48, 48, 1, 1, NULL); + ok(!!hbmp, "Failed to create a bitmap.\n"); + r = pImageList_Add(himl, hbmp, 0); + ok(!r, "Unexpected return value %d.\n", r); + r = pImageList_Add(himl, hbmp, 0); + ok(r == 1, "Unexpected return value %d.\n", r); + DeleteObject(hbmp); + + r = SendMessageA(hwnd, LVM_SETIMAGELIST, LVSIL_STATE, (LPARAM)himl); + ok(!r, "Unexpected return value %d.\n", r); + + ret = SendMessageA(hwnd, LVM_SETCOLUMNWIDTH, 0, LVSCW_AUTOSIZE); + ok(ret, "Failed to set column width.\n"); + + width2 = SendMessageA(hwnd, LVM_GETCOLUMNWIDTH, 0, 0); + ok(width2 > 0, "Unexpected column width %d.\n", width2); + todo_wine + ok(width2 > width, "Expected increased column width.\n"); + DestroyWindow(hwnd); } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/7855
From: Nikolay Sivov <nsivov(a)codeweavers.com> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=58072 Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> --- dlls/comctl32/listview.c | 4 ++-- dlls/comctl32/tests/listview.c | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index 54cd452ce81..169aacd01ba 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -8472,8 +8472,8 @@ static BOOL LISTVIEW_SetColumnWidth(LISTVIEW_INFO *infoPtr, INT nColumn, INT cx) if (infoPtr->himlSmall && (nColumn == 0 || (LISTVIEW_GetColumnInfo(infoPtr, nColumn)->fmt & LVCFMT_IMAGE))) max_cx += infoPtr->iconSize.cx; max_cx += TRAILING_LABEL_PADDING; - if (nColumn == 0 && (infoPtr->dwLvExStyle & LVS_EX_CHECKBOXES)) - max_cx += GetSystemMetrics(SM_CXSMICON); + if (nColumn == 0 && infoPtr->himlState) + max_cx += infoPtr->iconStateSize.cx; } /* autosize based on listview items width */ diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c index 0b52678a496..b4748ffe5e2 100644 --- a/dlls/comctl32/tests/listview.c +++ b/dlls/comctl32/tests/listview.c @@ -7033,7 +7033,6 @@ static void test_LVSCW_AUTOSIZE(void) width2 = SendMessageA(hwnd, LVM_GETCOLUMNWIDTH, 0, 0); ok(width2 > 0, "Unexpected column width %d.\n", width2); - todo_wine ok(width2 > width, "Expected increased column width.\n"); DestroyWindow(hwnd); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/7855
This merge request was approved by Zhiyi Zhang. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/7855
participants (3)
-
Nikolay Sivov -
Nikolay Sivov (@nsivov) -
Zhiyi Zhang (@zhiyi)