summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-06-20 09:21:10 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-08-23 10:58:33 +0200
commitb50c8680f36ea89fcd1411a9c37a139aa55a30cd (patch)
treea06eacdf4c037de02de249053a29d6994f0a5c39 /sw/qa
parent7824d47b66d820fb4b48ebc0a356017b707b73a1 (diff)
tdf#108524 sw: add split section in table testcase
And if we're at it, test the other way around as well, I almost broke it. Reviewed-on: https://gerrit.libreoffice.org/38999 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org> (cherry picked from commit e9d2016648c7fdfc57932ac0793547cf099749be) Conflicts: sw/qa/extras/uiwriter/uiwriter.cxx Change-Id: Ia81e46f218336e5db13dafdbad7b896d8dadaf46
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/extras/uiwriter/data/table-in-sect.odtbin0 -> 11744 bytes
-rw-r--r--sw/qa/extras/uiwriter/data/tdf108524.odtbin0 -> 9053 bytes
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx30
3 files changed, 30 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/data/table-in-sect.odt b/sw/qa/extras/uiwriter/data/table-in-sect.odt
new file mode 100644
index 000000000000..f439edef997e
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/table-in-sect.odt
Binary files differ
diff --git a/sw/qa/extras/uiwriter/data/tdf108524.odt b/sw/qa/extras/uiwriter/data/tdf108524.odt
new file mode 100644
index 000000000000..d8978b269cab
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/tdf108524.odt
Binary files differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 36c1a5a10199..54fedd55ddd6 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -202,6 +202,8 @@ public:
void testTdf78727();
void testTdf104814();
void testParagraphOfTextRange();
+ void testTdf108524();
+ void testTableInSection();
CPPUNIT_TEST_SUITE(SwUiWriterTest);
CPPUNIT_TEST(testReplaceForward);
@@ -306,6 +308,8 @@ public:
CPPUNIT_TEST(testTdf78727);
CPPUNIT_TEST(testTdf104814);
CPPUNIT_TEST(testParagraphOfTextRange);
+ CPPUNIT_TEST(testTdf108524);
+ CPPUNIT_TEST(testTableInSection);
CPPUNIT_TEST_SUITE_END();
private:
@@ -3753,6 +3757,32 @@ void SwUiWriterTest::testParagraphOfTextRange()
CPPUNIT_ASSERT_EQUAL(OUString("In section"), xParagraph->getString());
}
+void SwUiWriterTest::testTdf108524()
+{
+ createDoc("tdf108524.odt");
+ xmlDocPtr pXmlDoc = parseLayoutDump();
+ // In total we expect two cells containing a section.
+ assertXPath(pXmlDoc, "/root/page/body/tab/row/cell/section", 2);
+
+ assertXPath(pXmlDoc, "/root/page[1]/body/tab/row/cell/section", 1);
+ // This was 0, section wasn't split, instead it was only on the first page
+ // and it was cut off.
+ assertXPath(pXmlDoc, "/root/page[2]/body/tab/row/cell/section", 1);
+}
+
+void SwUiWriterTest::testTableInSection()
+{
+ // The document has a section, containing a table that spans over 2 pages.
+ createDoc("table-in-sect.odt");
+ xmlDocPtr pXmlDoc = parseLayoutDump();
+ // In total we expect 4 cells.
+ assertXPath(pXmlDoc, "/root/page/body/section/tab/row/cell", 4);
+
+ // Assert that on both pages the section contains 2 cells.
+ assertXPath(pXmlDoc, "/root/page[1]/body/section/tab/row/cell", 2);
+ assertXPath(pXmlDoc, "/root/page[2]/body/section/tab/row/cell", 2);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
CPPUNIT_PLUGIN_IMPLEMENT();