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

comctl32/monthcal: Properly adjust day of week in MCM_SETCURSEL.

parent d6349844
......@@ -247,9 +247,7 @@ static inline BOOL MONTHCAL_IsDateEqual(const SYSTEMTIME *first, const SYSTEMTIM
static BOOL MONTHCAL_ValidateDate(const SYSTEMTIME *time)
{
if(time->wMonth < 1 || time->wMonth > 12 ) return FALSE;
if(time->wDayOfWeek > 6) return FALSE;
if(time->wDay > MONTHCAL_MonthLength(time->wMonth, time->wYear))
return FALSE;
if(time->wDay > MONTHCAL_MonthLength(time->wMonth, time->wYear)) return FALSE;
return TRUE;
}
......@@ -1481,7 +1479,7 @@ MONTHCAL_GetCurSel(const MONTHCAL_INFO *infoPtr, SYSTEMTIME *curSel)
static LRESULT
MONTHCAL_SetCurSel(MONTHCAL_INFO *infoPtr, SYSTEMTIME *curSel)
{
SYSTEMTIME prev = infoPtr->minSel;
SYSTEMTIME prev = infoPtr->minSel, selection;
INT diff;
WORD day;
......@@ -1511,8 +1509,9 @@ MONTHCAL_SetCurSel(MONTHCAL_INFO *infoPtr, SYSTEMTIME *curSel)
MONTHCAL_GetMonth(&infoPtr->calendars[i].month, diff);
}
infoPtr->minSel = *curSel;
infoPtr->maxSel = *curSel;
selection = *curSel;
MONTHCAL_CalculateDayOfWeek(&selection, TRUE);
infoPtr->minSel = infoPtr->maxSel = selection;
/* if selection is still in current month, reduce rectangle */
day = prev.wDay;
......
......@@ -782,15 +782,15 @@ static void test_currdate(void)
st_test.wMonth = 10;
st_test.wDayOfWeek = 100;
res = SendMessage(hwnd, MCM_SETCURSEL, 0, (LPARAM)&st_test);
todo_wine expect(1, res);
expect(1, res);
memset(&st_test, 0, sizeof(st_test));
res = SendMessage(hwnd, MCM_GETCURSEL, 0, (LPARAM)&st_test);
expect(1, res);
expect(2009, st_test.wYear);
todo_wine expect(7, st_test.wDay);
expect(7, st_test.wDay);
expect(10, st_test.wMonth);
todo_wine expect(3, st_test.wDayOfWeek);
expect(3, st_test.wDayOfWeek);
DestroyWindow(hwnd);
}
......
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