From: Paul Gofman pgofman@codeweavers.com
--- dlls/comctl32/tests/combo.c | 53 +++++++++++++++++++++++++++++++------ 1 file changed, 45 insertions(+), 8 deletions(-)
diff --git a/dlls/comctl32/tests/combo.c b/dlls/comctl32/tests/combo.c index 0ba720a03ce..61516fd4aa9 100644 --- a/dlls/comctl32/tests/combo.c +++ b/dlls/comctl32/tests/combo.c @@ -743,17 +743,20 @@ static void test_combo_setitemheight(DWORD style)
static void test_combo_setfont(DWORD style) { + unsigned int expected_height, initial_height; HFONT hFont1, hFont2; HWND hCombo; RECT r; int i;
+ winetest_push_context("style %#lx", style); hCombo = create_combobox(style); hFont1 = CreateFontA(10, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, SYMBOL_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH|FF_DONTCARE, "Marlett"); hFont2 = CreateFontA(8, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, SYMBOL_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH|FF_DONTCARE, "Marlett");
GetClientRect(hCombo, &r); - expect_rect(r, 0, 0, 100, get_font_height(GetStockObject(SYSTEM_FONT)) + 8); + initial_height = get_font_height(GetStockObject(SYSTEM_FONT)) + 8; + expect_rect(r, 0, 0, 100, initial_height); SendMessageA(hCombo, CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)&r); MapWindowPoints(HWND_DESKTOP, hMainWnd, (LPPOINT)&r, 2); todo_wine expect_rect(r, 5, 5, 105, 105); @@ -766,24 +769,50 @@ static void test_combo_setfont(DWORD style) { SendMessageA(hCombo, WM_SETFONT, (WPARAM)hFont1, FALSE); GetClientRect(hCombo, &r); - expect_rect(r, 0, 0, 100, 18); + expected_height = style & CBS_OWNERDRAWFIXED ? initial_height : 18; + todo_wine_if(style & CBS_OWNERDRAWFIXED) expect_rect(r, 0, 0, 100, expected_height); SendMessageA(hCombo, CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)&r); MapWindowPoints(HWND_DESKTOP, hMainWnd, (LPPOINT)&r, 2); - todo_wine expect_rect(r, 5, 5, 105, 105 - (get_font_height(GetStockObject(SYSTEM_FONT)) - get_font_height(hFont1))); + + if (style & CBS_OWNERDRAWFIXED) + { + todo_wine expect_rect(r, 5, 5, 105, 105); + } + else + { + todo_wine expect_rect(r, 5, 5, 105, 105 - (get_font_height(GetStockObject(SYSTEM_FONT)) - get_font_height(hFont1))); + }
SendMessageA(hCombo, WM_SETFONT, (WPARAM)hFont2, FALSE); GetClientRect(hCombo, &r); - expect_rect(r, 0, 0, 100, 16); + expected_height = style & CBS_OWNERDRAWFIXED ? initial_height : 16; + todo_wine_if(style & CBS_OWNERDRAWFIXED) expect_rect(r, 0, 0, 100, expected_height); SendMessageA(hCombo, CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)&r); MapWindowPoints(HWND_DESKTOP, hMainWnd, (LPPOINT)&r, 2); - todo_wine expect_rect(r, 5, 5, 105, 105 - (get_font_height(GetStockObject(SYSTEM_FONT)) - get_font_height(hFont2))); + + if (style & CBS_OWNERDRAWFIXED) + { + todo_wine expect_rect(r, 5, 5, 105, 105); + } + else + { + todo_wine expect_rect(r, 5, 5, 105, 105 - (get_font_height(GetStockObject(SYSTEM_FONT)) - get_font_height(hFont2))); + }
SendMessageA(hCombo, WM_SETFONT, (WPARAM)hFont1, FALSE); GetClientRect(hCombo, &r); - expect_rect(r, 0, 0, 100, 18); + expected_height = style & CBS_OWNERDRAWFIXED ? initial_height : 18; + todo_wine_if(style & CBS_OWNERDRAWFIXED) expect_rect(r, 0, 0, 100, expected_height); SendMessageA(hCombo, CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)&r); MapWindowPoints(HWND_DESKTOP, hMainWnd, (LPPOINT)&r, 2); - todo_wine expect_rect(r, 5, 5, 105, 105 - (get_font_height(GetStockObject(SYSTEM_FONT)) - get_font_height(hFont1))); + if (style & CBS_OWNERDRAWFIXED) + { + todo_wine expect_rect(r, 5, 5, 105, 105); + } + else + { + todo_wine expect_rect(r, 5, 5, 105, 105 - (get_font_height(GetStockObject(SYSTEM_FONT)) - get_font_height(hFont1))); + } } else { @@ -798,7 +827,13 @@ static void test_combo_setfont(DWORD style)
SendMessageA(hCombo, WM_SETFONT, (WPARAM)hFont, FALSE); GetClientRect(hCombo, &r); - ok((r.bottom - r.top) == (height + 8), "Unexpected client rect height.\n"); + if (style & CBS_OWNERDRAWFIXED) + expected_height = initial_height; + else + expected_height = (height + 8); + todo_wine_if(style & CBS_OWNERDRAWFIXED && initial_height != height + 8) + ok((r.bottom - r.top) == expected_height, "Unexpected client rect height %ld, expected %d.\n", r.bottom - r.top, + expected_height); SendMessageA(hCombo, WM_SETFONT, 0, FALSE); DeleteObject(hFont); } @@ -806,6 +841,7 @@ static void test_combo_setfont(DWORD style) DestroyWindow(hCombo); DeleteObject(hFont1); DeleteObject(hFont2); + winetest_pop_context(); }
static LRESULT (CALLBACK *old_parent_proc)(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); @@ -1691,6 +1727,7 @@ START_TEST(combo) test_combo_WS_VSCROLL(); test_combo_setfont(CBS_DROPDOWN); test_combo_setfont(CBS_DROPDOWNLIST); + test_combo_setfont(CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED); test_combo_setitemheight(CBS_DROPDOWN); test_combo_setitemheight(CBS_DROPDOWNLIST); test_combo_CBN_SELCHANGE();