From d3758e02b84d33a058a942f2799a203e0a127ae4 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Fri, 23 Sep 2011 14:17:14 +0400 Subject: [PATCH] comctl32/monthcal: Properly adjust day of week in MCM_SETCURSEL. --- dlls/comctl32/monthcal.c | 11 +++++------ dlls/comctl32/tests/monthcal.c | 6 +++--- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/dlls/comctl32/monthcal.c b/dlls/comctl32/monthcal.c index 652bee8d57d..d230f34ed5b 100644 --- a/dlls/comctl32/monthcal.c +++ b/dlls/comctl32/monthcal.c @@ -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; diff --git a/dlls/comctl32/tests/monthcal.c b/dlls/comctl32/tests/monthcal.c index 454ea89bf40..2686fb70a14 100644 --- a/dlls/comctl32/tests/monthcal.c +++ b/dlls/comctl32/tests/monthcal.c @@ -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); } -- 2.11.4.GIT