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