summaryrefslogtreecommitdiff
path: root/desktop/qa
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2017-03-23 21:27:18 +0100
committerJan Holesovsky <kendy@collabora.com>2017-03-24 19:05:42 +0100
commita9d218fd74f4fd4f934fecbbc16af9111ded5e67 (patch)
tree7359d35e87a4a41c982a93a9ba4929d831feee0a /desktop/qa
parent4ea53461a8b573d5254c25eab2ffdd5c88032c6b (diff)
lok: Allow setting of the language during load.
Conflicts: desktop/CppunitTest_desktop_app.mk desktop/qa/desktop_lib/test_desktop_lib.cxx include/LibreOfficeKit/LibreOfficeKit.hxx Change-Id: I9dbb62950e639376c26122ceb9fcec2982b3ca82
Diffstat (limited to 'desktop/qa')
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx30
1 files changed, 30 insertions, 0 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index ad7cf926f747..6a2cd225f603 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -106,6 +106,7 @@ public:
void testPaintPartTile();
void testWriterCommentInsertCursor();
void testGetFontSubset();
+ void testExtractParameter();
CPPUNIT_TEST_SUITE(DesktopLOKTest);
CPPUNIT_TEST(testGetStyles);
@@ -140,6 +141,7 @@ public:
CPPUNIT_TEST(testPaintPartTile);
CPPUNIT_TEST(testWriterCommentInsertCursor);
CPPUNIT_TEST(testGetFontSubset);
+ CPPUNIT_TEST(testExtractParameter);
CPPUNIT_TEST_SUITE_END();
uno::Reference<lang::XComponent> mxComponent;
@@ -1445,6 +1447,34 @@ void DesktopLOKTest::testGetFontSubset()
comphelper::LibreOfficeKit::setActive(false);
}
+void DesktopLOKTest::testExtractParameter()
+{
+ OUString aOptions("Language=de-DE");
+ OUString aValue = extractParameter(aOptions, "Language");
+ CPPUNIT_ASSERT_EQUAL(OUString("de-DE"), aValue);
+ CPPUNIT_ASSERT_EQUAL(OUString(), aOptions);
+
+ aOptions = "Language=en-US,Something";
+ aValue = extractParameter(aOptions, "Language");
+ CPPUNIT_ASSERT_EQUAL(OUString("en-US"), aValue);
+ CPPUNIT_ASSERT_EQUAL(OUString("Something"), aOptions);
+
+ aOptions = "SomethingElse,Language=cs-CZ";
+ aValue = extractParameter(aOptions, "Language");
+ CPPUNIT_ASSERT_EQUAL(OUString("cs-CZ"), aValue);
+ CPPUNIT_ASSERT_EQUAL(OUString("SomethingElse"), aOptions);
+
+ aOptions = "Something1,Language=hu-HU,Something2";
+ aValue = extractParameter(aOptions, "Language");
+ CPPUNIT_ASSERT_EQUAL(OUString("hu-HU"), aValue);
+ CPPUNIT_ASSERT_EQUAL(OUString("Something1,Something2"), aOptions);
+
+ aOptions = "Something1,Something2=blah,Something3";
+ aValue = extractParameter(aOptions, "Language");
+ CPPUNIT_ASSERT_EQUAL(OUString(), aValue);
+ CPPUNIT_ASSERT_EQUAL(OUString("Something1,Something2=blah,Something3"), aOptions);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest);
CPPUNIT_PLUGIN_IMPLEMENT();