Alexander Kochetkov : comctl32: Fixed height of comboboxex32.

Alexandre Julliard julliard at winehq.org
Mon Feb 7 16:06:40 CST 2011


Module: wine
Branch: master
Commit: d668e76461dabd4504fade2efa28874724801b5e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=d668e76461dabd4504fade2efa28874724801b5e

Author: Alexander Kochetkov <al.kochet at gmail.com>
Date:   Sun Feb  6 19:41:30 2011 +0300

comctl32: Fixed height of comboboxex32.

---

 dlls/comctl32/comboex.c       |    2 +-
 dlls/comctl32/tests/comboex.c |   48 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+), 1 deletions(-)

diff --git a/dlls/comctl32/comboex.c b/dlls/comctl32/comboex.c
index e516ea8..10d8b87 100644
--- a/dlls/comctl32/comboex.c
+++ b/dlls/comctl32/comboex.c
@@ -1693,7 +1693,7 @@ static LRESULT COMBOEX_WindowPosChanging (const COMBOEX_INFO *infoPtr, WINDOWPOS
     height =   (cb_wrect.bottom-cb_wrect.top)
 	     + (cbx_wrect.bottom-cbx_wrect.top)
              - (cbx_crect.bottom-cbx_crect.top);
-    if (wp->cy < height) wp->cy = height;
+    wp->cy = height;
     if (infoPtr->hwndEdit) {
 	COMBOEX_AdjustEditPos (infoPtr);
 	InvalidateRect (infoPtr->hwndCombo, 0, TRUE);
diff --git a/dlls/comctl32/tests/comboex.c b/dlls/comctl32/tests/comboex.c
index a747500..ca30482 100644
--- a/dlls/comctl32/tests/comboex.c
+++ b/dlls/comctl32/tests/comboex.c
@@ -380,6 +380,53 @@ static void test_CB_GETLBTEXT(void)
     DestroyWindow(hCombo);
 }
 
+static void test_WM_WINDOWPOSCHANGING(void)
+{
+    HWND hCombo;
+    WINDOWPOS wp;
+    RECT rect;
+    int combo_height;
+    int ret;
+
+    hCombo = createComboEx(WS_BORDER | WS_VISIBLE | WS_CHILD | CBS_DROPDOWN);
+    ok(hCombo != NULL, "createComboEx failed\n");
+    ret = GetWindowRect(hCombo, &rect);
+    ok(ret, "GetWindowRect failed\n");
+    combo_height = rect.bottom - rect.top;
+    ok(combo_height > 0, "wrong combo height\n");
+
+    /* Test height > combo_height */
+    wp.x = rect.left;
+    wp.y = rect.top;
+    wp.cx = (rect.right - rect.left);
+    wp.cy = combo_height * 2;
+    wp.flags = 0;
+    wp.hwnd = hCombo;
+    wp.hwndInsertAfter = NULL;
+
+    ret = SendMessageA(hCombo, WM_WINDOWPOSCHANGING, 0, (LPARAM)&wp);
+    ok(ret == 0, "expected 0, got %x", ret);
+    ok(wp.cy == combo_height,
+            "Expected height %d, got %d\n", combo_height, wp.cy);
+
+    /* Test height < combo_height */
+    wp.x = rect.left;
+    wp.y = rect.top;
+    wp.cx = (rect.right - rect.left);
+    wp.cy = combo_height / 2;
+    wp.flags = 0;
+    wp.hwnd = hCombo;
+    wp.hwndInsertAfter = NULL;
+
+    ret = SendMessageA(hCombo, WM_WINDOWPOSCHANGING, 0, (LPARAM)&wp);
+    ok(ret == 0, "expected 0, got %x", ret);
+    ok(wp.cy == combo_height,
+            "Expected height %d, got %d\n", combo_height, wp.cy);
+
+    ret = DestroyWindow(hCombo);
+    ok(ret, "DestroyWindow failed\n");
+}
+
 static LRESULT CALLBACK ComboExTestWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 {
     switch(msg) {
@@ -528,6 +575,7 @@ START_TEST(comboex)
     test_comboboxex();
     test_WM_LBUTTONDOWN();
     test_CB_GETLBTEXT();
+    test_WM_WINDOWPOSCHANGING();
     test_comboboxex_subclass();
     test_get_set_item();
 




More information about the wine-cvs mailing list