comctl32: datetime: Support literals in apostrophes.
This commit is contained in:
parent
a871830dd3
commit
41025d56e3
|
@ -133,8 +133,8 @@ extern int MONTHCAL_MonthLength(int month, int year);
|
|||
static BOOL DATETIME_SendSimpleNotify (const DATETIME_INFO *infoPtr, UINT code);
|
||||
static BOOL DATETIME_SendDateTimeChangeNotify (const DATETIME_INFO *infoPtr);
|
||||
extern void MONTHCAL_CopyTime(const SYSTEMTIME *from, SYSTEMTIME *to);
|
||||
static const WCHAR allowedformatchars[] = {'d', 'h', 'H', 'm', 'M', 's', 't', 'y', 'X', '\'', 0};
|
||||
static const int maxrepetition [] = {4,2,2,2,4,2,2,4,-1,-1};
|
||||
static const WCHAR allowedformatchars[] = {'d', 'h', 'H', 'm', 'M', 's', 't', 'y', 'X', 0};
|
||||
static const int maxrepetition [] = {4,2,2,2,4,2,2,4,-1};
|
||||
|
||||
|
||||
static DWORD
|
||||
|
@ -205,6 +205,7 @@ DATETIME_UseFormat (DATETIME_INFO *infoPtr, LPCWSTR formattxt)
|
|||
{
|
||||
unsigned int i;
|
||||
int j, k, len;
|
||||
BOOL inside_literal = FALSE; /* inside '...' */
|
||||
int *nrFields = &infoPtr->nrFields;
|
||||
|
||||
*nrFields = 0;
|
||||
|
@ -214,6 +215,7 @@ DATETIME_UseFormat (DATETIME_INFO *infoPtr, LPCWSTR formattxt)
|
|||
|
||||
for (i = 0; formattxt[i]; i++) {
|
||||
TRACE ("\n%d %c:", i, formattxt[i]);
|
||||
if (!inside_literal) {
|
||||
for (j = 0; j < len; j++) {
|
||||
if (allowedformatchars[j]==formattxt[i]) {
|
||||
TRACE ("%c[%d,%x]", allowedformatchars[j], *nrFields, infoPtr->fieldspec[*nrFields]);
|
||||
|
@ -235,6 +237,15 @@ DATETIME_UseFormat (DATETIME_INFO *infoPtr, LPCWSTR formattxt)
|
|||
break;
|
||||
} /* if allowedformatchar */
|
||||
} /* for j */
|
||||
}
|
||||
else
|
||||
j = len;
|
||||
|
||||
if (formattxt[i] == '\'')
|
||||
{
|
||||
inside_literal = !inside_literal;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* char is not a specifier: handle char like a string */
|
||||
if (j == len) {
|
||||
|
|
|
@ -193,6 +193,8 @@ static HWND create_datetime_control(DWORD style, DWORD exstyle)
|
|||
|
||||
static void test_dtm_set_format(HWND hWndDateTime)
|
||||
{
|
||||
CHAR txt[256];
|
||||
SYSTEMTIME systime;
|
||||
LRESULT r;
|
||||
|
||||
r = SendMessage(hWndDateTime, DTM_SETFORMAT, 0, (LPARAM)NULL);
|
||||
|
@ -203,6 +205,17 @@ static void test_dtm_set_format(HWND hWndDateTime)
|
|||
expect(1, r);
|
||||
|
||||
ok_sequence(sequences, DATETIME_SEQ_INDEX, test_dtm_set_format_seq, "test_dtm_set_format", FALSE);
|
||||
|
||||
r = SendMessage(hWndDateTime, DTM_SETFORMAT, 0,
|
||||
(LPARAM)"'hh' hh");
|
||||
expect(1, r);
|
||||
ZeroMemory(&systime, sizeof(systime));
|
||||
systime.wYear = 2000;
|
||||
systime.wMonth = systime.wDay = 1;
|
||||
r = SendMessage(hWndDateTime, DTM_SETSYSTEMTIME, 0, (LPARAM)&systime);
|
||||
expect(1, r);
|
||||
GetWindowText(hWndDateTime, txt, 256);
|
||||
todo_wine ok(strcmp(txt, "hh 12") == 0, "String mismatch (\"%s\" vs \"hh 12\")\n", txt);
|
||||
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue