diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2019-07-22 21:14:50 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-07-23 13:48:53 +0200 |
commit | 413956ae4c1e833d7ecb6e3695bcdec92533c2ce (patch) | |
tree | 843e54bc5435aa8f4e316ca71e724316e9e95e54 | |
parent | 25cf4dad747c506ef7cd25f6aaffac627d8fd0f5 (diff) |
RTF import: add tests for RTF_TLMDOT/HYPH/TH/EQ
lcov points out these were not covered previously. Also, Word maps TH to
underline and EQ to nothing, so do the same.
Change-Id: I994f78cbe1c6c2edec73edc8944f739e2a7cb8d8
Reviewed-on: https://gerrit.libreoffice.org/76144
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r-- | sw/qa/extras/rtfexport/data/tab-stop-fill-chars.rtf | 14 | ||||
-rw-r--r-- | sw/qa/extras/rtfexport/rtfexport4.cxx | 23 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdispatchflag.cxx | 7 |
3 files changed, 39 insertions, 5 deletions
diff --git a/sw/qa/extras/rtfexport/data/tab-stop-fill-chars.rtf b/sw/qa/extras/rtfexport/data/tab-stop-fill-chars.rtf new file mode 100644 index 000000000000..f1fc4e8e2284 --- /dev/null +++ b/sw/qa/extras/rtfexport/data/tab-stop-fill-chars.rtf @@ -0,0 +1,14 @@ +{\rtf1 +\pard \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\tlmdot\tx2520\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid1061119 +{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid1061119 \tab \hich\af37\dbch\af37\loch\f37 tlmdot +\par } +\pard \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\tlhyph\tx2520\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid1061119 +{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid1061119 \tab \hich\af37\dbch\af37\loch\f37 tlhyph +\par } +\pard \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\tlth\tx2520\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid1061119 +{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid1061119 \tab \hich\af37\dbch\af37\loch\f37 tlth +\par } +\pard \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\tleq\tx2520\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid1061119 +{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid1061119 \tab \hich\af37\dbch\af37\loch\f37 tleq +\par } +} diff --git a/sw/qa/extras/rtfexport/rtfexport4.cxx b/sw/qa/extras/rtfexport/rtfexport4.cxx index 0d86a00df960..6b75eda278fd 100644 --- a/sw/qa/extras/rtfexport/rtfexport4.cxx +++ b/sw/qa/extras/rtfexport/rtfexport4.cxx @@ -105,6 +105,29 @@ DECLARE_RTFEXPORT_TEST(testCjklist34, "cjklist34.rtf") CPPUNIT_ASSERT_EQUAL(style::NumberingType::NUMBER_UPPER_ZH_TW, numFormat); } +DECLARE_RTFIMPORT_TEST(testTabStopFillChars, "tab-stop-fill-chars.rtf") +{ + // tlmdot + auto aTabstops = getProperty<uno::Sequence<style::TabStop>>(getParagraph(1), "ParaTabStops"); + CPPUNIT_ASSERT(aTabstops.hasElements()); + CPPUNIT_ASSERT_EQUAL(u'·', aTabstops[0].FillChar); + + // tlhyph + aTabstops = getProperty<uno::Sequence<style::TabStop>>(getParagraph(2), "ParaTabStops"); + CPPUNIT_ASSERT(aTabstops.hasElements()); + CPPUNIT_ASSERT_EQUAL(u'-', aTabstops[0].FillChar); + + // tlth + aTabstops = getProperty<uno::Sequence<style::TabStop>>(getParagraph(3), "ParaTabStops"); + CPPUNIT_ASSERT(aTabstops.hasElements()); + CPPUNIT_ASSERT_EQUAL(u'_', aTabstops[0].FillChar); + + // tleq + aTabstops = getProperty<uno::Sequence<style::TabStop>>(getParagraph(4), "ParaTabStops"); + CPPUNIT_ASSERT(aTabstops.hasElements()); + CPPUNIT_ASSERT_EQUAL(u' ', aTabstops[0].FillChar); +} + DECLARE_RTFEXPORT_TEST(testCjklist38, "cjklist38.rtf") { sal_Int16 numFormat = getNumberingTypeOfParagraph(1); diff --git a/writerfilter/source/rtftok/rtfdispatchflag.cxx b/writerfilter/source/rtftok/rtfdispatchflag.cxx index 32de52c40b32..c8f65d57369f 100644 --- a/writerfilter/source/rtftok/rtfdispatchflag.cxx +++ b/writerfilter/source/rtftok/rtfdispatchflag.cxx @@ -150,14 +150,11 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) nParam = NS_ooxml::LN_Value_ST_TabTlc_hyphen; break; case RTF_TLUL: + case RTF_TLTH: nParam = NS_ooxml::LN_Value_ST_TabTlc_underscore; break; - case RTF_TLTH: - nParam = NS_ooxml::LN_Value_ST_TabTlc_hyphen; - break; // thick line is not supported by dmapper, this is just a hack case RTF_TLEQ: - nParam = NS_ooxml::LN_Value_ST_TabTlc_none; - break; // equal sign isn't, either + break; default: break; } |