summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorVasily Melenchuk <vasily.melenchuk@cib.de>2022-06-16 12:16:33 +0300
committerThorsten Behrens <thorsten.behrens@allotropia.de>2022-07-12 21:16:48 +0200
commita4ab155ae15e9e6d4deb157634f8b86c87fcbde4 (patch)
tree70274f5a3bff02ac73725f2a149fe8a092610fba /sw
parenta73daa562c82a5c058a217ba80035da08d40451d (diff)
tdf#149313: DOCX import: improved conditions for removeparagraph
Quite complex conditions to define if current paragraph can be removed for document were forcing to keep paragraphs after page break with only section definition. Usually these pars are removed, but since tdf#103975 fix they were kept. It looks like to resolve that problem will be enough to ensure current break is a column break: they are bit different and processed in a different way unlike other break types. So this condition part instead of "do not remove par with section info after any break" it is right now "do not remove par after column break". Change-Id: Ib6290dc6254430883a598bef3ecd1f7ab7063922 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135969 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf149313.docxbin0 -> 2106 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport12.cxx2
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport17.cxx13
3 files changed, 15 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf149313.docx b/sw/qa/extras/ooxmlexport/data/tdf149313.docx
new file mode 100644
index 000000000000..4c0c454b42a6
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf149313.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
index 5573a1b1adf2..d027706de65d 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
@@ -689,6 +689,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf112202, "090716_Studentische_Arbeit_VWS.docx")
assertXPath(pXmlDoc, "/root/page[3]/header/tab", 1);
assertXPath(pXmlDoc, "/root/page[3]/header/tab/row/cell/txt/Text", 0);
assertXPath(pXmlDoc, "/root/page[3]/header//anchored", 0);
+ // tdf#149313: ensure 3rd page does not have extra empty paragraph at top
+ assertXPathContent(pXmlDoc, "/root/page[3]/body//txt", "AUFGABENSTELLUNG");
// page 4 header: 1 table, 1 paragraph, with text
assertXPath(pXmlDoc, "/root/page[4]/header/txt", 1);
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
index 496a7cfaed02..93ad3abf2da6 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
@@ -1018,6 +1018,19 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf149200)
CPPUNIT_ASSERT_EQUAL(OUString("dark1"), getXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/w:rPr/w:color", "themeColor"));
}
+DECLARE_OOXMLEXPORT_TEST(testTdf149313, "tdf149313.docx")
+{
+ // only 2, but not 3 pages in document
+ CPPUNIT_ASSERT_EQUAL(2, getPages());
+
+ xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+ // And ensure that pages are with correct sections (have correct dimensions)
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(4989), getXPath(pXmlDoc, "/root/page[1]/infos/bounds", "height").toInt32());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(4989), getXPath(pXmlDoc, "/root/page[1]/infos/bounds", "width").toInt32());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(4989), getXPath(pXmlDoc, "/root/page[2]/infos/bounds", "height").toInt32());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(8000), getXPath(pXmlDoc, "/root/page[2]/infos/bounds", "width").toInt32());
+}
+
DECLARE_OOXMLEXPORT_TEST(testTdf135923, "tdf135923-min.docx")
{
uno::Reference<text::XText> xShape(getShape(1), uno::UNO_QUERY);