[PATCH] comctl32/tests: Fix combobox height after SetItemHeight, SetWindowPos.

Nikolay Sivov nsivov at codeweavers.com
Sun Nov 24 14:44:00 CST 2019


Hi, thanks for the patch. Some comments below.

> +    HWND hCombo;
> +    HFONT hFont;
> +    int height;
> +
> +    /* This test requires the WC_COMBOBOXA style.  It won't work for WC_COMBOBOXEXA */
> +    hCombo = CreateWindowExA(0, WC_COMBOBOXA, NULL, WS_BORDER | WS_VISIBLE | WS_CHILD | CBS_DROPDOWN, 0, 0, 300, 300,
> +                                hComboExParentWnd, NULL, hMainHinst, NULL);
> +
> +    /* Add items to the combobox */
> +    SendMessageA(hCombo, (UINT)CB_ADDSTRING, (WPARAM)0, (LPARAM)"Item 0");
> +    SendMessageA(hCombo, (UINT)CB_ADDSTRING, (WPARAM)0, (LPARAM)"Item 1");
> +    SendMessageA(hCombo, (UINT)CB_ADDSTRING, (WPARAM)0, (LPARAM)"Item 2");
> +    SendMessageA(hCombo, (UINT)CB_ADDSTRING, (WPARAM)0, (LPARAM)"Item 3");
> +    SendMessageA(hCombo, CB_SETCURSEL, 1, 0);
I don't think this is necessary. You don't need any string to trigger 
this feature.
> +
> +    /* Create large enough font for test to work. */
> +    hFont = CreateFontA(17, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_DEFAULT_PRECIS,
> +                        CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH|FF_DONTCARE, "Marlett");
> +    SendMessageA(hCombo, WM_SETFONT, (WPARAM)hFont, FALSE);
> +
> +    /* Set Item Height followed by SetWindowPos() is the test */
> +    SendMessageA(hCombo, CB_SETITEMHEIGHT, -1, 4);
> +
> +    /* SetWindowPos() should set the height according to font size*/
> +    SetWindowPos(hCombo,NULL, 10,10,150,20, SWP_SHOWWINDOW);
> +    height = SendMessageA(hCombo, CB_GETITEMHEIGHT, -1, 0);
> +    ok(height > 6, "SetWindowPos() failed. Height (%d)\n", height);
You don't need special font either I think. The point is to set item 
height smaller than its natural default, and then trigger window size 
update. So you could set height to a half of current item height to the 
same effect I believe.
> +
> +    /* Cleanup */
> +    DestroyWindow(hCombo);
> +    DeleteObject(hFont);
P.S. subject line is inaccurate because patch does not fix anything. 
Same test would apply to user32 implementation too.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20191124/8b73d190/attachment.htm>


More information about the wine-devel mailing list