summaryrefslogtreecommitdiff
path: root/sw/qa/extras/rtfimport
diff options
context:
space:
mode:
Diffstat (limited to 'sw/qa/extras/rtfimport')
-rw-r--r--sw/qa/extras/rtfimport/data/cont-section-pagebreak.rtf16
-rw-r--r--sw/qa/extras/rtfimport/data/footer-para.rtf5
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx42
3 files changed, 63 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/data/footer-para.rtf b/sw/qa/extras/rtfimport/data/footer-para.rtf
new file mode 100644
index 000000000000..28863b202f17
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/footer-para.rtf
@@ -0,0 +1,5 @@
+{\rtf1\fbidis\ansi\ansicpg0\uc0\deff0\deflang0\deflangfe0\paperw11905\paperh16838\margl1200\margr1200\margt1200\margb1200\headery600\footery600\viewscale100\viewzk0\titlepg
+{\fonttbl{\f0\fnil Arial;}}
+{\footerf
+\pard\s0\fi0\li0\qc\ri0\sb0\sa0\itap0 \plain \f0\fs18 All Rights Reserved.\par}
+\pard\par}
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")