[Libreoffice-commits] core.git: sw/CppunitTest_sw_layoutwriter.mk sw/qa

Mark Hung (via logerrit) logerrit at kemper.freedesktop.org
Fri May 10 11:49:29 UTC 2019


 sw/CppunitTest_sw_layoutwriter.mk |    1 +
 sw/qa/extras/layout/layout.cxx    |    6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)

New commits:
commit b67fbe0a163a8bb5bc30eb84ad796dcd24a27145
Author:     Mark Hung <marklh9 at gmail.com>
AuthorDate: Sun Apr 28 23:22:20 2019 +0800
Commit:     Mark Hung <marklh9 at gmail.com>
CommitDate: Fri May 10 13:48:39 2019 +0200

    sw/qa: recover locale in testUserFieldTypeLanguage.
    
    In testUserFieldTypeLanguage the locale was set to de-DE
    first then revert by calling SetLocaleConfigString with an
    empty string when the test finished. Calling
    SetLocaleConfigString with an empty string set the system
    locale to the system default, which is not necessarily en-US
    which is the default for unit tests.
    
    Unfortunately it makes testTdf108021 fail because the
    layouts in the testTdf108021 are different in en-US and
    zh-TW locale in my environment. This locale-dependent layout
    issue is tracked as tdf#125025 now.
    
    Change-Id: I50ae2df5fb4624f94d070742c6189bf333370137
    Reviewed-on: https://gerrit.libreoffice.org/71480
    Tested-by: Jenkins
    Reviewed-by: Mark Hung <marklh9 at gmail.com>

diff --git a/sw/CppunitTest_sw_layoutwriter.mk b/sw/CppunitTest_sw_layoutwriter.mk
index eb25e0258fd8..aaddcffb4d8a 100644
--- a/sw/CppunitTest_sw_layoutwriter.mk
+++ b/sw/CppunitTest_sw_layoutwriter.mk
@@ -34,6 +34,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_layoutwriter, \
     vcl \
     tl \
     utl \
+    i18nlangtag \
 ))
 
 $(eval $(call gb_CppunitTest_use_externals,sw_layoutwriter,\
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index bb3aea800d0e..af45e6ba8db4 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -15,6 +15,7 @@
 #include <officecfg/Office/Common.hxx>
 #include <comphelper/scopeguard.hxx>
 #include <unotools/syslocaleoptions.hxx>
+#include <i18nlangtag/languagetag.hxx>
 #include <vcl/scheduler.hxx>
 #include <fmtanchr.hxx>
 #include <fmtfsize.hxx>
@@ -2536,10 +2537,11 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testUserFieldTypeLanguage)
 {
     // Set the system locale to German, the document will be English.
     SvtSysLocaleOptions aOptions;
+    OUString sLocaleConfigString = aOptions.GetLanguageTag().getBcp47();
     aOptions.SetLocaleConfigString("de-DE");
     aOptions.Commit();
-    comphelper::ScopeGuard g([&aOptions] {
-        aOptions.SetLocaleConfigString(OUString());
+    comphelper::ScopeGuard g([&aOptions, &sLocaleConfigString] {
+        aOptions.SetLocaleConfigString(sLocaleConfigString);
         aOptions.Commit();
     });
 


More information about the Libreoffice-commits mailing list