diff options
Diffstat (limited to 'sw/qa/extras/layout/layout3.cxx')
-rw-r--r-- | sw/qa/extras/layout/layout3.cxx | 54 |
1 files changed, 52 insertions, 2 deletions
diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx index aecea0148d..9c46d8395a 100644 --- a/sw/qa/extras/layout/layout3.cxx +++ b/sw/qa/extras/layout/layout3.cxx @@ -1572,6 +1572,20 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf145826) assertXPath(pXmlDoc, "/root/page/body/section/column[2]/ftncont/ftn"_ostr, 3); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTable0HeightRows) +{ + createSwDoc("table-0-height-rows.fodt"); + + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + CPPUNIT_ASSERT(pXmlDoc); + + // the problem was that the table was erroneously split across 2 or 3 pages + assertXPath(pXmlDoc, "/root/page[1]/body/tab"_ostr, 1); + assertXPath(pXmlDoc, "/root/page[1]/body/tab/row"_ostr, 28); + assertXPath(pXmlDoc, "/root/page[1]/body/tab/row/infos/bounds[@height='0']"_ostr, 25); + assertXPath(pXmlDoc, "/root/page"_ostr, 1); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf105481) { createSwDoc("tdf105481.odt"); @@ -1776,12 +1790,12 @@ static SwRect lcl_getVisibleFlyObjRect(SwWrtShell* pWrtShell) SwSortedObjs* pDrawObjs = pPage->GetDrawObjs(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pDrawObjs->size()); SwAnchoredObject* pDrawObj = (*pDrawObjs)[0]; - CPPUNIT_ASSERT_EQUAL(OUString("Rahmen8"), pDrawObj->GetFrameFormat().GetName()); + CPPUNIT_ASSERT_EQUAL(OUString("Rahmen8"), pDrawObj->GetFrameFormat()->GetName()); pPage = static_cast<SwPageFrame*>(pPage->GetNext()); pDrawObjs = pPage->GetDrawObjs(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pDrawObjs->size()); pDrawObj = (*pDrawObjs)[0]; - CPPUNIT_ASSERT_EQUAL(OUString("Rahmen123"), pDrawObj->GetFrameFormat().GetName()); + CPPUNIT_ASSERT_EQUAL(OUString("Rahmen123"), pDrawObj->GetFrameFormat()->GetName()); SwRect aFlyRect = pDrawObj->GetObjRect(); CPPUNIT_ASSERT(pPage->getFrameArea().Contains(aFlyRect)); return aFlyRect; @@ -2253,6 +2267,42 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf159271) assertXPath(pXmlDoc, "/root/page/body/tab/row/cell[2]/txt//SwFieldPortion"_ostr, 1); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf159259) +{ + // Given a document with a block sdt with a single field, having framePr aligned to right + createSwDoc("sdt+framePr.docx"); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + // Make sure there is only one page and one paragraph with one line and one anchored object + assertXPath(pXmlDoc, "/root/page"_ostr, 1); + // Without the fix, this would fail: there were two paragraphs + assertXPath(pXmlDoc, "/root/page/body/txt"_ostr, 1); + assertXPath(pXmlDoc, "/root/page/body/txt/SwParaPortion"_ostr, 1); + assertXPath(pXmlDoc, "/root/page/body/txt/SwParaPortion/SwLineLayout"_ostr, 1); + // Without the fix, this would fail: there was a field portion in the line + assertXPath(pXmlDoc, "/root/page/body/txt/SwParaPortion/SwLineLayout/SwFieldPortion"_ostr, 0); + // Without the fix, this would fail: there was no anchored objects + assertXPath(pXmlDoc, "/root/page/body/txt/anchored"_ostr, 1); + assertXPath(pXmlDoc, "/root/page/body/txt/anchored/fly"_ostr, 1); + + const sal_Int32 paraRight + = getXPath(pXmlDoc, "/root/page/body/txt/infos/bounds"_ostr, "right"_ostr).toInt32(); + const sal_Int32 paraHeight + = getXPath(pXmlDoc, "/root/page/body/txt/infos/bounds"_ostr, "height"_ostr).toInt32(); + + CPPUNIT_ASSERT_GREATER(sal_Int32(0), paraRight); + CPPUNIT_ASSERT_GREATER(sal_Int32(0), paraHeight); + + const sal_Int32 flyRight + = getXPath(pXmlDoc, "/root/page/body/txt/anchored/fly/infos/bounds"_ostr, "right"_ostr) + .toInt32(); + const sal_Int32 flyHeight + = getXPath(pXmlDoc, "/root/page/body/txt/anchored/fly/infos/bounds"_ostr, "height"_ostr) + .toInt32(); + + CPPUNIT_ASSERT_EQUAL(paraRight, flyRight); // The fly is right-aligned + CPPUNIT_ASSERT_EQUAL(paraHeight, flyHeight); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |