comctl32: Don't change month range in MCM_SETRANGE. Add tests for this.

Vitaliy Margolen wine-patch at kievinfo.com
Wed Feb 15 07:57:23 CST 2006


ChangeLog:
comctl32: Don't change month range in MCM_SETRANGE. Add tests for this.

Month range has nothing to do with set date limits. It seems it only depends on
the control size.

 dlls/comctl32/monthcal.c       |   17 +----------------
 dlls/comctl32/tests/monthcal.c |   11 +++++++++--
 2 files changed, 10 insertions(+), 18 deletions(-)
-------------- next part --------------
5be6b3af87ab68876f1b5d1486ddf55946291932
diff --git a/dlls/comctl32/monthcal.c b/dlls/comctl32/monthcal.c
index 1de342f..be9d705 100644
--- a/dlls/comctl32/monthcal.c
+++ b/dlls/comctl32/monthcal.c
@@ -930,17 +930,10 @@ MONTHCAL_GetMaxTodayWidth(MONTHCAL_INFO 
 }
 
 
-/* FIXME: are validated times taken from current date/time or simply
- * copied?
- * FIXME:    check whether MCM_GETMONTHRANGE shows correct result after
- *            adjusting range with MCM_SETRANGE
- */
-
 static LRESULT
 MONTHCAL_SetRange(MONTHCAL_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
     SYSTEMTIME *lprgSysTimeArray=(SYSTEMTIME *)lParam;
-    int prev;
 
     TRACE("%x %lx\n", wParam, lParam);
 
@@ -959,15 +952,7 @@ MONTHCAL_SetRange(MONTHCAL_INFO *infoPtr
         infoPtr->rangeValid |= GDTR_MAX;
     }
 
-  prev = infoPtr->monthRange;
-  infoPtr->monthRange = infoPtr->maxDate.wMonth - infoPtr->minDate.wMonth;
-
-  if(infoPtr->monthRange!=prev) {
-	infoPtr->monthdayState = ReAlloc(infoPtr->monthdayState,
-                                                  infoPtr->monthRange * sizeof(MONTHDAYSTATE));
-  }
-
-  return 1;
+    return TRUE;
 }
 
 
diff --git a/dlls/comctl32/tests/monthcal.c b/dlls/comctl32/tests/monthcal.c
index b04f137..52103f0 100644
--- a/dlls/comctl32/tests/monthcal.c
+++ b/dlls/comctl32/tests/monthcal.c
@@ -33,6 +33,7 @@ void test_monthcal(void)
     HWND hwnd;
     SYSTEMTIME st[2], st1[2];
     INITCOMMONCONTROLSEX ic = {sizeof(INITCOMMONCONTROLSEX), ICC_DATE_CLASSES};
+    int res, month_range;
 
     InitCommonControlsEx(&ic);
     hwnd = CreateWindowA(MONTHCAL_CLASSA, "MonthCal", WS_POPUP | WS_VISIBLE, CW_USEDEFAULT,
@@ -61,19 +62,25 @@ void test_monthcal(void)
     st[0].wMonth = 5;
     st[1] = st[0];
 
+    month_range = SendMessage(hwnd, MCM_GETMONTHRANGE, GMR_VISIBLE, (LPARAM)st1);
     st[1].wMonth--;
     ok(SendMessage(hwnd, MCM_SETRANGE, GDTR_MIN | GDTR_MAX, (LPARAM)st), "Failed to set both min and max limits\n");
+    res = SendMessage(hwnd, MCM_GETMONTHRANGE, GMR_VISIBLE, (LPARAM)st1);
+    ok(res == month_range, "Invalid month range (%d)\n", res);
+
     st[1].wMonth += 2;
     ok(SendMessage(hwnd, MCM_SETRANGE, GDTR_MIN | GDTR_MAX, (LPARAM)st), "Failed to set both min and max limits\n");
+    res = SendMessage(hwnd, MCM_GETMONTHRANGE, GMR_VISIBLE, (LPARAM)st1);
+    ok(res == month_range, "Invalid month range (%d)\n", res);
+
     st[1].wYear --;
     ok(SendMessage(hwnd, MCM_SETRANGE, GDTR_MIN | GDTR_MAX, (LPARAM)st), "Failed to set both min and max limits\n");
     st[1].wYear += 1;
     ok(SendMessage(hwnd, MCM_SETRANGE, GDTR_MIN | GDTR_MAX, (LPARAM)st), "Failed to set both min and max limits\n");
 
-/* This crashing Wine so commented untill fixed.
     st[1].wMonth -= 3;
     ok(SendMessage(hwnd, MCM_SETRANGE, GDTR_MAX, (LPARAM)st), "Failed to set max limit\n");
-*/
+
     st[1].wMonth += 4;
     ok(SendMessage(hwnd, MCM_SETRANGE, GDTR_MAX, (LPARAM)st), "Failed to set max limit\n");
     st[1].wYear -= 3;


More information about the wine-patches mailing list