summaryrefslogtreecommitdiff
path: root/configmgr
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2023-02-16 07:56:46 +0100
committerStephan Bergmann <sbergman@redhat.com>2023-02-16 10:05:29 +0000
commite2cd6fca2f94885e308e9454a2fc986b0ae5afe8 (patch)
tree6a163b6ac3dcc513ec7ea1d8262576da3a282264 /configmgr
parentcc584681cae755c6de07f343093259bbe034392a (diff)
Improve testLocalizedProperty
c3bd52f81bf733a0b9b0560794a54b2ac1e0f444 "Use the (first segment of the) original locale value for the workaround again" had stated: "The added test code unfortunately doesn't actually test this piece of code, and somewhat unexpectedly receives the "default" value from the empty string locale default, rather than the "en-US" value from the higher precedence "en-US" locale default, because `aFallbacks` happens to contain an empty string, so we already leave Access::getChild early in the 'Find the best match using the LanguageTag fallback mechanism, excluding the original tag' block." But, of course, the relevant code can well be tested after all, using a localized property that does not have a default no-xml:lang value. (And add a TODO comment about the unexpected "default" vs. "en-US" in the original test code, in case the LanguageTag::getFallbackStrings behavior ever changes and the test starts to fail.) Change-Id: I526a830a5929b6b5ad17ba57af5943954b07b86a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147137 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'configmgr')
-rw-r--r--configmgr/qa/unit/test.cxx9
1 files changed, 9 insertions, 0 deletions
diff --git a/configmgr/qa/unit/test.cxx b/configmgr/qa/unit/test.cxx
index 7aa2daf6f96d..fa380ab76dbf 100644
--- a/configmgr/qa/unit/test.cxx
+++ b/configmgr/qa/unit/test.cxx
@@ -329,8 +329,17 @@ void Test::testLocalizedProperty() {
OUString v;
CPPUNIT_ASSERT(
access->getByHierarchicalName("/org.libreoffice.unittest/localized/*-") >>= v);
+ //TODO: "default" instead of "en-US" is presumably due to a bug in
+ // LanguageTag::getFallbackStrings, which returns an empty string:
CPPUNIT_ASSERT_EQUAL(OUString("default"), v);
}
+ {
+ // Make sure a degenerate passed-in "-" locale is handled gracefully:
+ OUString v;
+ CPPUNIT_ASSERT(
+ access->getByHierarchicalName("/org.libreoffice.unittest/noDefaultLang/*-") >>= v);
+ CPPUNIT_ASSERT_EQUAL(OUString("en-US"), v);
+ }
}
void Test::testReadCommands()