comctl32/monthcal: Correct MCM_SETTODAY handler return value.

This commit is contained in:
Nikolay Sivov 2011-09-23 13:34:37 +04:00 committed by Alexandre Julliard
parent efbb419621
commit d6349844e6
2 changed files with 29 additions and 8 deletions

View File

@ -1680,12 +1680,13 @@ MONTHCAL_SetToday(MONTHCAL_INFO *infoPtr, const SYSTEMTIME *today)
{ {
TRACE("%p\n", today); TRACE("%p\n", today);
if(!today) return FALSE; if (today)
{
/* remember if date was set successfully */ /* remember if date was set successfully */
if (MONTHCAL_UpdateToday(infoPtr, today)) infoPtr->todaySet = TRUE; if (MONTHCAL_UpdateToday(infoPtr, today)) infoPtr->todaySet = TRUE;
}
return TRUE; return 0;
} }
/* returns calendar index containing specified point, or -1 if it's background */ /* returns calendar index containing specified point, or -1 if it's background */

View File

@ -775,6 +775,23 @@ static void test_currdate(void)
res = SendMessage(hwnd, MCM_SETCURSEL, 0, (LPARAM)&st_new); res = SendMessage(hwnd, MCM_SETCURSEL, 0, (LPARAM)&st_new);
expect(1, res); 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); DestroyWindow(hwnd);
} }
@ -1162,7 +1179,8 @@ static void test_todaylink(void)
st_test.wMonth = 1; st_test.wMonth = 1;
st_test.wYear = 2005; 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)); memset(&st_new, 0, sizeof(st_new));
res = SendMessage(hwnd, MCM_GETTODAY, 0, (LPARAM)&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.wDay = 27;
st_new.wMonth = 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); res = SendMessage(hwnd, MCM_GETTODAY, 0, (LPARAM)&st_new);
expect(1, res); expect(1, res);
@ -1223,7 +1242,8 @@ static void test_today(void)
st_test.wDay = 0; st_test.wDay = 0;
st_test.wMonth = 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); res = SendMessage(hwnd, MCM_GETTODAY, 0, (LPARAM)&st_new);
expect(1, res); expect(1, res);