51#define CHECKPTR(func) p##func = (void*)GetProcAddress(hOleaut32, #func); \
52 if (!p##func) { win_skip("function " # func " not available, not testing it\n"); return; }
56 while (*str1 && (*str1 == *str2)) { str1++; str2++; }
60#define FMT_NUMBER(vt,val) \
61 VariantInit(&v); V_VT(&v) = vt; val(&v) = 1; \
62 hres = pVarFormatNumber(&v,2,0,0,0,0,&str); \
63 ok(hres == S_OK, "VarFormatNumber (vt %d): returned %8x\n", vt, hres); \
65 ok(str && strcmpW(str,szResult1) == 0, \
66 "VarFormatNumber (vt %d): string different\n", vt); \
72 static const WCHAR szSrc1[] = {
'1',
'\0' };
73 static const WCHAR szResult1[] = {
'1',
'.',
'0',
'0',
'\0' };
74 static const WCHAR szSrc2[] = {
'-',
'1',
'\0' };
75 static const WCHAR szResult2[] = {
'(',
'1',
'.',
'0',
'0',
')',
'\0' };
86 skip(
"Skipping VarFormatNumber tests as decimal separator is '%s'\n",
buff);
108 hres = pVarFormatNumber(&
v,2,0,0,0,0,&
str);
111 ok(
str &&
strcmpW(
str, szResult1) == 0,
"VarFormatNumber (bstr): string different\n");
116 hres = pVarFormatNumber(&
v,2,0,-1,0,0,&
str);
119 ok(
str &&
strcmpW(
str, szResult2) == 0,
"VarFormatNumber (-bstr): string different\n");
124#define SIGNED_VTBITS (VTBIT_I1|VTBIT_I2|VTBIT_I4|VTBIT_I8|VTBIT_R4|VTBIT_R8)
126static const char *
szVarFmtFail =
"VT %d|0x%04x Format %s: expected 0x%08x, '%s', got 0x%08x, '%s'\n";
127#define VARFMT(vt,v,val,fmt,ret,str) do { \
129 V_VT(&in) = (vt); v(&in) = val; \
130 if (fmt) MultiByteToWideChar(CP_ACP, 0, fmt, -1, buffW, ARRAY_SIZE(buffW)); \
131 hres = pVarFormat(&in,fmt ? buffW : NULL,fd,fw,flags,&out); \
132 if (SUCCEEDED(hres)) WideCharToMultiByte(CP_ACP, 0, out, -1, buff, sizeof(buff),0,0); \
133 else buff[0] = '\0'; \
134 ok(hres == ret && (FAILED(ret) || !strcmp(buff, str)), \
136 (vt)&VT_TYPEMASK,(vt)&~VT_TYPEMASK,fmt?fmt:"<null>",ret,str,hres,buff); \
137 SysFreeString(out); \
151 {
"General Number",
"1",
"0" },
152 {
"Percent",
"100.00%",
"0.00%" },
153 {
"Standard",
"1.00",
"0.00" },
154 {
"Scientific",
"1.00E+00",
"0.00E+00" },
155 {
"True/False",
"True",
"False" },
156 {
"On/Off",
"On",
"Off" },
157 {
"Yes/No",
"Yes",
"No" },
160 {
"#.#",
"1.",
"." },
162 {
"00",
"01",
"00" },
163 {
"0.0",
"1.0",
"0.0" },
164 {
"00\\c\\o\\p\\y",
"01copy",
"00copy" },
165 {
"\"pos\";\"neg\"",
"pos",
"pos" },
166 {
"\"pos\";\"neg\";\"zero\"",
"pos",
"zero" }
185 { 2.525,
"am/pm",
"pm" },
186 { 2.525,
"AM/PM",
"PM" },
187 { 2.525,
"A/P",
"P" },
188 { 2.525,
"a/p",
"p" },
191 { 2.525,
"dd",
"01" },
192 { 2.525,
"ddd",
"Mon" },
193 { 2.525,
"dddd",
"Monday" },
194 { 2.525,
"mmm",
"Jan" },
195 { 2.525,
"mmmm",
"January" },
197 { 2.525,
"yy",
"00" },
198 { 2.525,
"yyy",
"001" },
199 { 2.525,
"yyyy",
"1900" },
200 { 2.525,
"dd mm yyyy hh:mm:ss",
"01 01 1900 12:36:00" },
201 { 2.525,
"dd mm yyyy mm",
"01 01 1900 01" },
202 { 2.525,
"dd mm yyyy :mm",
"01 01 1900 :01" },
203 { 2.525,
"dd mm yyyy hh:mm",
"01 01 1900 12:36" },
204 { 2.525,
"mm mm",
"01 01" },
205 { 2.525,
"mm :mm:ss",
"01 :01:00" },
206 { 2.525,
"mm :ss:mm",
"01 :00:01" },
207 { 2.525,
"hh:mm :ss:mm",
"12:36 :00:01" },
208 { 2.525,
"hh:dd :mm:mm",
"12:01 :01:01" },
209 { 2.525,
"dd:hh :mm:mm",
"01:12 :36:01" },
210 { 2.525,
"hh :mm:mm",
"12 :36:01" },
211 { 2.525,
"dd :mm:mm",
"01 :01:01" },
212 { 2.525,
"dd :mm:nn",
"01 :01:36" },
213 { 2.725,
"hh:nn:ss A/P",
"05:24:00 P" },
214 { 40531.0,
"dddd",
"Sunday" },
215 { 40531.0,
"ddd",
"Sun" }
221 { 2.525,
"short time",
"12:36" },
222 { 2.525,
"medium time",
"12:36 PM" },
223 { 2.525,
"long time",
"12:36:00 PM" }
226#define VNUMFMT(vt,v) \
227 for (i = 0; i < ARRAY_SIZE(VarFormat_results); i++) \
229 VARFMT(vt,v,1,VarFormat_results[i].fmt,S_OK,VarFormat_results[i].one_res); \
230 VARFMT(vt,v,0,VarFormat_results[i].fmt,S_OK,VarFormat_results[i].zero_res); \
232 if ((1 << vt) & SIGNED_VTBITS) \
234 VARFMT(vt,v,-1,"\"pos\";\"neg\"",S_OK,"neg"); \
235 VARFMT(vt,v,-1,"\"pos\";\"neg\";\"zero\"",S_OK,"neg"); \
240 static const WCHAR szTesting[] = {
't',
'e',
's',
't',
'i',
'n',
'g',
'\0' };
241 static const WCHAR szNum[] = {
'3',
'9',
'6',
'9',
'7',
'.',
'1',
'1',
'\0' };
246 VARIANT_BOOL bTrue = VARIANT_TRUE, bFalse = VARIANT_FALSE;
256 skip(
"Skipping VarFormat tests for non English language\n");
262 skip(
"Skipping VarFormat tests as decimal separator is '%s'\n",
buff);
268 skip(
"Skipping VarFormat tests as decimal places is '%s'\n",
buff);
314 skip(
"Skipping named time tests as time format is '%s'\n",
buff);
358 VARFMT(
VT_I4,
V_I4,1,
"0,000,000,000",
S_OK,
"0,000,000,001");
433 ok(
out ==
NULL,
"expected NULL formatted string\n");
451 "VarWeekdayName (%d, %d, %d, %d, %x): returned %8x, expected %8x\n";
452#define VARWDN(iWeekday, fAbbrev, iFirstDay, dwFlags, ret, buff, out, freeOut) \
454 hres = pVarWeekdayName(iWeekday, fAbbrev, iFirstDay, dwFlags, &out); \
455 if (SUCCEEDED(hres)) { \
456 WideCharToMultiByte(CP_ACP, 0, out, -1, buff, sizeof(buff), 0, 0); \
457 if (freeOut) SysFreeString(out); \
463 iWeekday, fAbbrev, iFirstDay, dwFlags, &out, hres, ret \
467#define VARWDN_F(iWeekday, fAbbrev, iFirstDay, dwFlags, ret) \
468 VARWDN(iWeekday, fAbbrev, iFirstDay, dwFlags, ret, buff, out, 1)
470#define VARWDN_O(iWeekday, fAbbrev, iFirstDay, dwFlags) \
471 VARWDN(iWeekday, fAbbrev, iFirstDay, dwFlags, S_OK, buff, out, 0)
478 int iWeekday, fAbbrev, iFirstDay;
480 DWORD defaultFirstDay;
492 win_skip(
"GetLocaleInfoW is not implemented\n");
499 for (fAbbrev = 0; fAbbrev <= 1; ++fAbbrev)
513 (
LPWSTR)&defaultFirstDay,
sizeof(defaultFirstDay) /
sizeof(
WCHAR));
521 hres = pVarWeekdayName(1, 0, 0, 0,
NULL);
523 "Null pointer: expected E_INVALIDARG, got 0x%08x\n",
hres);
528 for (iWeekday = 1; iWeekday <= 7; ++iWeekday)
530 for (fAbbrev = 0; fAbbrev <= 1; ++fAbbrev)
533 for (iFirstDay = 0; iFirstDay <= 7; ++iFirstDay)
535 VARWDN_O(iWeekday, fAbbrev, iFirstDay, 0);
537 firstDay = defaultFirstDay;
540 firstDay = iFirstDay - 2;
541 day = (7 + iWeekday - 1 + firstDay) % 7;
544 "VarWeekdayName(%d,%d,%d): got wrong dayname: '%s'\n",
545 iWeekday, fAbbrev, iFirstDay,
buff);
554 for (fAbbrev = 0; fAbbrev <= 1; ++fAbbrev)
563 static WCHAR number_fmt[] = {
'#',
'#',
'#',
',',
'#',
'#',
'0',
'.',
'0',
'0',0};
565 static const WCHAR number_us[] = {
'6',
'9',
'0',
'.',
'0',
'0',0};
567 static WCHAR date_fmt[] = {
'd',
'd',
'-',
'm',
'm',0};
568 static const WCHAR date[] = {
'1',
'2',
'-',
'1',
'1',0};
569 static const WCHAR date_us[] = {
'1',
'1',
'-',
'1',
'2',0};
571 static WCHAR string_fmt[] = {
'@',0};
572 static const WCHAR string_de[] = {
'1',
',',
'5',0};
573 static const WCHAR string_us[] = {
'1',
'.',
'5',0};
648 str = (
void *)0xdeadbeef;
650 ok(
hr ==
S_OK,
"Unexpected return value %08x\n",
hr);
653 str = (
void *)0xdeadbeef;
655 ok(
hr ==
S_OK,
"Unexpected return value %08x\n",
hr);
660 ok(
hr ==
S_OK,
"Unexpected return value %08x\n",
hr);
665 ok(
hr ==
S_OK,
"Unexpected return value %08x\n",
hr);
666 ok(str2 ==
str,
"Got %p\n", str2);
670 ok(
hr ==
S_OK,
"Unexpected return value %08x\n",
hr);
675 ok(
hr ==
S_OK,
"Unexpected return value %08x\n",
hr);
int strcmp(const char *String1, const char *String2)
#define ERROR_CALL_NOT_IMPLEMENTED
#define GetProcAddress(x, y)
static DOUBLE day(DOUBLE time)
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
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)
static unsigned char buff[32768]
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
static unsigned int number
#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
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
DWORD WINAPI GetLastError(void)
#define LOCALE_STIMEFORMAT
#define LOCALE_SABBREVDAYNAME1
#define LOCALE_IFIRSTDAYOFWEEK