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

This commit is contained in:
Vitaliy Margolen 2006-02-16 12:19:09 +01:00 committed by Alexandre Julliard
parent 89529f8a8e
commit f273bdc0b5
2 changed files with 10 additions and 18 deletions

View File

@ -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;
}

View File

@ -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;