summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-04-21 11:25:18 +0200
committerMiklos Vajna <vmiklos@suse.cz>2012-04-21 11:57:19 +0200
commitf8bda240a09b4ece1c3401874b3cc8f325dbcedb (patch)
tree3d59ce78a08694416a48d6005b916a09a923e8ca /sw
parent2abba84aa7c639011956721a4922653130dd09a6 (diff)
fdo#48023 fix RTF import of Russian characters without an encoding specified
lcl_GetDefaultTextEncodingForRTF() in editeng did the same.
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/rtftok/data/fdo48023.rtf8
-rw-r--r--sw/qa/extras/rtftok/rtftok.cxx25
2 files changed, 33 insertions, 0 deletions
diff --git a/sw/qa/extras/rtftok/data/fdo48023.rtf b/sw/qa/extras/rtftok/data/fdo48023.rtf
new file mode 100644
index 000000000000..6d6a0d9b551e
--- /dev/null
+++ b/sw/qa/extras/rtftok/data/fdo48023.rtf
@@ -0,0 +1,8 @@
+{\rtf
+{\fonttbl
+{\f1 Arial;}
+}
+\pard
+\f1 Программист
+\par
+}
diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx
index fa1321f25ef0..6870f0202e86 100644
--- a/sw/qa/extras/rtftok/rtftok.cxx
+++ b/sw/qa/extras/rtftok/rtftok.cxx
@@ -82,6 +82,7 @@ public:
void testFdo44176();
void testFdo39053();
void testFdo48356();
+ void testFdo48023();
CPPUNIT_TEST_SUITE(RtfModelTest);
#if !defined(MACOSX) && !defined(WNT)
@@ -106,6 +107,7 @@ public:
CPPUNIT_TEST(testFdo44176);
CPPUNIT_TEST(testFdo39053);
CPPUNIT_TEST(testFdo48356);
+ CPPUNIT_TEST(testFdo48023);
#endif
CPPUNIT_TEST_SUITE_END();
@@ -574,6 +576,29 @@ void RtfModelTest::testFdo48356()
CPPUNIT_ASSERT_EQUAL(1, i);
}
+void RtfModelTest::testFdo48023()
+{
+ lang::Locale aLocale;
+ aLocale.Language = "ru";
+ AllSettings aSettings(Application::GetSettings());
+ AllSettings aSavedSettings(aSettings);
+ aSettings.SetLocale(aLocale);
+ Application::SetSettings(aSettings);
+ load("fdo48023.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);
+
+ // Implicit encoding detection based on locale was missing
+ OUString aExpected("Программист", 22, RTL_TEXTENCODING_UTF8);
+ CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString());
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(RtfModelTest);
CPPUNIT_PLUGIN_IMPLEMENT();