sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx | 39 +- sw/qa/core/attr/attr.cxx | 3 sw/qa/core/crsr/crsr.cxx | 17 - sw/qa/core/doc/doc.cxx | 30 +- sw/qa/core/docnode/docnode.cxx | 6 sw/qa/core/draw/draw.cxx | 10 sw/qa/core/edit/edit.cxx | 3 sw/qa/core/fields/fields.cxx | 3 sw/qa/core/frmedt/frmedt.cxx | 4 sw/qa/core/layout/layout.cxx | 72 +++-- sw/qa/core/objectpositioning/objectpositioning.cxx | 8 sw/qa/core/text/text.cxx | 42 +- sw/qa/core/tox/tox.cxx | 6 sw/qa/core/txtnode/txtnode.cxx | 28 + sw/qa/core/undo/undo.cxx | 6 sw/qa/core/unocore/unocore.cxx | 34 +- sw/qa/core/view/view.cxx | 3 sw/qa/extras/globalfilter/globalfilter.cxx | 41 +- sw/qa/extras/htmlexport/htmlexport.cxx | 41 +- sw/qa/extras/htmlimport/htmlimport.cxx | 48 +-- sw/qa/extras/indexing/IndexingExportTest.cxx | 24 + sw/qa/extras/indexing/SearchResultLocatorTest.cxx | 15 - sw/qa/extras/layout/layout.cxx | 107 ++++--- sw/qa/extras/layout/layout2.cxx | 214 +++++++++------ sw/qa/extras/mailmerge/mailmerge.cxx | 2 sw/qa/extras/mailmerge/mailmerge2.cxx | 2 sw/qa/extras/odfexport/odfexport.cxx | 2 sw/qa/extras/odfexport/odfexport2.cxx | 4 sw/qa/extras/odfimport/odffeatures.cxx | 6 sw/qa/extras/odfimport/odfimport.cxx | 145 +++++----- sw/qa/extras/ooxmlexport/ooxmlexport10.cxx | 2 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 12 sw/qa/extras/ooxmlexport/ooxmlexport16.cxx | 12 sw/qa/extras/ooxmlexport/ooxmlexport17.cxx | 4 sw/qa/extras/ooxmlexport/ooxmlexport18.cxx | 6 sw/qa/extras/ooxmlexport/ooxmlexport4.cxx | 4 sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx | 6 sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 184 ++++++------ sw/qa/extras/ooxmlimport/ooxmlimport2.cxx | 102 +++---- sw/qa/extras/rtfexport/rtfexport.cxx | 2 sw/qa/extras/rtfexport/rtfexport2.cxx | 12 sw/qa/extras/rtfexport/rtfexport3.cxx | 4 sw/qa/extras/rtfexport/rtfexport4.cxx | 12 sw/qa/extras/rtfexport/rtfexport5.cxx | 8 sw/qa/extras/rtfimport/rtfimport.cxx | 188 ++++++------- sw/qa/extras/tiledrendering/tiledrendering.cxx | 2 sw/qa/extras/txtimport/txtimport.cxx | 19 - sw/qa/extras/uiwriter/uiwriter.cxx | 126 +++++--- sw/qa/extras/uiwriter/uiwriter2.cxx | 189 ++++++++----- sw/qa/extras/uiwriter/uiwriter3.cxx | 102 ++++--- sw/qa/extras/uiwriter/uiwriter4.cxx | 143 ++++++---- sw/qa/extras/uiwriter/uiwriter5.cxx | 186 ++++++++----- sw/qa/extras/uiwriter/uiwriter6.cxx | 125 +++++--- sw/qa/extras/uiwriter/uiwriter7.cxx | 126 +++++--- sw/qa/extras/uiwriter/uiwriter8.cxx | 100 ++++--- sw/qa/extras/unowriter/unowriter.cxx | 22 - sw/qa/extras/ww8export/ww8export.cxx | 2 sw/qa/extras/ww8export/ww8export3.cxx | 6 sw/qa/extras/ww8import/ww8import.cxx | 28 - sw/qa/filter/html/html.cxx | 6 sw/qa/inc/swmodeltestbase.hxx | 22 - sw/qa/uibase/dochdl/dochdl.cxx | 6 sw/qa/uibase/docvw/docvw.cxx | 6 sw/qa/uibase/fldui/fldui.cxx | 3 sw/qa/uibase/frmdlg/frmdlg.cxx | 2 sw/qa/uibase/shells/shells.cxx | 19 - sw/qa/uibase/uiview/uiview.cxx | 3 sw/qa/uibase/uno/uno.cxx | 5 sw/qa/uibase/wrtsh/wrtsh.cxx | 39 +- sw/qa/unit/swmodeltestbase.cxx | 14 70 files changed, 1706 insertions(+), 1118 deletions(-)
New commits: commit 4a6b56a5a1cd8756ff6d0335554fe78bf9988c27 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Fri Nov 11 14:18:18 2022 +0100 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Fri Nov 11 16:26:05 2022 +0100 SwModelTestBase: use createSwDoc everywhere In order to unify the code Also call getSwDoc only when it's needed so move it outside createSwDoc Change-Id: I082d46108581e8f2e2e430e854980035f471ceac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142586 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx index 9397832bebf5..6d848da7e25d 100644 --- a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx +++ b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx @@ -21,7 +21,8 @@ public: CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckDocumentIssues) { - SwDoc* pDoc = createSwDoc("DocumentTest.odt"); + createSwDoc("DocumentTest.odt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); @@ -33,7 +34,8 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckDocumentIssues) CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testTableSplitMergeAndAltText) { - SwDoc* pDoc = createSwDoc("AccessibilityTests1.odt"); + createSwDoc("AccessibilityTests1.odt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); @@ -53,7 +55,8 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckParagraphIssues) { // Tests whether formatting issues are detected when the whole paragraph has them instead of // some text inside the paragraph - SwDoc* pDoc = createSwDoc("ParagraphTest.odt"); + createSwDoc("ParagraphTest.odt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); @@ -64,7 +67,8 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckParagraphIssues) CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckBackgroundImage) { - SwDoc* pDoc = createSwDoc("BackgroundImageTest.odt"); + createSwDoc("BackgroundImageTest.odt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); @@ -75,7 +79,8 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckBackgroundImage) CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckNewlineSpace) { - SwDoc* pDoc = createSwDoc("NewlineTest.odt"); + createSwDoc("NewlineTest.odt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); @@ -87,7 +92,8 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckNewlineSpace) CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckSpacebarSpace) { - SwDoc* pDoc = createSwDoc("SpaceTest.odt"); + createSwDoc("SpaceTest.odt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); @@ -98,7 +104,8 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckSpacebarSpace) CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testHyperlinks) { - SwDoc* pDoc = createSwDoc("HyperlinkTest.odt"); + createSwDoc("HyperlinkTest.odt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); @@ -110,7 +117,8 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testHyperlinks) CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckHighlightedText) { - SwDoc* pDoc = createSwDoc("HighlightTest.odt"); + createSwDoc("HighlightTest.odt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); @@ -121,7 +129,8 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckHighlightedText) CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testNumberingCheck) { - SwDoc* pDoc = createSwDoc("AccessibilityTests_NumberingCheck.odt"); + createSwDoc("AccessibilityTests_NumberingCheck.odt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); @@ -136,7 +145,8 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testNumberingCheck) CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckFakeFootnote) { - SwDoc* pDoc = createSwDoc("FakeFootnoteTest.odt"); + createSwDoc("FakeFootnoteTest.odt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); @@ -148,7 +158,8 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckFakeFootnote) CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckFakeCaption) { - SwDoc* pDoc = createSwDoc("FakeCaptionTest.odt"); + createSwDoc("FakeCaptionTest.odt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); @@ -159,7 +170,8 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckFakeCaption) CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckTableFormatting) { - SwDoc* pDoc = createSwDoc("TableFormattingTest.odt"); + createSwDoc("TableFormattingTest.odt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); @@ -170,7 +182,8 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckTableFormatting) CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckTabsFormatting) { - SwDoc* pDoc = createSwDoc("TabsTest.odt"); + createSwDoc("TabsTest.odt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); diff --git a/sw/qa/core/attr/attr.cxx b/sw/qa/core/attr/attr.cxx index 0b60c1424092..3ba2a3b9a1eb 100644 --- a/sw/qa/core/attr/attr.cxx +++ b/sw/qa/core/attr/attr.cxx @@ -28,7 +28,8 @@ public: CPPUNIT_TEST_FIXTURE(Test, testSwAttrSet) { // Given a document with track changes and the whole document is selected: - SwDoc* pDoc = createSwDoc("attr-set.docx"); + createSwDoc("attr-set.docx"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pDocShell = pDoc->GetDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); dispatchCommand(mxComponent, ".uno:SelectAll", {}); diff --git a/sw/qa/core/crsr/crsr.cxx b/sw/qa/core/crsr/crsr.cxx index fe341f6c276f..2fa3b1140a27 100644 --- a/sw/qa/core/crsr/crsr.cxx +++ b/sw/qa/core/crsr/crsr.cxx @@ -90,7 +90,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testFindReplace) CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testSelAllStartsWithTable) { - load("sel-all-starts-with-table.odt"); + createSwDoc("sel-all-starts-with-table.odt"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwDocShell* pDocShell = pTextDoc->GetDocShell(); SwDoc* pDoc = pDocShell->GetDoc(); @@ -113,7 +113,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testSelAllStartsWithTable) CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testContentControlLineBreak) { // Given a document with a (rich text) content control: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XText> xText = xTextDocument->getText(); @@ -144,7 +145,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testContentControlLineBreak) CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testContentControlReadOnly) { // Given a document with a checkbox content control: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XText> xText = xTextDocument->getText(); @@ -171,7 +173,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testContentControlReadOnly) CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testTdf135451) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); // Insert narrow no-break space and move the cursor right before it @@ -191,7 +194,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testTdf135451) CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testDropdownContentControl) { // Given a document with a dropdown content control: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->InsertContentControl(SwContentControlType::DROP_DOWN_LIST); @@ -208,7 +212,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testDropdownContentControl) CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testContentControlProtectedSection) { // Given a document with a date content control in a protected section: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->InsertContentControl(SwContentControlType::DATE); pWrtShell->SelAll(); diff --git a/sw/qa/core/doc/doc.cxx b/sw/qa/core/doc/doc.cxx index 7c5bdd8f3eb9..cec9525eb9e8 100644 --- a/sw/qa/core/doc/doc.cxx +++ b/sw/qa/core/doc/doc.cxx @@ -49,7 +49,8 @@ public: CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testMathInsertAnchorType) { // Given an empty document. - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); // When inserting an a math object. SwWrtShell* pShell = pDoc->GetDocShell()->GetWrtShell(); @@ -72,7 +73,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testMathInsertAnchorType) CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testTextboxTextRotateAngle) { // Check the writing direction of the only TextFrame in the document. - SwDoc* pDoc = createSwDoc("textbox-textrotateangle.odt"); + createSwDoc("textbox-textrotateangle.odt"); + SwDoc* pDoc = getSwDoc(); SwFrameFormats& rFrameFormats = *pDoc->GetSpzFrameFormats(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), rFrameFormats.size()); CPPUNIT_ASSERT_EQUAL(o3tl::narrowing<sal_uInt16>(RES_DRAWFRMFMT), rFrameFormats[0]->Which()); @@ -90,7 +92,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testTextboxTextRotateAngle) CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testNumDownIndent) { - SwDoc* pDoc = createSwDoc("num-down-indent.docx"); + createSwDoc("num-down-indent.docx"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pDocShell = pDoc->GetDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); pWrtShell->Down(/*bSelect=*/false); @@ -109,7 +112,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testNumDownIndent) CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testLocaleIndependentTemplate) { - SwDoc* pDoc = createSwDoc("locale-independent-template.odt"); + createSwDoc("locale-independent-template.odt"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pDocShell = pDoc->GetDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); SfxItemSet aSet(pWrtShell->GetAttrPool(), svl::Items<RES_CHRATR_LANGUAGE, RES_CHRATR_LANGUAGE>); @@ -129,7 +133,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testLocaleIndependentTemplate) CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testTextBoxZOrder) { - SwDoc* pDoc = createSwDoc("textbox-zorder.docx"); + createSwDoc("textbox-zorder.docx"); + SwDoc* pDoc = getSwDoc(); SwFrameFormats& rFormats = *pDoc->GetSpzFrameFormats(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), rFormats.size()); const SwFrameFormat* pEllipse = rFormats[2]; @@ -146,7 +151,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testTextBoxZOrder) CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testTextBoxMakeFlyFrame) { // Given a document with an as-char textbox (as-char draw format + at-char fly format): - SwDoc* pDoc = createSwDoc("textbox-makeflyframe.docx"); + createSwDoc("textbox-makeflyframe.docx"); + SwDoc* pDoc = getSwDoc(); // When cutting the textbox and pasting it to a new document: SwView* pView = pDoc->GetDocShell()->GetView(); @@ -180,7 +186,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testIMEGrouping) // non-headless. #if !defined MACOSX && !defined _WIN32 // Given an empty document: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); // Make sure no idle is in action, so the ExtTextInput events go to SwEditWin. Scheduler::ProcessEventsToIdle(); @@ -235,7 +242,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testImageHyperlinkStyle) CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testContentControlDelete) { // Given a document with a content control: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XText> xText = xTextDocument->getText(); @@ -265,7 +273,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testContentControlDelete) CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testCopyBookmarks) { // Given a document with a bookmark in a header that is linked later: - SwDoc* pDoc = createSwDoc("copy-bookmarks.docx"); + createSwDoc("copy-bookmarks.docx"); + SwDoc* pDoc = getSwDoc(); // When checking the # of non-copy bookmarks in the resulting doc model: sal_Int32 nActual = 0; @@ -420,7 +429,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testBookmarkDeleteListeners) CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testBookmarkDeleteRedline) { // Given a document with redlines, a mark (annotation mark) inside a redline: - SwDoc* pDoc = createSwDoc("bookmark-delete-redline.doc"); + createSwDoc("bookmark-delete-redline.doc"); + SwDoc* pDoc = getSwDoc(); // When hiding deletions / showing only inserts, make sure we don't crash: // Without the accompanying fix in place, this test would have crashed, equal_range() was used diff --git a/sw/qa/core/docnode/docnode.cxx b/sw/qa/core/docnode/docnode.cxx index 12363e756f12..0282414f2116 100644 --- a/sw/qa/core/docnode/docnode.cxx +++ b/sw/qa/core/docnode/docnode.cxx @@ -28,7 +28,8 @@ CPPUNIT_TEST_FIXTURE(Test, testRedlineEndsBeforeToC) { // Load a document where a delete redline ends right before a ToC, then redlines are hidden at a // layout level. - SwDoc* pDoc = createSwDoc("redline-ends-before-toc.docx"); + createSwDoc("redline-ends-before-toc.docx"); + SwDoc* pDoc = getSwDoc(); const SwRedlineTable& rTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable(); // Without the accompanying fix in place, this test would have resulted in an assertion failure // in InsertCnt_(), because the start of the section was hidden, but not its end. @@ -41,7 +42,8 @@ CPPUNIT_TEST_FIXTURE(Test, testRedlineEndsBeforeToC) CPPUNIT_TEST_FIXTURE(Test, testTdf150086) { // Load a document where an insert redline ends right before a ToC - SwDoc* pDoc = createSwDoc("tdf150086.docx"); + createSwDoc("tdf150086.docx"); + SwDoc* pDoc = getSwDoc(); const SwRedlineTable& rTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable(); CPPUNIT_ASSERT_EQUAL(static_cast<SwRedlineTable::size_type>(8), rTable.size()); diff --git a/sw/qa/core/draw/draw.cxx b/sw/qa/core/draw/draw.cxx index 799400c85ee9..56094315a604 100644 --- a/sw/qa/core/draw/draw.cxx +++ b/sw/qa/core/draw/draw.cxx @@ -36,7 +36,8 @@ public: CPPUNIT_TEST_FIXTURE(SwCoreDrawTest, testTextboxDeleteAsChar) { // Load a document with an as-char shape in it that has a textbox and an image in it. - SwDoc* pDoc = createSwDoc("as-char-textbox.docx"); + createSwDoc("as-char-textbox.docx"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); sal_Int32 nActual = pPage->GetObjCount(); @@ -62,7 +63,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreDrawTest, testTextboxUndoOrdNum) // - picture // - draw format + fly format and a picture in it // - picture - SwDoc* pDoc = createSwDoc("textbox-undo-ordnum.docx"); + createSwDoc("textbox-undo-ordnum.docx"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); const SwFrameFormats& rFormats = *pDoc->GetSpzFrameFormats(); // Test the state before del + undo. @@ -109,7 +111,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreDrawTest, testTextboxUndoOrdNum) CPPUNIT_TEST_FIXTURE(SwCoreDrawTest, testTdf107727FrameBorder) { // Load a document with a textframe without border, one with only left border - load("tdf107727_FrameBorder.odt"); + createSwDoc("tdf107727_FrameBorder.odt"); // Export to RTF and reload reload("Rich Text Format", nullptr); @@ -143,7 +145,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreDrawTest, testSdtTextboxHeader) // shape+fly pair (textbox) anchored in the same header // When loading that document, then make sure that layout doesn't fail with an assertion because // the "master SdrObj should have the highest index" invariant doesn't hold: - load("sdt-textbox-header.docx"); + createSwDoc("sdt-textbox-header.docx"); } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/qa/core/edit/edit.cxx b/sw/qa/core/edit/edit.cxx index 9edbdb8ceb6e..84c05301075f 100644 --- a/sw/qa/core/edit/edit.cxx +++ b/sw/qa/core/edit/edit.cxx @@ -29,7 +29,8 @@ public: CPPUNIT_TEST_FIXTURE(Test, testRedlineHidden) { // Given a document with ShowRedlineChanges=false: - SwDoc* pDoc = createSwDoc("redline-hidden.fodt"); + createSwDoc("redline-hidden.fodt"); + SwDoc* pDoc = getSwDoc(); // When formatting a paragraph by setting the para adjust to center, then make sure setting the // new item set on the paragraph doesn't crash: diff --git a/sw/qa/core/fields/fields.cxx b/sw/qa/core/fields/fields.cxx index b9e4e28287a2..6f1fd79ee582 100644 --- a/sw/qa/core/fields/fields.cxx +++ b/sw/qa/core/fields/fields.cxx @@ -36,7 +36,8 @@ public: CPPUNIT_TEST_FIXTURE(Test, testAuthorityTooltip) { // Create a document with a bibliography reference in it. - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xField( xFactory->createInstance("com.sun.star.text.TextField.Bibliography"), uno::UNO_QUERY); diff --git a/sw/qa/core/frmedt/frmedt.cxx b/sw/qa/core/frmedt/frmedt.cxx index 7a0520e4f8e3..473dd414c293 100644 --- a/sw/qa/core/frmedt/frmedt.cxx +++ b/sw/qa/core/frmedt/frmedt.cxx @@ -37,7 +37,7 @@ public: CPPUNIT_TEST_FIXTURE(SwCoreFrmedtTest, testTextboxReanchor) { // Load a document with a textframe and a textbox(shape+textframe). - load("textbox-reanchor.odt"); + createSwDoc("textbox-reanchor.odt"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); SdrPage* pDrawPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); @@ -114,7 +114,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreFrmedtTest, testVertPosFromBottomBoundingBox) CPPUNIT_TEST_FIXTURE(SwCoreFrmedtTest, testPasteFlyInTextBox) { // Given a document that contains a textbox, which contains an sw image (fly frame) - load("paste-fly-in-textbox.docx"); + createSwDoc("paste-fly-in-textbox.docx"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwDocShell* pDocShell = pTextDoc->GetDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx index d6763199e76c..9369bef2c637 100644 --- a/sw/qa/core/layout/layout.cxx +++ b/sw/qa/core/layout/layout.cxx @@ -38,7 +38,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTableFlyOverlap) { // Load a document that has an image anchored in the header. // It also has a table which has the wrap around the image. - load("table-fly-overlap.docx"); + createSwDoc("table-fly-overlap.docx"); SwTwips nFlyTop = parseDump("//header/txt/anchored/fly/infos/bounds", "top").toInt32(); SwTwips nFlyHeight = parseDump("//header/txt/anchored/fly/infos/bounds", "height").toInt32(); SwTwips nFlyBottom = nFlyTop + nFlyHeight; @@ -57,7 +57,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTdf128195) { // Load a document that has two paragraphs in the header. // The second paragraph should have its bottom spacing applied. - load("tdf128195.docx"); + createSwDoc("tdf128195.docx"); sal_Int32 nTxtHeight = parseDump("//header/txt[2]/infos/bounds", "height").toInt32(); sal_Int32 nTxtBottom = parseDump("//header/txt[2]/infos/bounds", "bottom").toInt32(); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2269), nTxtHeight); @@ -67,14 +67,14 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTdf128195) CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testBIRT) { // this looped - load("birt_min.odt"); + createSwDoc("birt_min.odt"); } CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testBorderCollapseCompat) { // Load a document with a border conflict: top cell has a dotted bottom border, bottom cell has // a solid upper border. - load("border-collapse-compat.docx"); + createSwDoc("border-collapse-compat.docx"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwDocShell* pShell = pTextDoc->GetDocShell(); std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); @@ -94,7 +94,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testBtlrTableRowSpan) { // Load a document which has a table. The A1 cell has btlr text direction, and the A1..A3 cells // are merged. - load("btlr-table-row-span.odt"); + createSwDoc("btlr-table-row-span.odt"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwDocShell* pShell = pTextDoc->GetDocShell(); std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); @@ -111,7 +111,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testBtlrTableRowSpan) CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTableFlyOverlapSpacing) { // Load a document that has an image on the right of a table. The table wraps around the image. - load("table-fly-overlap-spacing.docx"); + createSwDoc("table-fly-overlap-spacing.docx"); SwTwips nFlyTop = parseDump("//body/txt/anchored/fly/infos/bounds", "top").toInt32(); SwTwips nFlyHeight = parseDump("//body/txt/anchored/fly/infos/bounds", "height").toInt32(); SwTwips nFlyBottom = nFlyTop + nFlyHeight; @@ -128,7 +128,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTableFlyOverlapSpacing) CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTablesMoveBackwards) { // Load a document with 1 pages: empty content on first page, then 21 tables on the second page. - load("tables-move-backwards.odt"); + createSwDoc("tables-move-backwards.odt"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwDocShell* pDocShell = pTextDoc->GetDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); @@ -152,7 +152,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTablesMoveBackwards) CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testContinuousEndnotesMoveBackwards) { // Load a document with the ContinuousEndnotes flag turned on. - load("continuous-endnotes-move-backwards.doc"); + createSwDoc("continuous-endnotes-move-backwards.doc"); xmlDocUniquePtr pLayout = parseLayoutDump(); // We have 2 pages. assertXPath(pLayout, "/root/page", 2); @@ -170,7 +170,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testAnchorPositionBasedOnParagraph) { // tdf#134783 check whether position of shape is good if it is anchored to paragraph and // the "Don't add space between paragraphs of the same style" option is set - load("tdf134783_testAnchorPositionBasedOnParagraph.fodt"); + createSwDoc("tdf134783_testAnchorPositionBasedOnParagraph.fodt"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "(//anchored/SwAnchoredDrawObject)[1]/bounds", "top", "1671"); @@ -184,7 +184,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testAnchorPositionBasedOnParagraph) CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextBoxStaysInsideShape) { // tdf#135198: check whether text box stays inside shape after moving it upwards - load("shape-textbox.odt"); + createSwDoc("shape-textbox.odt"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); CPPUNIT_ASSERT(pXmlDoc); @@ -199,7 +199,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextBoxNotModifiedOnOpen) { // tdf#138050: a freshly opened document containing a shape with a text box // should not appear to be modified - load("textbox-phantom-change.docx"); + createSwDoc("textbox-phantom-change.docx"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); @@ -210,7 +210,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextBoxNotModifiedOnOpen) CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextBoxAutoGrowVertical) { - load("textbox-autogrow-vertical.docx"); + createSwDoc("textbox-autogrow-vertical.docx"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); @@ -233,7 +233,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextBoxAutoGrowVertical) CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextboxModification) { // Load a document with a textbox in it: the layout will have to position the shape part. - load("textbox-modification.docx"); + createSwDoc("textbox-modification.docx"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwDocShell* pDocShell = pTextDoc->GetDocShell(); @@ -245,7 +245,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextboxModification) CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testBtlrNestedCell) { // Load a document with a nested table, the inner A1 cell has a btlr text direction. - load("btlr-nested-cell.odt"); + createSwDoc("btlr-nested-cell.odt"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); @@ -272,7 +272,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testKeepwithnextFullheight) // conflicting requirements. // Without the accompanying fix in place, this test would have failed with a layout loop in // SwEditShell::CalcLayout(). - load("keepwithnext-fullheight.fodt"); + createSwDoc("keepwithnext-fullheight.fodt"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); CPPUNIT_ASSERT(pXmlDoc); @@ -288,7 +288,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testGutterMargin) { // Create a document, remember the old left edge of the page print area (the rectangle that is // inside margins). - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); uno::Reference<beans::XPropertySet> xStandard(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY); SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); @@ -313,7 +314,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testGutterTopMargin) { // Create a document, remember the old top edge of the page print area (the rectangle that is // inside margins). - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xSettings( xFactory->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY); @@ -340,7 +342,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testGutterTopMargin) CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testGutterMirrorMargin) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwDocShell* pDocShell = pDoc->GetDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); pWrtShell->InsertPageBreak(); @@ -370,7 +373,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testGutterMirrorMargin) CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testRtlGutterMargin) { // Given a document with a right margin: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); uno::Reference<beans::XPropertySet> xStandard(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY); SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); @@ -399,7 +403,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testGutterMarginPageBorder) // the actual values were 6346, 10066) - something broke metafile generation on Windows? #if !defined(MACOSX) && !defined(_WIN32) // Given a document with a non-0 gutter margin. - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); uno::Reference<beans::XPropertySet> xStandard(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY); sal_Int32 nGutterMm100 = 2000; @@ -427,13 +432,14 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testGutterMarginPageBorder) CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTdf45908_invoice) { // without the fix, this was hanging (and slowly consuming memory) on fileopen. - load("tdf45908_invoice.odt"); + createSwDoc("tdf45908_invoice.odt"); } CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testVerticallyMergedCellBorder) { // Given a document with a table: 2 columns, 5 rows. B2 -> B5 is merged: - SwDoc* pDoc = createSwDoc("vmerge-cell-border.docx"); + createSwDoc("vmerge-cell-border.docx"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // When rendering the table: @@ -504,12 +510,15 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testVerticallyMergedCellBorder) } } -CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testCrashRemoveFromLayout) { load("tdf122894-4.doc"); } +CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testCrashRemoveFromLayout) +{ + createSwDoc("tdf122894-4.doc"); +} CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testLinkedBullet) { // Given a document with a graphic bullet, where the image is a linked one: - load("linked-bullet.odt"); + createSwDoc("linked-bullet.odt"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwDocShell* pShell = pTextDoc->GetDocShell(); @@ -529,7 +538,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testLinkedBullet) CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testInnerCellBorderIntersect) { // Given a table with both outer and inner borders: - SwDoc* pDoc = createSwDoc("inner-border.docx"); + createSwDoc("inner-border.docx"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // When rendering table borders: @@ -582,7 +592,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testInnerCellBorderIntersect) CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testDoubleBorderVertical) { // Given a table with a left and right double border, outer is thick, inner is thin: - SwDoc* pDoc = createSwDoc("double-border-vertical.docx"); + createSwDoc("double-border-vertical.docx"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // When rendering that document: @@ -630,7 +641,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testDoubleBorderVertical) CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testDoubleBorderHorizontal) { // Given a table with a top and bottom double border, outer is thin, inner is thick: - SwDoc* pDoc = createSwDoc("double-border-horizontal.docx"); + createSwDoc("double-border-horizontal.docx"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // When rendering table borders: @@ -678,7 +690,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testDoubleBorderHorizontal) CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testParaBorderInCellClip) { // Given a document which has outside-cell borders defined, which should not be visible: - SwDoc* pDoc = createSwDoc("para-border-in-cell-clip.docx"); + createSwDoc("para-border-in-cell-clip.docx"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // When rendering those borders: @@ -698,7 +711,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testParaBorderInCellClip) CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testDoublePageBorder) { // Given a page with a top and bottom double border, outer is thick, inner is thin: - SwDoc* pDoc = createSwDoc("double-page-border.docx"); + createSwDoc("double-page-border.docx"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // When rendering that document: diff --git a/sw/qa/core/objectpositioning/objectpositioning.cxx b/sw/qa/core/objectpositioning/objectpositioning.cxx index 00c85221d1fd..bb3a12793ae8 100644 --- a/sw/qa/core/objectpositioning/objectpositioning.cxx +++ b/sw/qa/core/objectpositioning/objectpositioning.cxx @@ -29,7 +29,7 @@ public: CPPUNIT_TEST_FIXTURE(SwCoreObjectpositioningTest, testOverlapCrash) { // Load a document with 2 images. - load("overlap-crash.odt"); + createSwDoc("overlap-crash.odt"); // Change their anchor type to to-char. uno::Reference<beans::XPropertySet> xShape1(getShape(1), uno::UNO_QUERY); @@ -148,7 +148,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreObjectpositioningTest, testVertAlignBottomMargin) CPPUNIT_TEST_FIXTURE(SwCoreObjectpositioningTest, testVertAlignBottomMarginWithFooter) { // Load an empty document with footer. - load("bottom-margin-with-footer.docx"); + createSwDoc("bottom-margin-with-footer.docx"); uno::Reference<css::lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); // Insert three shapes and align it the bottom,center,top of page print area bottom. @@ -221,7 +221,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreObjectpositioningTest, testInsideOutsideVertAlignBott { // Load a document, with two shapes. // The shapes align the outside and inside of page print area bottom. - load("inside-outside-vert-align.docx"); + createSwDoc("inside-outside-vert-align.docx"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); sal_Int32 nBodyBottom = getXPath(pXmlDoc, "//body/infos/bounds", "bottom").toInt32(); //15704 @@ -244,7 +244,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreObjectpositioningTest, testVMLVertAlignBottomMargin) // The shapes align the top,center,bottom,outside and inside of page print area bottom. // The height of page print area bottom is 4320 ~ 7.62cm. // The size of shapes are 442 ~ 0.78cm - load("vml-vertical-alignment.docx"); + createSwDoc("vml-vertical-alignment.docx"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); sal_Int32 nBodyBottom = getXPath(pXmlDoc, "//body/infos/bounds", "bottom").toInt32(); //11803 diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx index e8ab18ff9682..382f9a8738a4 100644 --- a/sw/qa/core/text/text.cxx +++ b/sw/qa/core/text/text.cxx @@ -53,7 +53,8 @@ public: CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testFootnoteConnect) { - SwDoc* pDoc = createSwDoc("footnote-connect.fodt"); + createSwDoc("footnote-connect.fodt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); // Jump to the start of the next page. pWrtShell->SttNxtPg(); @@ -168,7 +169,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testLineHeight) CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testLineWidth) { // Given a document with an as-char image, width in twips not fitting into sal_uInt16: - SwDoc* pDoc = createSwDoc("line-width.fodt"); + createSwDoc("line-width.fodt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); sal_Int32 nOldLeft = pWrtShell->GetCharRect().Left(); @@ -208,7 +210,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testChineseAutoFirstLineIndent) CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testRuby) { // Given a document with multiple ruby portions: - SwDoc* pDoc = createSwDoc("ruby.fodt"); + createSwDoc("ruby.fodt"); + SwDoc* pDoc = getSwDoc(); // When laying out that document: SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); @@ -475,7 +478,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testClearingLineBreakHeader) CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testAsCharImageDocModelFromViewPoint) { // Given a document with an as-char image: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xTextGraphic( xFactory->createInstance("com.sun.star.text.TextGraphicObject"), uno::UNO_QUERY); @@ -518,7 +522,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testAsCharImageDocModelFromViewPoint) CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testRedlineDelete) { // Given a document with A4 paper size, some text, redlining on, but hidden: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwDocShell* pDocShell = pDoc->GetDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); { @@ -558,7 +563,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testRedlineDelete) CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf120715_CursorMoveWhenTypingSpaceAtCenteredLineEnd) { - SwDoc* pDoc = createSwDoc("tdf43100_tdf120715_cursorOnSpacesOverMargin.docx"); + createSwDoc("tdf43100_tdf120715_cursorOnSpacesOverMargin.docx"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); // Make a paint to force the call of AddExtraBlankWidth, that calculate width for holePortions. @@ -580,7 +586,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf43100_CursorMoveToSpacesOverMargin) // These differences are based on its paragraphs // - alignment (left, center, right, justified), // - line count (1 line, 2 lines, blank line containing only spaces) - SwDoc* pDoc = createSwDoc("tdf43100_tdf120715_cursorOnSpacesOverMargin.docx"); + createSwDoc("tdf43100_tdf120715_cursorOnSpacesOverMargin.docx"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); // Make a paint to force the call of AddExtraBlankWidth, that calculate width for holePortions. @@ -627,7 +634,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf43100_CursorMoveToSpacesOverMargin) CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testContentControlPDF) { // Given a file with a content control: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->InsertContentControl(SwContentControlType::RICH_TEXT); pWrtShell->SttEndDoc(/*bStt=*/true); @@ -669,7 +677,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testContentControlPDF) CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testCheckboxContentControlPDF) { // Given a file with a checkbox content control: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->InsertContentControl(SwContentControlType::CHECKBOX); @@ -694,7 +703,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testCheckboxContentControlPDF) CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testDropdownContentControlPDF) { // Given a file with a dropdown content control: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->InsertContentControl(SwContentControlType::DROP_DOWN_LIST); @@ -719,7 +729,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testDropdownContentControlPDF) CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testDateContentControlPDF) { // Given a file with a date content control: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->InsertContentControl(SwContentControlType::DATE); @@ -744,7 +755,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testDateContentControlPDF) CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testContentControlPDFFont) { // Given a document with a custom 24pt font size and a content control: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SfxItemSetFixed<RES_CHRATR_FONTSIZE, RES_CHRATR_FONTSIZE> aSet(pWrtShell->GetAttrPool()); SvxFontHeightItem aItem(480, 100, RES_CHRATR_FONTSIZE); @@ -771,7 +783,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testContentControlPDFFont) CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testComboContentControlPDF) { // Given a file with a combo box content control: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->InsertContentControl(SwContentControlType::COMBO_BOX); @@ -797,7 +810,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testComboContentControlPDF) CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testRichContentControlPDF) { // Given a file with a rich content control, its value set to "xxx<b>yyy</b>": - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->InsertContentControl(SwContentControlType::RICH_TEXT); pWrtShell->SttEndDoc(/*bStt=*/true); diff --git a/sw/qa/core/tox/tox.cxx b/sw/qa/core/tox/tox.cxx index a5667a6947c0..89fc71a7eb33 100644 --- a/sw/qa/core/tox/tox.cxx +++ b/sw/qa/core/tox/tox.cxx @@ -116,7 +116,8 @@ CPPUNIT_TEST_FIXTURE(Test, testAuthorityTableEntryURL) CPPUNIT_TEST_FIXTURE(Test, testAuthorityTableEntryClick) { // Given an empty document: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); // When inserting a biblio entry field with an URL: uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); @@ -159,7 +160,8 @@ CPPUNIT_TEST_FIXTURE(Test, testAuthorityTableEntryClick) CPPUNIT_TEST_FIXTURE(Test, testAuthorityTableEntryRelClick) { // Given an empty document with a file:// base URL: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); uno::Sequence<beans::PropertyValue> aArgs = { comphelper::makePropertyValue("FilterName", OUString("writer8")), diff --git a/sw/qa/core/txtnode/txtnode.cxx b/sw/qa/core/txtnode/txtnode.cxx index d8da288ad8bf..3712850dccee 100644 --- a/sw/qa/core/txtnode/txtnode.cxx +++ b/sw/qa/core/txtnode/txtnode.cxx @@ -47,7 +47,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testBtlrCellChinese) // classified as vertical, i.e. the glyph has the same direction in both the lrtb ("Latin") and // tbrl ("Chinese") directions. Make sure that Chinese text is handled the same way in the btlr // case as it's handled in the Latin case. - load("btlr-cell-chinese.doc"); + createSwDoc("btlr-cell-chinese.doc"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwDocShell* pShell = pTextDoc->GetDocShell(); std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); @@ -63,7 +63,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testBtlrCellChinese) CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testTextBoxCopyAnchor) { - load("textbox-copy-anchor.docx"); + createSwDoc("textbox-copy-anchor.docx"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwDocShell* pShell = pTextDoc->GetDocShell(); SwWrtShell* pWrtShell = pShell->GetWrtShell(); @@ -91,7 +91,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testTextBoxCopyAnchor) CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testTextBoxNodeSplit) { - load("textbox-node-split.docx"); + createSwDoc("textbox-node-split.docx"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwDocShell* pShell = pTextDoc->GetDocShell(); SwWrtShell* pWrtShell = pShell->GetWrtShell(); @@ -135,7 +135,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testTitleFieldInvalidate) comphelper::LibreOfficeKit::setActive(true); // Given a document with a title field: - load("title-field-invalidate.fodt"); + createSwDoc("title-field-invalidate.fodt"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); pTextDoc->initializeForTiledRendering({}); SwDocShell* pShell = pTextDoc->GetDocShell(); @@ -171,7 +171,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testTitleFieldInvalidate) CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testFlyAnchorUndo) { // Given a document with a fly frame, anchored after the last char of the document: - load("fly-anchor-undo.odt"); + createSwDoc("fly-anchor-undo.odt"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwDocShell* pShell = pTextDoc->GetDocShell(); SwDoc* pDoc = pShell->GetDoc(); @@ -196,7 +196,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testFlyAnchorUndo) CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testSplitNodeSuperscriptCopy) { // Given a document with superscript text at the end of a paragraph: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->Insert("1st"); pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/true, 2, /*bBasicCall=*/false); @@ -220,7 +221,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testSplitNodeSuperscriptCopy) CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testInsertDropDownContentControlTwice) { // Given an already selected dropdown content control: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->InsertContentControl(SwContentControlType::DROP_DOWN_LIST); @@ -231,7 +233,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testInsertDropDownContentControlTwice) CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testCheckboxContentControlKeyboard) { // Given an already selected checkbox content control: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->InsertContentControl(SwContentControlType::CHECKBOX); SwEditWin& rEditWin = pWrtShell->GetView().GetEditWin(); @@ -255,7 +258,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testCheckboxContentControlKeyboard) CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testDropdownContentControlKeyboard) { // Given an already selected dropdown content control: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->InsertContentControl(SwContentControlType::DROP_DOWN_LIST); @@ -276,7 +280,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testDropdownContentControlKeyboard) CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testPictureContentControlKeyboard) { // Given an already selected picture content control: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->InsertContentControl(SwContentControlType::PICTURE); pWrtShell->GotoObj(/*bNext=*/true, GotoObjFlags::Any); @@ -303,7 +308,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testPictureContentControlKeyboard) CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testDateContentControlKeyboard) { // Given an already selected date content control: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->InsertContentControl(SwContentControlType::DATE); diff --git a/sw/qa/core/undo/undo.cxx b/sw/qa/core/undo/undo.cxx index 12d316c49259..583458d30127 100644 --- a/sw/qa/core/undo/undo.cxx +++ b/sw/qa/core/undo/undo.cxx @@ -35,7 +35,7 @@ public: CPPUNIT_TEST_FIXTURE(SwCoreUndoTest, testTextboxCutSave) { // Load the document and select all. - load("textbox-cut-save.docx"); + createSwDoc("textbox-cut-save.docx"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwDocShell* pDocShell = pTextDoc->GetDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); @@ -61,7 +61,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUndoTest, testTextboxCutSave) CPPUNIT_TEST_FIXTURE(SwCoreUndoTest, testTextboxCutUndo) { - load("textbox-cut-undo.docx"); + createSwDoc("textbox-cut-undo.docx"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwDocShell* pDocShell = pTextDoc->GetDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); @@ -90,7 +90,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUndoTest, testTextboxCutUndo) CPPUNIT_TEST_FIXTURE(SwCoreUndoTest, testTableCopyRedline) { // Given a document with two table cells and redlining enabled: - load("table-copy-redline.odt"); + createSwDoc("table-copy-redline.odt"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwDocShell* pDocShell = pTextDoc->GetDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); diff --git a/sw/qa/core/unocore/unocore.cxx b/sw/qa/core/unocore/unocore.cxx index 0706005a047e..a521cdebca8d 100644 --- a/sw/qa/core/unocore/unocore.cxx +++ b/sw/qa/core/unocore/unocore.cxx @@ -44,7 +44,7 @@ public: CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testTdf119081) { // Load a doc with a nested table in it. - load("tdf119081.odt"); + createSwDoc("tdf119081.odt"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); SwDocShell* pDocShell = pTextDoc->GetDocShell(); @@ -198,7 +198,7 @@ static void BasicDisplayErrorHandler(const OUString& /*rErr*/, const OUString& / CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testBrokenEmbeddedObject) { // Given a document with a broken embedded object (the XML markup is not well-formed): - load("broken-embedded-object.odt"); + createSwDoc("broken-embedded-object.odt"); uno::Reference<text::XTextEmbeddedObjectsSupplier> xSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xObjects(xSupplier->getEmbeddedObjects(), uno::UNO_QUERY); @@ -222,7 +222,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testBrokenEmbeddedObject) CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testLineBreakInsert) { // Given an empty document: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); // When inserting a line-break with properties: uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponent, uno::UNO_QUERY); @@ -314,7 +315,8 @@ CPPUNIT_TEST_FIXTURE(SwModelTestBase, testUserFieldTooltip) CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testContentControlInsert) { // Given an empty document: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); // When inserting a content control around one or more text portions: uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponent, uno::UNO_QUERY); @@ -384,7 +386,8 @@ CPPUNIT_TEST_FIXTURE(SwModelTestBase, testImageTooltip) CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testContentControlTextPortionEnum) { // Given a document with a content control around one or more text portions: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XText> xText = xTextDocument->getText(); @@ -441,7 +444,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testContentControlTextPortionEnum) CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testContentControlCheckbox) { // Given an empty document: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); // When inserting a checkbox content control: uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponent, uno::UNO_QUERY); @@ -479,7 +483,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testContentControlCheckbox) CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testContentControlDropdown) { // Given an empty document: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); // When inserting a dropdown content control: uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponent, uno::UNO_QUERY); @@ -556,7 +561,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testInsertFileInContentControlException) CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testContentControlPicture) { // Given an empty document: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); // When inserting a picture content control: uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponent, uno::UNO_QUERY); @@ -593,7 +599,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testContentControlPicture) CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testContentControlDate) { // Given an empty document: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); // When inserting a date content control: uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponent, uno::UNO_QUERY); @@ -657,7 +664,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testListIdState) { // Given a document with 3 paragraphs: an outer numbering on para 1 & 3, an inner numbering on // para 2: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); { SfxItemSetFixed<RES_PARATR_NUMRULE, RES_PARATR_NUMRULE> aSet(pWrtShell->GetAttrPool()); @@ -696,7 +704,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testListIdState) CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testContentControlPlainText) { // Given an empty document: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); // When inserting a plain text content control around a text portion: uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponent, uno::UNO_QUERY); @@ -748,7 +757,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testContentControlPlainText) CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testContentControlComboBox) { // Given an empty document: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); // When inserting a combobox content control: uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponent, uno::UNO_QUERY); diff --git a/sw/qa/core/view/view.cxx b/sw/qa/core/view/view.cxx index d2ba15d9b458..a3fd1863031e 100644 --- a/sw/qa/core/view/view.cxx +++ b/sw/qa/core/view/view.cxx @@ -40,7 +40,8 @@ public: CPPUNIT_TEST_FIXTURE(Test, testUpdateOleObjectPreviews) { // Given a document with two embedded objects, both with broken native data: - SwDoc* pDoc = createSwDoc("update-ole-object-previews.odt"); + createSwDoc("update-ole-object-previews.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); // When updating the previews of those embedded objects (right after document load, before diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx b/sw/qa/extras/globalfilter/globalfilter.cxx index 5db20aa7d7db..188340354a88 100644 --- a/sw/qa/extras/globalfilter/globalfilter.cxx +++ b/sw/qa/extras/globalfilter/globalfilter.cxx @@ -103,7 +103,7 @@ void Test::testEmbeddedGraphicRoundtrip() { // Check whether the export code swaps in the image which was swapped out before by auto mechanism - load("document_with_two_images.odt"); + createSwDoc("document_with_two_images.odt"); // Export the document and import again for a check reload(rFilterName.toUtf8().getStr(), nullptr); @@ -157,7 +157,7 @@ void Test::testLinkedGraphicRT() for (OUString const & rFilterName : aFilterNames) { - load("document_with_linked_graphic.odt"); + createSwDoc("document_with_linked_graphic.odt"); const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8(); @@ -213,7 +213,7 @@ void Test::testImageWithSpecialID() for (OUString const & rFilterName : aFilterNames) { - load("images_with_special_IDs.odt"); + createSwDoc("images_with_special_IDs.odt"); // Export the document and import again for a check reload(rFilterName.toUtf8().getStr(), nullptr); @@ -296,7 +296,7 @@ void Test::testGraphicShape() for (OUString const & rFilterName : aFilterNames) { - load("graphic_shape.odt"); + createSwDoc("graphic_shape.odt"); // Export the document and import again for a check reload(rFilterName.toUtf8().getStr(), nullptr); @@ -390,7 +390,7 @@ void Test::testMultipleIdenticalGraphics() for (OUString const & rFilterName : aFilterNames) { - load("multiple_identical_graphics.odt"); + createSwDoc("multiple_identical_graphics.odt"); // Export the document and import again for a check reload(rFilterName.toUtf8().getStr(), nullptr); @@ -432,7 +432,7 @@ void Test::testCharHighlightBody() for (OUString const & rFilterName : aFilterNames) { - load("char_highlight.docx"); + createSwDoc("char_highlight.docx"); const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8(); @@ -515,7 +515,7 @@ void Test::testCharStyleHighlight() for (OUString const & rFilterName : aFilterNames) { - load("tdf138345_charstyle_highlight.odt"); + createSwDoc("tdf138345_charstyle_highlight.odt"); const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8(); @@ -548,7 +548,7 @@ void Test::testCharHighlight() void Test::testCharHighlightODF() { - load("char_background_editing.docx"); + createSwDoc("char_background_editing.docx"); // don't check import, testMSCharBackgroundEditing already does that @@ -627,7 +627,7 @@ void Test::testMSCharBackgroundEditing() for (OUString const & rFilterName : aFilterNames) { - load("char_background_editing.docx"); + createSwDoc("char_background_editing.docx"); const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8(); @@ -726,7 +726,7 @@ void Test::testCharBackgroundToHighlighting() for (OUString const & rFilterName : aFilterNames) { - load("char_background.odt"); + createSwDoc("char_background.odt"); OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8(); @@ -790,7 +790,7 @@ void Test::testSkipImages() OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterNamePair.first.toUtf8(); setImportFilterOptions(rFilterNamePair.second); - load(rFilterNamePair.first.toUtf8().getStr()); + createSwDoc(rFilterNamePair.first.toUtf8().getStr()); sFailedMessage += " - " + rFilterNamePair.second.toUtf8(); // Check shapes (images, textboxes, custom shapes) @@ -911,7 +911,7 @@ void Test::testNestedFieldmark() for (auto const & rFilterName : aFilterNames) { - load(rFilterName.second.toUtf8().getStr()); + createSwDoc(rFilterName.second.toUtf8().getStr()); verifyNestedFieldmark(rFilterName.first + ", load", mxComponent); @@ -956,7 +956,7 @@ auto Test::verifyText13(char const*const pTestName) -> void void Test::testODF13() { // import - load("text13e.odt"); + createSwDoc("text13e.odt"); // check model verifyText13("import"); @@ -1068,7 +1068,8 @@ void Test::testRedlineFlags() "Office Open XML Text", }; - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwPaM pam(SwPosition(pDoc->GetNodes().GetEndOfContent(), SwNodeOffset(-1))); pDoc->getIDocumentContentOperations().InsertString(pam, "foo bar baz"); @@ -1114,7 +1115,7 @@ void Test::testBulletAsImage() { OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8(); - load("BulletAsImage.odt"); + createSwDoc("BulletAsImage.odt"); // Check if import was successful { @@ -1236,7 +1237,7 @@ void Test::testTextFormField() for (const OUString& rFilterName : aFilterNames) { - load("text_form_field.odt"); + createSwDoc("text_form_field.odt"); const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8(); @@ -1289,7 +1290,7 @@ void Test::testCheckBoxFormField() for (const OUString& rFilterName : aFilterNames) { - load("checkbox_form_field.odt"); + createSwDoc("checkbox_form_field.odt"); const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8(); @@ -1342,7 +1343,7 @@ void Test::testDropDownFormField() for (const OUString& rFilterName : aFilterNames) { - load("dropdown_form_field.odt"); + createSwDoc("dropdown_form_field.odt"); const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8(); @@ -1417,7 +1418,7 @@ void Test::testDateFormField() for (const OUString& rFilterName : aFilterNames) { - load("date_form_field.odt"); + createSwDoc("date_form_field.odt"); const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8(); @@ -1601,7 +1602,7 @@ void Test::testDateFormFieldCharacterFormatting() for (const OUString& rFilterName : aFilterNames) { - load("date_form_field_char_formatting.odt"); + createSwDoc("date_form_field_char_formatting.odt"); const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8(); diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx index 29d52500fa86..c04226e0f5c8 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -943,7 +943,7 @@ DECLARE_HTMLEXPORT_TEST(testTransparentImage, "transparent-image.odt") CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testTransparentImageReqIf) { - load("transparent-image.odt"); + createSwDoc("transparent-image.odt"); uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); uno::Sequence<beans::PropertyValue> aStoreProperties = { comphelper::makePropertyValue("FilterName", OUString("HTML (StarWriter)")), @@ -1098,7 +1098,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testRTFOLEMimeType) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testChinese) { // Load a document with Chinese text in it. - load("reqif-chinese.odt"); + createSwDoc("reqif-chinese.odt"); // Export it. ExportToReqif(); @@ -1186,7 +1186,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifParagraphAlignment) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifOle1PDF) { // Save to reqif-xhtml. - load("pdf-ole.odt"); + createSwDoc("pdf-ole.odt"); ExportToReqif(); OUString aRtfUrl = GetOlePath(); @@ -1273,7 +1273,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifOle1Paint) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifOle1PaintBitmapFormat) { // Given a document with a 8bpp bitmap: - load("paint-ole-bitmap-format.odt"); + createSwDoc("paint-ole-bitmap-format.odt"); // When exporting to reqif-xhtml with ExportImagesAsOLE enabled: uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); @@ -1370,7 +1370,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testUnderlineNone) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifOle1PresDataNoOle2) { // Save to reqif-xhtml. - load("no-ole2-pres-data.odt"); + createSwDoc("no-ole2-pres-data.odt"); ExportToReqif(); OUString aRtfUrl = GetOlePath(); SvMemoryStream aOle1; @@ -1386,7 +1386,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifOle1PresDataNoOle2) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifOle1PresDataWmfOnly) { // Save to reqif-xhtml. - load("ole1-pres-data-wmf.odt"); + createSwDoc("ole1-pres-data-wmf.odt"); ExportToReqif(); OUString aRtfUrl = GetOlePath(); SvMemoryStream aOle1; @@ -1403,7 +1403,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifOle1PresDataWmfOnly) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifAscharObjsize) { // Given a document with an as-char anchored embedded object: - load("reqif-aschar-objsize.odt"); + createSwDoc("reqif-aschar-objsize.odt"); // When exporting to reqif-xhtml: ExportToReqif(); @@ -1425,7 +1425,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifAscharObjsize) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifObjdataPresentationDataSize) { // Given a document with an OLE2 embedded object, containing a preview: - load("reqif-objdata-presentationdatasize.odt"); + createSwDoc("reqif-objdata-presentationdatasize.odt"); // When exporting to ReqIF: ExportToReqif(); @@ -2035,7 +2035,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testListsHeading) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testOleEmfPreviewToHtml) { // Given a document containing an embedded object, with EMF preview: - load("ole2.odt"); + createSwDoc("ole2.odt"); // When exporting to HTML: uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); @@ -2055,7 +2055,8 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testOleEmfPreviewToHtml) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testNestedBullets) { // Given a documented with nested lists: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->Insert("first"); sal_uInt16 nPos = pDoc->MakeNumRule(pDoc->GetUniqueNumRuleName()); @@ -2094,7 +2095,8 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testNestedBullets) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testTrailingLineBreak) { // Given a document with a trailing line-break: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->Insert("test\n"); @@ -2134,7 +2136,8 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testTrailingLineBreak) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testLeadingTab) { // Given a document with leading tabs: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->Insert("\t first"); pWrtShell->SplitNode(); @@ -2170,7 +2173,8 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testLeadingTab) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testLeadingTabHTML) { // Given a document with leading tabs: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->Insert("\t test"); @@ -2226,7 +2230,7 @@ CPPUNIT_TEST_FIXTURE(HtmlExportTest, testClearingBreak) // Given a document with an at-para anchored image + a clearing break: // When loading that file: - load("clearing-break.html"); + createSwWebDoc("clearing-break.html"); // Then make sure that the clear property of the break is not ignored: verify(); reload(mpFilter, "clearing-break.html"); @@ -2238,7 +2242,8 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testTableBackground) { // Given a document with two tables: first stable has a background, second table has a // background in its first row: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SwInsertTableOptions aInsertTableOptions(SwInsertTableFlags::DefaultBorder, /*nRowsToRepeat=*/0); @@ -2313,7 +2318,8 @@ CPPUNIT_TEST_FIXTURE(HtmlExportTest, testImageKeepRatio) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testSectionDir) { // Given a document with a section: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->Insert("test"); pWrtShell->SelAll(); @@ -2337,7 +2343,8 @@ CPPUNIT_TEST_FIXTURE(HtmlExportTest, testTdf114769) { // Create document from scratch since relative urls to filesystem can be replaced // by absolute during save/load - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->Insert("Hyperlink1"); pWrtShell->SplitNode(); diff --git a/sw/qa/extras/htmlimport/htmlimport.cxx b/sw/qa/extras/htmlimport/htmlimport.cxx index c1e4981cf983..b9d9595129f5 100644 --- a/sw/qa/extras/htmlimport/htmlimport.cxx +++ b/sw/qa/extras/htmlimport/htmlimport.cxx @@ -40,7 +40,7 @@ class HtmlImportTest : public SwModelTestBase CPPUNIT_TEST_FIXTURE(HtmlImportTest, testPictureImport) { - load("picture.html"); + createSwWebDoc("picture.html"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); // The document contains two pictures stored as a link. @@ -57,7 +57,7 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testPictureImport) CPPUNIT_TEST_FIXTURE(HtmlImportTest, testInlinedImage) { - load("inlined_image.html"); + createSwWebDoc("inlined_image.html"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); // The document contains only one embedded picture inlined in img's src attribute. @@ -95,7 +95,7 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testInlinedImage) CPPUNIT_TEST_FIXTURE(HtmlImportTest, testInlinedImagesPageAndParagraph) { - load("PageAndParagraphFilled.html"); + createSwWebDoc("PageAndParagraphFilled.html"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); @@ -136,7 +136,7 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testInlinedImagesPageAndParagraph) CPPUNIT_TEST_FIXTURE(HtmlImportTest, testListStyleType) { - load("list-style.html"); + createSwWebDoc("list-style.html"); // check unnumbered list style - should be type circle here uno::Reference< beans::XPropertySet > xParagraphProperties(getParagraph(4), uno::UNO_QUERY); @@ -181,7 +181,7 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testListStyleType) CPPUNIT_TEST_FIXTURE(HtmlImportTest, testMetaIsoDates) { - load("meta-ISO8601-dates.html"); + createSwWebDoc("meta-ISO8601-dates.html"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); SwDocShell* pDocShell(pTextDoc->GetDocShell()); @@ -202,7 +202,7 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testMetaIsoDates) CPPUNIT_TEST_FIXTURE(HtmlImportTest, testImageWidthAuto) { - load("image-width-auto.html"); + createSwWebDoc("image-width-auto.html"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); SwTextAttr const*const pAttr(pTextDoc->GetDocShell()->GetDoc()->GetEditShell()-> @@ -215,7 +215,7 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testImageWidthAuto) CPPUNIT_TEST_FIXTURE(HtmlImportTest, testImageLazyRead) { - load("image-lazy-read.html"); + createSwWebDoc("image-lazy-read.html"); auto xGraphic = getProperty<uno::Reference<graphic::XGraphic>>(getShape(1), "Graphic"); Graphic aGraphic(xGraphic); // This failed, import loaded the graphic, it wasn't lazy-read. @@ -224,7 +224,7 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testImageLazyRead) CPPUNIT_TEST_FIXTURE(HtmlImportTest, testChangedby) { - load("meta-changedby.html"); + createSwWebDoc("meta-changedby.html"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); SwDocShell* pDocShell(pTextDoc->GetDocShell()); @@ -250,7 +250,7 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testChangedby) CPPUNIT_TEST_FIXTURE(HtmlImportTest, testTableBorder1px) { - load("table_border_1px.html"); + createSwWebDoc("table_border_1px.html"); uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount()); @@ -301,7 +301,7 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testTableBorder1px) CPPUNIT_TEST_FIXTURE(HtmlImportTest, testOutlineLevel) { - load("outline-level.html"); + createSwWebDoc("outline-level.html"); // This was 0, HTML imported into Writer lost the outline numbering for // Heading 1 styles. CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), @@ -312,14 +312,14 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testReqIfBr) { setImportFilterOptions("xhtmlns=reqif-xhtml"); setImportFilterName("HTML (StarWriter)"); - load("reqif-br.xhtml"); + createSwDoc("reqif-br.xhtml"); // <reqif-xhtml:br/> was not recognized as a line break from a ReqIf file. CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("aaa\nbbb")); } CPPUNIT_TEST_FIXTURE(HtmlImportTest, testTdf80194_subscript) { - load("tdf80194_subscript.html"); + createSwWebDoc("tdf80194_subscript.html"); uno::Reference<text::XTextRange> xPara = getParagraph(1); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.f, getProperty<float>(getRun(xPara, 1), "CharEscapement"), 0); // Most recently, the default subscript was 33%, which is much too large for a subscript. @@ -341,7 +341,7 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testReqIfTable) { setImportFilterOptions("xhtmlns=reqif-xhtml"); setImportFilterName("HTML (StarWriter)"); - load("reqif-table.xhtml"); + createSwDoc("reqif-table.xhtml"); // to see this: soffice --infilter="HTML (StarWriter):xhtmlns=reqif-xhtml" sw/qa/extras/htmlimport/data/reqif-table.xhtml // Load a table with xhtmlns=reqif-xhtml filter param. uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY); @@ -365,7 +365,7 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testReqIfTable) CPPUNIT_TEST_FIXTURE(HtmlImportTest, testImageSize) { - load("image-size.html"); + createSwWebDoc("image-size.html"); awt::Size aSize = getShape(1)->getSize(); OutputDevice* pDevice = Application::GetDefaultDevice(); Size aPixelSize(200, 400); @@ -379,7 +379,7 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testImageSize) CPPUNIT_TEST_FIXTURE(HtmlImportTest, testTdf142781) { - load("tdf142781.html"); + createSwWebDoc("tdf142781.html"); OutputDevice* pDevice = Application::GetDefaultDevice(); Size aPixelSize(672, 480); Size aExpected = pDevice->PixelToLogic(aPixelSize, MapMode(MapUnit::Map100thMM)); @@ -398,7 +398,7 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testTdf142781) CPPUNIT_TEST_FIXTURE(HtmlImportTest, testTdf122789) { - load("tdf122789.html"); + createSwWebDoc("tdf122789.html"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); @@ -410,7 +410,7 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testTdf122789) CPPUNIT_TEST_FIXTURE(HtmlImportTest, testTdf118579) { - load("tdf118579.html"); + createSwWebDoc("tdf118579.html"); //Without the fix in place, the file fails to load SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); @@ -420,7 +420,7 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testReqIfPageStyle) { setImportFilterOptions("xhtmlns=reqif-xhtml"); setImportFilterName("HTML (StarWriter)"); - load("reqif-page-style.xhtml"); + createSwDoc("reqif-page-style.xhtml"); // Without the accompanying fix in place, this test would have failed with // 'Expected: Standard, Actual : HTML'. CPPUNIT_ASSERT_EQUAL(OUString("Standard"), @@ -461,7 +461,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlOptionsImportTest, testAllowedRTFOLEMimeTypes) CPPUNIT_TEST_FIXTURE(SwHtmlOptionsImportTest, testHiddenTextframe) { // Load HTML content into Writer, similar to HTML paste. - load("hidden-textframe.html"); + createSwWebDoc("hidden-textframe.html"); // Check the content of the draw page. uno::Reference<drawing::XDrawPageSupplier> xSupplier(mxComponent, uno::UNO_QUERY); @@ -480,7 +480,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlOptionsImportTest, testOleImg) // ignored): setImportFilterOptions("xhtmlns=reqif-xhtml"); setImportFilterName("HTML (StarWriter)"); - load("ole-img.xhtml"); + createSwDoc("ole-img.xhtml"); // Then make sure the result is a single Writer image: uno::Reference<text::XTextGraphicObjectsSupplier> xSupplier(mxComponent, uno::UNO_QUERY); @@ -499,7 +499,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlOptionsImportTest, testOleImgSvg) // ignored): setImportFilterOptions("xhtmlns=reqif-xhtml"); setImportFilterName("HTML (StarWriter)"); - load("ole-img-svg.xhtml"); + createSwDoc("ole-img-svg.xhtml"); // Then make sure the result is a single Writer image: uno::Reference<text::XTextGraphicObjectsSupplier> xSupplier(mxComponent, uno::UNO_QUERY); @@ -514,7 +514,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlOptionsImportTest, testOleImgSvg) CPPUNIT_TEST_FIXTURE(HtmlImportTest, testUTF16_nonBMP) { - load("emojis16BE.html"); + createSwWebDoc("emojis16BE.html"); // tdf#146173: non-BMP characters' surrogates didn't combine correctly CPPUNIT_ASSERT_EQUAL(OUString(u"a text with emojis: 🌾 ☀👨🏼🌾🏃🏼♂️🤙🏽🔍"), getParagraph(1)->getString()); @@ -526,7 +526,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlOptionsImportTest, testOleData) // (containing PNG): setImportFilterOptions("xhtmlns=reqif-xhtml"); setImportFilterName("HTML (StarWriter)"); - load("ole-data.xhtml"); + createSwDoc("ole-data.xhtml"); // Then make sure the result is a single clickable Writer image: uno::Reference<text::XTextGraphicObjectsSupplier> xSupplier(mxComponent, uno::UNO_QUERY); @@ -547,7 +547,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlOptionsImportTest, testOleData2) // Given an XHTML with 2 objects: the first has a link, the second does not have: setImportFilterOptions("xhtmlns=reqif-xhtml"); setImportFilterName("HTML (StarWriter)"); - load("ole-data2.xhtml"); + createSwDoc("ole-data2.xhtml"); // Then make sure that the second image doesn't have a link set: uno::Reference<text::XTextGraphicObjectsSupplier> xSupplier(mxComponent, uno::UNO_QUERY); diff --git a/sw/qa/extras/indexing/IndexingExportTest.cxx b/sw/qa/extras/indexing/IndexingExportTest.cxx index 2161f7476967..fa56aa3c53a0 100644 --- a/sw/qa/extras/indexing/IndexingExportTest.cxx +++ b/sw/qa/extras/indexing/IndexingExportTest.cxx @@ -44,7 +44,8 @@ public: void IndexingExportTest::testIndexingExport_Paragraphs() { - SwDoc* pDoc = createSwDoc("IndexingExport_VariousParagraphs.odt"); + createSwDoc("IndexingExport_VariousParagraphs.odt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); SvMemoryStream aMemoryStream; @@ -79,7 +80,8 @@ void IndexingExportTest::testIndexingExport_Paragraphs() void IndexingExportTest::testIndexingExport_Images() { - SwDoc* pDoc = createSwDoc("IndexingExport_Images.odt"); + createSwDoc("IndexingExport_Images.odt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); SvMemoryStream aMemoryStream; @@ -101,7 +103,8 @@ void IndexingExportTest::testIndexingExport_Images() void IndexingExportTest::testIndexingExport_OLE() { - SwDoc* pDoc = createSwDoc("IndexingExport_OLE.odt"); + createSwDoc("IndexingExport_OLE.odt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); SvMemoryStream aMemoryStream; @@ -120,7 +123,8 @@ void IndexingExportTest::testIndexingExport_OLE() void IndexingExportTest::testIndexingExport_Shapes() { - SwDoc* pDoc = createSwDoc("IndexingExport_Shapes.odt"); + createSwDoc("IndexingExport_Shapes.odt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); SvMemoryStream aMemoryStream; @@ -159,7 +163,8 @@ void IndexingExportTest::testIndexingExport_Shapes() void IndexingExportTest::testIndexingExport_Tables() { - SwDoc* pDoc = createSwDoc("IndexingExport_Tables.odt"); + createSwDoc("IndexingExport_Tables.odt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); SvMemoryStream aMemoryStream; @@ -226,7 +231,8 @@ void IndexingExportTest::testIndexingExport_Tables() void IndexingExportTest::testIndexingExport_Sections() { - SwDoc* pDoc = createSwDoc("IndexingExport_Sections.odt"); + createSwDoc("IndexingExport_Sections.odt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); SvMemoryStream aMemoryStream; @@ -257,7 +263,8 @@ void IndexingExportTest::testIndexingExport_Sections() void IndexingExportTest::testIndexingExport_Fontwork() { - SwDoc* pDoc = createSwDoc("IndexingExport_Fontwork.odt"); + createSwDoc("IndexingExport_Fontwork.odt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); SvMemoryStream aMemoryStream; @@ -281,7 +288,8 @@ void IndexingExportTest::testIndexingExport_Fontwork() void IndexingExportTest::testIndexingExport_Header_Footer() { - SwDoc* pDoc = createSwDoc("IndexingExport_Header_Footer.odt"); + createSwDoc("IndexingExport_Header_Footer.odt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); SvMemoryStream aMemoryStream; diff --git a/sw/qa/extras/indexing/SearchResultLocatorTest.cxx b/sw/qa/extras/indexing/SearchResultLocatorTest.cxx index 670069318ab8..b953ea3e100a 100644 --- a/sw/qa/extras/indexing/SearchResultLocatorTest.cxx +++ b/sw/qa/extras/indexing/SearchResultLocatorTest.cxx @@ -41,7 +41,8 @@ void SearchResultLocatorTest::testSearchResultLocator() if (!IsDefaultDPI()) return; - SwDoc* pDoc = createSwDoc("IndexingExport_VariousParagraphs.odt"); + createSwDoc("IndexingExport_VariousParagraphs.odt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); sw::search::SearchResultLocator aLocator(pDoc); @@ -68,7 +69,8 @@ void SearchResultLocatorTest::testSearchResultLocatorUsingXmlPayload() if (!IsDefaultDPI()) return; - SwDoc* pDoc = createSwDoc("IndexingExport_VariousParagraphs.odt"); + createSwDoc("IndexingExport_VariousParagraphs.odt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); sw::search::SearchResultLocator aLocator(pDoc); @@ -96,7 +98,8 @@ void SearchResultLocatorTest::testSearchResultLocatorUsingJsonPayload() if (!IsDefaultDPI()) return; - SwDoc* pDoc = createSwDoc("IndexingExport_VariousParagraphs.odt"); + createSwDoc("IndexingExport_VariousParagraphs.odt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); sw::search::SearchResultLocator aLocator(pDoc); @@ -124,7 +127,8 @@ void SearchResultLocatorTest::testSearchResultLocatorForSdrObjects() if (!IsDefaultDPI()) return; - SwDoc* pDoc = createSwDoc("IndexingExport_Shapes.odt"); + createSwDoc("IndexingExport_Shapes.odt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); sw::search::SearchResultLocator aLocator(pDoc); @@ -151,7 +155,8 @@ void SearchResultLocatorTest::testSearchResultLocatorForSdrObjectsUsingJsonPaylo if (!IsDefaultDPI()) return; - SwDoc* pDoc = createSwDoc("IndexingExport_Shapes.odt"); + createSwDoc("IndexingExport_Shapes.odt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); sw::search::SearchResultLocator aLocator(pDoc); diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 4d251d786218..180f9c604e06 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -283,7 +283,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFootnotes) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf136588) { - load("tdf136588.docx"); + createSwDoc("tdf136588.docx"); auto pXMLLayoutDump = parseLayoutDump(); CPPUNIT_ASSERT(pXMLLayoutDump); @@ -700,7 +700,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInBody) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf134272) { - SwDoc* pDoc = createSwDoc("tdf134472.odt"); + createSwDoc("tdf134472.odt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "/root/page[1]/header/txt[2]/infos/bounds", "height", "843"); @@ -709,7 +710,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf134272) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestNestedTableMoveFwd) { - SwDoc* pDoc = createSwDoc("tabellen_test_windows_1.odt"); + createSwDoc("tabellen_test_windows_1.odt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // the row with the nested table should not be split but be the first row on page 2 @@ -722,7 +724,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestNestedTableMoveFwd) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf136613) { - SwDoc* pDoc = createSwDoc("tdf136613.docx"); + createSwDoc("tdf136613.docx"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); //get the flys and the root frame @@ -753,7 +756,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf136613) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf88496) { - SwDoc* pDoc = createSwDoc("tdf88496.docx"); + createSwDoc("tdf88496.docx"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // This was 4, table fallback "switch off repeating header" started on a new page @@ -1193,7 +1197,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInHeader) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf137025) { // Check the padding of the textbox - SwDoc* pDoc = createSwDoc("tdf137025.docx"); + createSwDoc("tdf137025.docx"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); CPPUNIT_ASSERT(pXmlDoc); @@ -1878,7 +1883,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFootnote) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf143239) { - SwDoc* pDoc = createSwDoc("tdf143239-1-min.odt"); + createSwDoc("tdf143239-1-min.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); // These are unstable on macOS and Win64 builds, @@ -1938,7 +1944,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTableOverlapFooterFly) { // Load a document that has a fly anchored in the footer. // It also has a table which initially overlaps with the fly, but then moves to the next page. - load("footer-fly-table.fodt"); + createSwDoc("footer-fly-table.fodt"); xmlDocUniquePtr pLayout = parseLayoutDump(); // no fly portions, was: 8 assertXPath(pLayout, @@ -1965,7 +1971,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTableOverlapFooterFly) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf134277) { - SwDoc* pDoc = createSwDoc("tdf134277.docx"); + createSwDoc("tdf134277.docx"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); SwDocShell* pShell = pDoc->GetDocShell(); @@ -1983,7 +1990,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf134277) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf116486) { - SwDoc* pDoc = createSwDoc("tdf116486.docx"); + createSwDoc("tdf116486.docx"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); OUString aTop = parseDump( "/root/page/body/txt/SwParaPortion/SwLineLayout[1]/child::*[@type='PortionType::Fly']", @@ -1994,7 +2002,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf116486) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf142080) { // this caused an infinite loop - load("fdo43573-2-min.docx"); + createSwDoc("fdo43573-2-min.docx"); xmlDocUniquePtr pLayout = parseLayoutDump(); // check the first paragraph on page 9 with its fly; the column was empty too @@ -2012,7 +2020,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf142080) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf128198) { - SwDoc* pDoc = createSwDoc("tdf128198-1.docx"); + createSwDoc("tdf128198-1.docx"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); xmlDocUniquePtr pLayout = parseLayoutDump(); // the problem was that line 5 was truncated at "this " @@ -2026,7 +2035,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf128198) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testNoLineBreakAtSlash) { - load("no-line-break-at-slash.fodt"); + createSwDoc("no-line-break-at-slash.fodt"); xmlDocUniquePtr pLayout = parseLayoutDump(); // the line break was between "Foostrasse 13/c/" and "2" @@ -2050,7 +2059,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testNoLineBreakAtSlash) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf106153) { - load("tdf106153.docx"); + createSwDoc("tdf106153.docx"); xmlDocUniquePtr pDump = parseLayoutDump(); const sal_Int64 nPageValLeft = getXPath(pDump, "/root/page/infos/bounds", "left").toInt64(); @@ -3456,7 +3465,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf147485Forcepoint) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf118058) { - SwDoc* pDoc = createSwDoc("tdf118058.fodt"); + createSwDoc("tdf118058.fodt"); + SwDoc* pDoc = getSwDoc(); // This resulted in a layout loop. pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout(); } @@ -3639,7 +3649,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf115094) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf112290) { - SwDoc* pDoc = createSwDoc("tdf112290.docx"); + createSwDoc("tdf112290.docx"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); auto pXml = parseLayoutDump(); assertXPath(pXml, "/root/page/body/txt/SwParaPortion/SwLineLayout[2]", "portion", "Xxxx Xxxx"); @@ -3802,7 +3813,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf150616) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testBtlrCell) { - SwDoc* pDoc = createSwDoc("btlr-cell.odt"); + createSwDoc("btlr-cell.odt"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -4009,7 +4021,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testAbi11870) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf118719) { // Insert a page break. - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); // Enable hide whitespace mode. @@ -4043,7 +4056,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testImageComment) { // Load a document that has "aaa" in it, then a commented image (4th char is the as-char image, // 5th char is the comment anchor). - SwDoc* pDoc = createSwDoc("image-comment.odt"); + createSwDoc("image-comment.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); // Look up a layout position which is on the right of the image. @@ -4077,7 +4091,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testImageComment) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testScriptField) { // Test clicking script field inside table ( tdf#141079 ) - SwDoc* pDoc = createSwDoc("tdf141079.odt"); + createSwDoc("tdf141079.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); // Look up layout position which is the first cell in the table @@ -4110,7 +4125,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testScriptField) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testCommentCursorPosition) { // Load a document that has "aaa" in it, followed by three comments. - SwDoc* pDoc = createSwDoc("endOfLineComments.odt"); + createSwDoc("endOfLineComments.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SwRootFrame* pRoot = pWrtShell->GetLayout(); @@ -4143,7 +4159,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testCommentCursorPosition) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testCombiningCharacterCursorPosition) { // Load a document that has "a" in it, followed by a combining acute in a separate rext span - SwDoc* pDoc = createSwDoc("tdf138592-a-acute.fodt"); + createSwDoc("tdf138592-a-acute.fodt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SwRootFrame* pRoot = pWrtShell->GetLayout(); @@ -4182,7 +4199,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf64222) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf113014) { - SwDoc* pDoc = createSwDoc("tdf113014.fodt"); + createSwDoc("tdf113014.fodt"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -4201,7 +4219,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf113014) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf130218) { - SwDoc* pDoc = createSwDoc("tdf130218.fodt"); + createSwDoc("tdf130218.fodt"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -4217,7 +4236,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf130218) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf127235) { - SwDoc* pDoc = createSwDoc("tdf127235.odt"); + createSwDoc("tdf127235.odt"); + SwDoc* pDoc = getSwDoc(); // This resulted in a layout loop. pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout(); } @@ -4440,7 +4460,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf124601b) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf124770) { // Enable content over margin. - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); pDoc->getIDocumentSettingAccess().set(DocumentSettingId::TAB_OVER_MARGIN, true); // Set page width. @@ -4485,7 +4506,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf124770) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testContinuousEndnotesInsertPageAtStart) { // Create a new document with CONTINUOUS_ENDNOTES enabled. - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); pDoc->getIDocumentSettingAccess().set(DocumentSettingId::CONTINUOUS_ENDNOTES, true); // Insert a second page, and an endnote on the 2nd page (both the anchor and the endnote is on @@ -4511,7 +4533,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testContinuousEndnotesInsertPageAtStart) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testContinuousEndnotesDeletePageAtStart) { // Create a new document with CONTINUOUS_ENDNOTES enabled. - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); pDoc->getIDocumentSettingAccess().set(DocumentSettingId::CONTINUOUS_ENDNOTES, true); // Insert a second page, and an endnote on the 2nd page (both the anchor and the endnote is on @@ -4536,7 +4559,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testContinuousEndnotesDeletePageAtStart) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf128399) { - SwDoc* pDoc = createSwDoc("tdf128399.docx"); + createSwDoc("tdf128399.docx"); + SwDoc* pDoc = getSwDoc(); SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); SwFrame* pPage = pLayout->GetLower(); SwFrame* pBody = pPage->GetLower(); @@ -4643,7 +4667,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf105481) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf117982) { - SwDoc* pDocument = createSwDoc("tdf117982.docx"); + createSwDoc("tdf117982.docx"); + SwDoc* pDocument = getSwDoc(); SwDocShell* pShell = pDocument->GetDocShell(); std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; @@ -4656,7 +4681,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf117982) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf128959) { // no orphan/widow control in table cells - SwDoc* pDocument = createSwDoc("tdf128959.docx"); + createSwDoc("tdf128959.docx"); + SwDoc* pDocument = getSwDoc(); CPPUNIT_ASSERT(pDocument); discardDumpedLayout(); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); @@ -4777,7 +4803,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testStableAtPageAnchoredFlyPosition) // it also has a style:master-page named "StandardEntwurf", which contains some fields. // if you add a break to page 2, or append some text to page 4 (or just toggle display field names), // the page anchored frame on page 4 vanishes, as it is incorrectly moved out of the page bounds. - SwDoc* pDoc = createSwDoc("stable-at-page-anchored-fly-position.odt"); + createSwDoc("stable-at-page-anchored-fly-position.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); // look up the layout position of the page-bound frame on page four @@ -4846,7 +4873,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf124423) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf137185) { // First load the sample bugdoc - load("tdf137185.odt"); + createSwDoc("tdf137185.odt"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); // Get the doc shell @@ -4886,7 +4913,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf137185) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf138782) { - CPPUNIT_ASSERT(createSwDoc("tdf138782.docx")); + createSwDoc("tdf138782.docx"); auto pXml = parseLayoutDump(); CPPUNIT_ASSERT(pXml); @@ -4928,7 +4955,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf135035) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf146704_EndnoteInSection) { - SwDoc* pDoc = createSwDoc("tdf146704_EndnoteInSection.odt"); + createSwDoc("tdf146704_EndnoteInSection.odt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // Without the fix, the endnote placed to 2. page ... etc. - the rest is truncated