summaryrefslogtreecommitdiff
path: root/sw/qa/extras/rtfexport
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-08-05 21:48:24 +0200
committerMiklos Vajna <vmiklos@collabora.com>2019-08-06 09:06:01 +0200
commit600025475630c59c53a9086ba6d95124416725b3 (patch)
treedbe3495a336a1f22a1a9a5e5723771802e4da8ce /sw/qa/extras/rtfexport
parent5841be069cf9891669b385f62f2e7f8d8e877981 (diff)
tdf#126309 RTF import: fix not needed para adjust swap for bidi text
Regression from commit 4ee2a882dddb395a816cd54004b634d57cfb2446 (tdf#86182 RTF import: fix handling of \rtlpar, 2015-04-17), now that we don't ignore \rtlpar, it turned out that dmapper should not do paragraph alignment left/right swapping for RTF. It seems this is needed for DOCX, but not for legacy DOC/RTF. See how SwWW8ImplReader::Read_Justify() doesn't do this, either, so this is one of those rare cases when dmapper has to know if the token stream is generated by the DOCX or the RTF tokenizers. Change-Id: Ibd52e3dc9e782e1d985418085b82b2e2628bc1dd Reviewed-on: https://gerrit.libreoffice.org/76995 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/qa/extras/rtfexport')
-rw-r--r--sw/qa/extras/rtfexport/data/tdf126309.rtf8
-rw-r--r--sw/qa/extras/rtfexport/rtfexport4.cxx9
2 files changed, 17 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfexport/data/tdf126309.rtf b/sw/qa/extras/rtfexport/data/tdf126309.rtf
new file mode 100644
index 000000000000..513061e49875
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf126309.rtf
@@ -0,0 +1,8 @@
+{\rtf1
+\pard\plain \rtlpar
+\s33\qr \li0\ri0\sb240\keepn\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid14905282 \rtlch\fcs1 \ab\af0\afs20\alang1025 \ltrch\fcs0 \b\fs20\lang1031\langfe1033\loch\af1\hich\af1\dbch\af13\cgrid\langnp1031\langfenp1033
+{
+\ltrch\fcs1 \alang1037 \rtlch\fcs0 \f1\fs20\lang1037\langnp1037\langfenp1037\insrsid7674863 1}
+{\rtlch\fcs1 \af0 \ltrch\fcs0 \lang1033\langfe1033\langnp1033\insrsid7674863\charrsid14905282
+\par }
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport4.cxx b/sw/qa/extras/rtfexport/rtfexport4.cxx
index 253c3b3b4735..1a261892661e 100644
--- a/sw/qa/extras/rtfexport/rtfexport4.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport4.cxx
@@ -180,6 +180,15 @@ DECLARE_RTFIMPORT_TEST(testPageBorder, "page-border.rtf")
CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(71), aRightBorder.LineWidth);
}
+DECLARE_RTFIMPORT_TEST(testTdf126309, "tdf126309.rtf")
+{
+ // Without the accompanying fix in place, this test would have failed, as
+ // the paragraph was aligned to left, not right.
+ CPPUNIT_ASSERT_EQUAL(
+ style::ParagraphAdjust_RIGHT,
+ static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>(getParagraph(1), "ParaAdjust")));
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */