sw: use calcLayout() everywhere

Change-Id: Ie03a3f13808456c831db10f2203fbfb84a50b999
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171076
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
Xisco Fauli 2024-07-26 17:06:00 +02:00
parent b147debad0
commit 7c5ae132fa
6 changed files with 20 additions and 24 deletions

View file

@ -157,7 +157,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTablesMoveBackwards)
pWrtShell->DelLeft(); pWrtShell->DelLeft();
// Calc the layout and check the number of pages. // Calc the layout and check the number of pages.
pWrtShell->CalcLayout(); calcLayout();
xmlDocUniquePtr pLayout = parseLayoutDump(); xmlDocUniquePtr pLayout = parseLayoutDump();
// Without the accompanying fix in place, this test would have failed with: // Without the accompanying fix in place, this test would have failed with:
// - Expected: 1 // - Expected: 1

View file

@ -251,7 +251,7 @@ CPPUNIT_TEST_FIXTURE(Test, testSplitFlyHeader)
pWrtShell->SttEndDoc(/*bStt=*/true); pWrtShell->SttEndDoc(/*bStt=*/true);
pWrtShell->SplitNode(); pWrtShell->SplitNode();
// Without the accompanying fix in place, this test would have crashed here. // Without the accompanying fix in place, this test would have crashed here.
pWrtShell->CalcLayout(); calcLayout();
// Then make sure we get one more page, since the first page is now 2 pages: // Then make sure we get one more page, since the first page is now 2 pages:
CPPUNIT_ASSERT_EQUAL(9, getPages()); CPPUNIT_ASSERT_EQUAL(9, getPages());

View file

@ -3321,7 +3321,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineSections)
dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {}); dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
CPPUNIT_ASSERT(!pLayout->IsHideRedlines()); CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
// why is this needed explicitly? // why is this needed explicitly?
pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout(); calcLayout();
discardDumpedLayout(); discardDumpedLayout();
xmlDocUniquePtr pXmlDoc = parseLayoutDump(); xmlDocUniquePtr pXmlDoc = parseLayoutDump();
@ -3399,7 +3399,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineSections)
dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {}); dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
CPPUNIT_ASSERT(pLayout->IsHideRedlines()); CPPUNIT_ASSERT(pLayout->IsHideRedlines());
// why is this needed explicitly? // why is this needed explicitly?
pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout(); calcLayout();
discardDumpedLayout(); discardDumpedLayout();
CheckRedlineSectionsHidden(); CheckRedlineSectionsHidden();
} }
@ -3444,7 +3444,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineTables)
dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {}); dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
CPPUNIT_ASSERT(!pLayout->IsHideRedlines()); CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
// why is this needed explicitly? // why is this needed explicitly?
pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout(); calcLayout();
discardDumpedLayout(); discardDumpedLayout();
pXmlDoc = parseLayoutDump(); pXmlDoc = parseLayoutDump();
@ -3504,7 +3504,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineTables)
dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {}); dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
CPPUNIT_ASSERT(pLayout->IsHideRedlines()); CPPUNIT_ASSERT(pLayout->IsHideRedlines());
// why is this needed explicitly? // why is this needed explicitly?
pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout(); calcLayout();
discardDumpedLayout(); discardDumpedLayout();
pXmlDoc = parseLayoutDump(); pXmlDoc = parseLayoutDump();
assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged"_ostr, "paraPropsNodeIndex"_ostr, assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged"_ostr, "paraPropsNodeIndex"_ostr,
@ -3549,7 +3549,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf144057)
// hide tracked table and table row deletions // hide tracked table and table row deletions
dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {}); dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
CPPUNIT_ASSERT(pLayout->IsHideRedlines()); CPPUNIT_ASSERT(pLayout->IsHideRedlines());
pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout(); calcLayout();
discardDumpedLayout(); discardDumpedLayout();
pXmlDoc = parseLayoutDump(); pXmlDoc = parseLayoutDump();
@ -3565,7 +3565,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf144057)
// show tracked table and table row deletions again // show tracked table and table row deletions again
dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {}); dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
CPPUNIT_ASSERT(!pLayout->IsHideRedlines()); CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout(); calcLayout();
discardDumpedLayout(); discardDumpedLayout();
pXmlDoc = parseLayoutDump(); pXmlDoc = parseLayoutDump();
assertXPath(pXmlDoc, "/root/page"_ostr, 4); assertXPath(pXmlDoc, "/root/page"_ostr, 4);
@ -3607,7 +3607,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf144347)
for (int i = 0; i < 12; ++i) for (int i = 0; i < 12; ++i)
pEditShell->AcceptRedline(0); pEditShell->AcceptRedline(0);
pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout(); calcLayout();
discardDumpedLayout(); discardDumpedLayout();
xmlDocUniquePtr pXmlDoc = parseLayoutDump(); xmlDocUniquePtr pXmlDoc = parseLayoutDump();
// show tracked row deletions // show tracked row deletions
@ -3621,7 +3621,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf144347)
dispatchCommand(mxComponent, u".uno:SelectAll"_ustr, {}); dispatchCommand(mxComponent, u".uno:SelectAll"_ustr, {});
dispatchCommand(mxComponent, u".uno:SelectAll"_ustr, {}); dispatchCommand(mxComponent, u".uno:SelectAll"_ustr, {});
dispatchCommand(mxComponent, u".uno:Delete"_ustr, {}); dispatchCommand(mxComponent, u".uno:Delete"_ustr, {});
pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout(); calcLayout();
discardDumpedLayout(); discardDumpedLayout();
pXmlDoc = parseLayoutDump(); pXmlDoc = parseLayoutDump();
@ -3633,7 +3633,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf144347)
while (pEditShell->GetRedlineCount() > 0) while (pEditShell->GetRedlineCount() > 0)
pEditShell->AcceptRedline(0); pEditShell->AcceptRedline(0);
pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout(); calcLayout();
discardDumpedLayout(); discardDumpedLayout();
pXmlDoc = parseLayoutDump(); pXmlDoc = parseLayoutDump();
@ -3670,7 +3670,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf155345)
// hide tracked table column deletions // hide tracked table column deletions
dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {}); dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
CPPUNIT_ASSERT(pLayout->IsHideRedlines()); CPPUNIT_ASSERT(pLayout->IsHideRedlines());
pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout(); calcLayout();
discardDumpedLayout(); discardDumpedLayout();
pXmlDoc = parseLayoutDump(); pXmlDoc = parseLayoutDump();
@ -3680,7 +3680,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf155345)
// show tracked table column deletions again // show tracked table column deletions again
dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {}); dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
CPPUNIT_ASSERT(!pLayout->IsHideRedlines()); CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout(); calcLayout();
discardDumpedLayout(); discardDumpedLayout();
pXmlDoc = parseLayoutDump(); pXmlDoc = parseLayoutDump();
assertXPath(pXmlDoc, "/root/page"_ostr, 4); assertXPath(pXmlDoc, "/root/page"_ostr, 4);
@ -3768,9 +3768,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf147485Forcepoint)
CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf118058) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf118058)
{ {
createSwDoc("tdf118058.fodt"); createSwDoc("tdf118058.fodt");
SwDoc* pDoc = getSwDoc();
// This resulted in a layout loop. // This resulted in a layout loop.
pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout(); calcLayout();
} }
//just care it doesn't crash/assert //just care it doesn't crash/assert

