comctl32: Fixed height of comboboxex32.
Alexander Kochetkov
al.kochet at gmail.com
Sun Feb 6 10:55:11 CST 2011
Fix and test for bug #23267
-------------- next part --------------
From c8a18a49eadc4c1953700207916902707737f5c8 Mon Sep 17 00:00:00 2001
From: Alexander Kochetkov <al.kochet at gmail.com>
Date: Sun, 6 Feb 2011 19:41:30 +0300
Subject: 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();
--
1.7.0.4
More information about the wine-patches
mailing list