RTF import: add unit test for page break in continuous section

Change-Id: I8b766aa61b1121f9b7068f5ccbdc24ef97253432
This commit is contained in:
Michael Stahl 2014-02-28 11:55:39 +01:00
parent e3f254ab82
commit f03218f43e
2 changed files with 41 additions and 0 deletions

View File

@ -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
}

View File

@ -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.