View file

@ -287,7 +287,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineCharAttributes)
dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {}); dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
CPPUNIT_ASSERT(!pLayout->IsHideRedlines()); CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
// why is this needed explicitly? // why is this needed explicitly?
pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout(); calcLayout();
discardDumpedLayout(); discardDumpedLayout();
xmlDocUniquePtr pXmlDoc = parseLayoutDump(); xmlDocUniquePtr pXmlDoc = parseLayoutDump();
@ -526,7 +526,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineCharAttributes)
dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {}); dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
CPPUNIT_ASSERT(pLayout->IsHideRedlines()); CPPUNIT_ASSERT(pLayout->IsHideRedlines());
// why is this needed explicitly? // why is this needed explicitly?
pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout(); calcLayout();
CheckRedlineCharAttributesHidden(); CheckRedlineCharAttributesHidden();
} }
@ -583,7 +583,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testtdf138951)
{ {
// Open the bugdoc // Open the bugdoc
createSwDoc("tdf138951.odt"); createSwDoc("tdf138951.odt");
auto pDoc = getSwDoc();
// Get the only shape // Get the only shape
uno::Reference<drawing::XShape> xShape(getShape(1), uno::UNO_QUERY); uno::Reference<drawing::XShape> xShape(getShape(1), uno::UNO_QUERY);
@ -595,7 +594,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testtdf138951)
const SwFrameFormat* pShFrm = SwTextBoxHelper::getOtherTextBoxFormat(pTxFrm, RES_FLYFRMFMT); const SwFrameFormat* pShFrm = SwTextBoxHelper::getOtherTextBoxFormat(pTxFrm, RES_FLYFRMFMT);
CPPUNIT_ASSERT(pShFrm); CPPUNIT_ASSERT(pShFrm);
pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout(); calcLayout();
// Get the bound rectangle of the textframe // Get the bound rectangle of the textframe
tools::Rectangle aTxtFrmRect(pTxFrm->FindRealSdrObject()->GetLogicRect()); tools::Rectangle aTxtFrmRect(pTxFrm->FindRealSdrObject()->GetLogicRect());
@ -2430,9 +2429,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTableExtrusion2)
CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf116848) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf116848)
{ {
createSwDoc("tdf116848.odt"); createSwDoc("tdf116848.odt");
SwDoc* pDoc = getSwDoc();
// This resulted in a layout loop. // This resulted in a layout loop.
pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout(); calcLayout();
} }
CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf117245) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf117245)

View file

@ -1364,9 +1364,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf130218)
CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf127235) CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf127235)
{ {
createSwDoc("tdf127235.odt"); createSwDoc("tdf127235.odt");
SwDoc* pDoc = getSwDoc();
// This resulted in a layout loop. // This resulted in a layout loop.
pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout(); calcLayout();
} }
CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf138039) CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf138039)

View file

@ -307,7 +307,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testRedlineSplitContentNode)
sw::UndoManager& rUndoManager = pDoc->GetUndoManager(); sw::UndoManager& rUndoManager = pDoc->GetUndoManager();
pWrtShell->CalcLayout(); calcLayout();
pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 18, /*bBasicCall=*/false); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 18, /*bBasicCall=*/false);
pWrtShell->SplitNode(true); pWrtShell->SplitNode(true);
rUndoManager.Undo(); rUndoManager.Undo();