>From cd86b035be6359c448ff78ed00e99948f93aaa63 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Fri, 23 Sep 2011 13:34:37 +0400 Subject: [PATCH 3/5] Correct MCM_SETTODAY handler return value --- dlls/comctl32/monthcal.c | 11 ++++++----- dlls/comctl32/tests/monthcal.c | 26 +++++++++++++++++++++++--- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/dlls/comctl32/monthcal.c b/dlls/comctl32/monthcal.c index 9e4284c..652bee8 100644 --- a/dlls/comctl32/monthcal.c +++ b/dlls/comctl32/monthcal.c @@ -1680,12 +1680,13 @@ MONTHCAL_SetToday(MONTHCAL_INFO *infoPtr, const SYSTEMTIME *today) { TRACE("%p\n", today); - if(!today) return FALSE; - - /* remember if date was set successfully */ - if(MONTHCAL_UpdateToday(infoPtr, today)) infoPtr->todaySet = TRUE; + if (today) + { + /* remember if date was set successfully */ + if (MONTHCAL_UpdateToday(infoPtr, today)) infoPtr->todaySet = TRUE; + } - return TRUE; + return 0; } /* returns calendar index containing specified point, or -1 if it's background */ diff --git a/dlls/comctl32/tests/monthcal.c b/dlls/comctl32/tests/monthcal.c index f661242..454ea89 100644 --- a/dlls/comctl32/tests/monthcal.c +++ b/dlls/comctl32/tests/monthcal.c @@ -775,6 +775,23 @@ static void test_currdate(void) res = SendMessage(hwnd, MCM_SETCURSEL, 0, (LPARAM)&st_new); expect(1, res); + /* set with invalid day of week */ + memset(&st_test, 0, sizeof(st_test)); + st_test.wYear = 2009; + st_test.wDay = 7; + st_test.wMonth = 10; + st_test.wDayOfWeek = 100; + res = SendMessage(hwnd, MCM_SETCURSEL, 0, (LPARAM)&st_test); + todo_wine 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(10, st_test.wMonth); + todo_wine expect(3, st_test.wDayOfWeek); + DestroyWindow(hwnd); } @@ -1162,7 +1179,8 @@ static void test_todaylink(void) st_test.wMonth = 1; st_test.wYear = 2005; - SendMessage(hwnd, MCM_SETTODAY, 0, (LPARAM)&st_test); + res = SendMessage(hwnd, MCM_SETTODAY, 0, (LPARAM)&st_test); + expect(0, res); memset(&st_new, 0, sizeof(st_new)); res = SendMessage(hwnd, MCM_GETTODAY, 0, (LPARAM)&st_new); @@ -1206,7 +1224,8 @@ static void test_today(void) st_new.wDay = 27; st_new.wMonth = 27; - SendMessage(hwnd, MCM_SETTODAY, 0, (LPARAM)&st_test); + res = SendMessage(hwnd, MCM_SETTODAY, 0, (LPARAM)&st_test); + expect(0, res); res = SendMessage(hwnd, MCM_GETTODAY, 0, (LPARAM)&st_new); expect(1, res); @@ -1223,7 +1242,8 @@ static void test_today(void) st_test.wDay = 0; st_test.wMonth = 0; - SendMessage(hwnd, MCM_SETTODAY, 0, (LPARAM)&st_test); + res = SendMessage(hwnd, MCM_SETTODAY, 0, (LPARAM)&st_test); + expect(0, res); res = SendMessage(hwnd, MCM_GETTODAY, 0, (LPARAM)&st_new); expect(1, res); -- 1.5.6.5