Commit f9041da2 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

oleaut32: Take lcid into account while parsing input variant in VARIANT_FormatString.

parent aa71e545
...@@ -568,6 +568,10 @@ static void test_VarFormatFromTokens(void) ...@@ -568,6 +568,10 @@ static void test_VarFormatFromTokens(void)
static const WCHAR date[] = {'1','2','-','1','1',0}; static const WCHAR date[] = {'1','2','-','1','1',0};
static const WCHAR date_us[] = {'1','1','-','1','2',0}; static const WCHAR date_us[] = {'1','1','-','1','2',0};
static WCHAR string_fmt[] = {'@',0};
static const WCHAR string_de[] = {'1',',','5',0};
static const WCHAR string_us[] = {'1','.','5',0};
BYTE buff[256]; BYTE buff[256];
LCID lcid; LCID lcid;
VARIANT var; VARIANT var;
...@@ -615,6 +619,25 @@ static void test_VarFormatFromTokens(void) ...@@ -615,6 +619,25 @@ static void test_VarFormatFromTokens(void)
SysFreeString(bstr); SysFreeString(bstr);
VariantClear(&var); VariantClear(&var);
V_VT(&var) = VT_R4;
V_R4(&var) = 1.5;
lcid = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT);
hres = VarTokenizeFormatString(string_fmt, buff, sizeof(buff), 1, 1, lcid, NULL);
ok(hres == S_OK, "VarTokenizeFormatString failed: %x\n", hres);
hres = VarFormatFromTokens(&var, string_fmt, buff, 0, &bstr, lcid);
ok(hres == S_OK, "VarFormatFromTokens failed: %x\n", hres);
ok(!strcmpW(bstr, string_us), "incorrectly formatted string: %s\n", wine_dbgstr_w(bstr));
SysFreeString(bstr);
lcid = MAKELCID(MAKELANGID(LANG_GERMAN, SUBLANG_GERMAN), SORT_DEFAULT);
hres = VarTokenizeFormatString(string_fmt, buff, sizeof(buff), 1, 1, lcid, NULL);
ok(hres == S_OK, "VarTokenizeFormatString failed: %x\n", hres);
hres = VarFormatFromTokens(&var, string_fmt, buff, 0, &bstr, lcid);
ok(hres == S_OK, "VarFormatFromTokens failed: %x\n", hres);
ok(!strcmpW(bstr, string_de), "incorrectly formatted string: %s\n", wine_dbgstr_w(bstr));
SysFreeString(bstr);
} }
START_TEST(varformat) START_TEST(varformat)
......
...@@ -1960,7 +1960,7 @@ static HRESULT VARIANT_FormatString(LPVARIANT pVarIn, LPOLESTR lpszFormat, ...@@ -1960,7 +1960,7 @@ static HRESULT VARIANT_FormatString(LPVARIANT pVarIn, LPOLESTR lpszFormat,
} }
else else
{ {
hRes = VariantChangeTypeEx(&vStr, pVarIn, LCID_US, VARIANT_NOUSEROVERRIDE, VT_BSTR); hRes = VariantChangeTypeEx(&vStr, pVarIn, lcid, VARIANT_NOUSEROVERRIDE, VT_BSTR);
if (FAILED(hRes)) if (FAILED(hRes))
return hRes; return hRes;
......
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