diff options
author | Thorsten Behrens <tbehrens@novell.com> | 2011-05-06 18:43:35 +0200 |
---|---|---|
committer | Thorsten Behrens <tbehrens@novell.com> | 2011-05-09 16:15:33 +0200 |
commit | 18936fbb3152ca5c04b2639e017129213484de40 (patch) | |
tree | e27c6f92c4f8375698dda43ef36330ccdcb6356a /sc/qa | |
parent | 11208eaa2fa89467e795a2f4dc6f17247caaa4aa (diff) |
Force calc unit test to use en-US locale and strings
Diffstat (limited to 'sc/qa')
-rw-r--r-- | sc/qa/unit/ucalc.cxx | 37 |
1 files changed, 14 insertions, 23 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index e7ab145c4aaa..56e205c696a2 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -49,6 +49,8 @@ #include <cppuhelper/bootstrap.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/oslfile2streamwrap.hxx> +#include <i18npool/mslangid.hxx> +#include <unotools/syslocaleoptions.hxx> #include <vcl/svapp.hxx> #include "scdll.hxx" @@ -304,28 +306,6 @@ Test::Test() //of retaining references to the root ServiceFactory as its passed around comphelper::setProcessServiceFactory(xSM); -#if 0 - // TODO: attempt to explicitly set UI locale to en-US, to get the unit - // test to work under non-English build environment. But this causes - // runtime exception.... - uno::Reference<lang::XMultiServiceFactory> theConfigProvider = - uno::Reference<lang::XMultiServiceFactory> ( - xSM->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationProvider"))), uno::UNO_QUERY_THROW); - - uno::Sequence<uno::Any> theArgs(1); - OUString aLocalePath(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Linguistic/General")); - theArgs[0] <<= aLocalePath; - uno::Reference<beans::XPropertySet> xProp( - theConfigProvider->createInstanceWithArguments( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationUpdateAccess")), theArgs), uno::UNO_QUERY_THROW); - - OUString aLang(RTL_CONSTASCII_USTRINGPARAM("en-US")); - uno::Any aAny; - aAny <<= aLang; - xProp->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("UILocale")), aAny); -#endif - // initialise UCB-Broker uno::Sequence<uno::Any> aUcbInitSequence(2); aUcbInitSequence[0] <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Local")); @@ -339,8 +319,19 @@ Test::Test() rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.FileContentProvider"))), uno::UNO_QUERY); xUcb->registerContentProvider(xFileProvider, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("file")), sal_True); - InitVCL(xSM); + // force locale (and resource files loaded) to en-US + const LanguageType eLang=LANGUAGE_ENGLISH_US; + rtl::OUString aLang, aCountry; + MsLangId::convertLanguageToIsoNames(eLang, aLang, aCountry); + lang::Locale aLocale(aLang, aCountry, rtl::OUString()); + ResMgr::SetDefaultLocale( aLocale ); + + SvtSysLocaleOptions aLocalOptions; + aLocalOptions.SetUILocaleConfigString( + MsLangId::convertLanguageToIsoString( eLang ) ); + + InitVCL(xSM); ScDLL::Init(); oslProcessError err = osl_getProcessWorkingDir(&m_aPWDURL.pData); |