comctl32: Fix getting of min size of monthcal when changing font.

oldstable
Clinton Stimpson 2008-10-25 10:04:52 -06:00 committed by Alexandre Julliard
parent 51f3e69120
commit 9f1ea3f15b
2 changed files with 31 additions and 0 deletions

View File

@ -1874,6 +1874,8 @@ static LRESULT MONTHCAL_SetFont(MONTHCAL_INFO *infoPtr, HFONT hFont, BOOL redraw
lf.lfWeight = FW_BOLD;
infoPtr->hBoldFont = CreateFontIndirectW(&lf);
MONTHCAL_UpdateSize(infoPtr);
if (redraw)
InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);

View File

@ -1112,6 +1112,34 @@ static void test_monthcal_MaxSelDay(HWND hwnd)
ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_max_sel_day_seq, "monthcal MaxSelDay", FALSE);
}
static void test_monthcal_size(HWND hwnd)
{
int res;
RECT r1, r2;
HFONT hFont1, hFont2;
LOGFONTA logfont;
lstrcpyA(logfont.lfFaceName, "Arial");
memset(&logfont, 0, sizeof(logfont));
logfont.lfHeight = 12;
hFont1 = CreateFontIndirectA(&logfont);
logfont.lfHeight = 24;
hFont2 = CreateFontIndirectA(&logfont);
/* initialize to a font we can compare against */
SendMessage(hwnd, WM_SETFONT, (WPARAM)hFont1, 0);
res = SendMessage(hwnd, MCM_GETMINREQRECT, 0, (LPARAM)&r1);
/* check that setting a larger font results in an larger rect */
SendMessage(hwnd, WM_SETFONT, (WPARAM)hFont2, 0);
res = SendMessage(hwnd, MCM_GETMINREQRECT, 0, (LPARAM)&r2);
OffsetRect(&r1, -r1.left, -r1.top);
OffsetRect(&r2, -r2.left, -r2.top);
ok(r1.bottom < r2.bottom, "Failed to get larger rect with larger font\n");
}
START_TEST(monthcal)
{
@ -1153,6 +1181,7 @@ START_TEST(monthcal)
test_monthcal_monthrange(hwnd);
test_monthcal_HitTest(hwnd);
test_monthcal_todaylink(hwnd);
test_monthcal_size(hwnd);
flush_sequences(sequences, NUM_MSG_SEQUENCES);
DestroyWindow(hwnd);