Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/comctl32/tests/listview.c | 48 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+)
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c index c6e31275c1..0506eaa147 100644 --- a/dlls/comctl32/tests/listview.c +++ b/dlls/comctl32/tests/listview.c @@ -6270,6 +6270,52 @@ static void test_state_image(void) } }
+static void test_LVSCW_AUTOSIZE(void) +{ + int width, width2; + HWND hwnd; + BOOL ret; + + hwnd = create_listview_control(LVS_REPORT); + ok(hwnd != NULL, "failed to create a listview window\n"); + + insert_column(hwnd, 0); + insert_column(hwnd, 1); + insert_item(hwnd, 0); + + ret = SendMessageA(hwnd, LVM_SETCOLUMNWIDTH, 0, LVSCW_AUTOSIZE); + ok(ret, "Failed to set column width.\n"); + + width = SendMessageA(hwnd, LVM_GETCOLUMNWIDTH, 0, 0); + ok(width > 0, "Unexpected column width %d.\n", width); + + /* Turn on checkboxes. */ + ret = SendMessageA(hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_CHECKBOXES, LVS_EX_CHECKBOXES); + ok(ret == 0, "Unexpected previous extended style.\n"); + + 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"); + + /* Turn off checkboxes. */ + ret = SendMessageA(hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_CHECKBOXES, 0); + ok(ret == LVS_EX_CHECKBOXES, "Unexpected previous extended style.\n"); + + ret = SendMessageA(hwnd, LVM_SETCOLUMNWIDTH, 0, LVSCW_AUTOSIZE); + ok(ret, "Failed to set column width.\n"); + + width = SendMessageA(hwnd, LVM_GETCOLUMNWIDTH, 0, 0); + ok(width > 0, "Unexpected column width %d.\n", width2); +todo_wine + ok(width2 > width, "Expected reduced column width.\n"); + + DestroyWindow(hwnd); +} + START_TEST(listview) { ULONG_PTR ctx_cookie; @@ -6330,6 +6376,7 @@ START_TEST(listview) test_oneclickactivate(); test_callback_mask(); test_state_image(); + test_LVSCW_AUTOSIZE();
if (!load_v6_module(&ctx_cookie, &hCtx)) { @@ -6371,6 +6418,7 @@ START_TEST(listview) test_LVM_REDRAWITEMS(); test_oneclickactivate(); test_state_image(); + test_LVSCW_AUTOSIZE();
unload_v6_module(ctx_cookie, hCtx);
From: Mark Jansen mark.jansen@reactos.org
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/comctl32/listview.c | 2 ++ dlls/comctl32/tests/listview.c | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index c085578062..0d7f7ec015 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -8406,6 +8406,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); }
/* autosize based on listview items width */ diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c index 0506eaa147..c9a165c39c 100644 --- a/dlls/comctl32/tests/listview.c +++ b/dlls/comctl32/tests/listview.c @@ -6298,7 +6298,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");
/* Turn off checkboxes. */ @@ -6310,7 +6309,6 @@ todo_wine
width = SendMessageA(hwnd, LVM_GETCOLUMNWIDTH, 0, 0); ok(width > 0, "Unexpected column width %d.\n", width2); -todo_wine ok(width2 > width, "Expected reduced column width.\n");
DestroyWindow(hwnd);