Kaydet (Commit) b67fbe0a authored tarafından Mark Hung's avatar Mark Hung

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: 's avatarMark Hung <marklh9@gmail.com>
üst 5ad4e88c
......@@ -34,6 +34,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_layoutwriter, \
vcl \
tl \
utl \
i18nlangtag \
))
$(eval $(call gb_CppunitTest_use_externals,sw_layoutwriter,\
......
......@@ -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();
});
......
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