Re: [Libreoffice] testDataPilot unit test breaks in sc

2011-05-09 Thread Fridrich Strba
On Fri, 2011-05-06 at 18:55 +0200, Thorsten Behrens wrote: 
 so, finally got to the bottom of this - patches attached. I feel
 *slightly* worried about pushing
 0001-Fix-non-changeability-of-UI-locale.patch to -3-4 - the second
 hunk has some potential to cause loops, so review appreciated.
 
 Generally, and going forward - I'd be a bit happier if unit tests
 would not assume en-US locale at all, since at least in theory, it's
 possible to do a build w/o en-US at all...

And we have some tinderboxes that actually don't build en-US.

F.

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] testDataPilot unit test breaks in sc

2011-05-09 Thread Kohei Yoshida
On Mon, 2011-05-09 at 14:27 +0200, Fridrich Strba wrote:
 On Fri, 2011-05-06 at 18:55 +0200, Thorsten Behrens wrote: 
  so, finally got to the bottom of this - patches attached. I feel
  *slightly* worried about pushing
  0001-Fix-non-changeability-of-UI-locale.patch to -3-4 - the second
  hunk has some potential to cause loops, so review appreciated.
  
  Generally, and going forward - I'd be a bit happier if unit tests
  would not assume en-US locale at all, since at least in theory, it's
  possible to do a build w/o en-US at all...
 
 And we have some tinderboxes that actually don't build en-US.

Do they just not specify en-US with with-lang switch, or do they
actually totally strip en-US from the build?  It was my understanding
that en-US locale resources are always there even when you explicitly
disable it at build time (as Andras said).

FYI some code in Calc assumes the en-US is always there even when en-US
is not explicitly enabled.  For instance ODF import export convert all
function names to English because the ODF spec requires it.  The always
use English function name functionality works precisely because en-US
strings are always available regardless of locales.

So, is being able to build without totally having en-US resources that
important?

Kohei

-- 
Kohei Yoshida, LibreOffice hacker, Calc
kyosh...@novell.com

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] testDataPilot unit test breaks in sc

2011-05-07 Thread Thorsten Behrens
Kohei Yoshida wrote:
 Well, if we can't assume a locale being set (regardless of whether or
 not it's en-US), we wouldn't be able to test e.g. calculations involving
 functions since all function names are localized.

Well, we could use translated names as input - granted, that sounds
like much more work.

  Also, without a locale set, a string collator won't work which is
  used even for simple things like populating data into data pilot
  cache (because of its need to check for string equality).

You got me there - that indeed sounds almost impossible to work
around. So then, let's standardize on en-US, and make that a
required locale.

Any opinion on whether to push the stuff to -3-4 already?

Cheers,

-- Thorsten


pgpqJaS03PBt2.pgp
Description: PGP signature
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] testDataPilot unit test breaks in sc

2011-05-07 Thread Andras Timar
2011/5/7 Thorsten Behrens t...@documentfoundation.org:
 You got me there - that indeed sounds almost impossible to work
 around. So then, let's standardize on en-US, and make that a
 required locale.

 Any opinion on whether to push the stuff to -3-4 already?

If it works reliably, then please push. I don't see theoretical
problem with standardizing on en-US. en-US is always built (regardless
of WITH_LANG setting). I think we should keep this behaviour so we can
rely on it.

Best regards,
Andras
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] testDataPilot unit test breaks in sc

2011-05-07 Thread Kohei Yoshida
On Fri, 2011-05-06 at 18:55 +0200, Thorsten Behrens wrote:
 so, finally got to the bottom of this - patches attached. I feel
 *slightly* worried about pushing
 0001-Fix-non-changeability-of-UI-locale.patch to -3-4 - the second
 hunk has some potential to cause loops, so review appreciated. 

It looks good to me.  I also tested its run-time behavior, and it
doesn't seem to cause any loops (for me).

Thanks for looking into this BTW.  Really appreciated. :-)

Kohei

-- 
Kohei Yoshida, LibreOffice hacker, Calc
kyosh...@novell.com

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] testDataPilot unit test breaks in sc

2011-05-06 Thread Thorsten Behrens
Kohei Yoshida wrote:
  This unit test expects that the UI is in English. Two English strings
  are hard coded into this test: Sum and Total.
 
 So, I looked into this this morning in hopes of finding a way to set UI
 locale to en-US explicitly.
 
 http://cgit.freedesktop.org/libreoffice/calc/commit/?h=libreoffice-3-4id=5051d6a1f1e239fb38c60a227046111ec438a518
 
 But at the moment this causes run-time exception.  I haven't
 investigated deeper into this to find out why.
 
