Kaydet (Commit) c03c77ef authored tarafından Samuel Mehrbrodt's avatar Samuel Mehrbrodt

test: Allow to force a certain locale during unit tests

So that screenshots can be generated in different languages

Change-Id: I486e48a49d6f3837058ec7ac93b5d7d3094be90e
Reviewed-on: https://gerrit.libreoffice.org/30914Reviewed-by: 's avatarSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Tested-by: 's avatarSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
üst b223028d
Environment variables in VCL:
LO_TEST_LOCALE - the locale to be used during unit tests. Defaults to en-US.
......@@ -58,13 +58,20 @@ IMPL_STATIC_LINK_NOARG(Hook, deinitHook, LinkParamNone *, void) {
}
void test::setUpVcl() {
// Force locale (and resource files loaded) to en-US:
ResMgr::SetDefaultLocale(LanguageTag("en-US"));
// Force locale (and resource files loaded):
OUString locale;
if (getenv("LO_TEST_LOCALE") != nullptr)
locale = OUString::fromUtf8(getenv("LO_TEST_LOCALE"));
else
locale = "en-US";
ResMgr::SetDefaultLocale(LanguageTag(locale));
SvtSysLocaleOptions localOptions;
localOptions.SetLocaleConfigString("en-US");
localOptions.SetUILocaleConfigString("en-US");
MsLangId::setConfiguredSystemUILanguage(LANGUAGE_ENGLISH_US);
LanguageTag::setConfiguredSystemLanguage(LANGUAGE_ENGLISH_US);
localOptions.SetLocaleConfigString(locale);
localOptions.SetUILocaleConfigString(locale);
LanguageTag tag(locale);
MsLangId::setConfiguredSystemUILanguage(tag.getLanguageType(false));
LanguageTag::setConfiguredSystemLanguage(tag.getLanguageType(false));
InitVCL();
if (isHeadless()) {
Application::EnableHeadlessMode(true);
......
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