When the combobox height is to be set by the application (as the CBS_NOINTEGRALHEIGHT style is on), and when a large size is specified but only a small number of items in the list, the height of the combobox should be set by the number of items rather than the size specified to avoid empty lines.
The first commit fixes this and the second is a test for this behavior.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57360
Closes #7
-- v2: comctl32: Make CBS_NOINTEGRALHEIGHT only set minimum combobox height. comctl32/tests: Add tests for a small number of items but big size to the combobox dropdown size tests.
From: Orin Varley ovarley@codeweavers.com
To catch bugs like the one below.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57360 --- dlls/comctl32/tests/combo.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/dlls/comctl32/tests/combo.c b/dlls/comctl32/tests/combo.c index 1040b863b13..e7c122920be 100644 --- a/dlls/comctl32/tests/combo.c +++ b/dlls/comctl32/tests/combo.c @@ -1277,6 +1277,8 @@ static void test_combo_dropdown_size(DWORD style) {33, 50, -1}, {35, 100, 40}, {15, 50, 3}, + {1, 650, 40}, + {7, 650, 3}, };
for (test = 0; test < ARRAY_SIZE(info_height); test++) @@ -1346,10 +1348,12 @@ static void test_combo_dropdown_size(DWORD style) - list_height_nonclient /* Subtract list nonclient area */ - edit_padding_size * 2; /* subtract space around the edit control */
+ expected_height_list = min(list_height_calculated, height_item * info_test->num_items); if (expected_height_list < 0) expected_height_list = 0;
+ todo_wine_if(height_item * info_test->num_items < list_height_calculated) ok(expected_height_list == height_list, "expected list height to be %d, got %d\n", expected_height_list, height_list); }
From: Orin Varley ovarley@codeweavers.com
When the combobox height is to be set by the application (as the CBS_NOINTEGRALHEIGHT style is on), and when a large size is specified but only a small number of items in the list, the height of the combobox should be set by the number of items rather than the size specified to avoid empty lines.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57360 --- dlls/comctl32/combo.c | 2 +- dlls/comctl32/tests/combo.c | 1 - 2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/dlls/comctl32/combo.c b/dlls/comctl32/combo.c index cb0e9745b2a..09579952f22 100644 --- a/dlls/comctl32/combo.c +++ b/dlls/comctl32/combo.c @@ -971,7 +971,7 @@ static void CBDropDown( LPHEADCOMBO lphc )
if (lphc->dwStyle & CBS_NOINTEGRALHEIGHT) { - nDroppedHeight -= 1; + nDroppedHeight = min(nItems * nIHeight + COMBO_YBORDERSIZE(), nDroppedHeight - 1); } else { diff --git a/dlls/comctl32/tests/combo.c b/dlls/comctl32/tests/combo.c index e7c122920be..432591a10d1 100644 --- a/dlls/comctl32/tests/combo.c +++ b/dlls/comctl32/tests/combo.c @@ -1353,7 +1353,6 @@ static void test_combo_dropdown_size(DWORD style) if (expected_height_list < 0) expected_height_list = 0;
- todo_wine_if(height_item * info_test->num_items < list_height_calculated) ok(expected_height_list == height_list, "expected list height to be %d, got %d\n", expected_height_list, height_list); }