Hi,

so, finally got to the bottom of this - patches attached. I feel
*slightly* worried about pushing
0001-Fix-non-changeability-of-UI-locale.patch to -3-4 - the second
hunk has some potential to cause loops, so review appreciated.

Generally, and going forward - I'd be a bit happier if unit tests
would not assume en-US locale at all, since at least in theory, it's
possible to do a build w/o en-US at all...

Cheers,

-- Thorsten
From ba779c09c294998dd873068d221b75294135b0e2 Mon Sep 17 00:00:00 2001
From: Thorsten Behrens tbehr...@novell.com
Date: Fri, 6 May 2011 18:43:35 +0200
Subject: [PATCH] Force calc unit test to use en-US locale and strings

---
 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 0ab6d32..edeb303 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::Referencelang::XMultiServiceFactory theConfigProvider =
-uno::Referencelang::XMultiServiceFactory (
-xSM-createInstance(
-OUString(RTL_CONSTASCII_USTRINGPARAM(com.sun.star.configuration.ConfigurationProvider))), uno::UNO_QUERY_THROW);
-
-uno::Sequenceuno::Any theArgs(1);
-OUString aLocalePath(RTL_CONSTASCII_USTRINGPARAM(org.openoffice.Office.Linguistic/General));
-theArgs[0] = aLocalePath;
-uno::Referencebeans::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::Sequenceuno::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);
-- 
1.7.1

From aac391874ad955afcf5c58ebd29680c035cbdeea Mon Sep 17 00:00:00 2001
From: Thorsten Behrens tbehr...@novell.com
Date: Fri, 6 May 2011 18:19:22 +0200
Subject: [PATCH] Fix non-changeability of UI locale

Enabled commented-out code, that actually permits changing the ui
locale without having to go through configuration.

This permits forcing en-us locale from the unit tests (which don't
have a working config)
---
 unotools/source/config/syslocaleoptions.cxx |   24 ++--
 1 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/unotools/source/config/syslocaleoptions.cxx b/unotools/source/config/syslocaleoptions.cxx
index 005b325..0697942 100644
--- a/unotools/source/config/syslocaleoptions.cxx
+++ b/unotools/source/config/syslocaleoptions.cxx
@@ -273,19 +273,16 @@ void SvtSysLocaleOptions_Impl::MakeRealLocale()
 
 void SvtSysLocaleOptions_Impl::MakeRealUILocale()
 {
-if ( !m_aRealUILocale.Language.getLength() )
+// as we can't switch UILocale at runtime, we only store changes in the configuration
+m_aRealUILocale = lcl_str_to_locale( 

Re: [Libreoffice] testDataPilot unit test breaks in sc

2011-05-03 Thread Kohei Yoshida
On Mon, 2011-05-02 at 16:08 +0200, Andras Timar wrote:

 This unit test expects that the UI is in English. Two English strings
 are hard coded into this test: Sum and Total.

So, I looked into this this morning in hopes of finding a way to set UI
locale to en-US explicitly.

http://cgit.freedesktop.org/libreoffice/calc/commit/?h=libreoffice-3-4id=5051d6a1f1e239fb38c60a227046111ec438a518

But at the moment this causes run-time exception.  I haven't
investigated deeper into this to find out why.

Kohei

-- 
Kohei Yoshida, LibreOffice hacker, Calc
kyosh...@novell.com

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice] testDataPilot unit test breaks in sc

2011-05-02 Thread Andras Timar
Hi,

Expected: Sum - Score  Actual: जोड़ - Score
ucalc.cxx:868:Assertion
Test name: N12_GLOBAL__N_14TestE::testDataPilot
assertion failed
- Expression: false
- Unexpected cell content.

Many of us have seen this. But it is still a problem in libreoffice-3-4
with all langs configured in, despite Kendy's patch in the bootstrap
repo (249ba40ac1155b88f3e3345bceef2513c3a3ac13).

This unit test expects that the UI is in English. Two English strings
are hard coded into this test: Sum and Total.

sc  source\ui\src\globstr.src   0   string  RID_GLOBSTR 
STR_FUN_TEXT_SUM
sc  source\ui\src\globstr.src   0   string  RID_GLOBSTR 
STR_PIVOT_TOTAL

I straced the run of the unit test and I did not understand that I saw.
It opened and read .res files in various languages instead of en-US.

http://pastebin.com/pRZB1d6t

BTW the failing string (जोड़) came from scsat.res.

This is how far I got...

Cheers,
Andras  
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice