Add a rudimentary test for localized properties
Change-Id: I9abe06e6f1f2b6b39cbbf07043dd9c5062ff0460
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147108
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
diff --git a/configmgr/qa/unit/test.cxx b/configmgr/qa/unit/test.cxx
index daa2070..3de93a6 100644
--- a/configmgr/qa/unit/test.cxx
+++ b/configmgr/qa/unit/test.cxx
@@ -24,6 +24,7 @@
#include <com/sun/star/beans/XPropertyChangeListener.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XPropertyState.hpp>
#include <com/sun/star/configuration/ReadOnlyAccess.hpp>
#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
@@ -63,6 +64,7 @@ public:
void testKeyReset();
void testSetSetMemberName();
void testInsertSetMember();
void testLocalizedProperty();
void testReadCommands();
void testListener();
void testRecursive();
@@ -89,6 +91,7 @@ public:
CPPUNIT_TEST(testKeyReset);
CPPUNIT_TEST(testSetSetMemberName);
CPPUNIT_TEST(testInsertSetMember);
CPPUNIT_TEST(testLocalizedProperty);
CPPUNIT_TEST(testReadCommands);
CPPUNIT_TEST(testListener);
CPPUNIT_TEST(testRecursive);
@@ -309,6 +312,20 @@ void Test::testInsertSetMember() {
access, css::uno::UNO_QUERY_THROW)->dispose();
}
void Test::testLocalizedProperty() {
auto const access = css::configuration::ReadOnlyAccess::create(
comphelper::getProcessComponentContext(), "*");
{
// See <https://bugs.documentfoundation.org/show_bug.cgi?id=33638> "Pagination extension
// not localized in LibreOffice", which wants to retrieve the non-canonical xml:lang="pt-PT"
// value for the passed-in "pt" locale:
OUString v;
CPPUNIT_ASSERT(
access->getByHierarchicalName("/org.libreoffice.unittest/localized/*pt") >>= v);
CPPUNIT_ASSERT_EQUAL(OUString("pt-PT"), v);
}
}
void Test::testReadCommands()
{
css::uno::Reference< css::container::XNameAccess > access(
diff --git a/test/user-template/registry-common/modifications.xcd b/test/user-template/registry-common/modifications.xcd
index b5e3ad6..1d31141 100644
--- a/test/user-template/registry-common/modifications.xcd
+++ b/test/user-template/registry-common/modifications.xcd
@@ -8,6 +8,19 @@
*
-->
<oor:data xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:oor="http://openoffice.org/2001/registry">
<oor:component-schema oor:package="org.libreoffice" oor:name="unittest">
<component>
<prop oor:name="localized" oor:localized="true" oor:type="xs:string">
</prop>
</component>
</oor:component-schema>
<oor:component-data oor:package="org.libreoffice" oor:name="unittest">
<prop oor:name="localized">
<value>default</value>
<value xml:lang="en-US">en-US</value>
<value xml:lang="pt-PT">pt-PT</value>
</prop>
</oor:component-data>
<oor:component-data xmlns:install="http://openoffice.org/2004/installation" oor:name="VCL" oor:package="org.openoffice">
<node oor:name="DefaultFonts">
<node oor:name="ar">