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

This commit is contained in:
Nikolay Sivov 2011-09-23 14:17:14 +04:00 committed by Alexandre Julliard
parent d6349844e6
commit d3758e02b8
2 changed files with 8 additions and 9 deletions

View file

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

View file

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