user32: combo: CB_SETITEMHEIGHT should make the edit area 2px higher than the item (with testcase)

Mikolaj Zalewski mikolajz at google.com
Thu Aug 30 13:47:49 CDT 2007


A small difference between Wine and Windows.
-------------- next part --------------
From ca30ad5ea9c672ab71906bc917defad342d9853f Mon Sep 17 00:00:00 2001
From: Mikolaj Zalewski <mikolaj at zalewski.pl>
Date: Thu, 30 Aug 2007 11:45:51 -0700
Subject: [PATCH] user32: combo: CB_SETITEMHEIGHT should make the edit area 2px higher than the item (with testcase)
---
 dlls/user32/combo.c       |    2 +-
 dlls/user32/tests/combo.c |   25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/dlls/user32/combo.c b/dlls/user32/combo.c
index 084e612..1e801a3 100644
--- a/dlls/user32/combo.c
+++ b/dlls/user32/combo.c
@@ -1640,7 +1640,7 @@ static LRESULT COMBO_SetItemHeight( LPHE
    {
        if( height < 32768 )
        {
-           lphc->editHeight = height;
+           lphc->editHeight = height + 2;  /* Is the 2 for 2*EDIT_CONTROL_PADDING? */
 
 	 /*
 	  * Redo the layout of the control.
diff --git a/dlls/user32/tests/combo.c b/dlls/user32/tests/combo.c
index 642c49d..f7cb467 100644
--- a/dlls/user32/tests/combo.c
+++ b/dlls/user32/tests/combo.c
@@ -69,6 +69,29 @@ static int is_font_installed(const char 
     return ret;
 }
 
+static void test_setitemheight(DWORD style)
+{
+    HWND hCombo = build_combo(style);
+    RECT r;
+    int i;
+
+    trace("Style %x\n", style);
+    GetClientRect(hCombo, &r);
+    expect_rect(r, 0, 0, 100, 24);
+    SendMessageA(hCombo, CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)&r);
+    MapWindowPoints(HWND_DESKTOP, hMainWnd, (LPPOINT)&r, 2);
+    todo_wine expect_rect(r, 5, 5, 105, 105);
+
+    for (i = 1; i < 30; i++)
+    {
+        SendMessage(hCombo, CB_SETITEMHEIGHT, -1, i);
+        GetClientRect(hCombo, &r);
+        expect_eq(r.bottom - r.top, i + 6, int, "%d");
+    }
+
+    DestroyWindow(hCombo);
+}
+
 static void test_setfont(DWORD style)
 {
     HWND hCombo = build_combo(style);
@@ -224,6 +247,8 @@ START_TEST(combo)
 
     test_setfont(CBS_DROPDOWN);
     test_setfont(CBS_DROPDOWNLIST);
+    test_setitemheight(CBS_DROPDOWN);
+    test_setitemheight(CBS_DROPDOWNLIST);
     test_CBN_SELCHANGE();
 
     DestroyWindow(hMainWnd);
-- 
1.4.1


More information about the wine-patches mailing list