From f273bdc0b53f1e872e88e967158b0fa87eb35f4a Mon Sep 17 00:00:00 2001 From: Vitaliy Margolen Date: Thu, 16 Feb 2006 12:19:09 +0100 Subject: [PATCH] comctl32: Don't change month range in MCM_SETRANGE. Add tests for this. --- dlls/comctl32/monthcal.c | 17 +---------------- dlls/comctl32/tests/monthcal.c | 11 +++++++++-- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/dlls/comctl32/monthcal.c b/dlls/comctl32/monthcal.c index 1de342f051f..be9d7056f00 100644 --- a/dlls/comctl32/monthcal.c +++ b/dlls/comctl32/monthcal.c @@ -930,17 +930,10 @@ MONTHCAL_GetMaxTodayWidth(MONTHCAL_INFO *infoPtr) } -/* 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, WPARAM wParam, LPARAM lParam) 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 b04f137a78c..52103f03fec 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;