oleaut32/tests: Allow testing VarParseNumFromStr() using Unicode strings.
Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit 627988565b
)
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
This commit is contained in:
parent
2253901ccf
commit
76d30e2d51
|
@ -1262,21 +1262,27 @@ static void test_VariantCopyInd(void)
|
||||||
"CopyInd(ref->ref): expected E_INVALIDARG, got 0x%08x\n", hres);
|
"CopyInd(ref->ref): expected E_INVALIDARG, got 0x%08x\n", hres);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT (WINAPI *pVarParseNumFromStr)(OLECHAR*,LCID,ULONG,NUMPARSE*,BYTE*);
|
static HRESULT (WINAPI *pVarParseNumFromStr)(const OLECHAR*,LCID,ULONG,NUMPARSE*,BYTE*);
|
||||||
|
|
||||||
/* Macros for converting and testing the result of VarParseNumFromStr */
|
/* Macros for converting and testing the result of VarParseNumFromStr */
|
||||||
#define FAILDIG 255
|
#define FAILDIG 255
|
||||||
|
|
||||||
|
static HRESULT wconvert_str( const OLECHAR *str, INT dig, ULONG flags,
|
||||||
|
NUMPARSE *np, BYTE rgb[128], LCID lcid )
|
||||||
|
{
|
||||||
|
memset( rgb, FAILDIG, 128 );
|
||||||
|
memset( np, 255, sizeof(*np) );
|
||||||
|
np->cDig = dig;
|
||||||
|
np->dwInFlags = flags;
|
||||||
|
return pVarParseNumFromStr( str, lcid, LOCALE_NOUSEROVERRIDE, np, rgb);
|
||||||
|
}
|
||||||
|
|
||||||
static HRESULT convert_str( const char *str, INT dig, ULONG flags,
|
static HRESULT convert_str( const char *str, INT dig, ULONG flags,
|
||||||
NUMPARSE *np, BYTE rgb[128], LCID lcid )
|
NUMPARSE *np, BYTE rgb[128], LCID lcid )
|
||||||
{
|
{
|
||||||
OLECHAR buff[128];
|
OLECHAR buff[128];
|
||||||
MultiByteToWideChar( CP_ACP,0, str, -1, buff, ARRAY_SIZE( buff ));
|
MultiByteToWideChar( CP_ACP,0, str, -1, buff, ARRAY_SIZE( buff ));
|
||||||
memset( rgb, FAILDIG, 128 );
|
return wconvert_str(buff, dig, flags, np, rgb, lcid);
|
||||||
memset( np, 255, sizeof(*np) );
|
|
||||||
np->cDig = dig;
|
|
||||||
np->dwInFlags = flags;
|
|
||||||
return pVarParseNumFromStr( buff, lcid, LOCALE_NOUSEROVERRIDE, np, rgb);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void expect_NumFromStr( int line, HRESULT hres, NUMPARSE *np, INT a, ULONG b, ULONG c,
|
static void expect_NumFromStr( int line, HRESULT hres, NUMPARSE *np, INT a, ULONG b, ULONG c,
|
||||||
|
@ -1293,6 +1299,8 @@ static void expect_NumFromStr( int line, HRESULT hres, NUMPARSE *np, INT a, ULON
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define WCONVERTN(str,dig,flags) hres = wconvert_str( str, dig, flags, &np, rgb, lcid )
|
||||||
|
#define WCONVERT(str,flags) WCONVERTN(str,sizeof(rgb),flags)
|
||||||
#define CONVERTN(str,dig,flags) hres = convert_str( str, dig, flags, &np, rgb, lcid )
|
#define CONVERTN(str,dig,flags) hres = convert_str( str, dig, flags, &np, rgb, lcid )
|
||||||
#define CONVERT(str,flags) CONVERTN(str,sizeof(rgb),flags)
|
#define CONVERT(str,flags) CONVERTN(str,sizeof(rgb),flags)
|
||||||
#define EXPECT(a,b,c,d,e,f) expect_NumFromStr( __LINE__, hres, &np, a, b, c, d, e, f )
|
#define EXPECT(a,b,c,d,e,f) expect_NumFromStr( __LINE__, hres, &np, a, b, c, d, e, f )
|
||||||
|
@ -1307,7 +1315,6 @@ static void test_VarParseNumFromStr(void)
|
||||||
LCID lcid = MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT);
|
LCID lcid = MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT);
|
||||||
NUMPARSE np;
|
NUMPARSE np;
|
||||||
BYTE rgb[128];
|
BYTE rgb[128];
|
||||||
WCHAR str[128];
|
|
||||||
|
|
||||||
/** No flags **/
|
/** No flags **/
|
||||||
|
|
||||||
|
@ -1731,10 +1738,9 @@ static void test_VarParseNumFromStr(void)
|
||||||
EXPECT(1,NUMPRS_STD,NUMPRS_DECIMAL,4,0,-1);
|
EXPECT(1,NUMPRS_STD,NUMPRS_DECIMAL,4,0,-1);
|
||||||
EXPECT2(1,0);
|
EXPECT2(1,0);
|
||||||
|
|
||||||
str[0] = 0x0660;
|
/* Arabic numerals are not allowed "0" */
|
||||||
str[1] = 0;
|
WCONVERT(L"\x660", NUMPRS_STD);
|
||||||
hres = pVarParseNumFromStr(str, lcid, LOCALE_NOUSEROVERRIDE, &np, rgb);
|
EXPECTFAIL;
|
||||||
ok(hres == DISP_E_TYPEMISMATCH, "VarParseNumFromStr returned %08x\n", hres);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT (WINAPI *pVarNumFromParseNum)(NUMPARSE*,BYTE*,ULONG,VARIANT*);
|
static HRESULT (WINAPI *pVarNumFromParseNum)(NUMPARSE*,BYTE*,ULONG,VARIANT*);
|
||||||
|
|
Loading…
Reference in New Issue