Commit b11208e5 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

comctl32/monthcal: Fix MCM_GETMONTHRANGE with regard to multiple calendars and parameter handling.

parent 4a4678ca
...@@ -1330,42 +1330,51 @@ MONTHCAL_SetFirstDayOfWeek(MONTHCAL_INFO *infoPtr, INT day) ...@@ -1330,42 +1330,51 @@ MONTHCAL_SetFirstDayOfWeek(MONTHCAL_INFO *infoPtr, INT day)
static LRESULT static LRESULT
MONTHCAL_GetMonthRange(const MONTHCAL_INFO *infoPtr, DWORD flag, SYSTEMTIME *st) MONTHCAL_GetMonthRange(const MONTHCAL_INFO *infoPtr, DWORD flag, SYSTEMTIME *st)
{ {
INT range;
TRACE("flag=%d, st=%p\n", flag, st); TRACE("flag=%d, st=%p\n", flag, st);
if(st) switch (flag) {
case GMR_VISIBLE:
{ {
switch (flag) { if (st)
case GMR_VISIBLE: {
{ st[0] = infoPtr->calendars[0].month;
st[0] = infoPtr->calendars[0].month; st[1] = infoPtr->calendars[MONTHCAL_GetCalCount(infoPtr)-1].month;
st[1] = infoPtr->calendars[MONTHCAL_GetCalCount(infoPtr)-1].month;
if (st[0].wMonth == min_allowed_date.wMonth && if (st[0].wMonth == min_allowed_date.wMonth &&
st[0].wYear == min_allowed_date.wYear) st[0].wYear == min_allowed_date.wYear)
{ {
st[0].wDay = min_allowed_date.wDay; st[0].wDay = min_allowed_date.wDay;
} }
else else
st[0].wDay = 1; st[0].wDay = 1;
MONTHCAL_CalculateDayOfWeek(&st[0], TRUE); MONTHCAL_CalculateDayOfWeek(&st[0], TRUE);
st[1].wDay = MONTHCAL_MonthLength(st[1].wMonth, st[1].wYear); st[1].wDay = MONTHCAL_MonthLength(st[1].wMonth, st[1].wYear);
MONTHCAL_CalculateDayOfWeek(&st[1], TRUE); MONTHCAL_CalculateDayOfWeek(&st[1], TRUE);
}
return MONTHCAL_GetCalCount(infoPtr); range = MONTHCAL_GetCalCount(infoPtr);
} break;
case GMR_DAYSTATE: }
{ case GMR_DAYSTATE:
MONTHCAL_GetMinDate(infoPtr, &st[0]); {
MONTHCAL_GetMaxDate(infoPtr, &st[1]); if (st)
break; {
} MONTHCAL_GetMinDate(infoPtr, &st[0]);
default: MONTHCAL_GetMaxDate(infoPtr, &st[1]);
WARN("Unknown flag value, got %d\n", flag); }
} /* include two partially visible months */
range = MONTHCAL_GetCalCount(infoPtr) + 2;
break;
}
default:
WARN("Unknown flag value, got %d\n", flag);
range = 0;
} }
return infoPtr->monthRange; return range;
} }
......
...@@ -1317,7 +1317,6 @@ static void test_monthrange(void) ...@@ -1317,7 +1317,6 @@ static void test_monthrange(void)
res = SendMessage(hwnd, MCM_GETMONTHRANGE, GMR_VISIBLE, (LPARAM)st_visible); res = SendMessage(hwnd, MCM_GETMONTHRANGE, GMR_VISIBLE, (LPARAM)st_visible);
expect(2, res); expect(2, res);
expect(2000, st_visible[0].wYear); expect(2000, st_visible[0].wYear);
expect(11, st_visible[0].wMonth); expect(11, st_visible[0].wMonth);
expect(1, st_visible[0].wDay); expect(1, st_visible[0].wDay);
...@@ -1326,9 +1325,7 @@ static void test_monthrange(void) ...@@ -1326,9 +1325,7 @@ static void test_monthrange(void)
expect(31, st_visible[1].wDay); expect(31, st_visible[1].wDay);
res = SendMessage(hwnd, MCM_GETMONTHRANGE, GMR_DAYSTATE, (LPARAM)st_daystate); res = SendMessage(hwnd, MCM_GETMONTHRANGE, GMR_DAYSTATE, (LPARAM)st_daystate);
todo_wine { expect(4, res);
expect(4, res);
}
expect(2000, st_daystate[0].wYear); expect(2000, st_daystate[0].wYear);
expect(10, st_daystate[0].wMonth); expect(10, st_daystate[0].wMonth);
expect(29, st_daystate[0].wDay); expect(29, st_daystate[0].wDay);
...@@ -1338,6 +1335,13 @@ static void test_monthrange(void) ...@@ -1338,6 +1335,13 @@ static void test_monthrange(void)
ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_monthrange_seq, "monthcal monthrange", FALSE); ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_monthrange_seq, "monthcal monthrange", FALSE);
/* with null date array parameter */
res = SendMessage(hwnd, MCM_GETMONTHRANGE, GMR_VISIBLE, 0);
expect(2, res);
res = SendMessage(hwnd, MCM_GETMONTHRANGE, GMR_DAYSTATE, 0);
expect(4, res);
/* resize control to display single Calendar */ /* resize control to display single Calendar */
MoveWindow(hwnd, 0, 0, r.right, r.bottom, FALSE); MoveWindow(hwnd, 0, 0, r.right, r.bottom, FALSE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment