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

Alexandre Julliard julliard at winehq.org
Mon Oct 27 08:03:20 CDT 2008


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

Author: Clinton Stimpson <cjstimpson at utwire.net>
Date:   Sat Oct 25 10:04:52 2008 -0600

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

---

 dlls/comctl32/monthcal.c       |    2 ++
 dlls/comctl32/tests/monthcal.c |   29 +++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/dlls/comctl32/monthcal.c b/dlls/comctl32/monthcal.c
index 6f9da81..e3e4d2a 100644
--- a/dlls/comctl32/monthcal.c
+++ b/dlls/comctl32/monthcal.c
@@ -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);
 
diff --git a/dlls/comctl32/tests/monthcal.c b/dlls/comctl32/tests/monthcal.c
index 6f2ae70..8aade81 100644
--- a/dlls/comctl32/tests/monthcal.c
+++ b/dlls/comctl32/tests/monthcal.c
@@ -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);




More information about the wine-cvs mailing list