Commit 4f3b7879 authored by Peter Schellenbach's avatar Peter Schellenbach Committed by Alexandre Julliard

oleaut32: Fixed short time & medium time named formats.

parent 955685a7
...@@ -217,6 +217,14 @@ static const FMTDATERES VarFormat_date_results[] = ...@@ -217,6 +217,14 @@ static const FMTDATERES VarFormat_date_results[] =
{ 40531.0, "ddd", "Sun" } { 40531.0, "ddd", "Sun" }
}; };
/* The following tests require that the time separator is a colon (:) */
static const FMTDATERES VarFormat_namedtime_results[] =
{
{ 2.525, "short time", "12:36" },
{ 2.525, "medium time", "12:36 PM" },
{ 2.525, "long time", "12:36:00 PM" }
};
#define VNUMFMT(vt,v) \ #define VNUMFMT(vt,v) \
for (i = 0; i < sizeof(VarFormat_results)/sizeof(FMTRES); i++) \ for (i = 0; i < sizeof(VarFormat_results)/sizeof(FMTRES); i++) \
{ \ { \
...@@ -301,6 +309,23 @@ static void test_VarFormat(void) ...@@ -301,6 +309,23 @@ static void test_VarFormat(void)
VarFormat_date_results[i].res); VarFormat_date_results[i].res);
} }
/* Named time formats */
GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_STIME, buff, sizeof(buff)/sizeof(char));
if (buff[0] != ':' || buff[1])
{
skip("Skipping namedtime tests as time separator is '%s'\n", buff);
}
else
{
for (i = 0; i < sizeof(VarFormat_namedtime_results)/sizeof(FMTDATERES); i++)
{
fd = 0;
VARFMT(VT_DATE,V_DATE,VarFormat_namedtime_results[i].val,
VarFormat_namedtime_results[i].fmt,S_OK,
VarFormat_namedtime_results[i].res);
}
}
/* Strings */ /* Strings */
bstrin = SysAllocString(szTesting); bstrin = SysAllocString(szTesting);
VARFMT(VT_BSTR,V_BSTR,bstrin,"",S_OK,"testing"); VARFMT(VT_BSTR,V_BSTR,bstrin,"",S_OK,"testing");
......
...@@ -263,7 +263,7 @@ typedef struct tagFMT_DATE_HEADER ...@@ -263,7 +263,7 @@ typedef struct tagFMT_DATE_HEADER
#define FMT_DATE_HOUR_0 0x1F /* Hours with leading 0 */ #define FMT_DATE_HOUR_0 0x1F /* Hours with leading 0 */
#define FMT_DATE_HOUR_12 0x20 /* Hours with no leading 0, 12 hour clock */ #define FMT_DATE_HOUR_12 0x20 /* Hours with no leading 0, 12 hour clock */
#define FMT_DATE_HOUR_12_0 0x21 /* Hours with leading 0, 12 hour clock */ #define FMT_DATE_HOUR_12_0 0x21 /* Hours with leading 0, 12 hour clock */
#define FMT_DATE_TIME_UNK2 0x23 #define FMT_DATE_TIME_UNK2 0x23 /* same as FMT_DATE_HOUR_0, for "short time" format */
/* FIXME: probably missing some here */ /* FIXME: probably missing some here */
#define FMT_DATE_AMPM_SYS1 0x2E /* AM/PM as defined by system settings */ #define FMT_DATE_AMPM_SYS1 0x2E /* AM/PM as defined by system settings */
#define FMT_DATE_AMPM_UPPER 0x2F /* Upper-case AM or PM */ #define FMT_DATE_AMPM_UPPER 0x2F /* Upper-case AM or PM */
...@@ -1660,6 +1660,13 @@ static HRESULT VARIANT_FormatDate(LPVARIANT pVarIn, LPOLESTR lpszFormat, ...@@ -1660,6 +1660,13 @@ static HRESULT VARIANT_FormatDate(LPVARIANT pVarIn, LPOLESTR lpszFormat,
pToken += 2; pToken += 2;
break; break;
case FMT_GEN_INLINE:
pToken += 2;
TRACE("copy %s\n", debugstr_a((LPCSTR)pToken));
while (*pToken)
*pBuff++ = *pToken++;
break;
case FMT_DATE_TIME_SEP: case FMT_DATE_TIME_SEP:
TRACE("time separator\n"); TRACE("time separator\n");
localeValue = LOCALE_STIME; localeValue = LOCALE_STIME;
...@@ -1836,6 +1843,7 @@ static HRESULT VARIANT_FormatDate(LPVARIANT pVarIn, LPOLESTR lpszFormat, ...@@ -1836,6 +1843,7 @@ static HRESULT VARIANT_FormatDate(LPVARIANT pVarIn, LPOLESTR lpszFormat,
break; break;
case FMT_DATE_HOUR_0: case FMT_DATE_HOUR_0:
case FMT_DATE_TIME_UNK2:
szPrintFmt = szPercentZeroTwo_d; szPrintFmt = szPercentZeroTwo_d;
dwVal = udate.st.wHour; dwVal = udate.st.wHour;
break; break;
......
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