user32: In COMBO_WindowPosChanging() do not change the height of the the dropped rectangle, if the new height is too small.

This commit is contained in:
Rein Klazes 2009-04-03 07:49:34 +02:00 committed by Alexandre Julliard
parent d7439c0b75
commit 8ac8957a36
2 changed files with 47 additions and 3 deletions

View File

@ -482,20 +482,20 @@ static LRESULT COMBO_WindowPosChanging(
/*
* Resizing a combobox has another side effect, it resizes the dropped
* rectangle as well. However, it does it only if the new height for the
* combobox is different from the height it should have. In other words,
* combobox is more than the height it should have. In other words,
* if the application resizing the combobox only had the intention to resize
* the actual control, for example, to do the layout of a dialog that is
* resized, the height of the dropdown is not changed.
*/
if (posChanging->cy != newComboHeight)
if (posChanging->cy > newComboHeight)
{
TRACE("posChanging->cy=%d, newComboHeight=%d, oldbot=%d, oldtop=%d\n",
posChanging->cy, newComboHeight, lphc->droppedRect.bottom,
lphc->droppedRect.top);
lphc->droppedRect.bottom = lphc->droppedRect.top + posChanging->cy - newComboHeight;
posChanging->cy = newComboHeight;
}
posChanging->cy = newComboHeight;
}
return 0;

View File

@ -355,6 +355,48 @@ static void test_WM_LBUTTONDOWN(void)
DestroyWindow(hCombo);
}
static void test_changesize( DWORD style)
{
HWND hCombo = build_combo(style);
RECT rc;
INT ddheight, clheight, ddwidth, clwidth;
/* get initial measurements */
GetClientRect( hCombo, &rc);
clheight = rc.bottom - rc.top;
clwidth = rc.right - rc.left;
SendMessageA(hCombo, CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)&rc);
ddheight = rc.bottom - rc.top;
ddwidth = rc.right - rc.left;
/* use MoveWindow to move & resize the combo */
/* first make it slightly smaller */
MoveWindow( hCombo, 10, 10, clwidth - 2, clheight - 2, TRUE);
GetClientRect( hCombo, &rc);
ok( rc.right - rc.left == clwidth - 2, "clientrect witdh is %d vs %d\n",
rc.right - rc.left, clwidth - 2);
ok( rc.bottom - rc.top == clheight, "clientrect height is %d vs %d\n",
rc.bottom - rc.top, clheight);
SendMessageA(hCombo, CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)&rc);
ok( rc.right - rc.left == clwidth - 2, "drop-down rect witdh is %d vs %d\n",
rc.right - rc.left, clwidth - 2);
ok( rc.bottom - rc.top == ddheight, "drop-down rect height is %d vs %d\n",
rc.bottom - rc.top, ddheight);
/* new cx, cy is slightly bigger then the initial values */
MoveWindow( hCombo, 10, 10, clwidth + 2, clheight + 2, TRUE);
GetClientRect( hCombo, &rc);
ok( rc.right - rc.left == clwidth + 2, "clientrect witdh is %d vs %d\n",
rc.right - rc.left, clwidth + 2);
ok( rc.bottom - rc.top == clheight, "clientrect height is %d vs %d\n",
rc.bottom - rc.top, clheight);
SendMessageA(hCombo, CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)&rc);
ok( rc.right - rc.left == clwidth + 2, "drop-down rect witdh is %d vs %d\n",
rc.right - rc.left, clwidth + 2);
todo_wine {
ok( rc.bottom - rc.top == clheight + 2, "drop-down rect height is %d vs %d\n",
rc.bottom - rc.top, clheight + 2);
}
DestroyWindow(hCombo);
}
START_TEST(combo)
{
hMainWnd = CreateWindow("static", "Test", WS_OVERLAPPEDWINDOW, 10, 10, 300, 300, NULL, NULL, NULL, 0);
@ -366,6 +408,8 @@ START_TEST(combo)
test_setitemheight(CBS_DROPDOWNLIST);
test_CBN_SELCHANGE();
test_WM_LBUTTONDOWN();
test_changesize(CBS_DROPDOWN);
test_changesize(CBS_DROPDOWNLIST);
DestroyWindow(hMainWnd);
}