Commit 86ea6b58 authored by Farshad Agah's avatar Farshad Agah Committed by Alexandre Julliard

comctl32: monthcal: Correct the return value in MCM_SETFIRSTDAYOFWEEK.

parent 9d69d533
...@@ -897,19 +897,23 @@ static LRESULT ...@@ -897,19 +897,23 @@ static LRESULT
MONTHCAL_SetFirstDayOfWeek(MONTHCAL_INFO *infoPtr, LPARAM lParam) MONTHCAL_SetFirstDayOfWeek(MONTHCAL_INFO *infoPtr, LPARAM lParam)
{ {
int prev = infoPtr->firstDay; int prev = infoPtr->firstDay;
int localFirstDay;
WCHAR buf[40]; WCHAR buf[40];
TRACE("day %ld\n", lParam); TRACE("day %ld\n", lParam);
if((lParam >= 0) && (lParam < 7)) { GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_IFIRSTDAYOFWEEK, buf, countof(buf));
infoPtr->firstDay = (int)lParam; TRACE("%s %d\n", debugstr_w(buf), strlenW(buf));
}
localFirstDay = atoiW(buf);
if(lParam == -1)
infoPtr->firstDay = MAKELONG(localFirstDay, FALSE);
else if(lParam >= 7)
infoPtr->firstDay = MAKELONG(localFirstDay, TRUE);
else else
{ infoPtr->firstDay = MAKELONG(lParam, TRUE);
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_IFIRSTDAYOFWEEK, buf, countof(buf));
TRACE("%s %d\n", debugstr_w(buf), strlenW(buf));
infoPtr->firstDay = (atoiW(buf)+1)%7;
}
return prev; return prev;
} }
......
...@@ -135,26 +135,56 @@ static const struct message monthcal_curr_date_seq[] = { ...@@ -135,26 +135,56 @@ static const struct message monthcal_curr_date_seq[] = {
static const struct message monthcal_first_day_seq[] = { static const struct message monthcal_first_day_seq[] = {
{ MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0}, { MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
{ MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
{ MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, -5},
{ MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0}, { MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
{ MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 1},
{ MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, -4},
{ MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0}, { MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
{ MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 2},
{ MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, -3},
{ MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0}, { MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
{ MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 3},
{ MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, -2},
{ MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0}, { MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
{ MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 4},
{ MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, -1},
{ MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
{ MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
{ MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
{ MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 1},
{ MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
{ MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 2},
{ MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0}, { MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
{ MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 5},
{ MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 3},
{ MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0}, { MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
{ MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 4},
{ MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
{ MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 5},
{ MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
{ MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 6}, { MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 6},
{ MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
{ MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 7},
{ MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
{ MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 8},
{ MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
{ MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 9},
{ MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
{ MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 10},
{ MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
{ MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 11},
{ MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0}, { MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
{ 0 } { 0 }
}; };
...@@ -583,40 +613,43 @@ static void test_monthcal_currDate(HWND hwnd) ...@@ -583,40 +613,43 @@ static void test_monthcal_currDate(HWND hwnd)
static void test_monthcal_firstDay(HWND hwnd) static void test_monthcal_firstDay(HWND hwnd)
{ {
int res, fday, i, temp; int res, fday, i, prev;
TCHAR b[128]; TCHAR b[128];
LCID lcid = LOCALE_USER_DEFAULT; LCID lcid = LOCALE_USER_DEFAULT;
flush_sequences(sequences, NUM_MSG_SEQUENCES); flush_sequences(sequences, NUM_MSG_SEQUENCES);
/* Setter and Getters for first day of week */ /* Setter and Getters for first day of week */
todo_wine { /* check for locale first day */
/* check for locale first day */ if(GetLocaleInfo(lcid, LOCALE_IFIRSTDAYOFWEEK, b, 128)){
if(GetLocaleInfo(lcid, LOCALE_IFIRSTDAYOFWEEK, b, 128)){ fday = atoi(b);
fday = atoi(b); res = SendMessage(hwnd, MCM_GETFIRSTDAYOFWEEK, 0, 0);
res = SendMessage(hwnd, MCM_GETFIRSTDAYOFWEEK, 0, 0); expect(fday, res);
expect(fday, res); prev = fday;
res = SendMessage(hwnd, MCM_SETFIRSTDAYOFWEEK, 0, (LPARAM) 0);
expect(fday, res);
}else{
skip("Cannot retrieve first day of the week\n");
SendMessage(hwnd, MCM_SETFIRSTDAYOFWEEK, 0, (LPARAM) 0);
}
/* check for days of the week*/ /* checking for the values that actually will be stored as */
for (i = 1, temp = 0x10000; i < 7; i++, temp++){ /* current first day when we set a new value */
res = SendMessage(hwnd, MCM_GETFIRSTDAYOFWEEK, 0, 0); for (i = -5; i < 12; i++){
expect(temp, res);
res = SendMessage(hwnd, MCM_SETFIRSTDAYOFWEEK, 0, (LPARAM) i); res = SendMessage(hwnd, MCM_SETFIRSTDAYOFWEEK, 0, (LPARAM) i);
expect(temp, res); expect(prev, res);
res = SendMessage(hwnd, MCM_GETFIRSTDAYOFWEEK, 0, 0);
prev = res;
if (i == -1){
expect(MAKELONG(fday, FALSE), res);
}else if (i >= 7){
expect(MAKELONG(fday, TRUE), res);
}else{
expect(MAKELONG(i, TRUE), res);
}
} }
/* check for returning to the original first day */ ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_first_day_seq, "monthcal firstDay", FALSE);
res = SendMessage(hwnd, MCM_GETFIRSTDAYOFWEEK, 0, 0);
todo_wine {expect(temp, res);} }else{
skip("Cannot retrieve first day of the week\n");
} }
ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_first_day_seq, "monthcal firstDay", FALSE);
} }
static void test_monthcal_unicode(HWND hwnd) static void test_monthcal_unicode(HWND 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