diff options
Diffstat (limited to 'sw/qa/extras/rtfimport/rtfimport.cxx')
-rw-r--r-- | sw/qa/extras/rtfimport/rtfimport.cxx | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 950402790cd4..73bf74921801 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> @@ -1413,6 +1414,47 @@ DECLARE_RTFIMPORT_TEST(testNestedTable, "rhbz1065629.rtf") getProperty<table::BorderLine2>(xCell, "RightBorder")); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0xffffffff), getProperty<sal_Int32>(xCell, "BackColor")); + + // \sect at the end resulted in spurious page break + 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(testFooterPara, "footer-para.rtf") +{ + // check that paragraph properties in footer are imported + uno::Reference<text::XText> xFooterText = + getProperty< uno::Reference<text::XText> >( + getStyles("PageStyles")->getByName("First Page"), "FooterText"); + uno::Reference<text::XTextContent> xParagraph = + getParagraphOrTable(1, xFooterText); + CPPUNIT_ASSERT_EQUAL(OUString("All Rights Reserved."), + uno::Reference<text::XTextRange>(xParagraph, uno::UNO_QUERY)->getString()); + CPPUNIT_ASSERT_EQUAL((sal_Int16)style::ParagraphAdjust_CENTER, + getProperty</*style::ParagraphAdjust*/sal_Int16>(xParagraph, "ParaAdjust")); } DECLARE_RTFIMPORT_TEST(testCp1000016, "hello.rtf") |