summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2023-12-27 18:58:33 -0500
committerJustin Luth <jluth@mail.com>2023-12-29 03:44:03 +0100
commit8d37b8e6430715860934ccaec8c0d1b448ac4d8c (patch)
treef63ebd6ebec0a8beb419cb3decad0e2d7088b6f9 /sw
parent8d247e3ad47e0b828437abb019e1573dbb1c05b1 (diff)
tdf#158826 rtfimport: ignore page break before document starts
This avoids a 24.2 exposed bug from my commit 016f779ee6c7f601be3ae19dc57497e63a5bf817 RTF import simply cannot be relied upon to create paragraphs where they need to be. A side effect of fixing frames is that spurious paragraphs can be created, and if a frame starts the document, then an otherwise ignored page break can be attached to the second paragraph and thus become exposed. This seems pretty much like the RTF implementation of what was done for DOC and DOCX for tdf#118711. At least it is related. make CppunitTest_sw_rtfexport8 CPPUNIT_TEST_NAME=testTdf158826_extraCR The following unit tests trigger this code (with no visible change) abi10076.odt tdf121623.rtf tdf129513.rtf tdf131963.docx Change-Id: I21afa826b6f6fbb735591603a0620b8b47de517e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161374 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161395
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/rtfexport/data/tdf158826_extraCR.rtf23
-rw-r--r--sw/qa/extras/rtfexport/rtfexport8.cxx14
2 files changed, 37 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfexport/data/tdf158826_extraCR.rtf b/sw/qa/extras/rtfexport/data/tdf158826_extraCR.rtf
new file mode 100644
index 000000000000..5461327da3ca
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf158826_extraCR.rtf
@@ -0,0 +1,23 @@
+{\rtf1
+\landscape\paperh5953\paperw8391\margl720\margr720\margt432\margb1728\gutter0\ltrsect
+
+
+\pagebb
+\intbl
+\pvpg\phpg
+
+\posx720\posy432
+\dxfrtext187\dfrmtxtx187\dfrmtxty0
+\wraparound\aspalpha\aspnum
+\faauto\adjustright
+\rin0\lin0\absnoovrlp1\pararsid5332093\yts39
+
+
+\shp
+
+
+a \cell b{\cell }
+\clwWidth6300\clshdrawnil \cellx6295
+\clwWidth4500\clshdrawnil \cellx10795\row
+
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport8.cxx b/sw/qa/extras/rtfexport/rtfexport8.cxx
index f8d800380cba..9848d0573db8 100644
--- a/sw/qa/extras/rtfexport/rtfexport8.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport8.cxx
@@ -36,6 +36,8 @@
using namespace css;
+namespace
+{
class Test : public SwModelTestBase
{
public:
@@ -84,6 +86,18 @@ DECLARE_RTFEXPORT_TEST(testTdf158586_lostFrame, "tdf158586_lostFrame.rtf")
// CPPUNIT_ASSERT_EQUAL(2, getPages());
}
+DECLARE_RTFEXPORT_TEST(testTdf158826_extraCR, "tdf158826_extraCR.rtf")
+{
+ // Note: this is a hand-minimized sample, and very likely doesn't follow RTF { } rules...
+
+ // The page break defined before the document content should not cause a page break
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
+
+ // There is a two-column floating table [that SHOULD be getParagraphOrTable(1)]
+ uno::Reference<text::XTextTable> xTable(getParagraphOrTable(2), uno::UNO_QUERY_THROW);
+}
+
+} // end of anonymous namespace
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */