diff options
author | Michael Stahl <mstahl@redhat.com> | 2014-02-28 11:55:39 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2014-03-03 13:53:22 +0100 |
commit | f03218f43e8c25c2e136d364455f3cdaf95362b6 (patch) | |
tree | dd70b538411340c50e638f63c83150be63a15319 /sw/qa/extras/rtfimport | |
parent | e3f254ab8211fbab7541cde2100a35c875b0c240 (diff) |
RTF import: add unit test for page break in continuous section
Change-Id: I8b766aa61b1121f9b7068f5ccbdc24ef97253432
Diffstat (limited to 'sw/qa/extras/rtfimport')
-rw-r--r-- | sw/qa/extras/rtfimport/data/cont-section-pagebreak.rtf | 16 | ||||
-rw-r--r-- | sw/qa/extras/rtfimport/rtfimport.cxx | 25 |
2 files changed, 41 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfimport/data/cont-section-pagebreak.rtf b/sw/qa/extras/rtfimport/data/cont-section-pagebreak.rtf new file mode 100644 index 000000000000..888dc2d0293e --- /dev/null +++ b/sw/qa/extras/rtfimport/data/cont-section-pagebreak.rtf @@ -0,0 +1,16 @@ +{\rtf1 \ansi +\fet0 \ftnbj \paperw11905 \paperh16837 \margt2267 \margb1133 \margl1417 \margr1417 + +\sectd +\sbknone +FIRST +\par +\sect +SECOND +\par +\page +\sect +THIRD +\par +\sect +} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 2c119f3bf76b..379475e84d9b 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -17,6 +17,7 @@ #include <com/sun/star/drawing/LineStyle.hpp> #include <com/sun/star/graphic/GraphicType.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/style/BreakType.hpp> #include <com/sun/star/style/CaseMap.hpp> #include <com/sun/star/style/LineSpacing.hpp> #include <com/sun/star/style/LineSpacingMode.hpp> @@ -1420,6 +1421,30 @@ DECLARE_RTFIMPORT_TEST(testNestedTable, "rhbz1065629.rtf") CPPUNIT_ASSERT_EQUAL(1, getPages()); } +DECLARE_RTFIMPORT_TEST(testContSectionPageBreak, "cont-section-pagebreak.rtf") +{ + uno::Reference<text::XTextRange> xParaSecond = getParagraph(2); + CPPUNIT_ASSERT_EQUAL(OUString("SECOND"), xParaSecond->getString()); + CPPUNIT_ASSERT_EQUAL(style::BreakType_NONE, + getProperty<style::BreakType>(xParaSecond, "BreakType")); + CPPUNIT_ASSERT_EQUAL(OUString(""), + getProperty<OUString>(xParaSecond, "PageDescName")); + // actually not sure how many paragraph there should be between + // SECOND and THIRD - important is that the page break is on there + uno::Reference<text::XTextRange> xParaNext = getParagraph(3); + CPPUNIT_ASSERT_EQUAL(OUString(""), xParaNext->getString()); + CPPUNIT_ASSERT_EQUAL(OUString("Converted1"), + getProperty<OUString>(xParaNext, "PageDescName")); + uno::Reference<text::XTextRange> xParaThird = getParagraph(4); + CPPUNIT_ASSERT_EQUAL(OUString("THIRD"), xParaThird->getString()); + CPPUNIT_ASSERT_EQUAL(style::BreakType_NONE, + getProperty<style::BreakType>(xParaThird, "BreakType")); + CPPUNIT_ASSERT_EQUAL(OUString(""), + getProperty<OUString>(xParaThird, "PageDescName")); + + CPPUNIT_ASSERT_EQUAL(2, getPages()); +} + DECLARE_RTFIMPORT_TEST(testCp1000016, "hello.rtf") { // The single-line document had a second fake empty para on Windows. |