[Libreoffice-commits] .: filter/source sw/qa

Miklos Vajna vmiklos at kemper.freedesktop.org
Wed Apr 25 06:03:44 PDT 2012


 filter/source/msfilter/util.cxx       |    2 ++
 sw/qa/extras/rtftok/data/fdo44211.rtf |    4 ++++
 sw/qa/extras/rtftok/rtftok.cxx        |   25 ++++++++++++++++++++++++-
 3 files changed, 30 insertions(+), 1 deletion(-)

New commits:
commit a8c05ae840f2673803d9784600be9a7b734076fc
Author: Aurimas Fišeras <aurimas at members.fsf.org>
Date:   Sat Apr 21 23:01:09 2012 +0300

    fdo#44211 (RTF) return default text encoding for Lithuanian

diff --git a/filter/source/msfilter/util.cxx b/filter/source/msfilter/util.cxx
index 62edc7f..76fe07c 100644
--- a/filter/source/msfilter/util.cxx
+++ b/filter/source/msfilter/util.cxx
@@ -46,6 +46,8 @@ rtl_TextEncoding getBestTextEncodingFromLocale(const ::com::sun::star::lang::Loc
         return RTL_TEXTENCODING_MS_1253;
     if (rLanguage == "tr")
         return RTL_TEXTENCODING_MS_1254;
+    if (rLanguage == "lt")
+        return RTL_TEXTENCODING_MS_1257;
     return RTL_TEXTENCODING_MS_1252;
 }
 
diff --git a/sw/qa/extras/rtftok/data/fdo44211.rtf b/sw/qa/extras/rtftok/data/fdo44211.rtf
new file mode 100644
index 0000000..699ce73
--- /dev/null
+++ b/sw/qa/extras/rtftok/data/fdo44211.rtf
@@ -0,0 +1,4 @@
+{\rtf1\ansi\deff0{\fonttbl{\f0 Helvetica;}}
+\pard\f0\fs20\'e0\'e8\'e6
+\par
+}
diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx
index 48e33e2..e416889 100644
--- a/sw/qa/extras/rtftok/rtftok.cxx
+++ b/sw/qa/extras/rtftok/rtftok.cxx
@@ -87,6 +87,7 @@ public:
     void testFdo48023();
     void testFdo48876();
     void testFdo48193();
+    void testFdo44211();
 
     CPPUNIT_TEST_SUITE(RtfModelTest);
 #if !defined(MACOSX) && !defined(WNT)
@@ -113,7 +114,7 @@ public:
     CPPUNIT_TEST(testFdo48356);
     CPPUNIT_TEST(testFdo48023);
     CPPUNIT_TEST(testFdo48876);
-    CPPUNIT_TEST(testFdo48193);
+    CPPUNIT_TEST(testFdo44211);
 #endif
     CPPUNIT_TEST_SUITE_END();
 
@@ -624,6 +625,28 @@ void RtfModelTest::testFdo48193()
     CPPUNIT_ASSERT_EQUAL(7, getLength());
 }
 
+void RtfModelTest::testFdo44211()
+{
+    lang::Locale aLocale;
+    aLocale.Language = "lt";
+    AllSettings aSettings(Application::GetSettings());
+    AllSettings aSavedSettings(aSettings);
+    aSettings.SetLocale(aLocale);
+    Application::SetSettings(aSettings);
+    load("fdo44211.rtf");
+    Application::SetSettings(aSavedSettings);
+
+    uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
+    uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
+    uno::Reference<container::XEnumerationAccess> xRangeEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY);
+    uno::Reference<container::XEnumeration> xRangeEnum = xRangeEnumAccess->createEnumeration();
+    uno::Reference<text::XTextRange> xTextRange(xRangeEnum->nextElement(), uno::UNO_QUERY);
+
+    OUString aExpected("ąčę", 6, RTL_TEXTENCODING_UTF8);
+    CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(RtfModelTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();


More information about the Libreoffice-commits mailing list