From 2be12eacaf616907a79354265bbb0f51d974e70a Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Wed, 18 Jul 2012 13:36:58 +0200 Subject: [PATCH] vbscript: Fixed locale-related test failures. --- dlls/vbscript/tests/api.vbs | 8 ++++---- dlls/vbscript/tests/run.c | 28 +++++++++++++++++++++------- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/dlls/vbscript/tests/api.vbs b/dlls/vbscript/tests/api.vbs index 4914e7a4d97..fd339dd9be7 100644 --- a/dlls/vbscript/tests/api.vbs +++ b/dlls/vbscript/tests/api.vbs @@ -154,8 +154,8 @@ TestUCase "test", "TEST" TestUCase "123aBC?", "123ABC?" TestUCase "", "" TestUCase 1, "1" -TestUCase true, "TRUE" -TestUCase 0.123, "0.123" +if isEnglishLang then TestUCase true, "TRUE" +TestUCase 0.123, doubleAsString(0.123) TestUCase Empty, "" Call ok(getVT(UCase(Null)) = "VT_NULL", "getVT(UCase(Null)) = " & getVT(UCase(Null))) @@ -168,8 +168,8 @@ TestLCase "test", "test" TestLCase "123aBC?", "123abc?" TestLCase "", "" TestLCase 1, "1" -TestLCase true, "true" -TestLCase 0.123, "0.123" +if isEnglishLang then TestLCase true, "true" +TestLCase 0.123, doubleAsString(0.123) TestLCase Empty, "" Call ok(getVT(LCase(Null)) = "VT_NULL", "getVT(LCase(Null)) = " & getVT(LCase(Null))) diff --git a/dlls/vbscript/tests/run.c b/dlls/vbscript/tests/run.c index 91c45e6c526..8569d71f0d3 100644 --- a/dlls/vbscript/tests/run.c +++ b/dlls/vbscript/tests/run.c @@ -82,6 +82,7 @@ DEFINE_EXPECT(Next); #define DISPID_GLOBAL_PROPARGPUT 1011 #define DISPID_GLOBAL_PROPARGPUT1 1012 #define DISPID_GLOBAL_COLLOBJ 1013 +#define DISPID_GLOBAL_DOUBLEASSTRING 1014 #define DISPID_TESTOBJ_PROPGET 2000 #define DISPID_TESTOBJ_PROPPUT 2001 @@ -90,7 +91,7 @@ DEFINE_EXPECT(Next); static const WCHAR testW[] = {'t','e','s','t',0}; -static BOOL strict_dispid_check; +static BOOL strict_dispid_check, is_english; static const char *test_name = "(null)"; static int test_counter; @@ -815,6 +816,11 @@ static HRESULT WINAPI Global_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD *pid = DISPID_GLOBAL_COUNTER; return S_OK; } + if(!strcmp_wa(bstrName, "doubleAsString")) { + test_grfdex(grfdex, fdexNameCaseInsensitive); + *pid = DISPID_GLOBAL_DOUBLEASSTRING; + return S_OK; + } if(strict_dispid_check && strcmp_wa(bstrName, "x")) ok(0, "unexpected call %s %x\n", wine_dbgstr_w(bstrName), grfdex); @@ -905,12 +911,7 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, ok(pei != NULL, "pei == NULL\n"); V_VT(pvarRes) = VT_BOOL; - if(is_lang_english()) { - V_BOOL(pvarRes) = VARIANT_TRUE; - }else { - skip("Skipping some tests in non-English UIs\n"); - V_BOOL(pvarRes) = VARIANT_FALSE; - } + V_BOOL(pvarRes) = is_english ? VARIANT_TRUE : VARIANT_FALSE; return S_OK; case DISPID_GLOBAL_VBVAR: @@ -1069,6 +1070,15 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, V_VT(pvarRes) = VT_I2; V_I2(pvarRes) = test_counter++; return S_OK; + + case DISPID_GLOBAL_DOUBLEASSTRING: + ok(wFlags == (INVOKE_FUNC|INVOKE_PROPERTYGET), "wFlags = %x\n", wFlags); + ok(pdp->cArgs == 1, "cArgs = %d\n", pdp->cArgs); + ok(V_VT(pdp->rgvarg) == VT_R8, "V_VT(pdp->rgvarg) = %d\n", V_VT(pdp->rgvarg)); + ok(pvarRes != NULL, "pvarRes == NULL\n"); + + V_VT(pvarRes) = VT_BSTR; + return VarBstrFromR8(V_R8(pdp->rgvarg), 0, 0, &V_BSTR(pvarRes)); } ok(0, "unexpected call %d\n", id); @@ -1590,6 +1600,10 @@ START_TEST(run) int argc; char **argv; + is_english = is_lang_english(); + if(!is_english) + skip("Skipping some tests in non-English UIs\n"); + argc = winetest_get_mainargs(&argv); CoInitialize(NULL);