From adb203bc05e3e36173cbd46b9951f79821a81799 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 11:27:54 +0200 Subject: Merging upstream version 4:24.2.1. Signed-off-by: Daniel Baumann --- sw/qa/extras/layout/data/sdt+framePr.docx | Bin 0 -> 12343 bytes sw/qa/extras/layout/data/table-0-height-rows.fodt | 630 ++++++++++++++++++++++ sw/qa/extras/layout/layout3.cxx | 54 +- 3 files changed, 682 insertions(+), 2 deletions(-) create mode 100644 sw/qa/extras/layout/data/sdt+framePr.docx create mode 100644 sw/qa/extras/layout/data/table-0-height-rows.fodt (limited to 'sw/qa/extras/layout') diff --git a/sw/qa/extras/layout/data/sdt+framePr.docx b/sw/qa/extras/layout/data/sdt+framePr.docx new file mode 100644 index 0000000000..d46bcbfaa7 Binary files /dev/null and b/sw/qa/extras/layout/data/sdt+framePr.docx differ diff --git a/sw/qa/extras/layout/data/table-0-height-rows.fodt b/sw/qa/extras/layout/data/table-0-height-rows.fodt new file mode 100644 index 0000000000..f32e2fbe99 --- /dev/null +++ b/sw/qa/extras/layout/data/table-0-height-rows.fodt @@ -0,0 +1,630 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + dfghdfgnhdfgnhdbhfghndhgbhdfbh + + + von + + + bis + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + fgdhgfhdfbhfbhfbhfgbfdbhdfbhfgbnfdbhdfbg + + + + + + + + + + + + + + + + + + + + + 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(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(pPage->GetNext()); pDrawObjs = pPage->GetDrawObjs(); CPPUNIT_ASSERT_EQUAL(static_cast(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: */ -- cgit v1.2.3