summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-04-04 10:29:49 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-04-04 10:53:27 +0200
commit8baff038befe47957967278a7225bc48e0d89889 (patch)
tree8ff19d84a6f61be06c56306579cb51a4b78993b2 /sw/qa
parentad6c7bc74ca9aac32a47bc9428c36bf1d71c400a (diff)
fdo#76628 RTF import: allow the same font to have multiple encodings
Commit bbe3627eece0c3486e7ea11f2f13377aaa3a8fed (rtftok: stop sending sprm:CRgFtc{0,1,2} tokens, 2014-03-05) dropped support for case when a font name is used in multiple entries in the font table, but with different encodings. Turns out that this is a valid use-case, so revert back to the old behavior where the key of the encoding table is the font index, not the font name. Change-Id: I048dff58af801d704fd4bc75a6a4dcb0f03bf185
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/extras/rtfimport/data/fdo76628.rtf10
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx12
2 files changed, 22 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfimport/data/fdo76628.rtf b/sw/qa/extras/rtfimport/data/fdo76628.rtf
new file mode 100644
index 000000000000..9429fb88e938
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo76628.rtf
@@ -0,0 +1,10 @@
+{\rtf1\deff0
+{\fonttbl
+{\f0\froman\fcharset204\fprq2 Times New Roman;}
+{\f18\froman\fcharset0\fprq2 Times New Roman;}
+}
+{\header \pard\plain \'cf\'ee\'e4\'e3\'ee\'f2\'ee\'e2\'eb\'e5\'ed\'ee
+\par }
+{\pard\plain \'ce\'c1\'d0\'c0\'c7\'c5\'d6
+\par }
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index cb19476e9d64..2a5694177714 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1619,6 +1619,18 @@ DECLARE_RTFIMPORT_TEST(testDprectAnchor, "dprect-anchor.rtf")
CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType"));
}
+DECLARE_RTFIMPORT_TEST(testFdo76628, "fdo76628.rtf")
+{
+ OUString aExpected("\xd0\x9e\xd0\x91\xd0\xa0\xd0\x90\xd0\x97\xd0\x95\xd0\xa6", 14, RTL_TEXTENCODING_UTF8);
+ // Should be 'SAMPLE' in Russian, was garbage.
+ getParagraph(1, aExpected);
+
+ uno::Reference<text::XText> xHeaderText = getProperty< uno::Reference<text::XText> >(getStyles("PageStyles")->getByName(DEFAULT_STYLE), "HeaderText");
+ OUString aExpectedHeader("\xd0\x9f\xd0\xbe\xd0\xb4\xd0\xb3\xd0\xbe\xd1\x82\xd0\xbe\xd0\xb2\xd0\xbb\xd0\xb5\xd0\xbd\xd0\xbe", 24, RTL_TEXTENCODING_UTF8);
+ // Should be 'prepared' in Russian, was garbage.
+ getParagraphOfText(1, xHeaderText, aExpectedHeader);
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */