40#define FMT_NUMBER(vt,val) \
41 VariantInit(&v); V_VT(&v) = vt; val(&v) = 1; \
42 hres = VarFormatNumber(&v,2,0,0,0,0,&str); \
43 ok(hres == S_OK, "VarFormatNumber (vt %d): returned %8lx\n", vt, hres); \
45 ok(str && wcscmp(str,szResult1) == 0, \
46 "VarFormatNumber (vt %d): string different\n", vt); \
52 static const WCHAR szResult1[] =
L"1.00";
61 skip(
"Skipping VarFormatNumber tests as decimal separator is '%s'\n",
buff);
83 ok(
str &&
wcscmp(
str, szResult1) == 0,
"VarFormatNumber (bstr): string different\n");
91 ok(
str &&
wcscmp(
str,
L"(1.00)") == 0,
"VarFormatNumber (-bstr): string different\n");
96#define SIGNED_VTBITS (VTBIT_I1|VTBIT_I2|VTBIT_I4|VTBIT_I8|VTBIT_R4|VTBIT_R8)
98static const char *
szVarFmtFail =
"VT %d|0x%04x Format %s: expected 0x%08x, '%s', got 0x%08x, '%s'\n";
99#define VARFMT(vt,v,val,fmt,ret,str) do { \
101 V_VT(&in) = (vt); v(&in) = val; \
102 if (fmt) MultiByteToWideChar(CP_ACP, 0, fmt, -1, buffW, ARRAY_SIZE(buffW)); \
103 hres = VarFormat(&in,fmt ? buffW : NULL,fd,fw,flags,&out); \
104 if (SUCCEEDED(hres)) WideCharToMultiByte(CP_ACP, 0, out, -1, buff, sizeof(buff),0,0); \
105 else buff[0] = '\0'; \
106 ok(hres == ret && (FAILED(ret) || !strcmp(buff, str)), \
108 (vt)&VT_TYPEMASK,(vt)&~VT_TYPEMASK,fmt?fmt:"<null>",ret,str,hres,buff); \
109 SysFreeString(out); \
123 {
"General Number",
"1",
"0" },
124 {
"Percent",
"100.00%",
"0.00%" },
125 {
"Standard",
"1.00",
"0.00" },
126 {
"Scientific",
"1.00E+00",
"0.00E+00" },
127 {
"True/False",
"True",
"False" },
128 {
"On/Off",
"On",
"Off" },
129 {
"Yes/No",
"Yes",
"No" },
132 {
"#.#",
"1.",
"." },
134 {
"00",
"01",
"00" },
135 {
"0.0",
"1.0",
"0.0" },
136 {
"00\\c\\o\\p\\y",
"01copy",
"00copy" },
137 {
"\"pos\";\"neg\"",
"pos",
"pos" },
138 {
"\"pos\";\"neg\";\"zero\"",
"pos",
"zero" }
157 { 2.525,
"am/pm",
"pm" },
158 { 2.525,
"AM/PM",
"PM" },
159 { 2.525,
"A/P",
"P" },
160 { 2.525,
"a/p",
"p" },
163 { 2.525,
"dd",
"01" },
164 { 2.525,
"ddd",
"Mon" },
165 { 2.525,
"dddd",
"Monday" },
166 { 2.525,
"mmm",
"Jan" },
167 { 2.525,
"mmmm",
"January" },
169 { 2.525,
"yy",
"00" },
170 { 2.525,
"yyy",
"001" },
171 { 2.525,
"yyyy",
"1900" },
172 { 2.525,
"dd mm yyyy hh:mm:ss",
"01 01 1900 12:36:00" },
173 { 2.525,
"dd mm yyyy mm",
"01 01 1900 01" },
174 { 2.525,
"dd mm yyyy :mm",
"01 01 1900 :01" },
175 { 2.525,
"dd mm yyyy hh:mm",
"01 01 1900 12:36" },
176 { 2.525,
"mm mm",
"01 01" },
177 { 2.525,
"mm :mm:ss",
"01 :01:00" },
178 { 2.525,
"mm :ss:mm",
"01 :00:01" },
179 { 2.525,
"hh:mm :ss:mm",
"12:36 :00:01" },
180 { 2.525,
"hh:dd :mm:mm",
"12:01 :01:01" },
181 { 2.525,
"dd:hh :mm:mm",
"01:12 :36:01" },
182 { 2.525,
"hh :mm:mm",
"12 :36:01" },
183 { 2.525,
"dd :mm:mm",
"01 :01:01" },
184 { 2.525,
"dd :mm:nn",
"01 :01:36" },
185 { 2.725,
"hh:nn:ss A/P",
"05:24:00 P" },
186 { 40531.0,
"dddd",
"Sunday" },
187 { 40531.0,
"ddd",
"Sun" }
193 { 2.525,
"short time",
"12:36" },
194 { 2.525,
"medium time",
"12:36 PM" },
195 { 2.525,
"long time",
"12:36:00 PM" }
198#define VNUMFMT(vt,v) \
199 for (i = 0; i < ARRAY_SIZE(VarFormat_results); i++) \
201 VARFMT(vt,v,1,VarFormat_results[i].fmt,S_OK,VarFormat_results[i].one_res); \
202 VARFMT(vt,v,0,VarFormat_results[i].fmt,S_OK,VarFormat_results[i].zero_res); \
204 if ((1 << vt) & SIGNED_VTBITS) \
206 VARFMT(vt,v,-1,"\"pos\";\"neg\"",S_OK,"neg"); \
207 VARFMT(vt,v,-1,"\"pos\";\"neg\";\"zero\"",S_OK,"neg"); \
216 VARIANT_BOOL bTrue = VARIANT_TRUE, bFalse = VARIANT_FALSE;
224 skip(
"Skipping VarFormat tests for non English language\n");
230 skip(
"Skipping VarFormat tests as decimal separator is '%s'\n",
buff);
236 skip(
"Skipping VarFormat tests as decimal places is '%s'\n",
buff);
276 skip(
"Skipping named time tests as time format is '%s'\n",
buff);
320 VARFMT(
VT_I4,
V_I4,1,
"0,000,000,000",
S_OK,
"0,000,000,001");
395 ok(
out ==
NULL,
"expected NULL formatted string\n");
413 "VarWeekdayName (%d, %d, %d, %d, %x): returned %8x, expected %8x\n";
414#define VARWDN(iWeekday, fAbbrev, iFirstDay, dwFlags, ret, buff, out, freeOut) \
416 hres = VarWeekdayName(iWeekday, fAbbrev, iFirstDay, dwFlags, &out); \
417 if (SUCCEEDED(hres)) { \
418 WideCharToMultiByte(CP_ACP, 0, out, -1, buff, sizeof(buff), 0, 0); \
419 if (freeOut) SysFreeString(out); \
425 iWeekday, fAbbrev, iFirstDay, dwFlags, &out, hres, ret \
429#define VARWDN_F(iWeekday, fAbbrev, iFirstDay, dwFlags, ret) \
430 VARWDN(iWeekday, fAbbrev, iFirstDay, dwFlags, ret, buff, out, 1)
432#define VARWDN_O(iWeekday, fAbbrev, iFirstDay, dwFlags) \
433 VARWDN(iWeekday, fAbbrev, iFirstDay, dwFlags, S_OK, buff, out, 0)
440 int iWeekday, fAbbrev, iFirstDay;
442 DWORD defaultFirstDay;
452 win_skip(
"GetLocaleInfoW is not implemented\n");
459 for (fAbbrev = 0; fAbbrev <= 1; ++fAbbrev)
473 (
LPWSTR)&defaultFirstDay,
sizeof(defaultFirstDay) /
sizeof(
WCHAR));
483 "Null pointer: expected E_INVALIDARG, got 0x%08lx\n",
hres);
486 for (iWeekday = 1; iWeekday <= 7; ++iWeekday)
488 for (fAbbrev = 0; fAbbrev <= 1; ++fAbbrev)
491 for (iFirstDay = 0; iFirstDay <= 7; ++iFirstDay)
493 VARWDN_O(iWeekday, fAbbrev, iFirstDay, 0);
495 firstDay = defaultFirstDay;
498 firstDay = iFirstDay - 2;
499 day = (7 + iWeekday - 1 + firstDay) % 7;
501 "VarWeekdayName(%d,%d,%d): got wrong dayname: '%s'\n",
502 iWeekday, fAbbrev, iFirstDay,
buff);
511 for (fAbbrev = 0; fAbbrev <= 1; ++fAbbrev)
520 static WCHAR number_fmt[] =
L"###,##0.00";
521 static WCHAR date_fmt[] =
L"dd-mm";
522 static WCHAR string_fmt[] =
L"@";
597 str = (
void *)0xdeadbeef;
599 ok(
hr ==
S_OK,
"Unexpected return value %08lx\n",
hr);
602 str = (
void *)0xdeadbeef;
604 ok(
hr ==
S_OK,
"Unexpected return value %08lx\n",
hr);
609 ok(
hr ==
S_OK,
"Unexpected return value %08lx\n",
hr);
614 ok(
hr ==
S_OK,
"Unexpected return value %08lx\n",
hr);
619 ok(
hr ==
S_OK,
"Unexpected return value %08lx\n",
hr);
624 ok(
hr ==
S_OK,
"Unexpected return value %08lx\n",
hr);
669 str = (
void *)0xdeadbeef;
672 ok(!
str,
"Unexpected out string %p.\n",
str);
#define ERROR_CALL_NOT_IMPLEMENTED
static DOUBLE day(DOUBLE time)
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
INT WINAPI GetLocaleInfoA(LCID lcid, LCTYPE lctype, LPSTR buffer, INT len)
LCID WINAPI GetUserDefaultLCID(void)
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
_ACRTIMP int __cdecl strcmp(const char *, const char *)
HRESULT WINAPI VarBstrCmp(BSTR pbstrLeft, BSTR pbstrRight, LCID lcid, DWORD dwFlags)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define LOCALE_USER_DEFAULT
#define MAKELCID(lgid, srtid)
HRESULT WINAPI GetAltMonthNames(LCID lcid, LPOLESTR **str)
BSTR WINAPI SysAllocString(LPCOLESTR str)
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
#define LANGIDFROMLCID(l)
#define SUBLANG_ARABIC_EGYPT
#define SUBLANG_ENGLISH_US
XML_HIDDEN void xmlParserErrors const char const xmlChar const xmlChar * str2
static const char *static const char const char DWORD void DWORD *static const char const char DWORD void DWORD *static const char DWORD DWORD void * buff
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
DWORD WINAPI GetLastError(void)
#define DISP_E_TYPEMISMATCH
#define LOCALE_STIMEFORMAT
#define LOCALE_SABBREVDAYNAME1
#define LOCALE_IFIRSTDAYOFWEEK