diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-11-07 14:15:49 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-11-07 14:34:01 +0100 |
commit | 55667bf69c19b2dcca6463b178c83570dffa5e10 (patch) | |
tree | 7042855316e6b5920dba95d8ab7c98e16ca01f9f /sw/qa/extras/uiwriter/uiwriter.cxx | |
parent | dfdb003fd063d9731cabce49370441ad5b111833 (diff) |
tdf#113686 sw: handle sections when counting height of first content line
When moving back a row that has a single text frame, it should not
matter if that text frame is in a section frame or not.
The problem was that the bugdoc has a split (outer) table, the follow's
ShouldBwdMoved() returned false, as
SwTabFrame::CalcHeightOfFirstContentLine() returned USHRT_MAX, as it had
no idea how to calc the height of a text frame in a section frame.
Fix this by looking "through" the section frame, and handling "text
frame" and "text frame in section frame" the same way.
Reviewed-on: https://gerrit.libreoffice.org/44393
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
(cherry picked from commit e024cad7c1365da6a198656c3ca0c32b28938e87)
Conflicts:
sw/qa/extras/uiwriter/uiwriter.cxx
Change-Id: Ic3605a1e2d28bfaa69bf18f31cfbf1e6e681c04f
Diffstat (limited to 'sw/qa/extras/uiwriter/uiwriter.cxx')
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter.cxx | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 7e791bee53ed..fa8651dbf70b 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -199,8 +199,8 @@ public: void testTdf99004(); void testTdf84695(); void testTdf84695NormalChar(); - void testParagraphOfTextRange(); void testTdf108524(); +#if 1 // HAVE_MORE_FONTS void testTableInSection(); void testTableInNestedSection(); void testTableInSectionInTable(); @@ -213,7 +213,10 @@ public: void testTdf112860(); void testTdf113287(); void testTdf113445(); + void testTdf113686(); +#endif void testLinesInSectionInTable(); + void testParagraphOfTextRange(); void testLinesMoveBackwardsInSectionInTable(); CPPUNIT_TEST_SUITE(SwUiWriterTest); @@ -316,23 +319,26 @@ public: CPPUNIT_TEST(testTdf99004); CPPUNIT_TEST(testTdf84695); CPPUNIT_TEST(testTdf84695NormalChar); - CPPUNIT_TEST(testParagraphOfTextRange); CPPUNIT_TEST(testTdf108524); CPPUNIT_TEST(testTdf108524); +#if 1 // HAVE_MORE_FONTS CPPUNIT_TEST(testTableInSection); CPPUNIT_TEST(testTableInNestedSection); - CPPUNIT_TEST(testLinesInSectionInTable); CPPUNIT_TEST(testTableInSectionInTable); CPPUNIT_TEST(testSectionInTableInTable); CPPUNIT_TEST(testSectionInTableInTable2); CPPUNIT_TEST(testSectionInTableInTable3); CPPUNIT_TEST(testSectionInTableInTable4); - CPPUNIT_TEST(testTdf112160); CPPUNIT_TEST(testLinesMoveBackwardsInSectionInTable); CPPUNIT_TEST(testTdf112741); + CPPUNIT_TEST(testTdf112160); CPPUNIT_TEST(testTdf112860); CPPUNIT_TEST(testTdf113287); CPPUNIT_TEST(testTdf113445); + CPPUNIT_TEST(testTdf113686); +#endif + CPPUNIT_TEST(testLinesInSectionInTable); + CPPUNIT_TEST(testParagraphOfTextRange); CPPUNIT_TEST_SUITE_END(); private: @@ -3908,6 +3914,32 @@ void SwUiWriterTest::testTdf113445() CPPUNIT_ASSERT_EQUAL(nCell3Top, nCell4Top); } +void SwUiWriterTest::testTdf113686() +{ + SwDoc* pDoc = createDoc("tdf113686.fodt"); + xmlDocPtr pXmlDoc = parseLayoutDump(); + assertXPath(pXmlDoc, "/root/page", 2); + sal_uInt32 nPage1LastNode = getXPath(pXmlDoc, "/root/page[1]/body/tab/row/cell[1]/tab/row/cell[1]/txt[last()]", "txtNodeIndex").toUInt32(); + CPPUNIT_ASSERT_EQUAL(OUString("Table2:A1-P10"), pDoc->GetNodes()[nPage1LastNode]->GetTextNode()->GetText()); + sal_uInt32 nPage2FirstNode = getXPath(pXmlDoc, "/root/page[2]/body/tab/row/cell[1]/section/txt[1]", "txtNodeIndex").toUInt32(); + CPPUNIT_ASSERT_EQUAL(OUString("Table1:A1"), pDoc->GetNodes()[nPage2FirstNode]->GetTextNode()->GetText()); + + // Remove page 2. + SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + while (pWrtShell->GetCursor()->Start()->nNode.GetIndex() < nPage1LastNode) + pWrtShell->Down(/*bSelect=*/false); + pWrtShell->EndPara(); + for (int i = 0; i < 3; ++i) + pWrtShell->Up(/*bSelect=*/true); + pWrtShell->DelLeft(); + + // Assert that the second page is removed. + discardDumpedLayout(); + pXmlDoc = parseLayoutDump(); + // This was still 2, content from 2nd page was not moved. + assertXPath(pXmlDoc, "/root/page", 1); +} + void SwUiWriterTest::testTableInSectionInTable() { // The document has a table, containing a section, containing a nested |