From 4a6b56a5a1cd8756ff6d0335554fe78bf9988c27 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Fri, 11 Nov 2022 14:18:18 +0100 Subject: 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 --- .../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(-) 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(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 xMSF(mxComponent, uno::UNO_QUERY); uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference 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 xMSF(mxComponent, uno::UNO_QUERY); uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference 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(2), rFrameFormats.size()); CPPUNIT_ASSERT_EQUAL(o3tl::narrowing(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); @@ -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(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 xMSF(mxComponent, uno::UNO_QUERY); uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference 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(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 xFactory(mxComponent, uno::UNO_QUERY); uno::Reference 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(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(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(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(mxComponent.get()); SwDocShell* pShell = pTextDoc->GetDocShell(); std::shared_ptr 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(mxComponent.get()); SwDocShell* pShell = pTextDoc->GetDocShell(); std::shared_ptr 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(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(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(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(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(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 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 xFactory(mxComponent, uno::UNO_QUERY); uno::Reference 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 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 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(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 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 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 xFactory(mxComponent, uno::UNO_QUERY); uno::Reference 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 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 "xxxyyy": - 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 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 xStorable(mxComponent, uno::UNO_QUERY); uno::Sequence 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(mxComponent.get()); SwDocShell* pShell = pTextDoc->GetDocShell(); std::shared_ptr 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(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(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(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(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(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(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(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(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 xSupplier(mxComponent, uno::UNO_QUERY); uno::Reference 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 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 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 xMSF(mxComponent, uno::UNO_QUERY); uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference 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 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 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 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 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 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 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 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 xStorable(mxComponent, uno::UNO_QUERY); uno::Sequence 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 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 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(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(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(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(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(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>(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(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 xTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference 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(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"); // 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 xPara = getParagraph(1); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.f, getProperty(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 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(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(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 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 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 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 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 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 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(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 @@ -4937,7 +4965,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf146704_EndnoteInSection) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf139336_ColumnsWithFootnoteDoNotOccupyEntirePage) { - SwDoc* pDoc = createSwDoc("tdf139336_ColumnsWithFootnoteDoNotOccupyEntirePage.docx"); + createSwDoc("tdf139336_ColumnsWithFootnoteDoNotOccupyEntirePage.docx"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // Without the fix, it would be 5 pages, but with the fix the whole document @@ -4955,7 +4984,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf54465_ColumnsWithFootnoteDoNotOccupy // was more than 1 page long. // Note: Somewhy this test miscalculates the layout of the old odt file. // It will be 4 pages long, while opened in Writer it is 5 pages long. - SwDoc* pDoc = createSwDoc("tdf54465_ColumnsWithFootnoteDoNotOccupyEntirePage_Old.odt"); + createSwDoc("tdf54465_ColumnsWithFootnoteDoNotOccupyEntirePage_Old.odt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); Scheduler::ProcessEventsToIdle(); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); @@ -4965,7 +4995,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf54465_ColumnsWithFootnoteDoNotOccupy xmlXPathFreeObject(pXmlObj); discardDumpedLayout(); - pDoc = createSwDoc("tdf54465_ColumnsWithFootnoteDoNotOccupyEntirePage_New.odt"); + createSwDoc("tdf54465_ColumnsWithFootnoteDoNotOccupyEntirePage_New.odt"); + pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "/root/page", 1); diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx index 99ef5cf22470..f844f0587c30 100644 --- a/sw/qa/extras/layout/layout2.cxx +++ b/sw/qa/extras/layout/layout2.cxx @@ -379,7 +379,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineShowHideFootnotePagination) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testtdf138951) { // Open the bugdoc - auto pDoc = createSwDoc("tdf138951.odt"); + createSwDoc("tdf138951.odt"); + auto pDoc = getSwDoc(); // Get the only shape uno::Reference xShape(getShape(1), uno::UNO_QUERY); @@ -449,7 +450,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf150790) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineNumberInNumbering) { - SwDoc* pDoc = createSwDoc("tdf42748.fodt"); + createSwDoc("tdf42748.fodt"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -473,7 +475,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineNumberInNumbering) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineNumbering) { - SwDoc* pDoc = createSwDoc("tdf115523.fodt"); + createSwDoc("tdf115523.fodt"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -494,7 +497,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineNumbering) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineNumbering2) { - SwDoc* pDoc = createSwDoc("tdf115524.fodt"); + createSwDoc("tdf115524.fodt"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -515,7 +519,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineNumbering2) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf149710_RedlineNumberingEditing) { - SwDoc* pDoc = createSwDoc("tdf149710.fodt"); + createSwDoc("tdf149710.fodt"); + SwDoc* pDoc = getSwDoc(); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); @@ -557,7 +562,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf149710_RedlineNumberingEditing) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf149709_RedlineNumberingLevel) { - SwDoc* pDoc = createSwDoc("tdf149709.fodt"); + createSwDoc("tdf149709.fodt"); + SwDoc* pDoc = getSwDoc(); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); @@ -614,7 +620,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf149709_RedlineNumberingLevel) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf149711_importDOCXMoveToParagraphMark) { - SwDoc* pDoc = createSwDoc("tdf149711.docx"); + createSwDoc("tdf149711.docx"); + SwDoc* pDoc = getSwDoc(); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "/root/page[1]/body/txt", 6); @@ -631,7 +638,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf149711_importDOCXMoveToParagraphMar CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineNumberInFootnote) { - SwDoc* pDoc = createSwDoc("tdf85610.fodt"); + createSwDoc("tdf85610.fodt"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -649,7 +657,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineNumberInFootnote) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineMoving) { - SwDoc* pDoc = createSwDoc("tdf42748.fodt"); + createSwDoc("tdf42748.fodt"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // create a 3-element list without change tracking @@ -677,7 +686,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineMoving) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineMoving2) { - SwDoc* pDoc = createSwDoc("tdf42748.fodt"); + createSwDoc("tdf42748.fodt"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // create a 3-element list without change tracking @@ -710,7 +720,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineMoving2) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineMovingDOCX) { - SwDoc* pDoc = createSwDoc("tdf104797.docx"); + createSwDoc("tdf104797.docx"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); SwEditShell* const pEditShell(pDoc->GetEditShell()); @@ -775,7 +786,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTableCellInvalidate) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf145719) { - SwDoc* pDoc = createSwDoc("tdf145719.odt"); + createSwDoc("tdf145719.odt"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -791,7 +803,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf145719) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testChangedTableRows) { - SwDoc* pDoc = createSwDoc("changed_table_rows.fodt"); + createSwDoc("changed_table_rows.fodt"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -810,7 +823,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testChangedTableRows) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf145225_RedlineMovingWithBadInsertion) { - SwDoc* pDoc = createSwDoc("tdf42748.fodt"); + createSwDoc("tdf42748.fodt"); + SwDoc* pDoc = getSwDoc(); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); @@ -845,7 +859,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf145225_RedlineMovingWithBadInsertio CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf146964_ReappearingMovedTextInHideChangesMode) { - SwDoc* pDoc = createSwDoc("tdf54819.fodt"); + createSwDoc("tdf54819.fodt"); + SwDoc* pDoc = getSwDoc(); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); @@ -877,7 +892,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf146964_ReappearingMovedTextInHideCh CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf125300) { - SwDoc* pDoc = createSwDoc("tdf125300.docx"); + createSwDoc("tdf125300.docx"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -900,7 +916,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf125300) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf116830) { - SwDoc* pDoc = createSwDoc("tdf116830.odt"); + createSwDoc("tdf116830.odt"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -927,7 +944,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf116830) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf114163) { - SwDoc* pDoc = createSwDoc("tdf114163.odt"); + createSwDoc("tdf114163.odt"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -952,7 +970,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf131707) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf122225) { - SwDoc* pDoc = createSwDoc("tdf122225.docx"); + createSwDoc("tdf122225.docx"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -977,7 +996,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf122225) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf125335) { - SwDoc* pDoc = createSwDoc("tdf125335.odt"); + createSwDoc("tdf125335.odt"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -992,7 +1012,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf125335) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf134247) { - SwDoc* pDoc = createSwDoc("legend-itemorder-min.docx"); + createSwDoc("legend-itemorder-min.docx"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1007,7 +1028,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf134247) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf75659) { - SwDoc* pDoc = createSwDoc("tdf75659.docx"); + createSwDoc("tdf75659.docx"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1024,7 +1046,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf75659) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf136816) { - SwDoc* pDoc = createSwDoc("tdf136816.odt"); + createSwDoc("tdf136816.odt"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1039,7 +1062,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf136816) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf126425) { - SwDoc* pDoc = createSwDoc("long_legendentry.docx"); + createSwDoc("long_legendentry.docx"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1056,7 +1080,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf126425) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testUnusedOLEprops) { - CPPUNIT_ASSERT(createSwDoc("tdf138465min.docx")); + createSwDoc("tdf138465min.docx"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); CPPUNIT_ASSERT(pXmlDoc); @@ -1072,7 +1096,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testUnusedOLEprops) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf123268) { - SwDoc* pDoc = createSwDoc("tdf123268.odt"); + createSwDoc("tdf123268.odt"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1090,7 +1115,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf123268) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf133005) { - SwDoc* pDoc = createSwDoc("tdf133005.odt"); + createSwDoc("tdf133005.odt"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1116,7 +1142,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf133005) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf115630) { - SwDoc* pDoc = createSwDoc("tdf115630.docx"); + createSwDoc("tdf115630.docx"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1141,7 +1168,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf115630) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf108021) { - SwDoc* pDoc = createSwDoc("tdf108021.odt"); + createSwDoc("tdf108021.odt"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1156,7 +1184,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf108021) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf125334) { - SwDoc* pDoc = createSwDoc("tdf125334.odt"); + createSwDoc("tdf125334.odt"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1171,7 +1200,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf125334) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf122800) { - SwDoc* pDoc = createSwDoc("tdf122800.odt"); + createSwDoc("tdf122800.odt"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1186,7 +1216,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf122800) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTruncatedAxisLabel) { - SwDoc* pDoc = createSwDoc("testTruncatedAxisLabel.odt"); + createSwDoc("testTruncatedAxisLabel.odt"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1204,7 +1235,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTruncatedAxisLabel) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf128996) { - SwDoc* pDoc = createSwDoc("tdf128996.docx"); + createSwDoc("tdf128996.docx"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1218,7 +1250,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf128996) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf126244) { - SwDoc* pDoc = createSwDoc("tdf126244.docx"); + createSwDoc("tdf126244.docx"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1246,7 +1279,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf126244) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf127304) { - SwDoc* pDoc = createSwDoc("tdf127304.odt"); + createSwDoc("tdf127304.odt"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1271,7 +1305,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf127304) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testHorizontal_multilevel) { - SwDoc* pDoc = createSwDoc("horizontal_multilevel.odt"); + createSwDoc("horizontal_multilevel.odt"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1367,7 +1402,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf116256) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf138194) { - SwDoc* pDoc = createSwDoc("xaxis-labelbreak.docx"); + createSwDoc("xaxis-labelbreak.docx"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1405,7 +1441,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf146272) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf138773) { - SwDoc* pDoc = createSwDoc("tdf138773.docx"); + createSwDoc("tdf138773.docx"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1423,7 +1460,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf138773) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf124796) { - SwDoc* pDoc = createSwDoc("tdf124796.odt"); + createSwDoc("tdf124796.odt"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1441,7 +1479,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf124796) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf72727) { - SwDoc* pDoc = createSwDoc("tdf72727.odt"); + createSwDoc("tdf72727.odt"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1460,7 +1499,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf72727) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf130969) { - SwDoc* pDoc = createSwDoc("tdf130969.docx"); + createSwDoc("tdf130969.docx"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1475,7 +1515,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf130969) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf40260) { - SwDoc* pDoc = createSwDoc("tdf40260.odt"); + createSwDoc("tdf40260.odt"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); @@ -1493,7 +1534,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf40260) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf129054) { - SwDoc* pDoc = createSwDoc("tdf129054.docx"); + createSwDoc("tdf129054.docx"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1519,7 +1561,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf129054) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf129173) { - SwDoc* pDoc = createSwDoc("testAreaChartNumberFormat.docx"); + createSwDoc("testAreaChartNumberFormat.docx"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1534,7 +1577,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf129173) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf134866) { - SwDoc* pDoc = createSwDoc("tdf134866.docx"); + createSwDoc("tdf134866.docx"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1549,7 +1593,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf134866) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf137116) { - SwDoc* pDoc = createSwDoc("tdf137116.docx"); + createSwDoc("tdf137116.docx"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1569,7 +1614,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf137116) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf137154) { - SwDoc* pDoc = createSwDoc("tdf137154.docx"); + createSwDoc("tdf137154.docx"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1589,7 +1635,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf137154) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf138777) { - SwDoc* pDoc = createSwDoc("outside_long_data_label.docx"); + createSwDoc("outside_long_data_label.docx"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1607,7 +1654,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf138777) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf130031) { - SwDoc* pDoc = createSwDoc("tdf130031.docx"); + createSwDoc("tdf130031.docx"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1626,7 +1674,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf130031) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf130242) { - SwDoc* pDoc = createSwDoc("tdf130242.odt"); + createSwDoc("tdf130242.odt"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1653,7 +1702,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf130242) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf134121) { - SwDoc* pDoc = createSwDoc("piechart_leaderline.odt"); + createSwDoc("piechart_leaderline.odt"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1668,7 +1718,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf134121) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf138018) { - SwDoc* pDoc = createSwDoc("tdf138018.docx"); + createSwDoc("tdf138018.docx"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1685,7 +1736,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf138018) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf130380) { - SwDoc* pDoc = createSwDoc("tdf130380.docx"); + createSwDoc("tdf130380.docx"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1708,7 +1760,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf130380) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf129095) { - SwDoc* pDoc = createSwDoc("tdf129095.docx"); + createSwDoc("tdf129095.docx"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1723,7 +1776,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf129095) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf132956) { - SwDoc* pDoc = createSwDoc("tdf132956.docx"); + createSwDoc("tdf132956.docx"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1739,7 +1793,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf132956) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf137819) { // Open the bugdoc and check if it went wrong - SwDoc* pDoc = createSwDoc("tdf137819.fodt"); + createSwDoc("tdf137819.fodt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); // Change the anchor if the textbox to As_char @@ -1761,7 +1816,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf137819) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf122014) { - SwDoc* pDoc = createSwDoc("tdf122014.docx"); + createSwDoc("tdf122014.docx"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1778,7 +1834,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf122014) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf134659) { - SwDoc* pDoc = createSwDoc("tdf134659.docx"); + createSwDoc("tdf134659.docx"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1795,7 +1852,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf134659) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf134235) { - SwDoc* pDoc = createSwDoc("tdf134235.docx"); + createSwDoc("tdf134235.docx"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1812,7 +1870,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf134235) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf134676) { - SwDoc* pDoc = createSwDoc("tdf134676.docx"); + createSwDoc("tdf134676.docx"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1829,7 +1888,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf134676) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf134146) { - SwDoc* pDoc = createSwDoc("tdf134146.docx"); + createSwDoc("tdf134146.docx"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1848,7 +1908,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf134146) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf136061) { - SwDoc* pDoc = createSwDoc("tdf136061.docx"); + createSwDoc("tdf136061.docx"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1862,7 +1923,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf136061) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf116925) { - SwDoc* pDoc = createSwDoc("tdf116925.docx"); + createSwDoc("tdf116925.docx"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1882,7 +1944,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf116925) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf117028) { - SwDoc* pDoc = createSwDoc("tdf117028.docx"); + createSwDoc("tdf117028.docx"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1904,7 +1967,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf117028) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf106390) { - SwDoc* pDoc = createSwDoc("tdf106390.odt"); + createSwDoc("tdf106390.odt"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1922,7 +1986,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf106390) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTableExtrusion1) { - SwDoc* pDoc = createSwDoc("table-extrusion1.odt"); + createSwDoc("table-extrusion1.odt"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1942,7 +2007,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTableExtrusion1) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTableExtrusion2) { - SwDoc* pDoc = createSwDoc("table-extrusion2.odt"); + createSwDoc("table-extrusion2.odt"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pShell = pDoc->GetDocShell(); // Dump the rendering of the first page as an XML file. @@ -1961,7 +2027,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTableExtrusion2) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf116848) { - SwDoc* pDoc = createSwDoc("tdf116848.odt"); + createSwDoc("tdf116848.odt"); + SwDoc* pDoc = getSwDoc(); // This resulted in a layout loop. pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout(); } @@ -2175,7 +2242,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf141220) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, TestTextBoxChangeViaUNO) { - CPPUNIT_ASSERT(createSwDoc("TextBoxFrame.odt")); + createSwDoc("TextBoxFrame.odt"); // this file has a shape and a frame inside. Try to set up // the frame for the shape as textbox. Before this was not // implemented. This will be necessary for proper WPG import. @@ -2216,7 +2283,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, TestTextBoxChangeViaUNO) CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf121509) { - auto pDoc = createSwDoc("Tdf121509.odt"); + createSwDoc("Tdf121509.odt"); + auto pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); // Get all shape/frame formats @@ -2304,7 +2372,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testUserFieldTypeLanguage) aOptions.Commit(); }); - SwDoc* pDoc = createSwDoc("user-field-type-language.fodt"); + createSwDoc("user-field-type-language.fodt"); + SwDoc* pDoc = getSwDoc(); SwViewShell* pViewShell = pDoc->getIDocumentLayoutAccess().GetCurrentViewShell(); pViewShell->UpdateFields(); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); @@ -2351,7 +2420,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf124261) { #if !defined(_WIN32) && !defined(MACOSX) // Make sure that pressing a key in a btlr cell frame causes an immediate, correct repaint. - SwDoc* pDoc = createSwDoc("tdf124261.docx"); + createSwDoc("tdf124261.docx"); + SwDoc* pDoc = getSwDoc(); SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); SwFrame* pPageFrame = pLayout->GetLower(); CPPUNIT_ASSERT(pPageFrame->IsPageFrame()); diff --git a/sw/qa/extras/mailmerge/mailmerge.cxx b/sw/qa/extras/mailmerge/mailmerge.cxx index 9e457b4323a0..0be7c0a8afde 100644 --- a/sw/qa/extras/mailmerge/mailmerge.cxx +++ b/sw/qa/extras/mailmerge/mailmerge.cxx @@ -216,7 +216,7 @@ public: // Windows before MM uses it, MM won't work, as it's already open. // Don't move the load before the mail merge execution! // (see gb_CppunitTest_use_instdir_configuration) - load(maMMtestFilename); + createSwDoc(maMMtestFilename); if (mnCurOutputType == text::MailMergeType::SHELL) { diff --git a/sw/qa/extras/mailmerge/mailmerge2.cxx b/sw/qa/extras/mailmerge/mailmerge2.cxx index 1d7d162968af..30c26402c1c3 100644 --- a/sw/qa/extras/mailmerge/mailmerge2.cxx +++ b/sw/qa/extras/mailmerge/mailmerge2.cxx @@ -216,7 +216,7 @@ public: // Windows before MM uses it, MM won't work, as it's already open. // Don't move the load before the mail merge execution! // (see gb_CppunitTest_use_instdir_configuration) - load(maMMTest2Filename); + createSwDoc(maMMTest2Filename); if (mnCurOutputType == text::MailMergeType::SHELL) { diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index 43188e5718f9..f8c774b3053d 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -2653,7 +2653,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTableStyles3) CPPUNIT_TEST_FIXTURE(Test, testTableStyles4) { - load("table_styles_4.odt"); + createSwDoc("table_styles_4.odt"); // Test if loaded styles overwrite existing styles uno::Reference XFamiliesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xFamilies(XFamiliesSupplier->getStyleFamilies()); diff --git a/sw/qa/extras/odfexport/odfexport2.cxx b/sw/qa/extras/odfexport/odfexport2.cxx index 5985463c07cf..f065b28d5308 100644 --- a/sw/qa/extras/odfexport/odfexport2.cxx +++ b/sw/qa/extras/odfexport/odfexport2.cxx @@ -633,7 +633,7 @@ DECLARE_ODFEXPORT_TEST(testTdf143605, "tdf143605.odt") CPPUNIT_TEST_FIXTURE(Test, testTdf57317_autoListName) { - load("tdf57317_autoListName.odt"); + createSwDoc("tdf57317_autoListName.odt"); // The list style (from styles.xml) overrides a duplicate named auto-style //uno::Any aNumStyle = getStyles("NumberingStyles")->getByName("L1"); //CPPUNIT_ASSERT(aNumStyle.hasValue()); @@ -768,7 +768,7 @@ CPPUNIT_TEST_FIXTURE(Test, testStyleLink) { // Given a document with a para and a char style that links each other, when loading that // document: - load("style-link.fodt"); + createSwDoc("style-link.fodt"); // Then make sure the char style links the para one: uno::Any aCharStyle = getStyles("CharacterStyles")->getByName("List Paragraph Char"); diff --git a/sw/qa/extras/odfimport/odffeatures.cxx b/sw/qa/extras/odfimport/odffeatures.cxx index 3f4784b929af..22a11b4176bf 100644 --- a/sw/qa/extras/odfimport/odffeatures.cxx +++ b/sw/qa/extras/odfimport/odffeatures.cxx @@ -20,11 +20,11 @@ public: } }; -CPPUNIT_TEST_FIXTURE(Test, testFeatureText) { load("feature_text.odt"); } +CPPUNIT_TEST_FIXTURE(Test, testFeatureText) { createSwDoc("feature_text.odt"); } -CPPUNIT_TEST_FIXTURE(Test, testFeatureTextBold) { load("feature_text_bold.odt"); } +CPPUNIT_TEST_FIXTURE(Test, testFeatureTextBold) { createSwDoc("feature_text_bold.odt"); } -CPPUNIT_TEST_FIXTURE(Test, testFeatureTextItalic) { load("feature_text_italic.odt"); } +CPPUNIT_TEST_FIXTURE(Test, testFeatureTextItalic) { createSwDoc("feature_text_italic.odt"); } CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx index a0c82aa775e1..236c84143edc 100644 --- a/sw/qa/extras/odfimport/odfimport.cxx +++ b/sw/qa/extras/odfimport/odfimport.cxx @@ -68,13 +68,13 @@ class Test : public SwModelTestBase CPPUNIT_TEST_FIXTURE(Test, testEmptySvgFamilyName) { - load("empty-svg-family-name.odt"); + createSwDoc("empty-svg-family-name.odt"); // .odt import did crash on the empty font list (which I think is valid according SVG spec) } CPPUNIT_TEST_FIXTURE(Test, testHideAllSections) { - load("fdo53210.odt"); + createSwDoc("fdo53210.odt"); // This document has a section that is conditionally hidden, but has no empty paragraph after it. uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xMasters = xTextFieldsSupplier->getTextFieldMasters(); @@ -87,7 +87,7 @@ CPPUNIT_TEST_FIXTURE(Test, testHideAllSections) CPPUNIT_TEST_FIXTURE(Test, testOdtBorders) { - load("borders_ooo33.odt"); + createSwDoc("borders_ooo33.odt"); AllBordersMap map; map.insert(StringSequencePair(OUString("B2"), { table::BorderLine(0, 2, 2, 35), // left @@ -272,14 +272,14 @@ CPPUNIT_TEST_FIXTURE(Test, testOdtBorders) CPPUNIT_TEST_FIXTURE(Test, testTdf41542_borderlessPadding) { - load("tdf41542_borderlessPadding.odt"); + createSwDoc("tdf41542_borderlessPadding.odt"); // the page style's borderless padding should force this to 3 pages, not 1 CPPUNIT_ASSERT_EQUAL( 3, getPages() ); } CPPUNIT_TEST_FIXTURE(Test, testPageStyleLayoutDefault) { - load("hello.odt"); + createSwDoc("hello.odt"); uno::Reference xPropertySet(getStyles("PageStyles")->getByName("Default Page Style"), uno::UNO_QUERY); // This was style::PageStyleLayout_MIRRORED. CPPUNIT_ASSERT_EQUAL(style::PageStyleLayout_ALL, getProperty(xPropertySet, "PageStyleLayout")); @@ -287,7 +287,7 @@ CPPUNIT_TEST_FIXTURE(Test, testPageStyleLayoutDefault) CPPUNIT_TEST_FIXTURE(Test, testTimeFormFormats) { - load("timeFormFormats.odt"); + createSwDoc("timeFormFormats.odt"); //FIXME: make it an ODFEXPORT_TEST. Validator fails with //attribute "form:current-value" has a bad value: "PT12H12M" does not satisfy the "time" type //See tdf#131127 @@ -329,7 +329,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTimeFormFormats) CPPUNIT_TEST_FIXTURE(Test, testDateFormFormats) { - load("dateFormFormats.odt"); + createSwDoc("dateFormFormats.odt"); //FIXME: make it an ODFEXPORT_TEST. Validator fails with //unexpected attribute "form:input-required" //See tdf#131148 @@ -373,9 +373,9 @@ CPPUNIT_TEST_FIXTURE(Test, testDateFormFormats) CPPUNIT_TEST_FIXTURE(Test, testTdf149978) { - load("tdf149978.fodt"); + createSwDoc("tdf149978.fodt"); // on Linux the bug only reproduces if a document has been loaded previously - load("tdf149978.fodt"); + createSwDoc("tdf149978.fodt"); // this was nondeterministic so try 10 times for (int i = 1; i <= 10; ++i) { @@ -385,7 +385,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf149978) CPPUNIT_TEST_FIXTURE(Test, testTdf64038) { - load("space.odt"); + createSwDoc("space.odt"); // no space CPPUNIT_ASSERT_EQUAL(OUString("a"), getRun(getParagraph(4), 1)->getString()); CPPUNIT_ASSERT_EQUAL(OUString("b"), getRun(getParagraph(4), 2)->getString()); @@ -465,7 +465,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf64038) CPPUNIT_TEST_FIXTURE(Test, testTdf74524) { - load("tdf74524.odt"); + createSwDoc("tdf74524.odt"); uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xFieldsAccess(xTextFieldsSupplier->getTextFields()); uno::Reference xFields(xFieldsAccess->createEnumeration()); @@ -490,7 +490,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf74524) CPPUNIT_TEST_FIXTURE(Test, testPageStyleLayoutRight) { - load("hello.odt"); + createSwDoc("hello.odt"); uno::Reference xPropertySet(getStyles("PageStyles")->getByName("Default Page Style"), uno::UNO_QUERY); // This caused a crash. xPropertySet->setPropertyValue("PageStyleLayout", uno::Any(style::PageStyleLayout_RIGHT)); @@ -498,7 +498,7 @@ CPPUNIT_TEST_FIXTURE(Test, testPageStyleLayoutRight) CPPUNIT_TEST_FIXTURE(Test, testFdo61952) { - load("hello.odt"); + createSwDoc("hello.odt"); uno::Reference xPara(getParagraph(1), uno::UNO_QUERY); xPara->setPropertyValue("PageDescName", uno::Any(OUString("Left Page"))); xPara->setPropertyValue("PageDescName", uno::Any(OUString("Right Page"))); @@ -508,7 +508,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo61952) CPPUNIT_TEST_FIXTURE(Test, testFdo60842) { - load("fdo60842.odt"); + createSwDoc("fdo60842.odt"); uno::Reference const xTable(getParagraphOrTable(1)); getCell(xTable, "A1", ""); getCell(xTable, "B1", "18/02/2012"); @@ -519,7 +519,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo60842) CPPUNIT_TEST_FIXTURE(Test, testFdo79269) { - load("fdo79269.odt"); + createSwDoc("fdo79269.odt"); CPPUNIT_ASSERT_EQUAL(2, getPages()); // The problem was that the first-footer was shared. @@ -534,7 +534,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo79269) CPPUNIT_TEST_FIXTURE(Test, testFdo79269_header) { - load("fdo79269_header.odt"); + createSwDoc("fdo79269_header.odt"); CPPUNIT_ASSERT_EQUAL(2, getPages()); uno::Reference xPropSet(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY); @@ -548,7 +548,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo79269_header) CPPUNIT_TEST_FIXTURE(Test, testPageBackground) { - load("PageBackground.odt"); + createSwDoc("PageBackground.odt"); uno::Reference xPropertySet(getStyles("PageStyles")->getByName("Default Page Style"), uno::UNO_QUERY); // The background image was lost CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_BITMAP, getProperty(xPropertySet, "FillStyle")); @@ -564,7 +564,7 @@ CPPUNIT_TEST_FIXTURE(Test, testPageBackground) CPPUNIT_TEST_FIXTURE(Test, testBibliographyEntryField) { - load("BibliographyEntryField.odt"); + createSwDoc("BibliographyEntryField.odt"); uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xFieldsAccess(xTextFieldsSupplier->getTextFields()); uno::Reference xFields(xFieldsAccess->createEnumeration()); @@ -581,7 +581,7 @@ CPPUNIT_TEST_FIXTURE(Test, testBibliographyEntryField) CPPUNIT_TEST_FIXTURE(Test, testFdo56272) { - load("fdo56272.odt"); + createSwDoc("fdo56272.odt"); uno::Reference xShape = getShape(1); // Vertical position was incorrect. CPPUNIT_ASSERT_EQUAL(sal_Int32(422), xShape->getPosition().Y); // Was -2371 @@ -589,7 +589,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo56272) CPPUNIT_TEST_FIXTURE(Test, testTdf128737) { - load("tdf128737.odt"); + createSwDoc("tdf128737.odt"); // Without the fix in place, this test would have crashed CPPUNIT_ASSERT_EQUAL(4, getPages()); CPPUNIT_ASSERT_EQUAL(8, getShapes()); @@ -597,19 +597,19 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf128737) CPPUNIT_TEST_FIXTURE(Test, testCalcFootnoteContent) { - load("ooo32780-1.odt"); + createSwDoc("ooo32780-1.odt"); //this was a CalcFootnoteContent crash } CPPUNIT_TEST_FIXTURE(Test, testMoveSubTree) { - load("ooo77837-1.odt"); + createSwDoc("ooo77837-1.odt"); //this was a MoveSubTree crash } CPPUNIT_TEST_FIXTURE(Test, testFdo75872_ooo33) { - load("fdo75872_ooo33.odt"); + createSwDoc("fdo75872_ooo33.odt"); // graphics default style: line color and fill color changed uno::Reference xShape = getShape(1); CPPUNIT_ASSERT_EQUAL(COL_BLACK, @@ -620,7 +620,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo75872_ooo33) CPPUNIT_TEST_FIXTURE(Test, testFdo75872_aoo40) { - load("fdo75872_aoo40.odt"); + createSwDoc("fdo75872_aoo40.odt"); // graphics default style: line color and fill color changed uno::Reference xShape = getShape(1); CPPUNIT_ASSERT_EQUAL(Color(0x808080), @@ -631,7 +631,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo75872_aoo40) CPPUNIT_TEST_FIXTURE(Test, testFdo55814) { - load("fdo55814.odt"); + createSwDoc("fdo55814.odt"); uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xFieldsAccess(xTextFieldsSupplier->getTextFields()); uno::Reference xFields(xFieldsAccess->createEnumeration()); @@ -654,7 +654,7 @@ static void lcl_CheckShape( CPPUNIT_TEST_FIXTURE(Test, testFdo68839) { - load("fdo68839.odt"); + createSwDoc("fdo68839.odt"); CPPUNIT_ASSERT_EQUAL(4, getShapes()); // check names lcl_CheckShape(getShape(1), "FrameXXX"); @@ -676,7 +676,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo68839) CPPUNIT_TEST_FIXTURE(Test, testFdo82165) { - load("fdo82165.odt"); + createSwDoc("fdo82165.odt"); CPPUNIT_ASSERT_EQUAL(1, getShapes()); // there was a duplicate shape in the left header lcl_CheckShape(getShape(1), "Picture 9"); @@ -684,7 +684,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo82165) CPPUNIT_TEST_FIXTURE(Test, testTdf89802) { - load("tdf89802.fodt"); + createSwDoc("tdf89802.fodt"); // the text frame was dropped during import uno::Reference const xTextFramesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference const xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); @@ -696,7 +696,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf89802) CPPUNIT_TEST_FIXTURE(Test, testFdo37606) { - load("fdo37606.odt"); + createSwDoc("fdo37606.odt"); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); @@ -743,7 +743,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo37606) #if HAVE_FEATURE_UI CPPUNIT_TEST_FIXTURE(Test, testFdo37606Copy) { - load("fdo37606.odt"); + createSwDoc("fdo37606.odt"); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); @@ -771,7 +771,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo37606Copy) CPPUNIT_TEST_FIXTURE(Test, testFdo69862) { - load("fdo69862.odt"); + createSwDoc("fdo69862.odt"); // The test doc is special in that it starts with a table and it also has a footnote. SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); @@ -791,7 +791,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo69862) CPPUNIT_TEST_FIXTURE(Test, testFdo69979) { - load("fdo69979.odt"); + createSwDoc("fdo69979.odt"); // The test doc is special in that it starts with a table and it also has a header. SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); @@ -811,7 +811,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo69979) CPPUNIT_TEST_FIXTURE(Test, testSpellmenuRedline) { - load("spellmenu-redline.odt"); + createSwDoc("spellmenu-redline.odt"); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); @@ -827,14 +827,14 @@ CPPUNIT_TEST_FIXTURE(Test, testSpellmenuRedline) CPPUNIT_TEST_FIXTURE(Test, testTdf107776) { - load("tdf107776.fodt"); + createSwDoc("tdf107776.fodt"); // Shape with a Graphics parent style name was imported as textbox. CPPUNIT_ASSERT(!getProperty(getShape(1), "TextBox")); } CPPUNIT_TEST_FIXTURE(Test, testAnnotationFormatting) { - load("annotation-formatting.odt"); + createSwDoc("annotation-formatting.odt"); uno::Reference xTextField = getProperty< uno::Reference >(getRun(getParagraph(1), 1), "TextField"); uno::Reference xText = getProperty< uno::Reference >(xTextField, "TextRange"); // Make sure we test the right annotation. @@ -845,7 +845,7 @@ CPPUNIT_TEST_FIXTURE(Test, testAnnotationFormatting) CPPUNIT_TEST_FIXTURE(Test, fdo81223) { - load("fdo81223.odt"); + createSwDoc("fdo81223.odt"); uno::Reference xTextFramesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); uno::Reference xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY); @@ -854,7 +854,7 @@ CPPUNIT_TEST_FIXTURE(Test, fdo81223) CPPUNIT_TEST_FIXTURE(Test, fdo90130_1) { - load("fdo90130-1.odt"); + createSwDoc("fdo90130-1.odt"); uno::Reference xTextFramesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); uno::Reference xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY); @@ -863,7 +863,7 @@ CPPUNIT_TEST_FIXTURE(Test, fdo90130_1) CPPUNIT_TEST_FIXTURE(Test, fdo90130_2) { - load("fdo90130-2.odt"); + createSwDoc("fdo90130-2.odt"); uno::Reference xTextFramesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); uno::Reference xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY); @@ -874,7 +874,7 @@ CPPUNIT_TEST_FIXTURE(Test, fdo90130_2) CPPUNIT_TEST_FIXTURE(Test, testBnc800714) { - load("bnc800714.fodt"); + createSwDoc("bnc800714.fodt"); // Document's second paragraph wants to be together with the third one, but: // - it's in a section with multiple columns // - contains a single as-char anchored frame @@ -885,7 +885,7 @@ CPPUNIT_TEST_FIXTURE(Test, testBnc800714) CPPUNIT_TEST_FIXTURE(Test, testTdf92586) { - load("tdf92586.odt"); + createSwDoc("tdf92586.odt"); uno::Any aPageStyle = getStyles("PageStyles")->getByName("Standard"); // This was BitmapMode_NO_REPEAT. CPPUNIT_ASSERT_EQUAL(drawing::BitmapMode_STRETCH, getProperty(aPageStyle, "FillBitmapMode")); @@ -893,7 +893,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf92586) CPPUNIT_TEST_FIXTURE(Test, testTdf103025) { - load("tdf103025.odt"); + createSwDoc("tdf103025.odt"); CPPUNIT_ASSERT_EQUAL(OUString("2014-01"), parseDump("/root/page[1]/header/tab[2]/row[2]/cell[3]/txt/SwParaPortion/SwLineLayout/SwFieldPortion", "expand")); CPPUNIT_ASSERT_EQUAL(OUString("2014-01"), parseDump("/root/page[2]/header/tab[2]/row[2]/cell[3]/txt/SwParaPortion/SwLineLayout/SwFieldPortion", "expand")); CPPUNIT_ASSERT_EQUAL(OUString("2014-02"), parseDump("/root/page[3]/header/tab[2]/row[2]/cell[3]/txt/SwParaPortion/SwLineLayout/SwFieldPortion", "expand")); @@ -903,34 +903,34 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf103025) CPPUNIT_TEST_FIXTURE(Test, testTdf76322_columnBreakInHeader) { - load("tdf76322_columnBreakInHeader.docx"); + createSwDoc("tdf76322_columnBreakInHeader.docx"); // column breaks were ignored. First line should start in column 2 CPPUNIT_ASSERT_EQUAL( OUString("Test1"), parseDump("/root/page[1]/header/section/column[2]/body/txt/text()") ); } CPPUNIT_TEST_FIXTURE(Test, testTdf76349_1columnBreak) { - load("tdf76349_1columnBreak.odt"); + createSwDoc("tdf76349_1columnBreak.odt"); //single-column breaks should only be treated as page breaks for MS formats - should be only one page here. CPPUNIT_ASSERT_EQUAL(1, getPages()); } CPPUNIT_TEST_FIXTURE(Test, testTdf96113) { - load("tdf96113.odt"); + createSwDoc("tdf96113.odt"); // Background of the formula frame was white (0xffffff), not green. CPPUNIT_ASSERT_EQUAL(Color(0x00ff00), getProperty(getShape(1), "BackColor")); } CPPUNIT_TEST_FIXTURE(Test, testFdo47267) { - load("fdo47267-3.odt"); + createSwDoc("fdo47267-3.odt"); // This was a Style Families getByName() crash } CPPUNIT_TEST_FIXTURE(Test, testTdf75221) { - load("tdf75221.odt"); + createSwDoc("tdf75221.odt"); // When "Don't add space between paragraphs of the same style" setting set, // spacing between same-style paragraphs must be equal to their line spacing. // It used to be 0. @@ -940,7 +940,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf75221) CPPUNIT_TEST_FIXTURE(Test, testTdf101729) { - load("tdf101729.odt"); + createSwDoc("tdf101729.odt"); sal_Int32 l = parseDump("/root/page/body/tab/row/cell[1]/infos/bounds", "left").toInt32(); sal_Int32 w = parseDump("/root/page/body/tab/row/cell[1]/infos/bounds", "width").toInt32(); sal_Int32 x = parseDump("/root/page/body/tab/row/cell[1]/txt/infos/bounds", "left").toInt32(); @@ -951,7 +951,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf101729) CPPUNIT_TEST_FIXTURE(Test, testTdf107392) { - load("tdf107392.odt"); + createSwDoc("tdf107392.odt"); // Shapes from bottom to top were Frame, SVG, Bitmap, i.e. in the order as // they appeared in the document, not according to their requested z-index, // as sorting failed. @@ -964,7 +964,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf107392) CPPUNIT_TEST_FIXTURE(Test, testTdf100033_1) { - load("tdf100033_1.odt"); + createSwDoc("tdf100033_1.odt"); // Test document have three duplicated frames with the same name and position/size -> import one frame uno::Reference xTextFramesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); @@ -973,7 +973,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf100033_1) CPPUNIT_TEST_FIXTURE(Test, testWordAsCharShape) { - load("Word2010AsCharShape.odt"); + createSwDoc("Word2010AsCharShape.odt"); // As-char shape had VertOrient "from-top"/NONE default from GetVOrient() uno::Reference const xShape(getShape(1)); CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AS_CHARACTER, getProperty(xShape, "AnchorType")); @@ -985,7 +985,7 @@ CPPUNIT_TEST_FIXTURE(Test, testWordAsCharShape) CPPUNIT_TEST_FIXTURE(Test, testTdf100033_2) { - load("tdf100033_2.odt"); + createSwDoc("tdf100033_2.odt"); // Test document have three different frames anchored to different paragraphs -> import all frames uno::Reference xTextFramesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); @@ -994,7 +994,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf100033_2) CPPUNIT_TEST_FIXTURE(Test, testI61225) { - load("i61225.sxw"); + createSwDoc("i61225.sxw"); // Part of ooo61225-1.sxw from crashtesting. // This never returned. @@ -1003,7 +1003,7 @@ CPPUNIT_TEST_FIXTURE(Test, testI61225) CPPUNIT_TEST_FIXTURE(Test, testTdf109080_loext_ns) { - load("tdf109080_loext_ns.odt"); + createSwDoc("tdf109080_loext_ns.odt"); // Test we can import and CPPUNIT_ASSERT_EQUAL(OUString("This is the first page header"), @@ -1019,7 +1019,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf109080_loext_ns) CPPUNIT_TEST_FIXTURE(Test, testTdf109080_style_ns) { - load("tdf109080_style_ns.odt"); + createSwDoc("tdf109080_style_ns.odt"); // Test we can import and // (produced by LibreOffice 4.0 - 5.x) @@ -1036,14 +1036,14 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf109080_style_ns) CPPUNIT_TEST_FIXTURE(Test, testTdf109228) { - load("tdf109228.odt"); + createSwDoc("tdf109228.odt"); // Embedded object with no frame name was imported incorrectly, it was anchored 'to character' instead of 'as character' CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AS_CHARACTER, getProperty(getShape(1), "AnchorType")); } CPPUNIT_TEST_FIXTURE(Test, testTdf94882) { - load("tdf94882.odt"); + createSwDoc("tdf94882.odt"); // Get the header of the page containing our content // (done this way to skip past any blank page inserted before it // due to the page number being even) @@ -1057,7 +1057,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf94882) CPPUNIT_TEST_FIXTURE(Test, testBlankBeforeFirstPage) { - load("tdf94882.odt"); + createSwDoc("tdf94882.odt"); // This document starts on page 50, which is even, but it should not have a // blank page inserted before it to make it a left page @@ -1068,13 +1068,13 @@ CPPUNIT_TEST_FIXTURE(Test, testBlankBeforeFirstPage) CPPUNIT_TEST_FIXTURE(Test, testTdf115079) { - load("tdf115079.odt"); + createSwDoc("tdf115079.odt"); // This document caused segfault when layouting } CPPUNIT_TEST_FIXTURE(Test, testTdf108482) { - load("tdf108482.odt"); + createSwDoc("tdf108482.odt"); CPPUNIT_ASSERT_EQUAL_MESSAGE("The table on second page must have two rows", OUString("2"), parseDump("count(/root/page[2]/body/tab/row)") ); @@ -1090,7 +1090,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf108482) CPPUNIT_TEST_FIXTURE(Test, testTdf116195) { - load("tdf116195.odt"); + createSwDoc("tdf116195.odt"); // The image was set to zero height due to a regression CPPUNIT_ASSERT_EQUAL( sal_Int32(12960), parseDump("/root/page/anchored/fly/notxt/infos/bounds", "height").toInt32() @@ -1099,13 +1099,13 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf116195) CPPUNIT_TEST_FIXTURE(Test, testTdf120677) { - load("tdf120677.fodt"); + createSwDoc("tdf120677.fodt"); // The document used to hang the layout, consuming memory until OOM } CPPUNIT_TEST_FIXTURE(Test, testTdf123829) { - load("tdf123829.odt"); + createSwDoc("tdf123829.odt"); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); @@ -1116,7 +1116,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf123829) CPPUNIT_TEST_FIXTURE(Test, testTdf113289) { - load("tdf113289.odt"); + createSwDoc("tdf113289.odt"); uno::Any aPageStyle = getStyles("PageStyles")->getByName("Standard"); CPPUNIT_ASSERT_EQUAL(static_cast(style::FootnoteLineStyle::SOLID), getProperty(aPageStyle, "FootnoteLineStyle")); @@ -1124,7 +1124,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf113289) CPPUNIT_TEST_FIXTURE(Test, testTdf123968) { - load("tdf123968.odt"); + createSwDoc("tdf123968.odt"); // The test doc is special in that it starts with a table and it also has a header. SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); @@ -1142,7 +1142,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf123968) CPPUNIT_TEST_FIXTURE(Test, testTdf133459) { - load("tdf133459.odt"); + createSwDoc("tdf133459.odt"); // Test that the number format was correctly imported, and used by both fields. uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xFields(xTextFieldsSupplier->getTextFields()->createEnumeration()); @@ -1170,7 +1170,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf133459) CPPUNIT_TEST_FIXTURE(Test, testTdf134971) { - load("tdf134971a.odt"); + createSwDoc("tdf134971a.odt"); // now insert 2nd file somewhere - insertDocumentFromURL should // _not_ touch pool defaults uno::Sequence aPropertyValues = comphelper::InitPropertySequence( @@ -1252,7 +1252,8 @@ CPPUNIT_TEST_FIXTURE(Test, testPasteFirstParaDirectFormat) CPPUNIT_TEST_FIXTURE(Test, testVerticallyMergedCellBorder) { // Given a document with two cells, vertically merged, when loading the document: - SwDoc* pDoc = createSwDoc("vmerge-cell-border.odt"); + createSwDoc("vmerge-cell-border.odt"); + SwDoc* pDoc = getSwDoc(); // Then make sure that the first cell has a right border while the second has no right border: SwDocShell* pDocShell = pDoc->GetDocShell(); @@ -1282,7 +1283,7 @@ CPPUNIT_TEST_FIXTURE(Test, testVerticallyMergedCellBorder) CPPUNIT_TEST_FIXTURE(Test, testPageAnchorZIndexFirstPage) { - load("PageAnchorZIndexFirstPage.fodt"); + createSwDoc("PageAnchorZIndexFirstPage.fodt"); CPPUNIT_ASSERT_EQUAL_MESSAGE("Image1 index not 0", sal_Int32(0), getProperty(getShapeByName(u"Image1"), "ZOrder")); @@ -1296,7 +1297,7 @@ CPPUNIT_TEST_FIXTURE(Test, testPageAnchorZIndexFirstPage) CPPUNIT_TEST_FIXTURE(Test, testPageAnchorZIndexSecondPage) { - load("PageAnchorZIndexSecondPage.fodt"); + createSwDoc("PageAnchorZIndexSecondPage.fodt"); CPPUNIT_ASSERT_EQUAL_MESSAGE("Image1 index not 0", sal_Int32(0), getProperty(getShapeByName(u"Image1"), "ZOrder")); @@ -1310,7 +1311,7 @@ CPPUNIT_TEST_FIXTURE(Test, testPageAnchorZIndexSecondPage) CPPUNIT_TEST_FIXTURE(Test, testTdf146257) { - load("tdf146257.odt"); + createSwDoc("tdf146257.odt"); // First list should contain no labels { @@ -1342,14 +1343,14 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf146257) CPPUNIT_TEST_FIXTURE(Test, testTdf146597) { - load("tdf146597.odt"); + createSwDoc("tdf146597.odt"); // This was crashed before. } // just care that it doesn't crash/assert CPPUNIT_TEST_FIXTURE(Test, testForcepoint101) { - load("forcepoint101.fodt"); + createSwDoc("forcepoint101.fodt"); } // just care that it doesn't crash/assert diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx index 29d15f6d2b22..cd7968b428e4 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx @@ -1123,7 +1123,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf95777, "tdf95777.docx") CPPUNIT_TEST_FIXTURE(Test, testTdf94374) { - load("hello.docx"); + createSwDoc("hello.docx"); uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference xText = xTextDocument->getText(); uno::Reference xEnd = xText->getEnd(); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index 1dd6d9dd5ba3..b68c077af668 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -73,11 +73,11 @@ DECLARE_OOXMLEXPORT_TEST(Tdf130907, "tdf130907.docx") CPPUNIT_TEST_FIXTURE(Test, testTdf128197) { - load("128197_compat14.docx"); + createSwDoc("128197_compat14.docx"); xmlDocUniquePtr pLayout14 = parseLayoutDump(); sal_Int32 nHeight14 = getXPath(pLayout14, "//page[1]/body/txt[1]/infos/bounds", "height").toInt32(); - load("128197_compat15.docx"); + createSwDoc("128197_compat15.docx"); xmlDocUniquePtr pLayout15 = parseLayoutDump(); sal_Int32 nHeight15 = getXPath(pLayout15, "//page[1]/body/txt[1]/infos/bounds", "height").toInt32(); @@ -795,7 +795,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTableStyleConfNested) CPPUNIT_TEST_FIXTURE(Test, testTdf133771) { // Create the doc model. - load("tdf133771.odt", /*pPassword*/ "test"); + createSwDoc("tdf133771.odt", /*pPassword*/ "test"); CPPUNIT_ASSERT_EQUAL(OUString("Password Protected"), getParagraph(1)->getString()); @@ -864,13 +864,13 @@ CPPUNIT_TEST_FIXTURE(Test, testSemiTransparentText) CPPUNIT_TEST_FIXTURE(Test, testTdf147485) { // Before the fix this was impossible. - load("Tdf147485.docx"); + createSwDoc("Tdf147485.docx"); } CPPUNIT_TEST_FIXTURE(Test, testTdf149546) { // Before the fix this was impossible. - load("tdf149546.docx"); + createSwDoc("tdf149546.docx"); } CPPUNIT_TEST_FIXTURE(Test, testUserField) @@ -909,7 +909,7 @@ CPPUNIT_TEST_FIXTURE(Test, testUserField) CPPUNIT_TEST_FIXTURE(Test, testHighlightEdit_numbering) { // Create the doc model. - load("tdf135774_numberingCRProps.docx"); + createSwDoc("tdf135774_numberingCRProps.docx"); // This only affects when saving as w:highlight - which is not the default since 7.0. SvtFilterOptions& rOpt = SvtFilterOptions::Get(); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx index d0f23c5b9d6f..57b8e68d58d2 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx @@ -149,7 +149,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf134219ContourWrap_glow_rotate) getProperty(getShape(1), "BottomMargin"), 1); }; // Given a document with a shape with contour wrap, that has glow effect and rotation. - load("tdf143219ContourWrap_glow_rotate.docx"); + createSwDoc("tdf143219ContourWrap_glow_rotate.docx"); // Error was, that the margins, which were added on import to approximate Word's rendering of // contour wrap, contained the effect extent for rotation. But LibreOffice extents the wrap @@ -175,7 +175,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf134219ContourWrap_stroke_shadow) getProperty(getShape(1), "BottomMargin"), 1); }; // Given a document with a shape with contour wrap, that has a fat stroke and large shadow. - load("tdf143219ContourWrap_stroke_shadow.docx"); + createSwDoc("tdf143219ContourWrap_stroke_shadow.docx"); // Error was, that the margins, which were added on import to approximate Word's rendering of // contour wrap, were not removed on export and so used twice on reload. @@ -639,7 +639,7 @@ DECLARE_OOXMLEXPORT_TEST(testShapeHyperlink, "hyperlinkshape.docx") CPPUNIT_TEST_FIXTURE(Test, testTextframeHyperlink) { // Make sure hyperlink is imported correctly - load("docxopenhyperlinkbox.docx"); + createSwDoc("docxopenhyperlinkbox.docx"); uno::Reference xTextFramesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); @@ -660,7 +660,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTextframeHyperlink) CPPUNIT_TEST_FIXTURE(Test, testTdf146171_invalid_change_date) { - load("tdf146171.docx"); + createSwDoc("tdf146171.docx"); // false alarm? during ODF roundtrip: // 'Error: "1970-01-01" does not satisfy the "dateTime" type' // disable and check only the conversion of the invalid (zeroed) change date @@ -714,7 +714,7 @@ CPPUNIT_TEST_FIXTURE(Test, testEffectExtentLineWidth) // Given a document with a shape that has a non-zero line width and effect extent: // When loading the document: - load("effect-extent-line-width.docx"); + createSwDoc("effect-extent-line-width.docx"); // Then make sure that the line width is not taken twice (once as part of the margin, and then // also as the line width): // Without the accompanying fix in place, this test would have failed with: @@ -729,7 +729,7 @@ CPPUNIT_TEST_FIXTURE(Test, testEffectExtentLineWidth) CPPUNIT_TEST_FIXTURE(Test, testRtlGutter) { // Given a document with RTL gutter: - load("rtl-gutter.docx"); + createSwDoc("rtl-gutter.docx"); uno::Reference xStandard(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY); CPPUNIT_ASSERT(getProperty(xStandard, "RtlGutter")); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx index f3d309802acf..05682a4d48d4 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx @@ -211,7 +211,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf135906) CPPUNIT_TEST_FIXTURE(Test, TestTdf146802) { - load("tdf146802.docx"); + createSwDoc("tdf146802.docx"); // First check if the load failed, as before the fix. CPPUNIT_ASSERT(mxComponent); @@ -982,7 +982,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf148455_2, "tdf148455_2.docx") CPPUNIT_TEST_FIXTURE(Test, testTdf147978enhancedPathABVW) { - load("tdf147978_enhancedPath_commandABVW.odt"); + createSwDoc("tdf147978_enhancedPath_commandABVW.odt"); reload("Office Open XML Text", nullptr); // Make sure the new implemented export for commands A,B,V and W use the correct arc between // the given two points, here the short one. diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx index 4197ba133b4f..1ce78f262eef 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx @@ -81,7 +81,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf147646, "tdf147646_mergedCellNumbering.docx") CPPUNIT_TEST_FIXTURE(Test, testTdf149551_mongolianVert) { // Given a docx document with a shape with vert="mongolianVert". - load("tdf149551_mongolianVert.docx"); + createSwDoc("tdf149551_mongolianVert.docx"); // The shape is imported as custom shape with attached frame. // Without fix the shape itself had WritingMode = 0 = LR_TB, @@ -118,7 +118,7 @@ CPPUNIT_TEST_FIXTURE(Test, testNumberPortionFormatFromODT) { // Given a document with a single paragraph, direct formatting asks 24pt font size for the // numbering and the text portion: - load("number-portion-format.odt"); + createSwDoc("number-portion-format.odt"); // When saving to DOCX: save("Office Open XML Text"); @@ -137,7 +137,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf150966_regularInset) { // Given a docx document with a rectangular shape with height cy="900000" (EMU), tIns="180000" // and bIns="360000", resulting in 360000EMU text area height. - load("tdf150966_regularInset.docx"); + createSwDoc("tdf150966_regularInset.docx"); // The shape is imported as custom shape with attached frame. // The insets are currently imported as margin top="4.99mm" and bottom="10mm". diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx index 9138703f501b..3f08067bf1a3 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx @@ -798,7 +798,7 @@ CPPUNIT_TEST_FIXTURE(Test, tdf134043_ImportComboBoxAsDropDown_true) officecfg::Office::Writer::Filter::Import::DOCX::ImportComboBoxAsDropDown::set(true, batch); batch->commit(); - load("combobox-control.docx"); + createSwDoc("combobox-control.docx"); verifyComboBoxExport(true); } @@ -808,7 +808,7 @@ CPPUNIT_TEST_FIXTURE(Test, tdf134043_ImportComboBoxAsDropDown_false) officecfg::Office::Writer::Filter::Import::DOCX::ImportComboBoxAsDropDown::set(false, batch); batch->commit(); - load("combobox-control.docx"); + createSwDoc("combobox-control.docx"); verifyComboBoxExport(false); } diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx index 235a7166dd21..96ba5e5a83e1 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx @@ -872,7 +872,7 @@ DECLARE_OOXMLEXPORT_TEST( testSdtDatePicker, "test_sdt_datepicker.docx" ) CPPUNIT_TEST_FIXTURE(Test, testContentControlGrabBag) { // Given a document with a tag: - load("content-control-grab-bag.docx"); + createSwDoc("content-control-grab-bag.docx"); // When exporting that document back to DOCX: // Then make sure that completes without an assertion failure, which would mean not-well-formed @@ -883,7 +883,7 @@ CPPUNIT_TEST_FIXTURE(Test, testContentControlGrabBag) CPPUNIT_TEST_FIXTURE(Test, testContentControlShape) { // Given a document with a tag: - load("content-control-shape.docx"); + createSwDoc("content-control-shape.docx"); // When exporting that document back to DOCX: // Then make sure that completes without an assertion failure, which would mean not-well-formed @@ -894,7 +894,7 @@ CPPUNIT_TEST_FIXTURE(Test, testContentControlShape) CPPUNIT_TEST_FIXTURE(Test, testTdf104823) { // Test how we can roundtrip sdt plain text with databindings support - load("tdf104823.docx"); + createSwDoc("tdf104823.docx"); // First paragraph: content from core properties uno::Reference xParagraph1 = getParagraph(1); diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 51b72ef71300..32a449a1259b 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -76,7 +76,7 @@ public: CPPUNIT_TEST_FIXTURE(Test, testImageHyperlink) { - load("image-hyperlink.docx"); + createSwDoc("image-hyperlink.docx"); OUString URL = getProperty(getShape(1), "HyperLinkURL"); CPPUNIT_ASSERT_EQUAL(OUString("http://www.libreoffice.org/"), URL); } @@ -89,7 +89,7 @@ CPPUNIT_TEST_FIXTURE(Test, testMathMalformedXml) CPPUNIT_TEST_FIXTURE(Test, testTdf103931) { - load("tdf103931.docx"); + createSwDoc("tdf103931.docx"); uno::Reference xTextSectionsSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xTextSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY); // This was 2, the last (empty) section of the document was lost on import. @@ -99,7 +99,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf103931) CPPUNIT_TEST_FIXTURE(Test, testN751017) { - load("n751017.docx"); + createSwDoc("n751017.docx"); uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xMasters(xTextFieldsSupplier->getTextFieldMasters()); // Make sure we have a variable named foo. @@ -146,7 +146,7 @@ CPPUNIT_TEST_FIXTURE(Test, testN751017) CPPUNIT_TEST_FIXTURE(Test, testN757890) { - load("n757890.docx"); + createSwDoc("n757890.docx"); // The w:pStyle token affected the text outside the textbox. uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY); @@ -167,7 +167,7 @@ CPPUNIT_TEST_FIXTURE(Test, testN757890) CPPUNIT_TEST_FIXTURE(Test, testN751077) { - load("n751077.docx"); + createSwDoc("n751077.docx"); /* xray ThisComponent.DrawPage(1).getByIndex(0).String xray ThisComponent.DrawPage(1).getByIndex(0).Anchor.PageStyleName @@ -183,7 +183,7 @@ xray ThisComponent.DrawPage(1).getByIndex(0).Anchor.PageStyleName CPPUNIT_TEST_FIXTURE(Test, testTdf129237) { - load("tdf129237.docx"); + createSwDoc("tdf129237.docx"); uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xFieldsAccess(xTextFieldsSupplier->getTextFields()); uno::Reference xFields(xFieldsAccess->createEnumeration()); @@ -227,7 +227,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf129237) CPPUNIT_TEST_FIXTURE(Test, testTdf134572) { - load("tdf134572.docx"); + createSwDoc("tdf134572.docx"); uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xFieldsAccess(xTextFieldsSupplier->getTextFields()); uno::Reference xFields(xFieldsAccess->createEnumeration()); @@ -256,7 +256,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf134572) CPPUNIT_TEST_FIXTURE(Test, testTdf128076) { - load("tdf128076.docx"); + createSwDoc("tdf128076.docx"); uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xFieldsAccess(xTextFieldsSupplier->getTextFields()); uno::Reference xFields(xFieldsAccess->createEnumeration()); @@ -273,7 +273,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf128076) CPPUNIT_TEST_FIXTURE(Test, testfdo90720) { - load("testfdo90720.docx"); + createSwDoc("testfdo90720.docx"); uno::Reference xTextFramesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount()); @@ -286,7 +286,7 @@ CPPUNIT_TEST_FIXTURE(Test, testfdo90720) CPPUNIT_TEST_FIXTURE(Test, testN760764) { - load("n760764.docx"); + createSwDoc("n760764.docx"); uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY); uno::Reference xParaEnum(xParaEnumAccess->createEnumeration()); @@ -304,7 +304,7 @@ CPPUNIT_TEST_FIXTURE(Test, testN760764) CPPUNIT_TEST_FIXTURE(Test, testN764745) { - load("n764745-alignment.docx"); + createSwDoc("n764745-alignment.docx"); /* shape = ThisComponent.DrawPage.getByIndex(0) xray shape.AnchorType @@ -333,14 +333,14 @@ xray ThisComponent.StyleFamilies.PageStyles.Default.Width CPPUNIT_TEST_FIXTURE(Test, testTdf115719b) { - load("tdf115719b.docx"); + createSwDoc("tdf115719b.docx"); // This was 0, 4th (last) paragraph had no increased spacing. CPPUNIT_ASSERT(getProperty(getParagraph(4), "ParaTopMargin") > 0); } CPPUNIT_TEST_FIXTURE(Test, testN766477) { - load("n766477.docx"); + createSwDoc("n766477.docx"); /* * The problem was that the checkbox was not checked. * @@ -364,7 +364,7 @@ CPPUNIT_TEST_FIXTURE(Test, testN766477) CPPUNIT_TEST_FIXTURE(Test, testTdf130804) { - load("tdf130804.docx"); + createSwDoc("tdf130804.docx"); OUString flyHeight = parseDump("/root/page/body/txt[1]/infos/bounds", "height"); OUString txtHeight = parseDump("/root/page/body/txt[1]/anchored/fly/infos/bounds", "height"); @@ -378,7 +378,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf130804) CPPUNIT_TEST_FIXTURE(Test, testN758883) { - load("n758883.docx"); + createSwDoc("n758883.docx"); /* * The problem was that direct formatting of the paragraph was not applied * to the numbering. This is easier to test using a layout dump. @@ -459,7 +459,7 @@ CPPUNIT_TEST_FIXTURE(Test, testN758883) CPPUNIT_TEST_FIXTURE(Test, testTdf74367_MarginsZeroed) { - load("tdf74367_MarginsZeroed.docx"); + createSwDoc("tdf74367_MarginsZeroed.docx"); // Do not import page borders with 'None' style, or else it will change the page margins. uno::Reference xPropertySet(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY); sal_Int32 nValue = 0; @@ -475,7 +475,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf74367_MarginsZeroed) CPPUNIT_TEST_FIXTURE(Test, testBnc773061) { - load("bnc773061.docx"); + createSwDoc("bnc773061.docx"); uno::Reference< text::XTextRange > paragraph = getParagraph( 1 ); uno::Reference< text::XTextRange > normal = getRun( paragraph, 1, "Normal " ); uno::Reference< text::XTextRange > raised = getRun( paragraph, 2, "Raised" ); @@ -490,7 +490,7 @@ CPPUNIT_TEST_FIXTURE(Test, testBnc773061) CPPUNIT_TEST_FIXTURE(Test, testN775899) { - load("n775899.docx"); + createSwDoc("n775899.docx"); /* * The problem was that a floating table wasn't imported as a frame, then it contained fake paragraphs. * @@ -515,7 +515,7 @@ CPPUNIT_TEST_FIXTURE(Test, testN775899) CPPUNIT_TEST_FIXTURE(Test, testN777345) { - load("n777345.docx"); + createSwDoc("n777345.docx"); // The problem was that v:imagedata inside v:rect was ignored. uno::Reference xSupplier(getShape(1), uno::UNO_QUERY); uno::Reference xGraphic = xSupplier->getReplacementGraphic(); @@ -530,7 +530,7 @@ CPPUNIT_TEST_FIXTURE(Test, testN777345) CPPUNIT_TEST_FIXTURE(Test, testN778140) { - load("n778140.docx"); + createSwDoc("n778140.docx"); /* * The problem was that the paragraph top/bottom margins were incorrect due * to unhandled w:doNotUseHTMLParagraphAutoSpacing. @@ -541,7 +541,7 @@ CPPUNIT_TEST_FIXTURE(Test, testN778140) CPPUNIT_TEST_FIXTURE(Test, testInk) { - load("ink.docx"); + createSwDoc("ink.docx"); /* * The problem was that ~nothing was imported, except an empty CustomShape. * @@ -553,7 +553,7 @@ CPPUNIT_TEST_FIXTURE(Test, testInk) CPPUNIT_TEST_FIXTURE(Test, testN779627) { - load("n779627.docx"); + createSwDoc("n779627.docx"); /* * The problem was that the table left position was based on the tableCellMar left value * even for nested tables, while it shouldn't. @@ -577,7 +577,7 @@ CPPUNIT_TEST_FIXTURE(Test, testN779627) CPPUNIT_TEST_FIXTURE(Test, testN779627b) { - load("n779627b.docx"); + createSwDoc("n779627b.docx"); /* * Another problem tested with the original n779627.docx document (before removing its unnecessary * shape loading) is that the roundrect is centered vertically and horizontally. @@ -599,7 +599,7 @@ CPPUNIT_TEST_FIXTURE(Test, testN779627b) CPPUNIT_TEST_FIXTURE(Test, testN782061) { - load("n782061.docx"); + createSwDoc("n782061.docx"); /* * The problem was that the character escapement in the second run was -58. */ @@ -608,7 +608,7 @@ CPPUNIT_TEST_FIXTURE(Test, testN782061) CPPUNIT_TEST_FIXTURE(Test, testN773061) { - load("n773061.docx"); + createSwDoc("n773061.docx"); // xray ThisComponent.TextFrames(0).LeftBorderDistance uno::Reference xTextFramesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); @@ -621,7 +621,7 @@ CPPUNIT_TEST_FIXTURE(Test, testN773061) CPPUNIT_TEST_FIXTURE(Test, testN780645) { - load("n780645.docx"); + createSwDoc("n780645.docx"); // The problem was that when the number of cells didn't match the grid, we // didn't take care of direct cell widths. uno::Reference xTablesSupplier(mxComponent, uno::UNO_QUERY); @@ -633,7 +633,7 @@ CPPUNIT_TEST_FIXTURE(Test, testN780645) CPPUNIT_TEST_FIXTURE(Test, testWordArtResizing) { - load("WordArt.docx"); + createSwDoc("WordArt.docx"); /* The Word-Arts and watermarks were getting resized automatically, It was as if they were getting glued to the fallback geometry(the sdrObj) and were getting bound to the font size. The test-case ensures the original height and width of the word-art is not changed while importing*/ @@ -646,7 +646,7 @@ CPPUNIT_TEST_FIXTURE(Test, testWordArtResizing) CPPUNIT_TEST_FIXTURE(Test, testGroupshapeLine) { - load("groupshape-line.docx"); + createSwDoc("groupshape-line.docx"); /* * Another fallout from n#792778, this time first the lines inside a * groupshape wasn't imported, then the fix broke the size/position of @@ -676,7 +676,7 @@ CPPUNIT_TEST_FIXTURE(Test, testGroupshapeLine) CPPUNIT_TEST_FIXTURE(Test, testGroupshapeChildRotation) { - load("groupshape-child-rotation.docx"); + createSwDoc("groupshape-child-rotation.docx"); // The problem was that (due to incorrect handling of rotation inside // groupshapes), the first child wasn't in the top left corner of an inline // groupshape. @@ -702,7 +702,7 @@ CPPUNIT_TEST_FIXTURE(Test, testGroupshapeChildRotation) CPPUNIT_TEST_FIXTURE(Test, testTableWidth) { - load("table_width.docx"); + createSwDoc("table_width.docx"); uno::Reference xTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY); // Relative width wasn't recognized during import. @@ -715,7 +715,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTableWidth) CPPUNIT_TEST_FIXTURE(Test, testN820788) { - load("n820788.docx"); + createSwDoc("n820788.docx"); // The problem was that AutoSize was not enabled for the text frame. uno::Reference xTextFramesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); @@ -726,7 +726,7 @@ CPPUNIT_TEST_FIXTURE(Test, testN820788) CPPUNIT_TEST_FIXTURE(Test, testN820504) { - load("n820504.docx"); + createSwDoc("n820504.docx"); uno::Reference xFamiliesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xFamiliesAccess = xFamiliesSupplier->getStyleFamilies(); uno::Reference xStylesAccess(xFamiliesAccess->getByName("ParagraphStyles"), uno::UNO_QUERY); @@ -741,7 +741,7 @@ CPPUNIT_TEST_FIXTURE(Test, testN820504) CPPUNIT_TEST_FIXTURE(Test, testFdo43641) { - load("fdo43641.docx"); + createSwDoc("fdo43641.docx"); uno::Reference xGroupLockedCanvas(getShape(1), uno::UNO_QUERY); uno::Reference xGroupShape(xGroupLockedCanvas->getByIndex(0), uno::UNO_QUERY); uno::Reference xLine(xGroupShape->getByIndex(1), uno::UNO_QUERY); @@ -752,7 +752,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo43641) CPPUNIT_TEST_FIXTURE(Test, testGroupshapeSdt) { - load("groupshape-sdt.docx"); + createSwDoc("groupshape-sdt.docx"); // All problems here are due to the groupshape: we have a drawinglayer rectangle, not a writer textframe. uno::Reference xOuterGroupShape(getShape(1), uno::UNO_QUERY); uno::Reference xInnerGroupShape(xOuterGroupShape->getByIndex(0), uno::UNO_QUERY); @@ -775,14 +775,14 @@ static void lcl_countTextFrames(const css::uno::Reference< lang::XComponent >& x CPPUNIT_TEST_FIXTURE(Test, testBnc779620) { - load("bnc779620.docx"); + createSwDoc("bnc779620.docx"); // The problem was that the floating table was imported as a non-floating one. lcl_countTextFrames( mxComponent, 1 ); } CPPUNIT_TEST_FIXTURE(Test, testTdf105127) { - load("tdf105127.docx"); + createSwDoc("tdf105127.docx"); auto aPolyPolygon = getProperty(getShape(1), "PolyPolygonBezier"); // tdf#106792 These values were wrong all the time due to a missing // conversion in SvxShapePolyPolygon::getPropertyValueImpl. There was no @@ -794,7 +794,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf105127) CPPUNIT_TEST_FIXTURE(Test, testTdf105143) { - load("tdf105143.docx"); + createSwDoc("tdf105143.docx"); OUString aTop = parseDump("/root/page/body/txt/anchored/SwAnchoredDrawObject/bounds", "top"); // This was 6272, i.e. the shape was moved up (incorrect position) to be // inside the page rectangle. @@ -803,7 +803,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf105143) CPPUNIT_TEST_FIXTURE(Test, testTdf105975) { - load("105975.docx"); + createSwDoc("105975.docx"); uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xMasters(xTextFieldsSupplier->getTextFieldMasters()); // Make sure we have a variable named TEST_VAR. @@ -812,7 +812,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf105975) CPPUNIT_TEST_FIXTURE(Test, testfdo76583) { - load("fdo76583.docx"); + createSwDoc("fdo76583.docx"); // The problem was that the floating table was imported as a non-floating one. // floating tables are imported as text frames, therefore the document should // exactly 1 text frame. @@ -821,7 +821,7 @@ CPPUNIT_TEST_FIXTURE(Test, testfdo76583) CPPUNIT_TEST_FIXTURE(Test, testTdf105975formula) { - load("tdf105975.docx"); + createSwDoc("tdf105975.docx"); // Make sure the field contains a formula with 10 + 15 uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xFieldsAccess(xTextFieldsSupplier->getTextFields()); @@ -839,7 +839,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf105975formula) CPPUNIT_TEST_FIXTURE(Test, testTdf133647) { - load("tdf133647.docx"); + createSwDoc("tdf133647.docx"); /* Tests that argument lists, cell references, and cell ranges are translated correctly * when importing table formulae from MS Word */ uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); @@ -890,7 +890,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf133647) CPPUNIT_TEST_FIXTURE(Test, testTdf123386) { - load("tdf123386.docx"); + createSwDoc("tdf123386.docx"); /* Tests that argument lists, cell references, and cell ranges are translated correctly * when importing table formulae from MS Word */ uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); @@ -947,7 +947,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf123386) CPPUNIT_TEST_FIXTURE(Test, testTdf133647_unicode) { - load("tdf133647_unicode.docx"); + createSwDoc("tdf133647_unicode.docx"); /* Tests that non-ASCII characters in formulas are preserved when importing from MS Word */ uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xFieldsAccess(xTextFieldsSupplier->getTextFields()); @@ -974,7 +974,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf133647_unicode) CPPUNIT_TEST_FIXTURE(Test, testTdf123389) { - load("tdf123389.docx"); + createSwDoc("tdf123389.docx"); /* Tests that argument lists, cell references, and cell ranges are translated correctly * when importing table formulae from MS Word */ uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); @@ -998,7 +998,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf123389) CPPUNIT_TEST_FIXTURE(Test, testTdf107784) { - load("tdf107784.docx"); + createSwDoc("tdf107784.docx"); // Make sure the field displays the citation's title and not the identifier uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xFieldsAccess(xTextFieldsSupplier->getTextFields()); @@ -1016,14 +1016,14 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf107784) CPPUNIT_TEST_FIXTURE(Test, testTdf115883) { - load("tdf115883.docx"); + createSwDoc("tdf115883.docx"); // Import failed due to an unhandled exception when getting the Surround // property of a not yet inserted frame. } CPPUNIT_TEST_FIXTURE(Test, testTdf75573) { - load("tdf75573_page1frame.docx"); + createSwDoc("tdf75573_page1frame.docx"); // the problem was that the frame was discarded // when an unrelated, unused, odd-header was flagged as discardable lcl_countTextFrames( mxComponent, 1 ); @@ -1050,7 +1050,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf75573) CPPUNIT_TEST_FIXTURE(Test, testTdf75573_lostTable) { - load("tdf75573_lostTable.docx"); + createSwDoc("tdf75573_lostTable.docx"); uno::Reference xTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL_MESSAGE("# of tables", sal_Int32(1), xTables->getCount() ); @@ -1062,7 +1062,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf75573_lostTable) CPPUNIT_TEST_FIXTURE(Test, testTdf109316_dropCaps) { - load("tdf109316_dropCaps.docx"); + createSwDoc("tdf109316_dropCaps.docx"); uno::Reference xSet(getParagraph(1), uno::UNO_QUERY); css::style::DropCapFormat aDropCap = getProperty(xSet,"DropCapFormat"); CPPUNIT_ASSERT_EQUAL( sal_Int8(2), aDropCap.Lines ); @@ -1084,7 +1084,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf109316_dropCaps) CPPUNIT_TEST_FIXTURE(Test, lineWpsOnly) { - load("line-wps-only.docx"); + createSwDoc("line-wps-only.docx"); uno::Reference xShape = getShape(1); // Check position, it was -7223 as it was set after the CustomShapeGeometry property. CPPUNIT_ASSERT_EQUAL(sal_Int32(210), xShape->getPosition().X); @@ -1092,7 +1092,7 @@ CPPUNIT_TEST_FIXTURE(Test, lineWpsOnly) CPPUNIT_TEST_FIXTURE(Test, lineRotation) { - load("line-rotation.docx"); + createSwDoc("line-rotation.docx"); uno::Reference xShape = getShape(3); // This was 5096: the line was shifted towards the bottom, so the end of // the 3 different lines wasn't at the same point. @@ -1101,7 +1101,7 @@ CPPUNIT_TEST_FIXTURE(Test, lineRotation) CPPUNIT_TEST_FIXTURE(Test, textboxWpsOnly) { - load("textbox-wps-only.docx"); + createSwDoc("textbox-wps-only.docx"); uno::Reference xFrame(getShape(1), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(OUString("Hello world!"), xFrame->getString()); // Position wasn't horizontally centered. @@ -1124,14 +1124,14 @@ CPPUNIT_TEST_FIXTURE(Test, textboxWpsOnly) CPPUNIT_TEST_FIXTURE(Test, testGroupshapeRelsize) { - load("groupshape-relsize.docx"); + createSwDoc("groupshape-relsize.docx"); // This was 43760, i.e. the height of the groupshape was larger than the page height, which is obviously incorrect. CPPUNIT_ASSERT_EQUAL(oox::drawingml::convertEmuToHmm(9142730), getShape(1)->getSize().Height); } CPPUNIT_TEST_FIXTURE(Test, testOleAnchor) { - load("ole-anchor.docx"); + createSwDoc("ole-anchor.docx"); // This was AS_CHARACTER, even if the VML style explicitly contains "position:absolute". CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, getProperty(getShape(1), "AnchorType")); // This was DYNAMIC, even if the default is THROUGH and there is no w10:wrap element in the bugdoc. @@ -1140,7 +1140,7 @@ CPPUNIT_TEST_FIXTURE(Test, testOleAnchor) CPPUNIT_TEST_FIXTURE(Test, testTdf48658_transparentOLEheader) { - load("tdf48658_transparentOLEheader.docx"); + createSwDoc("tdf48658_transparentOLEheader.docx"); // The problem was that the shape in the header was hidden in the background. // The round-tripped document was always fine (even before the fix) but the shape numbers change, so import-only test. CPPUNIT_ASSERT_EQUAL(true, getProperty(getShape(1), "Opaque")); @@ -1148,7 +1148,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf48658_transparentOLEheader) CPPUNIT_TEST_FIXTURE(Test, testDMLGroupShapeParaAdjust) { - load("dml-groupshape-paraadjust.docx"); + createSwDoc("dml-groupshape-paraadjust.docx"); // Paragraph adjustment inside a group shape was not imported uno::Reference xGroup(getShape(1), uno::UNO_QUERY); uno::Reference xText = uno::Reference(xGroup->getByIndex(1), uno::UNO_QUERY_THROW)->getText(); @@ -1168,14 +1168,14 @@ CPPUNIT_TEST_FIXTURE(Test, testDMLGroupShapeParaAdjust) CPPUNIT_TEST_FIXTURE(Test, testTdf99135) { - load("tdf99135.docx"); + createSwDoc("tdf99135.docx"); // This was 0, crop was ignored on VML import. CPPUNIT_ASSERT_EQUAL(static_cast(1825), getProperty(getShape(1), "GraphicCrop").Bottom); } CPPUNIT_TEST_FIXTURE(Test, testTdf85523) { - load("tdf85523.docx"); + createSwDoc("tdf85523.docx"); auto xTextField = getProperty< uno::Reference >(getRun(getParagraph(1), 7), "TextField"); auto xText = getProperty< uno::Reference >(xTextField, "TextRange"); // This was "commentX": an unexpected extra char was added at the comment end. @@ -1184,14 +1184,14 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf85523) CPPUNIT_TEST_FIXTURE(Test, testStrictLockedcanvas) { - load("strict-lockedcanvas.docx"); + createSwDoc("strict-lockedcanvas.docx"); // locked canvas shape was missing. getShape(1); } CPPUNIT_TEST_FIXTURE(Test, testFdo75722vml) { - load("fdo75722-vml.docx"); + createSwDoc("fdo75722-vml.docx"); uno::Reference xShape = getShape(1); awt::Point aPos = xShape->getPosition(); awt::Size aSize = xShape->getSize(); @@ -1206,7 +1206,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo75722vml) CPPUNIT_TEST_FIXTURE(Test, testFdo75722dml) { - load("fdo75722-dml.docx"); + createSwDoc("fdo75722-dml.docx"); uno::Reference xShape = getShape(1); awt::Point aPos = xShape->getPosition(); awt::Size aSize = xShape->getSize(); @@ -1222,7 +1222,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo75722dml) CPPUNIT_TEST_FIXTURE(Test, testUnbalancedColumnsCompat) { - load("unbalanced-columns-compat.docx"); + createSwDoc("unbalanced-columns-compat.docx"); uno::Reference xTextSectionsSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xTextSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY); // This was false, we ignored the relevant compat setting to make this non-last section unbalanced. @@ -1231,7 +1231,7 @@ CPPUNIT_TEST_FIXTURE(Test, testUnbalancedColumnsCompat) CPPUNIT_TEST_FIXTURE(Test, testFloatingTableSectionColumns) { - load("floating-table-section-columns.docx"); + createSwDoc("floating-table-section-columns.docx"); OUString tableWidth = parseDump("/root/page[1]/body/section/column[2]/body/txt/anchored/fly/tab/infos/bounds", "width"); // table width was restricted by a column CPPUNIT_ASSERT( tableWidth.toInt32() > 10000 ); @@ -1244,7 +1244,7 @@ static OString dateTimeToString( const util::DateTime& dt ) CPPUNIT_TEST_FIXTURE(Test, testBnc821804) { - load("bnc821804.docx"); + createSwDoc("bnc821804.docx"); CPPUNIT_ASSERT_EQUAL( OUString( "TITLE" ), getRun( getParagraph( 1 ), 1 )->getString()); CPPUNIT_ASSERT(!hasProperty(getRun(getParagraph(1), 1), "RedlineType")); // Redline information (SwXRedlinePortion) are separate "runs" apparently. @@ -1375,7 +1375,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo87488) // StarView MetaFile. SvtFilterOptions::Get().SetSmartArt2Shape(true); comphelper::ScopeGuard g([] { SvtFilterOptions::Get().SetSmartArt2Shape(false); }); - load("fdo87488.docx"); + createSwDoc("fdo87488.docx"); uno::Reference group(getShape(1), uno::UNO_QUERY); { uno::Reference text(group->getByIndex(1), uno::UNO_QUERY); @@ -1392,7 +1392,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo87488) CPPUNIT_TEST_FIXTURE(Test, testTdf85232) { - load("tdf85232.docx"); + createSwDoc("tdf85232.docx"); uno::Reference xShapes(getShapeByName(u"Group 219"), uno::UNO_QUERY); uno::Reference xShape(xShapes->getByIndex(1), uno::UNO_QUERY); uno::Reference xShapeDescriptor = xShape; @@ -1405,7 +1405,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf85232) CPPUNIT_TEST_FIXTURE(Test, testTdf95755) { - load("tdf95755.docx"); + createSwDoc("tdf95755.docx"); /* * The problem was that the width of a second table with single cell was discarded * and resulted in too wide table @@ -1421,7 +1421,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf95755) CPPUNIT_TEST_FIXTURE(Test, testTdf60351) { - load("tdf60351.docx"); + createSwDoc("tdf60351.docx"); // Get the first image in the document and check its contour polygon. // It should contain 6 points. Check their coordinates. uno::Reference xPropertySet(getShape(1), uno::UNO_QUERY); @@ -1449,7 +1449,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf60351) CPPUNIT_TEST_FIXTURE(Test, testTdf95970) { - load("tdf95970.docx"); + createSwDoc("tdf95970.docx"); // First shape: the rotation should be -12.94 deg, it should be mirrored. // Proper color order of image on test doc (left->right): // top row: green->red @@ -1477,7 +1477,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf95970) CPPUNIT_TEST_FIXTURE(Test, testTdf96674) { - load("tdf96674.docx"); + createSwDoc("tdf96674.docx"); uno::Reference xShape = getShape(1); CPPUNIT_ASSERT(xShape.is()); awt::Size aActualSize(xShape->getSize()); @@ -1488,7 +1488,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf96674) CPPUNIT_TEST_FIXTURE(Test, testTdf122717) { - load("tdf122717.docx"); + createSwDoc("tdf122717.docx"); uno::Reference xShape = getShape(1); CPPUNIT_ASSERT(xShape.is()); awt::Size aActualSize(xShape->getSize()); @@ -1502,7 +1502,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf122717) CPPUNIT_TEST_FIXTURE(Test, testTdf98882) { - load("tdf98882.docx"); + createSwDoc("tdf98882.docx"); sal_Int32 nFlyHeight = parseDump("//anchored/fly/infos/bounds", "height").toInt32(); sal_Int32 nContentHeight = parseDump("//notxt/infos/bounds", "height").toInt32(); // The content height was 600, not 360, so the frame and the content height did not match. @@ -1511,14 +1511,14 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf98882) CPPUNIT_TEST_FIXTURE(Test, testTdf100830) { - load("tdf100830.docx"); + createSwDoc("tdf100830.docx"); // FillTransparence wasn't imported, this was 0. CPPUNIT_ASSERT_EQUAL(static_cast(30), getProperty(getShape(1), "FillTransparence")); } CPPUNIT_TEST_FIXTURE(Test, testTdf103664) { - load("tdf103664.docx"); + createSwDoc("tdf103664.docx"); // Wingdings symbols were displayed as rectangles uno::Reference xPara(getParagraph(1)); CPPUNIT_ASSERT_EQUAL(u'\xf020', xPara->getString()[0] ); @@ -1537,21 +1537,21 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf103664) CPPUNIT_TEST_FIXTURE(Test, testTdf82824) { - load("tdf82824.docx"); + createSwDoc("tdf82824.docx"); // This was text::TextContentAnchorType_AS_CHARACTER, wasn't handled on import for the chart. CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, getProperty(getShape(1), "AnchorType")); } CPPUNIT_TEST_FIXTURE(Test, testTdf96218) { - load("tdf96218.docx"); + createSwDoc("tdf96218.docx"); // Image had a bad position because layoutInCell attribute was not ignored CPPUNIT_ASSERT(!getProperty(getShape(1), "IsFollowingTextFlow")); } CPPUNIT_TEST_FIXTURE(Test, testTdf101626) { - load("tdf101626.docx"); + createSwDoc("tdf101626.docx"); // Transform soft-hyphen to hard-hyphen as list bulletChar to avoid missing symbols in export uno::Reference xPropertySet(getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY); uno::Reference xLevels(xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY); @@ -1571,7 +1571,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf101626) CPPUNIT_TEST_FIXTURE(Test, testTdf106606) { - load("tdf106606.docx" ); + createSwDoc("tdf106606.docx" ); auto FindGraphicBitmapPropertyInNumStyle = [&]( OUString rStyleName ) { uno::Reference xPropertySet( getStyles( "NumberingStyles" )->getByName( rStyleName ), uno::UNO_QUERY ); @@ -1595,7 +1595,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf106606) CPPUNIT_TEST_FIXTURE(Test, testTdf101627) { - load("tdf101627.docx"); + createSwDoc("tdf101627.docx"); // Do not shrink the textbox in the footer uno::Reference xFrame(getShape(1), uno::UNO_QUERY); CPPUNIT_ASSERT(xFrame->getString().startsWith( "1" ) ); @@ -1604,7 +1604,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf101627) CPPUNIT_TEST_FIXTURE(Test, testTdf133448) { - load("tdf133448.docx"); + createSwDoc("tdf133448.docx"); auto xGraphic = getProperty>(getShape(1), "Graphic"); Graphic aGraphic(xGraphic); uno::Reference xGraphicDescriptor(xGraphic, uno::UNO_QUERY_THROW); @@ -1618,7 +1618,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf133448) CPPUNIT_TEST_FIXTURE(Test, testTdf100072) { - load("tdf100072.docx"); + createSwDoc("tdf100072.docx"); uno::Reference xShape = getShape(1); // Ensure that shape has non-zero height @@ -1661,7 +1661,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf100072) CPPUNIT_TEST_FIXTURE(Test, testTdf76446) { - load("tdf76446.docx"); + createSwDoc("tdf76446.docx"); uno::Reference xShape = getShape(1); sal_Int64 nRot = getProperty(xShape, "RotateAngle"); CPPUNIT_ASSERT_EQUAL(sal_Int64(3128), nRot); @@ -1669,7 +1669,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf76446) CPPUNIT_TEST_FIXTURE(Test, testTdf108350) { - load("tdf108350.docx"); + createSwDoc("tdf108350.docx"); // For OOXML without explicit font information, font needs to be Calibri 11 pt uno::Reference xPara(getParagraph(1)); uno::Reference xRun(getRun(xPara, 1), uno::UNO_QUERY); @@ -1679,7 +1679,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf108350) CPPUNIT_TEST_FIXTURE(Test, testTdf108408) { - load("tdf108408.docx"); + createSwDoc("tdf108408.docx"); // Font size must consider units specifications; previously ignored and only used // integer part as half-pt size, i.e. 10 pt (20 half-pt) instead of 20 pt uno::Reference xPara(getParagraph(1)); @@ -1689,7 +1689,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf108408) CPPUNIT_TEST_FIXTURE(Test, testTdf108806) { - load("tdf108806.docx"); + createSwDoc("tdf108806.docx"); // tdf#108806:The CRLF in the text contents of XML must be converted to single spaces. CPPUNIT_ASSERT_EQUAL(1, getParagraphs()); uno::Reference< text::XTextRange > paragraph = getParagraph(1); @@ -1700,7 +1700,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf108806) CPPUNIT_TEST_FIXTURE(Test, testTdf87533_bidi) { - load("tdf87533_bidi.docx"); + createSwDoc("tdf87533_bidi.docx"); // "w:bidi" (specified inside Default paragraph properties) should not be ignored static const OUStringLiteral writingMode = u"WritingMode"; //getPropertyName(PROP_WRITING_MODE); @@ -1733,7 +1733,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf87533_bidi) CPPUNIT_TEST_FIXTURE(Test, testVmlAdjustments) { - load("vml-adjustments.docx"); + createSwDoc("vml-adjustments.docx"); uno::Reference xPropertySet(getShape(1), uno::UNO_QUERY); comphelper::SequenceAsHashMap aGeometry(xPropertySet->getPropertyValue("CustomShapeGeometry")); uno::Sequence aAdjustmentValues = @@ -1745,7 +1745,7 @@ CPPUNIT_TEST_FIXTURE(Test, testVmlAdjustments) CPPUNIT_TEST_FIXTURE(Test, testTdf108714) { - load("tdf108714.docx"); + createSwDoc("tdf108714.docx"); CPPUNIT_ASSERT_EQUAL(6, getParagraphs()); CPPUNIT_ASSERT_EQUAL_MESSAGE("Page break is absent - we lost bug-to-bug compatibility with Word", 4, getPages()); @@ -1805,7 +1805,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf108714) CPPUNIT_TEST_FIXTURE(Test, testTdf136952_pgBreak3) { - load("tdf136952_pgBreak3.docx"); + createSwDoc("tdf136952_pgBreak3.docx"); // The original 6 page ODT was designed to visually exaggerate the problems // of emulating LO's followed-by-page-style into MSWord's sections. // While much has been improved, there are extra pages present, which still need fixing. @@ -1820,7 +1820,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf136952_pgBreak3) CPPUNIT_TEST_FIXTURE(Test, testImageLazyRead) { - load("image-lazy-read.docx"); + createSwDoc("image-lazy-read.docx"); auto xGraphic = getProperty>(getShape(1), "Graphic"); Graphic aGraphic(xGraphic); // This failed, import loaded the graphic, it wasn't lazy-read. @@ -1829,7 +1829,7 @@ CPPUNIT_TEST_FIXTURE(Test, testImageLazyRead) CPPUNIT_TEST_FIXTURE(Test, testTdf108995) { - load("xml_space.docx"); + createSwDoc("xml_space.docx"); CPPUNIT_ASSERT_EQUAL(1, getParagraphs()); // We need to take xml:space attribute into account uno::Reference< text::XTextRange > paragraph = getParagraph(1); @@ -1840,7 +1840,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf108995) CPPUNIT_TEST_FIXTURE(Test, testGroupShapeTextHighlight) { - load("tdf131841_HighlightColorGroupedShape.docx"); + createSwDoc("tdf131841_HighlightColorGroupedShape.docx"); // tdf#131841 Highlight color of text in grouped shapes was not imported. // These are the possible highlight colors in MSO Word. Check that we import them properly. diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx index 66c9e78f0c6d..dd36e5e02059 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx @@ -52,7 +52,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf143476LockedCanvas_twoShapes) // Given a lockedCanvas in a docx document with compatibility to Word version 12 (2007). // It contains two shapes. Error was, that the lockedCanvas was not imported as group at all, // and only one shape was imported and that one was scaled to lockedCanvas area. - load("tdf143476_lockedCanvas_twoShapes.docx"); + createSwDoc("tdf143476_lockedCanvas_twoShapes.docx"); // The group shape corresponds to the lockedCanvas. uno::Reference xGroup(getShape(1), uno::UNO_QUERY); CPPUNIT_ASSERT(xGroup.is()); @@ -69,7 +69,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf143476LockedCanvas_position) // Given a lockedCanvas in a docx document with compatibility to Word version 12 (2007). // Tests fix for regression introduced by 3262fc5ef3bde5b158909d11ccb008161ea95519 // Error was, that the imported shape had wrong position. - load("tdf143476_lockedCanvas_position.docx"); + createSwDoc("tdf143476_lockedCanvas_position.docx"); // The group shape corresponds to the lockedCanvas. uno::Reference xGroupShape(getShape(1), uno::UNO_QUERY); // Without fix in place the test failed with position 185|947. @@ -81,7 +81,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf143476LockedCanvas_image_line) { // Given a lockedCanvas in a docx document with compatibility to Word version 12 (2007). // It contains an image and a line. Error was, that both were not imported. - load("tdf143476_lockedCanvas_image_line.docx"); + createSwDoc("tdf143476_lockedCanvas_image_line.docx"); CPPUNIT_ASSERT_MESSAGE("No shapes imported", getShapes() > 0); } @@ -90,7 +90,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf143475rotatedWord2007imageInline) // Given a docx document with compatibility to Word version 12 (2007), which has a shape // rotated by 75deg. Similar to testTdf143475rotatedWord2007image but with inline anchored // shape, as in bug report. - load("tdf143475_rotatedWord2007imageInline.docx"); + createSwDoc("tdf143475_rotatedWord2007imageInline.docx"); // Word 2007 does not swap width and height for rotated images as done in later versions. // This was not considered and lead to wrong distance to text on import and wrong effectExtent @@ -114,7 +114,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf143475rotatedWord2007image) { // Given a docx document with compatibility to Word version 12 (2007), which has a shape // rotated by 75deg. - load("tdf143475_rotatedWord2007image.docx"); + createSwDoc("tdf143475_rotatedWord2007image.docx"); // Word 2007 does not swap width and height for rotated images as done in later versions. // This was not considered and lead to wrong distance to text on import and wrong effectExtent @@ -136,7 +136,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf143475rotatedWord2007image) CPPUNIT_TEST_FIXTURE(Test, testTdf143219ContourWrapRotate) { - load("tdf143219_ContourWrap_rotate.docx"); + createSwDoc("tdf143219_ContourWrap_rotate.docx"); const uno::Reference xShape = getShape(1); const uno::Reference xShapeProps(xShape, uno::UNO_QUERY_THROW); sal_Int32 nWrapDistanceLeft = -1; @@ -163,14 +163,14 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf143219ContourWrapRotate) CPPUNIT_TEST_FIXTURE(Test, testTdf108545_embeddedDocxIcon) { - load("tdf108545_embeddedDocxIcon.docx"); + createSwDoc("tdf108545_embeddedDocxIcon.docx"); uno::Reference xSupplier(getShape(1), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(embed::Aspects::MSOLE_ICON, xSupplier->getAspect()); } CPPUNIT_TEST_FIXTURE(Test, testTdf121203) { - load("tdf121203.docx"); + createSwDoc("tdf121203.docx"); // We imported the date field uno::Reference xTextPortion(getRun(getParagraph(1), 1), uno::UNO_QUERY); OUString aPortionType; @@ -205,7 +205,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf121203) CPPUNIT_TEST_FIXTURE(Test, testTdf109053) { - load("tdf109053.docx"); + createSwDoc("tdf109053.docx"); // Table was imported into a text frame which led to a one page document // Originally the table takes two pages, so Writer should import it accordingly. CPPUNIT_ASSERT_EQUAL(2, getPages()); @@ -213,7 +213,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf109053) CPPUNIT_TEST_FIXTURE(Test, testTdf121664) { - load("tdf121664.docx"); + createSwDoc("tdf121664.docx"); uno::Reference xLineNumbering(mxComponent, uno::UNO_QUERY); CPPUNIT_ASSERT(xLineNumbering.is()); // Without the accompanying fix in place, numbering did not restart on the @@ -224,7 +224,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf121664) CPPUNIT_TEST_FIXTURE(Test, testTdf108849) { - load("tdf108849.docx"); + createSwDoc("tdf108849.docx"); // sectPr element that is child element of body must be the last child. However, Word accepts it // in wrong places, and we should do the same (bug-to-bug compatibility) without creating extra sections. CPPUNIT_ASSERT_EQUAL(2, getParagraphs()); @@ -234,7 +234,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf108849) CPPUNIT_TEST_FIXTURE(Test, testTdf97038) { - load("tdf97038.docx"); + createSwDoc("tdf97038.docx"); // Without the accompanying fix in place, this test would have failed, as the importer lost the // fLayoutInCell shape property for wrap-though shapes. CPPUNIT_ASSERT(getProperty(getShapeByName(u"Kep2"), "IsFollowingTextFlow")); @@ -242,7 +242,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf97038) CPPUNIT_TEST_FIXTURE(Test, testTdf114212) { - load("tdf114212.docx"); + createSwDoc("tdf114212.docx"); // Without the accompanying fix in place, this test would have failed with: // - Expected: 1428 // - Actual : 387 @@ -252,7 +252,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf114212) CPPUNIT_TEST_FIXTURE(Test, testTdf109524) { - load("tdf109524.docx"); + createSwDoc("tdf109524.docx"); uno::Reference xTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY); @@ -267,7 +267,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf109524) CPPUNIT_TEST_FIXTURE(Test, testTdf120547) { - load("tdf120547.docx"); + createSwDoc("tdf120547.docx"); uno::Reference xGroupShape = getShape(1); uno::Reference xGroup(getShape(1), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(static_cast(3), xGroup->getCount()); @@ -318,7 +318,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf120547) CPPUNIT_TEST_FIXTURE(Test, testTdf118693) { - load("tdf118693.docx"); + createSwDoc("tdf118693.docx"); uno::Reference xGroupShape = getShape(1); uno::Reference xGroup(getShape(1), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(static_cast(2), xGroup->getCount()); @@ -357,7 +357,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf118693) CPPUNIT_TEST_FIXTURE(Test, testGroupShapeFontName) { - load("groupshape-fontname.docx"); + createSwDoc("groupshape-fontname.docx"); // Font names inside a group shape were not imported uno::Reference xGroup(getShape(1), uno::UNO_QUERY); uno::Reference xText @@ -376,7 +376,7 @@ CPPUNIT_TEST_FIXTURE(Test, testGroupShapeFontName) CPPUNIT_TEST_FIXTURE(Test, testTdf124600) { - load("tdf124600.docx"); + createSwDoc("tdf124600.docx"); // uno::Reference xShape = getShape(1); // Without the accompanying fix in place, this test would have failed with: // - Expected: 0 @@ -403,7 +403,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf124600) CPPUNIT_TEST_FIXTURE(Test, testTdf120548) { - load("tdf120548.docx"); + createSwDoc("tdf120548.docx"); // Without the accompanying fix in place, this test would have failed with 'Expected: 00ff0000; // Actual: ffffffff', i.e. the numbering portion was black, not red. CPPUNIT_ASSERT_EQUAL(OUString("00ff0000"), @@ -412,7 +412,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf120548) CPPUNIT_TEST_FIXTURE(Test, test120551) { - load("tdf120551.docx"); + createSwDoc("tdf120551.docx"); auto nHoriOrientPosition = getProperty(getShape(1), "HoriOrientPosition"); // Without the accompanying fix in place, this test would have failed with // 'Expected: 430, Actual : -2542'. @@ -423,7 +423,7 @@ CPPUNIT_TEST_FIXTURE(Test, test120551) CPPUNIT_TEST_FIXTURE(Test, testTdf111550) { - load("tdf111550.docx"); + createSwDoc("tdf111550.docx"); // The test document has following ill-formed structure: // // @@ -490,7 +490,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf111550) CPPUNIT_TEST_FIXTURE(Test, testTdf117843) { - load("tdf117843.docx"); + createSwDoc("tdf117843.docx"); uno::Reference xPageStyles = getStyles("PageStyles"); uno::Reference xPageStyle(xPageStyles->getByName("Standard"), uno::UNO_QUERY); uno::Reference xHeaderText @@ -504,7 +504,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf117843) // related tdf#124754 CPPUNIT_TEST_FIXTURE(Test, testTdf43017) { - load("tdf43017.docx"); + createSwDoc("tdf43017.docx"); uno::Reference xParagraph = getParagraph(1); uno::Reference xText = getRun(xParagraph, 2, "kick the bucket"); @@ -515,7 +515,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf43017) CPPUNIT_TEST_FIXTURE(Test, testTdf127778) { - load("tdf127778.docx"); + createSwDoc("tdf127778.docx"); xmlDocUniquePtr pLayout = parseLayoutDump(); // Without the accompanying fix in place, this test would have failed with: // equality assertion failed @@ -528,7 +528,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf127778) // related tdf#43017 CPPUNIT_TEST_FIXTURE(Test, testTdf124754) { - load("tdf124754.docx"); + createSwDoc("tdf124754.docx"); uno::Reference textbox(getShape(1), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(1, getParagraphs(textbox)); @@ -542,7 +542,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf124754) CPPUNIT_TEST_FIXTURE(Test, testTextCopy) { - load("text-copy.docx"); + createSwDoc("text-copy.docx"); // The document has a header on the second page that is copied as part of the import process. // The header has a single paragraph: make sure shapes anchored to it are not lost. // Note that the single paragraph itself has no text portions. @@ -570,7 +570,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTextCopy) CPPUNIT_TEST_FIXTURE(Test, testTdf112443) { - load("tdf112443.docx"); + createSwDoc("tdf112443.docx"); // the position of the flying text frame should be off page // 30624 below its anchor SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); @@ -591,13 +591,13 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf112443) // and as result only one page should be generated. CPPUNIT_TEST_FIXTURE(Test, testTdf113182) { - load("tdf113182.docx"); + createSwDoc("tdf113182.docx"); CPPUNIT_ASSERT_EQUAL(1, getPages()); } CPPUNIT_TEST_FIXTURE(Test, testBtlrFrameVml) { - load("btlr-frame-vml.docx"); + createSwDoc("btlr-frame-vml.docx"); uno::Reference xTextFrame(getShape(1), uno::UNO_QUERY); CPPUNIT_ASSERT(xTextFrame.is()); @@ -609,7 +609,7 @@ CPPUNIT_TEST_FIXTURE(Test, testBtlrFrameVml) CPPUNIT_TEST_FIXTURE(Test, testTdf124398) { - load("tdf124398.docx"); + createSwDoc("tdf124398.docx"); uno::Reference xGroup(getShape(1), uno::UNO_QUERY); CPPUNIT_ASSERT(xGroup.is()); // Without the accompanying fix in place, this test would have failed with 'Expected: 2; Actual: @@ -622,7 +622,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf124398) CPPUNIT_TEST_FIXTURE(Test, testTdf104167) { - load("tdf104167.docx"); + createSwDoc("tdf104167.docx"); // Make sure that heading 1 paragraphs start on a new page. uno::Any xStyle = getStyles("ParagraphStyles")->getByName("Heading 1"); // Without the accompanying fix in place, this test would have failed with: @@ -635,7 +635,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf104167) CPPUNIT_TEST_FIXTURE(Test, testTdf113946) { - load("tdf113946.docx"); + createSwDoc("tdf113946.docx"); OUString aTop = parseDump("/root/page/body/txt/anchored/SwAnchoredDrawObject/bounds", "top"); // tdf#106792 Checked loading of tdf113946.docx. Before the change, the expected // value of this test was "1696". Opening the file shows a single short line anchored @@ -647,7 +647,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf113946) CPPUNIT_TEST_FIXTURE(Test, testTdf121804) { - load("tdf121804.docx"); + createSwDoc("tdf121804.docx"); uno::Reference xGroup(getShape(1), uno::UNO_QUERY); uno::Reference xShape(xGroup->getByIndex(0), uno::UNO_QUERY); uno::Reference xFirstPara = getParagraphOfText(1, xShape->getText()); @@ -666,14 +666,14 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf121804) CPPUNIT_TEST_FIXTURE(Test, testTdf114217) { - load("tdf114217.docx"); + createSwDoc("tdf114217.docx"); // This was 1, multi-page table was imported as a floating one. CPPUNIT_ASSERT_EQUAL(0, getShapes()); } CPPUNIT_TEST_FIXTURE(Test, testTdf119200) { - load("tdf119200.docx"); + createSwDoc("tdf119200.docx"); auto xPara = getParagraph(1); // Check that we import MathType functional symbols as symbols, not functions with missing args CPPUNIT_ASSERT_EQUAL(OUString(u" size 12{ func \u2208 } {}"), getFormula(getRun(xPara, 1))); @@ -687,7 +687,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf119200) CPPUNIT_TEST_FIXTURE(Test, testTdf115094) { - load("tdf115094.docx"); + createSwDoc("tdf115094.docx"); // anchor of graphic has to be the text in the text frame // xray ThisComponent.DrawPage(1).Anchor.Text uno::Reference xShape(getShape(2), uno::UNO_QUERY); @@ -705,7 +705,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf115094) CPPUNIT_TEST_FIXTURE(Test, testTdf115094v2) { - load("tdf115094v2.docx"); + createSwDoc("tdf115094v2.docx"); // layoutInCell="1" combined with CPPUNIT_ASSERT(getProperty(getShapeByName(u"Grafik 18"), "IsFollowingTextFlow")); @@ -714,7 +714,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf115094v2) CPPUNIT_TEST_FIXTURE(Test, testTdf122224) { - load("tdf122224.docx"); + createSwDoc("tdf122224.docx"); uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); @@ -726,7 +726,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf122224) CPPUNIT_TEST_FIXTURE(Test, testTdf121440) { - load("tdf121440.docx"); + createSwDoc("tdf121440.docx"); // Insert some text in front of footnote SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); @@ -743,7 +743,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf121440) CPPUNIT_TEST_FIXTURE(Test, testTdf124670) { - load("tdf124670.docx"); + createSwDoc("tdf124670.docx"); CPPUNIT_ASSERT_EQUAL(1, getParagraphs()); // We need to take xml:space attribute into account, even in w:document element uno::Reference paragraph = getParagraph(1); @@ -754,7 +754,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf124670) CPPUNIT_TEST_FIXTURE(Test, testTdf126114) { - load("tdf126114.docx"); + createSwDoc("tdf126114.docx"); // The problem was that after the drop-down form field, also the placeholder string // was imported as text. Beside the duplication of the field, it also caused a crash. // the word is from replacement of the drop-down field in ModelToViewHelper @@ -763,7 +763,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf126114) CPPUNIT_TEST_FIXTURE(Test, testTdf127825) { - load("tdf127825.docx"); + createSwDoc("tdf127825.docx"); // The document has a shape with Japanese-style text in it. The shape has relative size and also // has automatic height. SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); @@ -788,7 +788,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf127825) CPPUNIT_TEST_FIXTURE(Test, testTdf103345) { - load("numbering-circle.docx"); + createSwDoc("numbering-circle.docx"); uno::Reference xPropertySet( getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY); uno::Reference xLevels( @@ -808,7 +808,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf103345) CPPUNIT_TEST_FIXTURE(Test, testTdf125038) { - load("tdf125038.docx"); + createSwDoc("tdf125038.docx"); OUString aActual = getParagraph(1)->getString(); // Without the accompanying fix in place, this test would have failed with: // - Expected: phone:... @@ -819,7 +819,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf125038) CPPUNIT_TEST_FIXTURE(Test, testTdf125038b) { - load("tdf125038b.docx"); + createSwDoc("tdf125038b.docx"); // Load a document with an IF field, where the IF field command contains a paragraph break. uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference xParagraphAccess(xTextDocument->getText(), @@ -844,7 +844,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf125038b) CPPUNIT_TEST_FIXTURE(Test, testTdf125038c) { - load("tdf125038c.docx"); + createSwDoc("tdf125038c.docx"); OUString aActual = getParagraph(1)->getString(); // Without the accompanying fix in place, this test would have failed with: // - Expected: email: test@test.test @@ -855,19 +855,19 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf125038c) CPPUNIT_TEST_FIXTURE(Test, testTdf130214) { - load("tdf130214.docx"); + createSwDoc("tdf130214.docx"); // Currently this file imports with errors because of tdf#126435; it must not segfault on load } CPPUNIT_TEST_FIXTURE(Test, testTdf129659) { - load("tdf129659.docx"); + createSwDoc("tdf129659.docx"); // don't crash on footnote with page break } CPPUNIT_TEST_FIXTURE(Test, testTdf129912) { - load("tdf129912.docx"); + createSwDoc("tdf129912.docx"); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); @@ -901,7 +901,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf129912) CPPUNIT_TEST_FIXTURE(Test, testTdf126426) { - load("tdf126426.docx"); + createSwDoc("tdf126426.docx"); uno::Reference xGroup(getShape(1), uno::UNO_QUERY_THROW); CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xGroup->getCount()); @@ -937,7 +937,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf126426) CPPUNIT_TEST_FIXTURE(Test, testTdf119039) { - load("tdf119039_bad_embedded_compound.docx"); + createSwDoc("tdf119039_bad_embedded_compound.docx"); // Should not crash/hang because of problematic embedded compound } diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index dc34e15ca953..a29cf8ac7451 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -1018,7 +1018,7 @@ DECLARE_RTFEXPORT_TEST(testTdf80708, "tdf80708.rtf") CPPUNIT_TEST_FIXTURE(Test, testHyperlinkWithoutURL) { - load("tdf90421.fodt"); + createSwDoc("tdf90421.fodt"); // Change the hyperlink, so its URL is empty. uno::Reference xRun(getRun(getParagraph(1), 2), uno::UNO_QUERY); xRun->setPropertyValue("HyperLinkURL", uno::Any(OUString())); diff --git a/sw/qa/extras/rtfexport/rtfexport2.cxx b/sw/qa/extras/rtfexport/rtfexport2.cxx index 8a13cb4374d5..e840a0d2ad4f 100644 --- a/sw/qa/extras/rtfexport/rtfexport2.cxx +++ b/sw/qa/extras/rtfexport/rtfexport2.cxx @@ -575,7 +575,7 @@ DECLARE_RTFEXPORT_TEST(testFdo55493, "fdo55493.rtf") CPPUNIT_TEST_FIXTURE(Test, testCopyPastePageStyle) { - load("copypaste-pagestyle.rtf"); + createSwDoc("copypaste-pagestyle.rtf"); // The problem was that RTF import during copy&paste did not ignore page styles. // Once we have more copy&paste tests, makes sense to refactor this to some helper method. uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); @@ -591,7 +591,7 @@ CPPUNIT_TEST_FIXTURE(Test, testCopyPastePageStyle) CPPUNIT_TEST_FIXTURE(Test, testCopyPasteFootnote) { - load("copypaste-footnote.rtf"); + createSwDoc("copypaste-footnote.rtf"); // The RTF import did not handle the case when the position wasn't the main document XText, but something different, e.g. a footnote. uno::Reference xFootnotesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xFootnotes = xFootnotesSupplier->getFootnotes(); @@ -603,7 +603,7 @@ CPPUNIT_TEST_FIXTURE(Test, testCopyPasteFootnote) CPPUNIT_TEST_FIXTURE(Test, testFdo63428) { - load("hello.rtf"); + createSwDoc("hello.rtf"); // Pasting content that contained an annotation caused a crash. uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference xText = xTextDocument->getText(); @@ -629,7 +629,7 @@ DECLARE_RTFEXPORT_TEST(testFdo69384, "fdo69384-paste.rtf") CPPUNIT_TEST_FIXTURE(Test, testFdo69384Inserted) { - load("hello.rtf"); + createSwDoc("hello.rtf"); uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference xText = xTextDocument->getText(); uno::Reference xEnd = xText->getEnd(); @@ -644,7 +644,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo69384Inserted) CPPUNIT_TEST_FIXTURE(Test, testFdo61193) { - load("hello.rtf"); + createSwDoc("hello.rtf"); // Pasting content that contained a footnote caused a crash. uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference xText = xTextDocument->getText(); @@ -654,7 +654,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo61193) CPPUNIT_TEST_FIXTURE(Test, testTdf108123) { - load("hello.rtf"); + createSwDoc("hello.rtf"); // This crashed, the shape push/pop and table manager stack went out of // sync -> we tried to de-reference an empty stack. uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); diff --git a/sw/qa/extras/rtfexport/rtfexport3.cxx b/sw/qa/extras/rtfexport/rtfexport3.cxx index 8b263bff1b8e..90adb69f2bf7 100644 --- a/sw/qa/extras/rtfexport/rtfexport3.cxx +++ b/sw/qa/extras/rtfexport/rtfexport3.cxx @@ -432,7 +432,7 @@ CPPUNIT_TEST_FIXTURE(Test, testRtlGutter) }; // Given a document with RTL gutter, when loading it: - load("rtl-gutter.rtf"); + createSwDoc("rtl-gutter.rtf"); // Then make sure the section's gutter is still RTL: // Without the accompanying fix in place, this test would have failed as \rtlgutter was missing. verify(); @@ -493,7 +493,7 @@ CPPUNIT_TEST_FIXTURE(Test, testNegativePageBorder) CPPUNIT_TEST_FIXTURE(Test, testTdf127806) { - load("tdf127806.rtf"); + createSwDoc("tdf127806.rtf"); CPPUNIT_ASSERT_EQUAL(2, getShapes()); CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.GroupShape"), getShape(1)->getShapeType()); diff --git a/sw/qa/extras/rtfexport/rtfexport4.cxx b/sw/qa/extras/rtfexport/rtfexport4.cxx index 6cbda01af917..608d4d094d85 100644 --- a/sw/qa/extras/rtfexport/rtfexport4.cxx +++ b/sw/qa/extras/rtfexport/rtfexport4.cxx @@ -338,7 +338,7 @@ DECLARE_RTFEXPORT_TEST(testCjklist34, "cjklist34.rtf") CPPUNIT_TEST_FIXTURE(Test, testTabStopFillChars) { - load("tab-stop-fill-chars.rtf"); + createSwDoc("tab-stop-fill-chars.rtf"); // tlmdot auto aTabstops = getProperty>(getParagraph(1), "ParaTabStops"); CPPUNIT_ASSERT(aTabstops.hasElements()); @@ -517,7 +517,7 @@ DECLARE_RTFEXPORT_TEST(testTdf136587_noStyleName, "tdf136587_noStyleName.rtf") CPPUNIT_TEST_FIXTURE(Test, testPageBorder) { - load("page-border.rtf"); + createSwDoc("page-border.rtf"); uno::Reference xPageStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY); auto aTopBorder = getProperty(xPageStyle, "TopBorder"); @@ -547,7 +547,7 @@ DECLARE_RTFEXPORT_TEST(testTbrlPage, "tbrl-page.rtf") CPPUNIT_TEST_FIXTURE(Test, testTdf126309) { - load("tdf126309.rtf"); + createSwDoc("tdf126309.rtf"); // Without the accompanying fix in place, this test would have failed, as // the paragraph was aligned to left, not right. CPPUNIT_ASSERT_EQUAL( @@ -586,7 +586,7 @@ DECLARE_RTFEXPORT_TEST(testTdf116358, "tdf116358.rtf") CPPUNIT_TEST_FIXTURE(Test, testGutterLeft) { - load("gutter-left.rtf"); + createSwDoc("gutter-left.rtf"); reload(mpFilter, "gutter-left.rtf"); uno::Reference xPageStyle; getStyles("PageStyles")->getByName("Standard") >>= xPageStyle; @@ -601,7 +601,7 @@ CPPUNIT_TEST_FIXTURE(Test, testGutterLeft) CPPUNIT_TEST_FIXTURE(Test, testGutterTop) { - load("gutter-top.rtf"); + createSwDoc("gutter-top.rtf"); reload(mpFilter, "gutter-left.rtf"); uno::Reference xFactory(mxComponent, uno::UNO_QUERY); uno::Reference xSettings( @@ -637,7 +637,7 @@ CPPUNIT_TEST_FIXTURE(Test, testClearingBreak) // Given a document with a clearing break: // When loading that file: - load("clearing-break.rtf"); + createSwDoc("clearing-break.rtf"); // Then make sure that the clear property of the break is not ignored: verify(); reload(mpFilter, "clearing-break.rtf"); diff --git a/sw/qa/extras/rtfexport/rtfexport5.cxx b/sw/qa/extras/rtfexport/rtfexport5.cxx index 82ae7824b312..1104b9e4683b 100644 --- a/sw/qa/extras/rtfexport/rtfexport5.cxx +++ b/sw/qa/extras/rtfexport/rtfexport5.cxx @@ -111,7 +111,7 @@ DECLARE_RTFEXPORT_TEST(testFdo64671, "fdo64671.rtf") CPPUNIT_TEST_FIXTURE(Test, testFdo62044) { - load("fdo62044.rtf"); + createSwDoc("fdo62044.rtf"); // The problem was that RTF import during copy&paste did not ignore existing paragraph styles. uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference xText = xTextDocument->getText(); @@ -180,7 +180,7 @@ DECLARE_RTFEXPORT_TEST(testParaBottomMargin, "para-bottom-margin.rtf") CPPUNIT_TEST_FIXTURE(Test, testParaStyleBottomMargin2) { - load("para-style-bottom-margin-2.rtf"); + createSwDoc("para-style-bottom-margin-2.rtf"); uno::Reference xPropertySet( getStyles("ParagraphStyles")->getByName("Standard"), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(353), getProperty(xPropertySet, "ParaBottomMargin")); @@ -819,7 +819,7 @@ DECLARE_RTFEXPORT_TEST(testTdf91074, "tdf91074.rtf") CPPUNIT_TEST_FIXTURE(Test, testTdf90260Nopar) { - load("hello.rtf"); + createSwDoc("hello.rtf"); uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference xText = xTextDocument->getText(); uno::Reference xEnd = xText->getEnd(); @@ -993,7 +993,7 @@ DECLARE_RTFEXPORT_TEST(testTdf87034, "tdf87034.rtf") CPPUNIT_TEST_FIXTURE(Test, testClassificatonPasteLevels) { - load("classification-confidential.rtf"); + createSwDoc("classification-confidential.rtf"); uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference xText = xTextDocument->getText(); uno::Reference xEnd = xText->getEnd(); diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 3a7700ee26e1..c018f9a581a9 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -69,7 +69,7 @@ protected: CPPUNIT_TEST_FIXTURE(Test, testN695479) { - load("n695479.rtf"); + createSwDoc("n695479.rtf"); uno::Reference xTextFramesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); @@ -119,14 +119,14 @@ CPPUNIT_TEST_FIXTURE(Test, testN695479) CPPUNIT_TEST_FIXTURE(Test, testTdf117246) { - load("tdf117246.rtf"); + createSwDoc("tdf117246.rtf"); // This was 2, all but the last \page was lost. CPPUNIT_ASSERT_EQUAL(3, getPages()); } CPPUNIT_TEST_FIXTURE(Test, testTdf108943) { - load("tdf108943.rtf"); + createSwDoc("tdf108943.rtf"); uno::Reference xPropertySet( getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY); uno::Reference xLevels( @@ -148,7 +148,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf108943) CPPUNIT_TEST_FIXTURE(Test, testFdo46662) { - load("fdo46662.rtf"); + createSwDoc("fdo46662.rtf"); OUString listStyle; @@ -200,7 +200,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo46662) CPPUNIT_TEST_FIXTURE(Test, testTdf115715) { - load("tdf115715.rtf"); + createSwDoc("tdf115715.rtf"); // This was 0, second paragraph was shifted to the right, it had the same // horizontal position as the 3rd paragraph. CPPUNIT_ASSERT_EQUAL(static_cast(-1270), @@ -209,14 +209,14 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf115715) CPPUNIT_TEST_FIXTURE(Test, testTdf81943) { - load("tdf81943.rtf"); + createSwDoc("tdf81943.rtf"); // The shape wasn't in background. CPPUNIT_ASSERT_EQUAL(false, getProperty(getShape(1), "Opaque")); } CPPUNIT_TEST_FIXTURE(Test, testTdf115155) { - load("tdf115155.rtf"); + createSwDoc("tdf115155.rtf"); auto xLevels = getProperty>(getParagraph(2), "NumberingRules"); // 1st level @@ -227,7 +227,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf115155) CPPUNIT_TEST_FIXTURE(Test, testTdf108951) { - load("tdf108951.rtf"); + createSwDoc("tdf108951.rtf"); // This test is import-only, as we assert the list ID, which is OK to // re-order on export, but then this test would not pass anymore. @@ -238,7 +238,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf108951) CPPUNIT_TEST_FIXTURE(Test, testFdo47036) { - load("fdo47036.rtf"); + createSwDoc("fdo47036.rtf"); int nShapes = getShapes(); CPPUNIT_ASSERT_EQUAL(3, nShapes); @@ -261,7 +261,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo47036) CPPUNIT_TEST_FIXTURE(Test, testFdo45182) { - load("fdo45182.rtf"); + createSwDoc("fdo45182.rtf"); uno::Reference xFootnotesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xFootnotes = xFootnotesSupplier->getFootnotes(); uno::Reference xTextRange(xFootnotes->getByIndex(0), uno::UNO_QUERY); @@ -272,7 +272,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo45182) CPPUNIT_TEST_FIXTURE(Test, testFdo85812) { - load("fdo85812.rtf"); + createSwDoc("fdo85812.rtf"); lang::Locale locale( getProperty(getRun(getParagraph(1), 1, "This "), "CharLocale")); // the \lang inside the group was applied to CJK not Western @@ -336,7 +336,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo85812) CPPUNIT_TEST_FIXTURE(Test, testFdo49692) { - load("fdo49692.rtf"); + createSwDoc("fdo49692.rtf"); uno::Reference xPropertySet( getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY); uno::Reference xLevels( @@ -357,7 +357,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo49692) CPPUNIT_TEST_FIXTURE(Test, testFdo45190) { - load("fdo45190.rtf"); + createSwDoc("fdo45190.rtf"); // inherited \fi should be reset CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty(getParagraph(1), "ParaFirstLineIndent")); @@ -369,7 +369,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo45190) CPPUNIT_TEST_FIXTURE(Test, testTdf59699) { - load("tdf59699.rtf"); + createSwDoc("tdf59699.rtf"); // This resulted in a lang.IndexOutOfBoundsException: the referenced graphic data wasn't imported. uno::Reference xImage(getShape(1), uno::UNO_QUERY); auto xGraphic = getProperty>(xImage, "Graphic"); @@ -378,7 +378,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf59699) CPPUNIT_TEST_FIXTURE(Test, testFdo52066) { - load("fdo52066.rtf"); + createSwDoc("fdo52066.rtf"); /* * The problem was that the height of the shape was too big. * @@ -390,7 +390,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo52066) CPPUNIT_TEST_FIXTURE(Test, testTdf112211_2) { - load("tdf112211-2.rtf"); + createSwDoc("tdf112211-2.rtf"); // Spacing between the bullet and the actual text was too large. // This is now around 269, large old value was 629. int nWidth = parseDump("/root/page/body/txt[2]/Text[@nType='PortionType::TabLeft']", "nWidth") @@ -400,7 +400,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf112211_2) CPPUNIT_TEST_FIXTURE(Test, testTdf122430) { - load("tdf122430.rtf"); + createSwDoc("tdf122430.rtf"); // Without the accompanying fix in place, this test would have failed with // 'Expected: 18, Actual : 12', i.e. the font was smaller than expected. CPPUNIT_ASSERT_EQUAL(18.0f, getProperty(getRun(getParagraph(1), 2), "CharHeight")); @@ -408,7 +408,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf122430) CPPUNIT_TEST_FIXTURE(Test, testFdo49892) { - load("fdo49892.rtf"); + createSwDoc("fdo49892.rtf"); int nShapes = getShapes(); CPPUNIT_ASSERT_EQUAL(5, nShapes); for (int i = 0; i < nShapes; ++i) @@ -432,7 +432,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo49892) CPPUNIT_TEST_FIXTURE(Test, testFdo52052) { - load("fdo52052.rtf"); + createSwDoc("fdo52052.rtf"); // Make sure the textframe containing the text "third" appears on the 3rd page. CPPUNIT_ASSERT_EQUAL(OUString("third"), parseDump("/root/page[3]/body/txt/anchored/fly/txt/text()")); @@ -440,7 +440,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo52052) CPPUNIT_TEST_FIXTURE(Test, testInk) { - load("ink.rtf"); + createSwDoc("ink.rtf"); /* * The problem was that the second segment had wrong command count and wrap type. * @@ -473,7 +473,7 @@ CPPUNIT_TEST_FIXTURE(Test, testInk) CPPUNIT_TEST_FIXTURE(Test, testFdo79319) { - load("fdo79319.rtf"); + createSwDoc("fdo79319.rtf"); // the thin horizontal rule was imported as a big fat rectangle uno::Reference xShape = getShape(1); CPPUNIT_ASSERT_EQUAL(sal_Int16(100), getProperty(xShape, "RelativeWidth")); @@ -487,7 +487,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo79319) CPPUNIT_TEST_FIXTURE(Test, testFdo48442) { - load("fdo48442.rtf"); + createSwDoc("fdo48442.rtf"); // The problem was that \pvmrg is the default in RTF, but not in Writer. uno::Reference xShape = getShape(1); CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_PRINT_AREA, @@ -496,7 +496,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo48442) CPPUNIT_TEST_FIXTURE(Test, testFdo55525) { - load("fdo55525.rtf"); + createSwDoc("fdo55525.rtf"); uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); @@ -512,7 +512,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo55525) CPPUNIT_TEST_FIXTURE(Test, testFdo57708) { - load("fdo57708.rtf"); + createSwDoc("fdo57708.rtf"); // There were two issues: the doc was of 2 pages and the picture was missing. CPPUNIT_ASSERT_EQUAL(1, getPages()); // Two objects: a picture and a textframe. @@ -521,7 +521,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo57708) CPPUNIT_TEST_FIXTURE(Test, testFdo45183) { - load("fdo45183.rtf"); + createSwDoc("fdo45183.rtf"); // Was text::WrapTextMode_PARALLEL, i.e. shpfblwtxt didn't send the shape below text. CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_THROUGH, getProperty(getShape(1), "Surround")); @@ -535,7 +535,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo45183) CPPUNIT_TEST_FIXTURE(Test, testFdo59953) { - load("fdo59953.rtf"); + createSwDoc("fdo59953.rtf"); uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); @@ -549,7 +549,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo59953) CPPUNIT_TEST_FIXTURE(Test, testTdf84684) { - load("tdf84684.rtf"); + createSwDoc("tdf84684.rtf"); // The ZOrder of the two children of the group shape were swapped. uno::Reference xGroup(getShape(1), uno::UNO_QUERY); uno::Reference xChild1(xGroup->getByIndex(0), uno::UNO_QUERY); @@ -562,7 +562,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf84684) CPPUNIT_TEST_FIXTURE(Test, testFdo81944) { - load("fdo81944.rtf"); + createSwDoc("fdo81944.rtf"); // font properties in style were not imported uno::Reference xPropertySet( getStyles("ParagraphStyles")->getByName("Standard"), uno::UNO_QUERY); @@ -577,7 +577,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo81944) CPPUNIT_TEST_FIXTURE(Test, testSbkodd) { - load("sbkodd.rtf"); + createSwDoc("sbkodd.rtf"); uno::Reference xModel(mxComponent, uno::UNO_QUERY); uno::Reference xTextViewCursorSupplier( xModel->getCurrentController(), uno::UNO_QUERY); @@ -590,7 +590,7 @@ CPPUNIT_TEST_FIXTURE(Test, testSbkodd) CPPUNIT_TEST_FIXTURE(Test, testSbkeven) { - load("sbkeven.rtf"); + createSwDoc("sbkeven.rtf"); uno::Reference xModel(mxComponent, uno::UNO_QUERY); uno::Reference xTextViewCursorSupplier( xModel->getCurrentController(), uno::UNO_QUERY); @@ -605,7 +605,7 @@ CPPUNIT_TEST_FIXTURE(Test, testSbkeven) CPPUNIT_TEST_FIXTURE(Test, testPoshPosv) { - load("posh-posv.rtf"); + createSwDoc("posh-posv.rtf"); CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::CENTER, getProperty(getShape(1), "HoriOrient")); CPPUNIT_ASSERT_EQUAL(text::VertOrientation::CENTER, @@ -615,7 +615,7 @@ CPPUNIT_TEST_FIXTURE(Test, testPoshPosv) CPPUNIT_TEST_FIXTURE(Test, testPoshLeftRight) { - load("posh-leftright.rtf"); + createSwDoc("posh-leftright.rtf"); CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::RIGHT, getProperty(getShape(1), "HoriOrient")); CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::LEFT, @@ -624,7 +624,7 @@ CPPUNIT_TEST_FIXTURE(Test, testPoshLeftRight) CPPUNIT_TEST_FIXTURE(Test, testTdf96326) { - load("tdf96326.rtf"); + createSwDoc("tdf96326.rtf"); // Make sure this is not checked. auto xFormField = getProperty>(getRun(getParagraph(1), 2), "Bookmark"); @@ -641,7 +641,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf96326) CPPUNIT_TEST_FIXTURE(Test, testN823655) { - load("n823655.rtf"); + createSwDoc("n823655.rtf"); uno::Sequence aProps = getProperty>(getShape(1), "CustomShapeGeometry"); uno::Sequence aPathProps; @@ -665,7 +665,7 @@ CPPUNIT_TEST_FIXTURE(Test, testN823655) CPPUNIT_TEST_FIXTURE(Test, testN823675) { - load("n823675.rtf"); + createSwDoc("n823675.rtf"); uno::Reference xPropertySet( getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY); uno::Reference xLevels( @@ -687,7 +687,7 @@ CPPUNIT_TEST_FIXTURE(Test, testN823675) CPPUNIT_TEST_FIXTURE(Test, testGroupshape) { - load("groupshape.rtf"); + createSwDoc("groupshape.rtf"); // There should be a single groupshape with 2 children. CPPUNIT_ASSERT_EQUAL(1, getShapes()); uno::Reference xGroupshape(getShape(1), uno::UNO_QUERY); @@ -696,7 +696,7 @@ CPPUNIT_TEST_FIXTURE(Test, testGroupshape) CPPUNIT_TEST_FIXTURE(Test, testGroupshape_notext) { - load("groupshape-notext.rtf"); + createSwDoc("groupshape-notext.rtf"); // There should be a single groupshape with 2 children. CPPUNIT_ASSERT_EQUAL(1, getShapes()); uno::Reference xGroupshape(getShape(1), uno::UNO_QUERY); @@ -705,7 +705,7 @@ CPPUNIT_TEST_FIXTURE(Test, testGroupshape_notext) CPPUNIT_TEST_FIXTURE(Test, testFdo81033) { - load("fdo81033.rtf"); + createSwDoc("fdo81033.rtf"); // Number of tabstops in the paragraph should be 2, was 3. uno::Sequence tabs( getProperty>(getParagraph(1), "ParaTabStops")); @@ -720,7 +720,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo81033) CPPUNIT_TEST_FIXTURE(Test, testTdf116269) { - load("tdf116269.rtf"); + createSwDoc("tdf116269.rtf"); // This was 2540, implicit 0 left margin was ignored on import (inherited // value from list definition is repeated if it's not 0). CPPUNIT_ASSERT_EQUAL(static_cast(0), @@ -729,7 +729,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf116269) CPPUNIT_TEST_FIXTURE(Test, testTdf116265) { - load("tdf116265.rtf"); + createSwDoc("tdf116265.rtf"); // This was -635, \fi as direct formatting has to be ignored due to // matching \fi in list definition (and with invalid level numbers). CPPUNIT_ASSERT_EQUAL(static_cast(0), @@ -738,7 +738,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf116265) CPPUNIT_TEST_FIXTURE(Test, testFdo66565) { - load("fdo66565.rtf"); + createSwDoc("fdo66565.rtf"); uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); @@ -752,7 +752,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo66565) CPPUNIT_TEST_FIXTURE(Test, testFdo67365) { - load("fdo67365.rtf"); + createSwDoc("fdo67365.rtf"); uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); @@ -773,7 +773,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo67365) CPPUNIT_TEST_FIXTURE(Test, testFdo47440) { - load("fdo47440.rtf"); + createSwDoc("fdo47440.rtf"); // Vertical and horizontal orientation of the picture wasn't imported (was text::RelOrientation::FRAME). CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty(getShape(1), "HoriOrientRelation")); @@ -783,7 +783,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo47440) CPPUNIT_TEST_FIXTURE(Test, testFdo53556) { - load("fdo53556.rtf"); + createSwDoc("fdo53556.rtf"); // This was drawing::FillStyle_SOLID, which resulted in being non-transparent, hiding text which would be visible. CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, getProperty(getShape(3), "FillStyle")); @@ -796,14 +796,14 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo53556) CPPUNIT_TEST_FIXTURE(Test, testGroupshapeRotation) { - load("groupshape-rotation.rtf"); + createSwDoc("groupshape-rotation.rtf"); // Rotation on groupshapes wasn't handled correctly, RotateAngle was 4500. CPPUNIT_ASSERT_EQUAL(sal_Int32(315 * 100), getProperty(getShape(1), "RotateAngle")); } CPPUNIT_TEST_FIXTURE(Test, testTdf115153) { - load("tdf115153.rtf"); + createSwDoc("tdf115153.rtf"); auto const xShape(getShape(1)); CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::NONE, getProperty(xShape, "HoriOrient")); CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, @@ -818,7 +818,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf115153) CPPUNIT_TEST_FIXTURE(Test, testFdo68291) { - load("fdo68291.odt"); + createSwDoc("fdo68291.odt"); uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference xText = xTextDocument->getText(); uno::Reference xEnd = xText->getEnd(); @@ -840,13 +840,13 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf105511) auto batch = comphelper::ConfigurationChanges::create(); DefaultLocale::set("ru-RU", batch); batch->commit(); - load("tdf105511.rtf"); + createSwDoc("tdf105511.rtf"); getParagraph(1, u"\u0418\u043C\u044F"); } CPPUNIT_TEST_FIXTURE(Test, testContSectionPageBreak) { - load("cont-section-pagebreak.rtf"); + createSwDoc("cont-section-pagebreak.rtf"); uno::Reference xParaSecond = getParagraph(2); CPPUNIT_ASSERT_EQUAL(OUString("SECOND"), xParaSecond->getString()); CPPUNIT_ASSERT_EQUAL(style::BreakType_NONE, @@ -873,7 +873,7 @@ CPPUNIT_TEST_FIXTURE(Test, testContSectionPageBreak) CPPUNIT_TEST_FIXTURE(Test, testBackground) { - load("background.rtf"); + createSwDoc("background.rtf"); // The first shape wasn't in the foreground. CPPUNIT_ASSERT_EQUAL(true, getProperty(getShape(1), "Opaque")); CPPUNIT_ASSERT_EQUAL(false, getProperty(getShape(2), "Opaque")); @@ -881,7 +881,7 @@ CPPUNIT_TEST_FIXTURE(Test, testBackground) CPPUNIT_TEST_FIXTURE(Test, testFdo74823) { - load("fdo74823.rtf"); + createSwDoc("fdo74823.rtf"); uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); @@ -895,7 +895,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo74823) CPPUNIT_TEST_FIXTURE(Test, testFdo74599) { - load("fdo74599.rtf"); + createSwDoc("fdo74599.rtf"); uno::Reference xPropertySet( getStyles("ParagraphStyles")->getByName("Heading 3"), uno::UNO_QUERY); // Writer default styles weren't disabled, so the color was gray, not default (black). @@ -905,7 +905,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo74599) CPPUNIT_TEST_FIXTURE(Test, testColumnBreak) { - load("column-break.rtf"); + createSwDoc("column-break.rtf"); // Column break at the very start of the document was ignored. CPPUNIT_ASSERT_EQUAL(style::BreakType_COLUMN_BEFORE, getProperty(getParagraph(2), "BreakType")); @@ -913,7 +913,7 @@ CPPUNIT_TEST_FIXTURE(Test, testColumnBreak) CPPUNIT_TEST_FIXTURE(Test, testUnbalancedColumnsCompat) { - load("unbalanced-columns-compat.rtf"); + createSwDoc("unbalanced-columns-compat.rtf"); uno::Reference xTextSectionsSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xTextSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY); @@ -924,7 +924,7 @@ CPPUNIT_TEST_FIXTURE(Test, testUnbalancedColumnsCompat) CPPUNIT_TEST_FIXTURE(Test, testOleInline) { - load("ole-inline.rtf"); + createSwDoc("ole-inline.rtf"); // Problem was that inline shape had at-page anchor. CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AS_CHARACTER, getProperty(getShape(1), "AnchorType")); @@ -932,7 +932,7 @@ CPPUNIT_TEST_FIXTURE(Test, testOleInline) CPPUNIT_TEST_FIXTURE(Test, testTdf128611) { - load("tdf128611.rtf"); + createSwDoc("tdf128611.rtf"); auto aPolyPolySequence = getProperty>>(getShape(1), "PolyPolygon"); CPPUNIT_ASSERT(aPolyPolySequence.hasElements()); @@ -951,7 +951,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf128611) CPPUNIT_TEST_FIXTURE(Test, testFdo80742) { - load("fdo80742.rtf"); + createSwDoc("fdo80742.rtf"); uno::Reference xPropertySet( getStyles("ParagraphStyles")->getByName("Heading 2"), uno::UNO_QUERY); // This was 0, outline level was body text. @@ -960,7 +960,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo80742) CPPUNIT_TEST_FIXTURE(Test, testBehindDoc) { - load("behind-doc.rtf"); + createSwDoc("behind-doc.rtf"); // The problem was that "behind doc" didn't result in the shape being in the background, only in being wrapped as "through". uno::Reference xShape = getShape(1); CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_THROUGH, @@ -971,7 +971,7 @@ CPPUNIT_TEST_FIXTURE(Test, testBehindDoc) CPPUNIT_TEST_FIXTURE(Test, testFdo82114) { - load("fdo82114.rtf"); + createSwDoc("fdo82114.rtf"); uno::Reference xHeaderText = getProperty>( getStyles("PageStyles")->getByName("Converted1"), "HeaderText"); OUString aActual = xHeaderText->getString(); @@ -981,7 +981,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo82114) CPPUNIT_TEST_FIXTURE(Test, testFdo44984) { - load("fdo44984.rtf"); + createSwDoc("fdo44984.rtf"); uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); @@ -995,7 +995,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo44984) CPPUNIT_TEST_FIXTURE(Test, testFdo82071) { - load("fdo82071.rtf"); + createSwDoc("fdo82071.rtf"); // The problem was that in TOC, chapter names were underlined, but they should not be. uno::Reference xRun = getRun(getParagraph(1), 1); // Make sure we test the right text portion. @@ -1006,7 +1006,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo82071) CPPUNIT_TEST_FIXTURE(Test, testFdo85179) { - load("fdo85179.rtf"); + createSwDoc("fdo85179.rtf"); // This was 0, border around the picture was ignored on import. // 360: EMU -> MM100 CPPUNIT_ASSERT_EQUAL(sal_uInt32(50800 / 360), @@ -1042,7 +1042,7 @@ CPPUNIT_TEST_FIXTURE(Test, testPasteFirstParaDirectFormat) CPPUNIT_TEST_FIXTURE(Test, testFdo82512) { - load("fdo82512.rtf"); + createSwDoc("fdo82512.rtf"); // This was style::BreakType_NONE, column break was before the 3rd paragraph, not before the 2nd one. CPPUNIT_ASSERT_EQUAL(style::BreakType_COLUMN_BEFORE, getProperty(getParagraph(2), "BreakType")); @@ -1050,7 +1050,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo82512) CPPUNIT_TEST_FIXTURE(Test, testUnbalancedColumns) { - load("unbalanced-columns.rtf"); + createSwDoc("unbalanced-columns.rtf"); uno::Reference xTextSectionsSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xTextSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY); @@ -1061,7 +1061,7 @@ CPPUNIT_TEST_FIXTURE(Test, testUnbalancedColumns) CPPUNIT_TEST_FIXTURE(Test, testTdf126173) { - load("tdf126173.rtf"); + createSwDoc("tdf126173.rtf"); // Without the accompanying fix in place, this test would have failed, as the TextFrame was lost // on import. CPPUNIT_ASSERT(getShape(1).is()); @@ -1069,7 +1069,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf126173) CPPUNIT_TEST_FIXTURE(Test, testFdo84685) { - load("fdo84685.rtf"); + createSwDoc("fdo84685.rtf"); // index mark was not imported uno::Reference xMark( getProperty>(getRun(getParagraph(1), 1), @@ -1088,7 +1088,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo84685) // This testcase illustrate leveltext with multibyte strings coded in cp950 ( BIG5 ). CPPUNIT_TEST_FIXTURE(Test, testCp950listleveltext1) { - load("cp950listleveltext1.rtf"); + createSwDoc("cp950listleveltext1.rtf"); // suffix with Chinese only ( most common case generated by MSO2010 TC) // This is a dot that is generally used as suffix of Chinese list number static constexpr OUStringLiteral aExpectedNumbering = u"\u4e00\u3001"; @@ -1101,7 +1101,7 @@ CPPUNIT_TEST_FIXTURE(Test, testCp950listleveltext1) // This testcase illustrate leveltext with multibyte strings coded in cp950 ( BIG5 ). CPPUNIT_TEST_FIXTURE(Test, testCp950listleveltext2) { - load("cp950listleveltext2.rtf"); + createSwDoc("cp950listleveltext2.rtf"); // Prefix and suffix with Chinese only ( tweaked from default in MSO2010 TC) static constexpr OUStringLiteral aExpectedNumbering = u"\u524d\u7f6e\u7532\u3001\u5f8c\u7f6e"; @@ -1113,7 +1113,7 @@ CPPUNIT_TEST_FIXTURE(Test, testCp950listleveltext2) // This testcase illustrate leveltext with multibyte strings coded in cp950 ( BIG5 ) CPPUNIT_TEST_FIXTURE(Test, testCp950listleveltext3) { - load("cp950listleveltext3.rtf"); + createSwDoc("cp950listleveltext3.rtf"); // Numbering is a mix Chinese and English ( tweaked from default in MSO2010 TC) static constexpr OUStringLiteral aExpectedNumbering = u"\u524da\u7f6eb\u7532\u3001" "c\u5f8cd\u7f6ee"; @@ -1125,7 +1125,7 @@ CPPUNIT_TEST_FIXTURE(Test, testCp950listleveltext3) CPPUNIT_TEST_FIXTURE(Test, testChtOutlineNumberingRtf) { - load("chtoutline.rtf"); + createSwDoc("chtoutline.rtf"); static constexpr OUStringLiteral aExpectedNumbering = u"\u7b2c 1 \u7ae0"; @@ -1136,7 +1136,7 @@ CPPUNIT_TEST_FIXTURE(Test, testChtOutlineNumberingRtf) CPPUNIT_TEST_FIXTURE(Test, testTdf90046) { - load("tdf90046.rtf"); + createSwDoc("tdf90046.rtf"); // this was crashing on importing the footnote uno::Reference xFootnotesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xFootnotes = xFootnotesSupplier->getFootnotes(); @@ -1146,7 +1146,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf90046) CPPUNIT_TEST_FIXTURE(Test, testFdo49893) { - load("fdo49893.rtf"); + createSwDoc("fdo49893.rtf"); // Image from shape was not loaded, invalid size of image after load uno::Reference xShape = getShape(2); CPPUNIT_ASSERT(xShape.is()); @@ -1156,7 +1156,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo49893) CPPUNIT_TEST_FIXTURE(Test, testFdo49893_3) { - load("fdo49893-3.rtf"); + createSwDoc("fdo49893-3.rtf"); // No artifacts (black lines in left top corner) as shape #3 are expected CPPUNIT_ASSERT_EQUAL(2, getShapes()); @@ -1167,7 +1167,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo49893_3) CPPUNIT_TEST_FIXTURE(Test, testWrapDistance) { - load("wrap-distance.rtf"); + createSwDoc("wrap-distance.rtf"); // Custom shape, handled directly in RTFSdrImport. uno::Reference xShape = getShape(1); CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.CustomShape"), xShape->getShapeType()); @@ -1194,7 +1194,7 @@ CPPUNIT_TEST_FIXTURE(Test, testWrapDistance) CPPUNIT_TEST_FIXTURE(Test, testTdf90260Par) { - load("hello.rtf"); + createSwDoc("hello.rtf"); uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference xText = xTextDocument->getText(); uno::Reference xEnd = xText->getEnd(); @@ -1204,7 +1204,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf90260Par) CPPUNIT_TEST_FIXTURE(Test, testTdf119599) { - load("tdf119599.rtf"); + createSwDoc("tdf119599.rtf"); uno::Reference xRun(getRun(getParagraph(1), 1), uno::UNO_QUERY); // This was beans::PropertyState_DIRECT_VALUE, changing the font size in // the style had no effect on the rendering result. @@ -1213,7 +1213,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf119599) CPPUNIT_TEST_FIXTURE(Test, testTdf90315) { - load("tdf90315.rtf"); + createSwDoc("tdf90315.rtf"); uno::Reference xTextSectionsSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xTextSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY); @@ -1226,14 +1226,14 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf90315) CPPUNIT_TEST_FIXTURE(Test, testTdf59454) { - load("tdf59454.rtf"); + createSwDoc("tdf59454.rtf"); // This was 1, section break was ignored right before a table. CPPUNIT_ASSERT_EQUAL(2, getPages()); } CPPUNIT_TEST_FIXTURE(Test, testTdf96308Tabpos) { - load("tdf96308-tabpos.rtf"); + createSwDoc("tdf96308-tabpos.rtf"); // Get the tab stops of the second para in the B1 cell of the first table in the document. uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xTables(xTextTablesSupplier->getTextTables(), @@ -1251,7 +1251,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf96308Tabpos) CPPUNIT_TEST_FIXTURE(Test, testLndscpsxn) { - load("lndscpsxn.rtf"); + createSwDoc("lndscpsxn.rtf"); // Check landscape flag. CPPUNIT_ASSERT_EQUAL(4, getPages()); @@ -1291,7 +1291,7 @@ CPPUNIT_TEST_FIXTURE(Test, testLndscpsxn) CPPUNIT_TEST_FIXTURE(Test, testTdf99498) { - load("tdf99498.rtf"); + createSwDoc("tdf99498.rtf"); uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); @@ -1303,7 +1303,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf99498) CPPUNIT_TEST_FIXTURE(Test, testClassificatonPaste) { - load("hello.rtf"); + createSwDoc("hello.rtf"); uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference xText = xTextDocument->getText(); uno::Reference xEnd = xText->getEnd(); @@ -1320,7 +1320,7 @@ CPPUNIT_TEST_FIXTURE(Test, testClassificatonPaste) CPPUNIT_TEST_FIXTURE(Test, testTdf90097) { - load("tdf90097.rtf"); + createSwDoc("tdf90097.rtf"); // Get the second child of the group shape. uno::Reference xGroup(getShape(1), uno::UNO_QUERY); uno::Reference xShape(xGroup->getByIndex(0), uno::UNO_QUERY); @@ -1334,7 +1334,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf90097) CPPUNIT_TEST_FIXTURE(Test, testTdf91684) { - load("tdf91684.rtf"); + createSwDoc("tdf91684.rtf"); // Scaling of the group shape children were incorrect, this was 3203. // (Unit was assumed to be twips, but it was relative coordinates.) CPPUNIT_ASSERT_EQUAL(static_cast(1337), getShape(1)->getSize().Height); @@ -1342,7 +1342,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf91684) CPPUNIT_TEST_FIXTURE(Test, testFlip) { - load("flip.rtf"); + createSwDoc("flip.rtf"); comphelper::SequenceAsHashMap aMap = getProperty>( getShapeByName(u"h-and-v"), "CustomShapeGeometry"); // This resulted in a uno::RuntimeException, as MirroredX wasn't set at all, so could not extract void to boolean. @@ -1367,7 +1367,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFlip) CPPUNIT_TEST_FIXTURE(Test, testTdf78506) { - load("tdf78506.rtf"); + createSwDoc("tdf78506.rtf"); uno::Reference xPropertySet( getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY); uno::Reference xLevels( @@ -1387,7 +1387,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf78506) CPPUNIT_TEST_FIXTURE(Test, testTdf117403) { - load("tdf117403.rtf"); + createSwDoc("tdf117403.rtf"); uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); @@ -1402,7 +1402,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf117403) CPPUNIT_TEST_FIXTURE(Test, testImportHeaderFooter) { - load("tdf108055.rtf"); + createSwDoc("tdf108055.rtf"); // The RTF import sometimes added Header and Footer multiple Times // as well as added the Header to the document body. uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); @@ -1457,7 +1457,7 @@ CPPUNIT_TEST_FIXTURE(Test, testImportHeaderFooter) CPPUNIT_TEST_FIXTURE(Test, testTdf108947) { - load("tdf108947.rtf"); + createSwDoc("tdf108947.rtf"); //Check if Headers/Footers contain what they should in this document uno::Reference xHeaderTextRight = getProperty>( getStyles("PageStyles")->getByName("Default Page Style"), "HeaderTextRight"); @@ -1476,7 +1476,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf108947) CPPUNIT_TEST_FIXTURE(Test, testWatermark) { - load("watermark.rtf"); + createSwDoc("watermark.rtf"); Size aExpectedSize(14965, 7482); uno::Reference xShape = getShape(1); awt::Size aActualSize(xShape->getSize()); @@ -1487,7 +1487,7 @@ CPPUNIT_TEST_FIXTURE(Test, testWatermark) CPPUNIT_TEST_FIXTURE(Test, testTdf104016) { - load("tdf104016.rtf"); + createSwDoc("tdf104016.rtf"); uno::Reference xParagraph(getParagraph(1), uno::UNO_QUERY); // This was beans::PropertyState_DIRECT_VALUE, leading to lack of // inheritance from numbering. @@ -1497,7 +1497,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf104016) CPPUNIT_TEST_FIXTURE(Test, testTdf115242) { - load("tdf115242.rtf"); + createSwDoc("tdf115242.rtf"); // This was 0, overridden left margin was lost by too aggressive style // deduplication. CPPUNIT_ASSERT_EQUAL(static_cast(2787), @@ -1506,7 +1506,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf115242) CPPUNIT_TEST_FIXTURE(Test, testDefaultValues) { - load("default-values.rtf"); + createSwDoc("default-values.rtf"); // tdf#105910: control words without values must be treated as having default values, // instead of being silently ignored @@ -1637,7 +1637,7 @@ CPPUNIT_TEST_FIXTURE(Test, testDefaultValues) CPPUNIT_TEST_FIXTURE(Test, testParaStyleBottomMargin) { - load("para-style-bottom-margin.rtf"); + createSwDoc("para-style-bottom-margin.rtf"); uno::Reference xPropertySet( getStyles("ParagraphStyles")->getByName("Standard"), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(353), getProperty(xPropertySet, "ParaBottomMargin")); diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index 7eb3f1b74e57..84a88ce1e527 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -163,7 +163,7 @@ SwXTextDocument* SwTiledRenderingTest::createDoc(const char* pName) if (!pName) createSwDoc(); else - load(pName); + createSwDoc(pName); SwXTextDocument* pTextDocument = dynamic_cast(mxComponent.get()); CPPUNIT_ASSERT(pTextDocument); diff --git a/sw/qa/extras/txtimport/txtimport.cxx b/sw/qa/extras/txtimport/txtimport.cxx index f64647a2d830..8be577b4b328 100644 --- a/sw/qa/extras/txtimport/txtimport.cxx +++ b/sw/qa/extras/txtimport/txtimport.cxx @@ -49,7 +49,7 @@ public: CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf112191) { - load("bullets.odt"); + createSwDoc("bullets.odt"); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); @@ -79,7 +79,7 @@ CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf112191) CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf60145_utf8withoutbom) { - load("UTF8WITHOUTBOM.txt"); + createSwDoc("UTF8WITHOUTBOM.txt"); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); @@ -92,7 +92,7 @@ CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf60145_utf8withoutbom) CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf60145_utf8withbom) { - load("UTF8WITHBOM.txt"); + createSwDoc("UTF8WITHBOM.txt"); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); @@ -105,7 +105,7 @@ CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf60145_utf8withbom) CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf60145_utf16lewithoutbom) { - load("UTF16LEWITHOUTBOM.txt"); + createSwDoc("UTF16LEWITHOUTBOM.txt"); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); @@ -118,7 +118,7 @@ CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf60145_utf16lewithoutbom) CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf60145_utf16lewithbom) { - load("UTF16LEWITHBOM.txt"); + createSwDoc("UTF16LEWITHBOM.txt"); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); @@ -131,7 +131,7 @@ CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf60145_utf16lewithbom) CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf92161_gb18030) { - load("GB18030.txt"); + createSwDoc("GB18030.txt"); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); @@ -144,7 +144,7 @@ CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf92161_gb18030) CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf60145_utf16bewithoutbom) { - load("UTF16BEWITHOUTBOM.txt"); + createSwDoc("UTF16BEWITHOUTBOM.txt"); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); @@ -157,7 +157,7 @@ CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf60145_utf16bewithoutbom) CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf60145_utf16bewithbom) { - load("UTF16BEWITHBOM.txt"); + createSwDoc("UTF16BEWITHBOM.txt"); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); @@ -170,7 +170,8 @@ CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf60145_utf16bewithbom) CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf115088) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->Insert("1"); pWrtShell->SplitNode(); diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 18693af898ba..fc3daa6bd7ea 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -93,7 +93,8 @@ std::unique_ptr SwUiWriterTest::readDOCXAutotext(std::u16string_vi osl::File::copy(createFileURL(sFileName), rURL)); SfxMedium aSrcMed(rURL, StreamMode::STD_READ); - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwReader aReader(aSrcMed, rURL, pDoc); Reader* pDOCXReader = SwReaderWriter::GetDOCXReader(); @@ -107,7 +108,8 @@ std::unique_ptr SwUiWriterTest::readDOCXAutotext(std::u16string_vi void SwUiWriterTest::testRedlineFrame(char const*const file) { - SwDoc * pDoc(createSwDoc(file)); + createSwDoc(file); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); // there is exactly one frame @@ -141,7 +143,8 @@ constexpr OUStringLiteral NON_CHINESE_CONTENT(u"Hippopotamus"); CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testReplaceForward) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); sw::UndoManager& rUndoManager = pDoc->GetUndoManager(); @@ -212,7 +215,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testThreadedException) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testBookmarkCopy) { - SwDoc * pDoc(createSwDoc()); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); // add text and bookmark IDocumentMarkAccess & rIDMA(*pDoc->getIDocumentMarkAccess()); @@ -286,7 +290,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testInsertFileInInputFieldException) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf67238) { //create a new writer document - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); sw::UndoManager& rUndoManager = pDoc->GetUndoManager(); //insert a 3X3 table in the newly created document @@ -378,7 +383,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf67238) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf147220) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->Insert(u"él"); @@ -415,7 +421,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf147220) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf135978) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->Insert("foobar"); @@ -466,7 +473,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf135978) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testFdo75110) { - SwDoc* pDoc = createSwDoc("fdo75110.odt"); + createSwDoc("fdo75110.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->SelAll(); @@ -479,7 +487,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testFdo75110) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testFdo75898) { - SwDoc* pDoc = createSwDoc("fdo75898.odt"); + createSwDoc("fdo75898.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->SelAll(); pWrtShell->InsertRow(1, true); @@ -496,7 +505,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testReplaceBackward) { //Regression test of fdo#70143 //EDITING: undo search&replace corrupt text when searching backward - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); sw::UndoManager& rUndoManager = pDoc->GetUndoManager(); @@ -518,7 +528,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testReplaceBackward) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testFdo69893) { - SwDoc* pDoc = createSwDoc("fdo69893.odt"); + createSwDoc("fdo69893.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->SelAll(); // A1 is empty -> selects the whole table. @@ -561,7 +572,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testFdo70807) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testImportRTF) { // Insert "foobar" and position the cursor between "foo" and "bar". - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->Insert("foobar"); pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/false, 3, /*bBasicCall=*/false); @@ -582,7 +594,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testImportRTF) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testExportRTF) { // Insert "aaabbbccc" and select "bbb". - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->Insert("aaabbbccc"); pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/false, 3, /*bBasicCall=*/false); @@ -700,7 +713,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testDOCXAutoTextGallery) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testWatermarkDOCX) { - SwDoc* const pDoc = createSwDoc("watermark.docx"); + createSwDoc("watermark.docx"); + SwDoc* const pDoc = getSwDoc(); SwDocShell* pDocShell = pDoc->GetDocShell(); const SfxWatermarkItem* pWatermark; SfxItemState eState = pDocShell->GetViewShell()->GetViewFrame()->GetDispatcher()->QueryState(SID_WATERMARK, pWatermark); @@ -728,7 +742,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testWatermarkPosition) int aPages = aPagesInDocument + aAdditionalPagesCount[i]; // Empty document with one Page Break - SwDoc* pDoc = createSwDoc("watermark-position.odt"); + createSwDoc("watermark-position.odt"); + SwDoc* pDoc = getSwDoc(); SwEditShell* pEditShell = pDoc->GetEditShell(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); uno::Reference xModel = pDoc->GetDocShell()->GetBaseModel(); @@ -796,7 +811,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testWatermarkPosition) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testFdo74981) { // create a document with an input field - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SwInputField aField(static_cast(pWrtShell->GetFieldType(0, SwFieldIds::Input)), "foo", "bar", 0, 0); pWrtShell->InsertField2(aField); @@ -825,7 +841,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testFdo74981) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf98512) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SwInputFieldType *const pType(static_cast( pWrtShell->GetFieldType(0, SwFieldIds::Input))); @@ -863,7 +880,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf98512) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testShapeTextboxSelect) { - SwDoc* pDoc = createSwDoc("shape-textbox.odt"); + createSwDoc("shape-textbox.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); SdrObject* pObject = pPage->GetObj(1); @@ -881,7 +899,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testShapeTextboxSelect) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testShapeTextboxDelete) { - SwDoc* pDoc = createSwDoc("shape-textbox.odt"); + createSwDoc("shape-textbox.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); SdrObject* pObject = pPage->GetObj(0); @@ -898,7 +917,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testShapeTextboxDelete) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testAnchorChangeSelection) { - SwDoc* pDoc = createSwDoc("test_anchor_as_character.odt"); + createSwDoc("test_anchor_as_character.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); SdrObject* pObject = pPage->GetObj(0); @@ -917,7 +937,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testAnchorChangeSelection) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testCp1000071) { - SwDoc* pDoc = createSwDoc("cp1000071.odt"); + createSwDoc("cp1000071.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); const SwRedlineTable& rTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable(); @@ -956,7 +977,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testCp1000071) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testShapeTextboxVertadjust) { - SwDoc* pDoc = createSwDoc("shape-textbox-vertadjust.odt"); + createSwDoc("shape-textbox-vertadjust.odt"); + SwDoc* pDoc = getSwDoc(); SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); SdrObject* pObject = pPage->GetObj(1); SwFrameFormat* pFormat = static_cast(pObject->GetUserCall())->GetFormat(); @@ -966,7 +988,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testShapeTextboxVertadjust) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testShapeTextboxAutosize) { - SwDoc* pDoc = createSwDoc("shape-textbox-autosize.odt"); + createSwDoc("shape-textbox-autosize.odt"); + SwDoc* pDoc = getSwDoc(); SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); // 0-1 is the first UI-visible shape+textbox. SdrObject* pFirst = pPage->GetObj(0); @@ -984,7 +1007,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testShapeTextboxAutosize) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testFdo82191) { - SwDoc* pDoc = createSwDoc("fdo82191.odt"); + createSwDoc("fdo82191.odt"); + SwDoc* pDoc = getSwDoc(); SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); // Make sure we have a single draw shape. CPPUNIT_ASSERT_EQUAL(sal_Int32(1), SwTextBoxHelper::getCount(pPage)); @@ -1005,7 +1029,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testCommentedWord) { // This word is commented. <- string in document // 123456789 <- character positions - SwDoc* pDoc = createSwDoc("commented-word.odt"); + createSwDoc("commented-word.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); // Move the cursor into the second word. pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 5, /*bBasicCall=*/false); @@ -1043,7 +1068,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testChineseConversionBlank) { // Given - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwView* pView = pDoc->GetDocShell()->GetView(); const uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); SwNodeIndex aIdx(pDoc->GetNodes().GetEndOfContent(), -1); @@ -1066,7 +1092,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testChineseConversionNonChineseText) { // Given - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwView* pView = pDoc->GetDocShell()->GetView(); const uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); SwNodeIndex aIdx(pDoc->GetNodes().GetEndOfContent(), -1); @@ -1090,7 +1117,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testChineseConversionTraditionalToSimplifie { // Given - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwView* pView = pDoc->GetDocShell()->GetView(); const uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); SwNodeIndex aIdx(pDoc->GetNodes().GetEndOfContent(), -1); @@ -1114,7 +1142,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testChineseConversionSimplifiedToTraditiona { // Given - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwView* pView = pDoc->GetDocShell()->GetView(); const uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); SwNodeIndex aIdx(pDoc->GetNodes().GetEndOfContent(), -1); @@ -1156,7 +1185,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testFdo85554) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testMergeDoc) { - SwDoc* const pDoc1(createSwDoc("merge-change1.odt")); + createSwDoc("merge-change1.odt"); + SwDoc* pDoc1 = getSwDoc(); auto xDoc2Component(loadFromDesktop( createFileURL(u"merge-change2.odt"), @@ -1202,7 +1232,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testCreatePortions) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testBookmarkUndo) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); sw::UndoManager& rUndoManager = pDoc->GetUndoManager(); IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess(); SwPaM aPaM( SwNodeIndex(pDoc->GetNodes().GetEndOfContent(), -1) ); @@ -1246,7 +1277,8 @@ static void lcl_setWeight(SwWrtShell* pWrtShell, FontWeight aWeight) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testFdo85876) { - SwDoc* const pDoc = createSwDoc(); + createSwDoc(); + SwDoc* const pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); lcl_setWeight(pWrtShell, WEIGHT_BOLD); pWrtShell->Insert("test"); @@ -1274,7 +1306,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testFdo85876) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testCaretPositionMovingUp) { - SwDoc* const pDoc = createSwDoc(); + createSwDoc(); + SwDoc* const pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->Insert("after"); pWrtShell->InsertLineBreak(); @@ -1286,7 +1319,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testCaretPositionMovingUp) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf93441) { - SwDoc* const pDoc = createSwDoc(); + createSwDoc(); + SwDoc* const pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->Insert("Hello"); pWrtShell->InsertLineBreak(); @@ -1302,7 +1336,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf93441) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf81226) { - SwDoc* const pDoc = createSwDoc(); + createSwDoc(); + SwDoc* const pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->Insert("before"); pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/false, 4, /*bBasicCall=*/false); @@ -1317,7 +1352,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf81226) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf137532) { - SwDoc* const pDoc = createSwDoc(); + createSwDoc(); + SwDoc* const pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->Insert("test"); @@ -1401,7 +1437,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testFdo87448) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTextCursorInvalidation) { createSwDoc(); - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); uno::Reference xPageStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY); CPPUNIT_ASSERT(xPageStyle.is()); @@ -1423,7 +1460,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTextCursorInvalidation) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf68183) { // First disable RSID and check if indeed no such attribute is inserted. - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SW_MOD()->GetModuleConfig()->SetStoreRsid(false); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->Insert2("X"); @@ -1458,7 +1496,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testCp1000115) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf63214) { //This is a crash test - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); sw::UndoManager& rUndoManager = pDoc->GetUndoManager(); pWrtShell->Insert("V"); @@ -1494,7 +1533,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf90003) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf51741) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); sw::UndoManager& rUndoManager = pDoc->GetUndoManager(); IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess(); @@ -1581,7 +1621,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testDefaultsOfOutlineNumbering) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testDeleteTableRedlines) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SwInsertTableOptions TableOpt(SwInsertTableFlags::DefaultBorder, 0); const SwTable& rTable = pWrtShell->InsertTable(TableOpt, 1, 3); @@ -1600,7 +1641,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testDeleteTableRedlines) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testXFlatParagraph) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); //Inserting some text in the document pWrtShell->Insert("This is sample text"); diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 0f4d5086bb81..74958f1cd6cf 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -69,7 +69,8 @@ protected: CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf47471_paraStyleBackground) { - SwDoc* pDoc = createSwDoc("tdf47471_paraStyleBackground.odt"); + createSwDoc("tdf47471_paraStyleBackground.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT_EQUAL(OUString("00Background"), @@ -102,7 +103,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf47471_paraStyleBackground) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdfChangeNumberingListAutoFormat) { - SwDoc* pDoc = createSwDoc("tdf117923.docx"); + createSwDoc("tdf117923.docx"); + SwDoc* pDoc = getSwDoc(); // Ensure that all text portions are calculated before testing. SwViewShell* pViewShell = pDoc->getIDocumentLayoutAccess().GetCurrentViewShell(); @@ -152,7 +154,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdfChangeNumberingListAutoFormat) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf101534) { // Copy the first paragraph of the document. - SwDoc* pDoc = createSwDoc("tdf101534.fodt"); + createSwDoc("tdf101534.fodt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->EndPara(/*bSelect=*/true); rtl::Reference pTransfer = new SwTransferable(*pWrtShell); @@ -177,7 +180,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf101534) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testRedlineMoveInsertInDelete) { - SwDoc* const pDoc = createSwDoc(); + createSwDoc(); + SwDoc* const pDoc = getSwDoc(); SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->Insert(" foo"); @@ -210,7 +214,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testRedlineMoveInsertInDelete) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testRedlineInHiddenSection) { - SwDoc* const pDoc = createSwDoc(); + createSwDoc(); + SwDoc* const pDoc = getSwDoc(); SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->SplitNode(); @@ -267,7 +272,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testRedlineInHiddenSection) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testRedlineSplitContentNode) { - SwDoc* pDoc = createSwDoc("try2.fodt"); + createSwDoc("try2.fodt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SwViewOption aViewOptions(*pWrtShell->GetViewOptions()); @@ -306,7 +312,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testRedlineSplitContentNode) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137318) { - SwDoc* const pDoc = createSwDoc(); + createSwDoc(); + SwDoc* const pDoc = getSwDoc(); SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->Insert("A"); @@ -384,7 +391,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137318) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf136704) { - SwDoc* const pDoc(createSwDoc()); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect()); corr.GetSwFlags().bReplaceStyles = true; @@ -411,7 +419,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf136704) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf134250) { - SwDoc* pDoc = createSwDoc("tdf134250.fodt"); + createSwDoc("tdf134250.fodt"); + SwDoc* pDoc = getSwDoc(); uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xTables(xTextTablesSupplier->getTextTables(), @@ -481,7 +490,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf134250) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf134436) { - SwDoc* pDoc = createSwDoc("tdf134436.fodt"); + createSwDoc("tdf134436.fodt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -623,7 +633,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf134252) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf136452) { - SwDoc* const pDoc(createSwDoc("tdf136452.fodt")); + createSwDoc("tdf136452.fodt"); + SwDoc* pDoc = getSwDoc(); SwNodeOffset const nNodes(pDoc->GetNodes().Count()); @@ -669,7 +680,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf136452) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf136453) { - SwDoc* pDoc = createSwDoc("tdf136453.fodt"); + createSwDoc("tdf136453.fodt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* const pWrtShell(pDoc->GetDocShell()->GetWrtShell()); SwNodeOffset const nNodes(pDoc->GetNodes().Count()); @@ -716,7 +728,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf136453) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137245) { - SwDoc* const pDoc(createSwDoc()); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect()); corr.GetSwFlags().bSetBorder = true; @@ -796,7 +809,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137245) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf132236) { - SwDoc* pDoc = createSwDoc("tdf132236.odt"); + createSwDoc("tdf132236.odt"); + SwDoc* pDoc = getSwDoc(); // select everything and delete SwWrtShell* const pWrtShell(pDoc->GetDocShell()->GetWrtShell()); @@ -816,7 +830,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf132236) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf131912) { - SwDoc* const pDoc = createSwDoc(); + createSwDoc(); + SwDoc* const pDoc = getSwDoc(); SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); sw::UndoManager& rUndoManager = pDoc->GetUndoManager(); @@ -964,7 +979,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf131912) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf140007) { - SwDoc* const pDoc = createSwDoc(); + createSwDoc(); + SwDoc* const pDoc = getSwDoc(); SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->Insert("foo"); @@ -1051,7 +1067,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf140007) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf139982) { - SwDoc* const pDoc = createSwDoc(); + createSwDoc(); + SwDoc* const pDoc = getSwDoc(); SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); // turn on redlining and show changes @@ -1101,7 +1118,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf139982) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf135976) { - SwDoc* const pDoc = createSwDoc(); + createSwDoc(); + SwDoc* const pDoc = getSwDoc(); SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->Insert("foobar"); @@ -1198,7 +1216,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf39721) // FIXME: disabled on Windows because of a not reproducible problem (not related to the patch) #if !defined(_WIN32) // check move down with redlining - SwDoc* pDoc = createSwDoc("tdf39721.fodt"); + createSwDoc("tdf39721.fodt"); + SwDoc* pDoc = getSwDoc(); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); //turn on red-lining and show changes @@ -1251,7 +1270,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf145066_bad_paragraph_deletion) { // check move down with redlining: jumping over a deleted paragraph // resulted bad deletion of the not deleted adjacent paragraph in Show Changes mode - SwDoc* pDoc = createSwDoc("tdf39721.fodt"); + createSwDoc("tdf39721.fodt"); + SwDoc* pDoc = getSwDoc(); //turn on red-lining and show changes pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowDelete @@ -1290,7 +1310,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf145311_move_over_empty_paragraphs) { // check move up/down with redlining: jumping over an empty paragraph // resulted bad insertion of the empty paragraph in Show Changes mode - SwDoc* pDoc = createSwDoc("tdf145311.fodt"); + createSwDoc("tdf145311.fodt"); + SwDoc* pDoc = getSwDoc(); //turn on red-lining and show changes pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowDelete @@ -1323,7 +1344,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf145311_move_over_empty_paragraphs) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf54819) { - SwDoc* pDoc = createSwDoc("tdf54819.fodt"); + createSwDoc("tdf54819.fodt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT_EQUAL(OUString("Heading 1"), getProperty(getParagraph(1), "ParaStyleName")); @@ -1352,7 +1374,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf54819) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf54819_keep_numbering_with_Undo) { - SwDoc* pDoc = createSwDoc("tdf54819b.odt"); + createSwDoc("tdf54819b.odt"); + SwDoc* pDoc = getSwDoc(); // heading CPPUNIT_ASSERT_EQUAL(OUString("Heading 1"), @@ -1436,7 +1459,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf119571_keep_numbering_with_Undo) { // as the previous test, but with partial paragraph deletion: // all deleted paragraphs get the formatting of the first (the partially deleted) one - SwDoc* pDoc = createSwDoc("tdf54819b.odt"); + createSwDoc("tdf54819b.odt"); + SwDoc* pDoc = getSwDoc(); // heading CPPUNIT_ASSERT_EQUAL(OUString("Heading 1"), @@ -1538,7 +1562,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf119571_keep_numbering_with_Reject) { // as the previous test, but with partial paragraph deletion: // all deleted paragraphs get the formatting of the first (the partially deleted) one - SwDoc* pDoc = createSwDoc("tdf54819b.odt"); + createSwDoc("tdf54819b.odt"); + SwDoc* pDoc = getSwDoc(); // heading CPPUNIT_ASSERT_EQUAL(OUString("Heading 1"), @@ -1624,7 +1649,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf119571_keep_numbering_with_Reject) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf140077) { - SwDoc* const pDoc = createSwDoc(); + createSwDoc(); + SwDoc* const pDoc = getSwDoc(); SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); @@ -1662,7 +1688,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf140077) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf109376_redline) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // need 2 paragraphs to get to the bMoveNds case @@ -1712,7 +1739,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf109376_redline) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf109376) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // need 2 paragraphs to get to the bMoveNds case @@ -1758,7 +1786,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf109376) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf147414) { - SwDoc* const pDoc(createSwDoc()); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect()); @@ -1788,7 +1817,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf147414) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf147310) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -1834,7 +1864,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf147310) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf64242_optimizeTable) { - SwDoc* pDoc = createSwDoc("tdf64242_optimizeTable.odt"); + createSwDoc("tdf64242_optimizeTable.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); uno::Reference xTablesSupplier(mxComponent, uno::UNO_QUERY); @@ -1875,7 +1906,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf64242_optimizeTable) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf45525) { - SwDoc* pDoc = createSwDoc("tdf45525.odt"); + createSwDoc("tdf45525.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); uno::Reference xTablesSupplier(mxComponent, uno::UNO_QUERY); @@ -1908,7 +1940,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf45525) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf126784_distributeSelectedColumns) { - SwDoc* pDoc = createSwDoc("tdf126784_distributeSelectedColumns.odt"); + createSwDoc("tdf126784_distributeSelectedColumns.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); uno::Reference xTablesSupplier(mxComponent, uno::UNO_QUERY); @@ -1935,7 +1968,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf126784_distributeSelectedColumns) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf144317) { - SwDoc* pDoc = createSwDoc("tdf144317.odt"); + createSwDoc("tdf144317.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); uno::Reference xTablesSupplier(mxComponent, uno::UNO_QUERY); @@ -1965,7 +1999,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf144317) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf108687_tabstop) { - SwDoc* pDoc = createSwDoc("tdf108687_tabstop.odt"); + createSwDoc("tdf108687_tabstop.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SwNodeOffset nStartIndex = pWrtShell->GetCursor()->GetPointNode().GetIndex(); CPPUNIT_ASSERT_EQUAL(SwNodeOffset(9), nStartIndex); @@ -1982,7 +2017,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf108687_tabstop) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf119571) { - SwDoc* pDoc = createSwDoc("tdf54819.fodt"); + createSwDoc("tdf54819.fodt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT_EQUAL(OUString("Heading 1"), getProperty(getParagraph(1), "ParaStyleName")); @@ -2015,7 +2051,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf119571) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf144058) { - SwDoc* pDoc = createSwDoc("tdf144058.fodt"); + createSwDoc("tdf144058.fodt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT_EQUAL(OUString("Heading 1"), getProperty(getParagraph(1), "ParaStyleName")); @@ -2051,7 +2088,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf144058) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf147507) { - SwDoc* pDoc = createSwDoc("tdf147507.fodt"); + createSwDoc("tdf147507.fodt"); + SwDoc* pDoc = getSwDoc(); // turn on red-lining and show changes pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowDelete @@ -2071,7 +2109,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf147507) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf119019) { // check handling of overlapping redlines - SwDoc* pDoc = createSwDoc("tdf119019.docx"); + createSwDoc("tdf119019.docx"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT_EQUAL(OUString("Nunc viverra imperdiet enim. Fusce est. Vivamus a tellus."), getParagraph(2)->getString()); @@ -2102,7 +2141,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf119019) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf119824) { // check handling of overlapping redlines with Redo - SwDoc* pDoc = createSwDoc("tdf119019.docx"); + createSwDoc("tdf119019.docx"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT_EQUAL(OUString("Pellentesque habitant morbi tristique senectus " "et netus et malesuada fames ac turpis egestas. " @@ -2162,7 +2202,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf119824) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf105413) { - SwDoc* pDoc = createSwDoc("tdf105413.fodt"); + createSwDoc("tdf105413.fodt"); + SwDoc* pDoc = getSwDoc(); // all paragraphs have got Standard paragraph style for (int i = 1; i < 4; ++i) @@ -2200,7 +2241,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf105413) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf76817) { - SwDoc* pDoc = createSwDoc("num-parent-style.docx"); + createSwDoc("num-parent-style.docx"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT_EQUAL(OUString("Heading 2"), getProperty(getParagraph(2), "ParaStyleName")); @@ -2358,7 +2400,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf76817_round_trip) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf76817_custom_outline) { - SwDoc* pDoc = createSwDoc("tdf76817.docx"); + createSwDoc("tdf76817.docx"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT_EQUAL(OUString("Heading 1"), getProperty(getParagraph(1), "ParaStyleName")); @@ -2423,7 +2466,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf123102) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testUnfloatButtonSmallTable) { // The floating table in the test document is too small, so we don't provide an unfloat button - SwDoc* pDoc = createSwDoc("small_floating_table.odt"); + createSwDoc("small_floating_table.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -2458,7 +2502,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testUnfloatButton) OString sTestFileName = OUStringToOString(aTestFile, RTL_TEXTENCODING_UTF8); OString sFailureMessage = OString::Concat("Failure in the test file: ") + sTestFileName; - SwDoc* pDoc = createSwDoc(sTestFileName.getStr()); + createSwDoc(sTestFileName.getStr()); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT_MESSAGE(sFailureMessage.getStr(), pWrtShell); @@ -2493,7 +2538,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testUnfloatButton) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testUnfloatButtonReadOnlyMode) { // In read only mode we don't show the unfloat button even if we have a multipage floating table - SwDoc* pDoc = createSwDoc("unfloatable_floating_table.odt"); + createSwDoc("unfloatable_floating_table.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); pWrtShell->SetReadonlyOption(true); @@ -2529,7 +2575,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testUnfloating) OString sFailureMessage = OString::Concat("Failure in the test file: ") + sTestFileName; // Test what happens when pushing the unfloat button - SwDoc* pDoc = createSwDoc("unfloatable_floating_table.docx"); + createSwDoc("unfloatable_floating_table.docx"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT_MESSAGE(sFailureMessage.getStr(), pWrtShell); @@ -2600,7 +2647,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testRTLparaStyle_LocaleArabic) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf122893) { - SwDoc* pDoc = createSwDoc("tdf105413.fodt"); + createSwDoc("tdf105413.fodt"); + SwDoc* pDoc = getSwDoc(); // all paragraphs are left-aligned with preset single line spacing for (int i = 1; i < 4; ++i) @@ -2641,7 +2689,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf122893) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf122901) { - SwDoc* pDoc = createSwDoc("tdf105413.fodt"); + createSwDoc("tdf105413.fodt"); + SwDoc* pDoc = getSwDoc(); // all paragraphs with zero borders for (int i = 1; i < 4; ++i) @@ -2679,7 +2728,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf122901) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf122942) { - SwDoc* pDoc = createSwDoc("tdf122942.odt"); + createSwDoc("tdf122942.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); // Do the moral equivalent of mouse button down, move and up. @@ -2733,7 +2783,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf132160) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137526) { - SwDoc* pDoc = createSwDoc("tdf132160.odt"); + createSwDoc("tdf132160.odt"); + SwDoc* pDoc = getSwDoc(); // switch on "Show changes in margin" mode dispatchCommand(mxComponent, ".uno:ShowChangesInMargin", {}); @@ -2757,7 +2808,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137526) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137684) { - SwDoc* pDoc = createSwDoc("tdf132160.odt"); + createSwDoc("tdf132160.odt"); + SwDoc* pDoc = getSwDoc(); // switch on "Show changes in margin" mode dispatchCommand(mxComponent, ".uno:ShowChangesInMargin", {}); @@ -2786,7 +2838,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137684) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137503) { - SwDoc* pDoc = createSwDoc("tdf132160.odt"); + createSwDoc("tdf132160.odt"); + SwDoc* pDoc = getSwDoc(); // switch on "Show changes in margin" mode dispatchCommand(mxComponent, ".uno:ShowChangesInMargin", {}); @@ -2816,7 +2869,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137503) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf138605) { - SwDoc* const pDoc(createSwDoc()); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); // turn on red-lining and show changes @@ -2844,7 +2898,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf138605) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf138135) { - SwDoc* pDoc = createSwDoc("tdf132160.odt"); + createSwDoc("tdf132160.odt"); + SwDoc* pDoc = getSwDoc(); // switch on "Show changes in margin" mode dispatchCommand(mxComponent, ".uno:ShowChangesInMargin", {}); @@ -2887,7 +2942,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf52391) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137771) { - SwDoc* pDoc = createSwDoc("tdf132160.odt"); + createSwDoc("tdf132160.odt"); + SwDoc* pDoc = getSwDoc(); // switch on "Show changes in margin" mode dispatchCommand(mxComponent, ".uno:ShowChangesInMargin", {}); @@ -2932,7 +2988,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137771) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf142130) { - SwDoc* pDoc = createSwDoc("tdf142130.fodt"); + createSwDoc("tdf142130.fodt"); + SwDoc* pDoc = getSwDoc(); //turn on red-lining and show changes pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowDelete @@ -2972,7 +3029,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf142130) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf142196) { - SwDoc* pDoc = createSwDoc("tdf142196.fodt"); + createSwDoc("tdf142196.fodt"); + SwDoc* pDoc = getSwDoc(); //turn on red-lining and show changes pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowDelete @@ -3016,7 +3074,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf142196) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf142700) { - SwDoc* pDoc = createSwDoc("tdf142700.fodt"); + createSwDoc("tdf142700.fodt"); + SwDoc* pDoc = getSwDoc(); //turn on red-lining and show changes pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowDelete @@ -3060,7 +3119,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf142700) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf139120) { - SwDoc* pDoc = createSwDoc("tdf54819.fodt"); + createSwDoc("tdf54819.fodt"); + SwDoc* pDoc = getSwDoc(); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); // switch on "Show changes in margin" mode @@ -3113,7 +3173,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf139120) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testJoinParaChangesInMargin) { - SwDoc* pDoc = createSwDoc("tdf54819.fodt"); + createSwDoc("tdf54819.fodt"); + SwDoc* pDoc = getSwDoc(); // switch on "Show changes in margin" mode dispatchCommand(mxComponent, ".uno:ShowChangesInMargin", {}); @@ -3150,7 +3211,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testJoinParaChangesInMargin) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf140757) { - SwDoc* pDoc = createSwDoc("tdf54819.fodt"); + createSwDoc("tdf54819.fodt"); + SwDoc* pDoc = getSwDoc(); // switch on "Show changes in margin" mode dispatchCommand(mxComponent, ".uno:ShowChangesInMargin", {}); @@ -3205,7 +3267,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testConditionalHiddenSectionIssue) if (!pPDFium) return; - SwDoc* pDoc = createSwDoc("HiddenSection.odt"); + createSwDoc("HiddenSection.odt"); + SwDoc* pDoc = getSwDoc(); // Check section conditional hidden status - all should be hidden (IsCondHidden == true) for (SwNodeOffset i(0); i < pDoc->GetNodes().Count(); ++i) diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index 3c615d7ea538..ebdce194e9cd 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -219,7 +219,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf145321) CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testVariableFieldTableRowSplitHeader) { - SwDoc* const pDoc = createSwDoc("variable-field-table-row-split-header.fodt"); + createSwDoc("variable-field-table-row-split-header.fodt"); + SwDoc* const pDoc = getSwDoc(); // finish layout Scheduler::ProcessEventsToIdle(); @@ -514,7 +515,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf147126) CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf148868) { - SwDoc* pDoc = createSwDoc("tdf148868.odt"); + createSwDoc("tdf148868.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT_EQUAL(1, getShapes()); @@ -533,7 +535,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf148868) CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf129382) { - SwDoc* pDoc = createSwDoc("tdf129382.docx"); + createSwDoc("tdf129382.docx"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT_EQUAL(8, getShapes()); @@ -563,7 +566,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf129382) CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf135662) { - SwDoc* pDoc = createSwDoc("tdf135662.odt"); + createSwDoc("tdf135662.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT_EQUAL(2, getShapes()); @@ -586,7 +590,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf135662) CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf134227) { - SwDoc* pDoc = createSwDoc("tdf134227.docx"); + createSwDoc("tdf134227.docx"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT_EQUAL(4, getShapes()); @@ -627,7 +632,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf139638) CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf135412) { - SwDoc* pDoc = createSwDoc("tdf135412.docx"); + createSwDoc("tdf135412.docx"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT_EQUAL(4, getShapes()); @@ -765,7 +771,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf135061) CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf132911) { - SwDoc* pDoc = createSwDoc("tdf132911.odt"); + createSwDoc("tdf132911.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); @@ -835,7 +842,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf132911) CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf61154) { - SwDoc* pDoc = createSwDoc("tdf61154.fodt"); + createSwDoc("tdf61154.fodt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->GotoNextTOXBase(); @@ -865,7 +873,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf124904) { // don't show deletions in referenced text, // (except if the full text is deleted) - SwDoc* pDoc = createSwDoc("tdf124904.fodt"); + createSwDoc("tdf124904.fodt"); + SwDoc* pDoc = getSwDoc(); // show changes pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowDelete @@ -893,7 +902,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf124904) CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf100691) { - SwDoc* pDoc = createSwDoc("tdf100691.fodt"); + createSwDoc("tdf100691.fodt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->GotoNextTOXBase(); @@ -976,7 +986,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf132321) CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf135056) { - SwDoc* pDoc = createSwDoc("tdf135056.odt"); + createSwDoc("tdf135056.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), pWrtShell->GetTOXCount()); @@ -996,7 +1007,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf135056) CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf132597) { - SwDoc* pDoc = createSwDoc("tdf132597.odt"); + createSwDoc("tdf132597.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT_EQUAL(1, getShapes()); @@ -1024,7 +1036,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf132597) CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf139737) { - SwDoc* pDoc = createSwDoc("tdf139737.fodt"); + createSwDoc("tdf139737.fodt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); uno::Reference xModel(mxComponent, uno::UNO_QUERY); @@ -1062,7 +1075,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf150845) CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf147961) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); @@ -1083,7 +1097,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf147961) CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf147206) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); // insert empty paragraph and heading text @@ -1152,7 +1167,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf147206) CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf144840) { - SwDoc* pDoc = createSwDoc("tdf144840.odt"); + createSwDoc("tdf144840.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT_EQUAL(1, getPages()); @@ -1192,7 +1208,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf144840) CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf131963) { - SwDoc* pDoc = createSwDoc("tdf131963.docx"); + createSwDoc("tdf131963.docx"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT_EQUAL(11, getPages()); @@ -1217,7 +1234,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf131963) CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf132596) { - SwDoc* pDoc = createSwDoc("tdf132596.docx"); + createSwDoc("tdf132596.docx"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT_EQUAL(2, getPages()); @@ -1243,7 +1261,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf132596) CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf126626) { - SwDoc* pDoc = createSwDoc("tdf126626.docx"); + createSwDoc("tdf126626.docx"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT_EQUAL(2, getShapes()); @@ -1298,7 +1317,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf133967) CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf132187) { - SwDoc* pDoc = createSwDoc("tdf132187.odt"); + createSwDoc("tdf132187.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT_EQUAL(1, getPages()); @@ -1326,7 +1346,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf132187) CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf130094) { - SwDoc* pDoc = createSwDoc("tdf130094.fodt"); + createSwDoc("tdf130094.fodt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT_EQUAL(OUString("First"), getParagraph(1)->getString()); @@ -1371,7 +1392,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf130094) CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf135733) { - SwDoc* pDoc = createSwDoc("tdf135733.odt"); + createSwDoc("tdf135733.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); @@ -1418,7 +1440,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf135733) CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf128739) { - SwDoc* pDoc = createSwDoc("tdf128739.docx"); + createSwDoc("tdf128739.docx"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT_EQUAL(OUString("Fehler: Verweis nicht gefunden"), getParagraph(1)->getString()); @@ -1441,7 +1464,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf128739) CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf124722) { - SwDoc* pDoc = createSwDoc("tdf124722.rtf"); + createSwDoc("tdf124722.rtf"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT_EQUAL(22, getPages()); @@ -1463,7 +1487,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf124722) CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testToxmarkLinks) { - SwDoc* pDoc = createSwDoc("udindex3.odt"); + createSwDoc("udindex3.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SwView& rView(*pDoc->GetDocShell()->GetView()); @@ -1653,7 +1678,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf133990) CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf126504) { - SwDoc* pDoc = createSwDoc("tdf126504.odt"); + createSwDoc("tdf126504.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); @@ -1701,7 +1727,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf126504) CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf133982) { - SwDoc* pDoc = createSwDoc("tdf133982.docx"); + createSwDoc("tdf133982.docx"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); @@ -1726,7 +1753,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf133982) CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf134253) { - SwDoc* pDoc = createSwDoc("tdf134253.odt"); + createSwDoc("tdf134253.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); @@ -2008,7 +2036,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf124397) CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf108124) { - SwDoc* pDoc = createSwDoc("tdf108124.odt"); + createSwDoc("tdf108124.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); uno::Reference xTextGraphicObjectsSupplier(mxComponent, @@ -2055,7 +2084,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf107975) { // This test also covers tdf#117185 tdf#110442 - SwDoc* pDoc = createSwDoc("tdf107975.odt"); + createSwDoc("tdf107975.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); @@ -2245,7 +2275,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf130746) CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf129805) { - SwDoc* pDoc = createSwDoc("tdf129805.docx"); + createSwDoc("tdf129805.docx"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT_EQUAL(OUString("x"), getParagraph(1)->getString()); @@ -2262,7 +2293,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf129805) CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf130685) { - SwDoc* pDoc = createSwDoc("tdf130685.odt"); + createSwDoc("tdf130685.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT_EQUAL(2, getPages()); @@ -2332,7 +2364,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf104649) CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf134931) { - SwDoc* pDoc = createSwDoc("tdf134931.odt"); + createSwDoc("tdf134931.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); @@ -2368,7 +2401,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf134931) CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf130680) { - SwDoc* pDoc = createSwDoc("tdf130680.odt"); + createSwDoc("tdf130680.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx b/sw/qa/extras/uiwriter/uiwriter4.cxx index 8d6dde77420c..9fa60eb4ceea 100644 --- a/sw/qa/extras/uiwriter/uiwriter4.cxx +++ b/sw/qa/extras/uiwriter/uiwriter4.cxx @@ -95,7 +95,8 @@ void SwUiWriterTest4::mergeDocs(const char* aDestDoc, const char* aInsertDoc) CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf96515) { // Enable hide whitespace mode. - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SwViewOption aViewOptions(*pWrtShell->GetViewOptions()); aViewOptions.SetHideWhitespaceMode(true); @@ -123,7 +124,7 @@ static OUString lcl_translitTest(SwDoc& rDoc, const SwPaM& rPaM, Transliteration CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf146449) { - load("tdf146449.odt"); + createSwDoc("tdf146449.odt"); auto pDoc = dynamic_cast(mxComponent.get()); CPPUNIT_ASSERT(pDoc); @@ -153,7 +154,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf146449) CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf49033) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); // Insert the test text at the end of the document. @@ -327,7 +329,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf49033) CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf147196) { using TF = TransliterationFlags; - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); // Insert the test text at the end of the document. @@ -361,7 +364,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf147196) CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf148148) { using TF = TransliterationFlags; - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->SttEndDoc(/*bStt=*/false); @@ -383,7 +387,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf148148) lcl_translitTest(*pDoc, *pCursor, TF::UPPERCASE_LOWERCASE)); /* Test what happens when node contains text but selection does not contain any text */ - pDoc = createSwDoc(); + createSwDoc(); + pDoc = getSwDoc(); pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->SttEndDoc(/*bStt=*/false); pWrtShell->Insert("text "); @@ -408,7 +413,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf148148) lcl_translitTest(*pDoc, *pCursor, TF::UPPERCASE_LOWERCASE)); /* Test what happens when node contains only non-word text but selection does not contain any text */ - pDoc = createSwDoc(); + createSwDoc(); + pDoc = getSwDoc(); pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->SttEndDoc(/*bStt=*/false); pWrtShell->Insert("-1 "); @@ -432,7 +438,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf148148) CPPUNIT_ASSERT_EQUAL(OUString("-1 "), lcl_translitTest(*pDoc, *pCursor, TF::UPPERCASE_LOWERCASE)); - pDoc = createSwDoc(); + createSwDoc(); + pDoc = getSwDoc(); pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->SttEndDoc(/*bStt=*/false); pWrtShell->Insert(" -1"); @@ -453,7 +460,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf148148) lcl_translitTest(*pDoc, *pCursor, TF::UPPERCASE_LOWERCASE)); /* Test what happens when node and selection contains only non-word text */ - pDoc = createSwDoc(); + createSwDoc(); + pDoc = getSwDoc(); pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->SttEndDoc(/*bStt=*/false); pWrtShell->Insert(" -1"); @@ -477,7 +485,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf148148) CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf96943) { // Enable hide whitespace mode. - SwDoc* pDoc = createSwDoc("tdf96943.odt"); + createSwDoc("tdf96943.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SwViewOption aViewOptions(*pWrtShell->GetViewOptions()); aViewOptions.SetHideWhitespaceMode(true); @@ -494,7 +503,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf96943) CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf96536) { // Enable hide whitespace mode. - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SwViewOption aViewOptions(*pWrtShell->GetViewOptions()); aViewOptions.SetHideWhitespaceMode(true); @@ -533,7 +543,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf96479) static const OUString emptyInputTextField = OUStringChar(CH_TXT_ATR_INPUTFIELDSTART) + OUStringChar(CH_TXT_ATR_INPUTFIELDEND); - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); // So we can clean up all references for reload { @@ -644,7 +655,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf96479) CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testBookmarkCollapsed) { // load document - SwDoc* pDoc = createSwDoc("collapsed_bookmark.odt"); + createSwDoc("collapsed_bookmark.odt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); // save original document @@ -681,7 +693,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testRemoveBookmarkText) // create document { // create a text document with "abcdef" - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); { SwNodeIndex aIdx(pDoc->GetNodes().GetEndOfContent(), -1); @@ -763,7 +776,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testRemoveBookmarkTextAndAddNew) // create document { // create a text document with "abcdef" - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); { SwNodeIndex aIdx(pDoc->GetNodes().GetEndOfContent(), -1); SwPaM aPaM(aIdx); @@ -862,7 +876,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testRemoveBookmarkTextAndAddNew) CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testRemoveBookmarkTextAndAddNewAfterReload) { // load document - SwDoc* pDoc = createSwDoc("collapsed_bookmark.odt"); + createSwDoc("collapsed_bookmark.odt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); // write "abc" to area marked with "testBookmark" bookmark @@ -904,7 +919,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testRemoveBookmarkTextAndAddNewAfterReload CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf96961) { // Insert a page break. - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->InsertPageBreak(); @@ -951,11 +967,13 @@ int checkShells(const SwDocShell* pSource, const SwDocShell* pDestination) CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testClassificationPaste) { - SwDocShell* pSourceShell = createSwDoc()->GetDocShell(); + createSwDoc(); + SwDocShell* pSourceShell = getSwDoc()->GetDocShell(); uno::Reference xSourceComponent = mxComponent; mxComponent.clear(); - SwDocShell* pDestinationShell = createSwDoc()->GetDocShell(); + createSwDoc(); + SwDocShell* pDestinationShell = getSwDoc()->GetDocShell(); // Not classified source, not classified destination. CPPUNIT_ASSERT_EQUAL(int(SfxClassificationCheckPasteResult::None), @@ -982,7 +1000,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testSmallCaps) { // Create a document, add some characters and select them. createSwDoc(); - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwDocShell* pDocShell = pDoc->GetDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); pWrtShell->Insert("text"); @@ -1044,7 +1063,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf99004) CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf84695) { - SwDoc* pDoc = createSwDoc("tdf84695.odt"); + createSwDoc("tdf84695.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); SdrObject* pObject = pPage->GetObj(1); @@ -1069,7 +1089,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf84695) CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf84695NormalChar) { - SwDoc* pDoc = createSwDoc("tdf84695.odt"); + createSwDoc("tdf84695.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); SdrObject* pObject = pPage->GetObj(1); @@ -1093,7 +1114,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf84695NormalChar) CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf84695Tab) { - SwDoc* pDoc = createSwDoc("tdf84695-tab.odt"); + createSwDoc("tdf84695-tab.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); SdrObject* pObject = pPage->GetObj(0); @@ -1121,7 +1143,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf84695Tab) CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTableStyleUndo) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); sw::UndoManager& rUndoManager = pDoc->GetUndoManager(); sal_Int32 nStyleCount = pDoc->GetTableStyles().size(); @@ -1178,7 +1201,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTableStyleUndo) CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testRedlineCopyPaste) { // regressed in tdf#106746 - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwNodeIndex aIdx(pDoc->GetNodes().GetEndOfContent(), -1); SwPaM aPaM(aIdx); @@ -1211,7 +1235,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testRedlineCopyPaste) CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf135260) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwDocShell* pDocShell = pDoc->GetDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); pWrtShell->Insert("test"); @@ -1239,7 +1264,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf135260) CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testRedlineParam) { // Create a document with minimal content. - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwDocShell* pDocShell = pDoc->GetDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); pWrtShell->Insert("middle"); @@ -1294,7 +1320,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testRedlineViewAuthor) // Test that setting an author at an SwView level has effect. // Create a document with minimal content. - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwDocShell* pDocShell = pDoc->GetDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); pWrtShell->Insert("middle"); @@ -1353,7 +1380,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf91292) CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf78727) { - SwDoc* pDoc = createSwDoc("tdf78727.docx"); + createSwDoc("tdf78727.docx"); + SwDoc* pDoc = getSwDoc(); SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); // This was 1: make sure we don't loose the TextBox anchored inside the // table that is moved inside a text frame. @@ -1365,7 +1393,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testRedlineTimestamp) // Test that a redline timestamp's second is not always 0. // Create a document with minimal content. - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwDocShell* pDocShell = pDoc->GetDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); pWrtShell->Insert("middle"); @@ -1403,7 +1432,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testRedlineTimestamp) CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testCursorWindows) { // Create a new document with one window. - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwDocShell* pDocShell = pDoc->GetDocShell(); SwWrtShell* pWrtShell1 = pDocShell->GetWrtShell(); @@ -1425,7 +1455,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testCursorWindows) CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testLandscape) { // Set page orientation to landscape. - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); uno::Sequence aPropertyValues( comphelper::InitPropertySequence({ { "AttributePage.Landscape", uno::Any(true) } })); dispatchCommand(mxComponent, ".uno:AttributePage", aPropertyValues); @@ -1444,7 +1475,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf95699) // Open the document with single FORMCHECKBOX field, select all and copy to clipboard // then check that clipboard contains the FORMCHECKBOX in text body. // Previously that failed. - SwDoc* pDoc = createSwDoc("tdf95699.odt"); + createSwDoc("tdf95699.odt"); + SwDoc* pDoc = getSwDoc(); IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pMarkAccess->getAllMarksCount()); SwDoc aClipboard; @@ -1464,7 +1496,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf104032) // Open the document with FORMCHECKBOX field, select it and copy to clipboard // Go to end of document and paste it, then undo // Previously that asserted in debug build. - SwDoc* pDoc = createSwDoc("tdf104032.odt"); + createSwDoc("tdf104032.odt"); + SwDoc* pDoc = getSwDoc(); sw::UndoManager& rUndoManager = pDoc->GetUndoManager(); SwDoc aClipboard; SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); @@ -1511,7 +1544,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf104425) // accepting change tracking gets stuck on change CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf104814) { - SwDoc* const pDoc1(createSwDoc("tdf104814.docx")); + createSwDoc("tdf104814.docx"); + SwDoc* pDoc1 = getSwDoc(); SwEditShell* const pEditShell(pDoc1->GetEditShell()); @@ -1523,7 +1557,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf104814) // crash at redo of accepting table change tracking imported from DOCX CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTableRedlineRedoCrash) { - SwDoc* const pDoc(createSwDoc("TC-table-del-add.docx")); + createSwDoc("TC-table-del-add.docx"); + SwDoc* pDoc = getSwDoc(); sw::UndoManager& rUndoManager = pDoc->GetUndoManager(); // accept all redlines, Undo and accept all redlines again @@ -1539,7 +1574,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTableRedlineRedoCrash) CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTableRemoveHasTextChangesOnly) { - SwDoc* pDoc = createSwDoc("TC-table-del-add.docx"); + createSwDoc("TC-table-del-add.docx"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -1611,7 +1647,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTableRemoveHasTextChangesOnly) CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTableRemoveHasTextChangesOnly2) { - SwDoc* pDoc = createSwDoc("TC-table-del-add.docx"); + createSwDoc("TC-table-del-add.docx"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -1670,7 +1707,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTableRemoveHasTextChangesOnly2) CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf147182_AcceptAllChangesInTableSelection) { - SwDoc* pDoc = createSwDoc("TC-table-del-add.docx"); + createSwDoc("TC-table-del-add.docx"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -1852,7 +1890,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf107362) CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf105417) { - SwDoc* pDoc = createSwDoc("tdf105417.odt"); + createSwDoc("tdf105417.odt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); SwView* pView = pDoc->GetDocShell()->GetView(); CPPUNIT_ASSERT(pView); @@ -1876,7 +1915,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf105417) CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf105625) { - SwDoc* pDoc = createSwDoc("tdf105625.fodt"); + createSwDoc("tdf105625.fodt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); // Ensure correct initial setting std::shared_ptr batch( @@ -1910,7 +1950,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf125151_protected) { // Similar to testTdf105625 except this is in a protected section, // so read-only is already true when fieldmarks are considered. - SwDoc* pDoc = createSwDoc("tdf125151_protected.fodt"); + createSwDoc("tdf125151_protected.fodt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); // Ensure correct initial setting std::shared_ptr batch( @@ -1928,7 +1969,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf125151_protected) CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf125151_protectedB) { // Similar to testTdf105625 except this is protected with the Protect_Form compat setting - SwDoc* pDoc = createSwDoc("tdf125151_protectedB.fodt"); + createSwDoc("tdf125151_protectedB.fodt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); // Ensure correct initial setting std::shared_ptr batch( @@ -1956,7 +1998,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf106736) CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testMsWordCompTrailingBlanks) { // The option is true in settings.xml - SwDoc* pDoc = createSwDoc("MsWordCompTrailingBlanksTrue.odt"); + createSwDoc("MsWordCompTrailingBlanksTrue.odt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT_EQUAL(true, pDoc->getIDocumentSettingAccess().get( DocumentSettingId::MS_WORD_COMP_TRAILING_BLANKS)); calcLayout(); @@ -1968,7 +2011,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testMsWordCompTrailingBlanks) CPPUNIT_ASSERT_EQUAL(OUString(), parseDump("/root/page/body/txt[3]/Text[5]", "nWidth")); // The option is false in settings.xml - pDoc = createSwDoc("MsWordCompTrailingBlanksFalse.odt"); + createSwDoc("MsWordCompTrailingBlanksFalse.odt"); + pDoc = getSwDoc(); CPPUNIT_ASSERT_EQUAL(false, pDoc->getIDocumentSettingAccess().get( DocumentSettingId::MS_WORD_COMP_TRAILING_BLANKS)); calcLayout(); @@ -1979,12 +2023,14 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testMsWordCompTrailingBlanks) CPPUNIT_ASSERT(!parseDump("/root/page/body/txt[3]/Text[5]", "nWidth").isEmpty()); // MsWordCompTrailingBlanks option should be false by default in new documents - pDoc = createSwDoc(); + createSwDoc(); + pDoc = getSwDoc(); CPPUNIT_ASSERT_EQUAL(false, pDoc->getIDocumentSettingAccess().get( DocumentSettingId::MS_WORD_COMP_TRAILING_BLANKS)); // The option should be true if a .docx, .doc or .rtf document is opened - pDoc = createSwDoc("MsWordCompTrailingBlanks.docx"); + createSwDoc("MsWordCompTrailingBlanks.docx"); + pDoc = getSwDoc(); CPPUNIT_ASSERT_EQUAL(true, pDoc->getIDocumentSettingAccess().get( DocumentSettingId::MS_WORD_COMP_TRAILING_BLANKS)); } @@ -2018,7 +2064,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testCreateDocxAnnotation) CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf107976) { // Create a document and create two transferables. - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell& rShell = *pDoc->GetDocShell()->GetWrtShell(); rtl::Reference pTransferable(new SwTransferable(rShell)); rtl::Reference pTransferable2(new SwTransferable(rShell)); diff --git a/sw/qa/extras/uiwriter/uiwriter5.cxx b/sw/qa/extras/uiwriter/uiwriter5.cxx index 4fd84528ba11..0ffd8213f06e 100644 --- a/sw/qa/extras/uiwriter/uiwriter5.cxx +++ b/sw/qa/extras/uiwriter/uiwriter5.cxx @@ -83,7 +83,8 @@ protected: CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf139127) { - SwDoc* pDoc = createSwDoc("tdf139127.fodt"); + createSwDoc("tdf139127.fodt"); + SwDoc* pDoc = getSwDoc(); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); // switch on "Show changes in margin" mode @@ -126,7 +127,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf139127) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf138479) { - SwDoc* const pDoc = createSwDoc(); + createSwDoc(); + SwDoc* const pDoc = getSwDoc(); SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); @@ -175,7 +177,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf138479) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf138666) { - SwDoc* pDoc = createSwDoc("tdf39721.fodt"); + createSwDoc("tdf39721.fodt"); + SwDoc* pDoc = getSwDoc(); //turn on red-lining and show changes pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowDelete @@ -207,7 +210,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf138666) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf140982) { - SwDoc* pDoc = createSwDoc("tdf115815.odt"); + createSwDoc("tdf115815.odt"); + SwDoc* pDoc = getSwDoc(); //turn on red-lining and show changes pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowDelete @@ -304,7 +308,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf126206) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf50447) { - SwDoc* pDoc = createSwDoc("tdf126206.docx"); + createSwDoc("tdf126206.docx"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); @@ -348,7 +353,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf50447) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf143918) { - SwDoc* pDoc = createSwDoc("tdf126206.docx"); + createSwDoc("tdf126206.docx"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); @@ -393,7 +399,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf143918) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf143938) { - SwDoc* pDoc = createSwDoc("tdf54819.fodt"); + createSwDoc("tdf54819.fodt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); @@ -459,7 +466,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf143938) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf143939) { - SwDoc* pDoc = createSwDoc("tdf126206.docx"); + createSwDoc("tdf126206.docx"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); @@ -504,7 +512,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf143939) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf50447_keep_hints) { - SwDoc* pDoc = createSwDoc("tdf50447.fodt"); + createSwDoc("tdf50447.fodt"); + SwDoc* pDoc = getSwDoc(); // first paragraph (_Lorem_ /ipsum/) @@ -657,7 +666,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf50447_keep_hints) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf144272) { - SwDoc* pDoc = createSwDoc("tdf50447.fodt"); + createSwDoc("tdf50447.fodt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); @@ -709,7 +719,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf144272) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf101873) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -738,7 +749,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf101873) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTextFormFieldInsertion) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); CPPUNIT_ASSERT(pMarkAccess); @@ -775,7 +787,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTextFormFieldInsertion) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testCheckboxFormFieldInsertion) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); @@ -823,7 +836,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testCheckboxFormFieldInsertion) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testDropDownFormFieldInsertion) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); @@ -863,7 +877,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testDropDownFormFieldInsertion) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testMixedFormFieldInsertion) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); @@ -891,7 +906,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testMixedFormFieldInsertion) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf147723) { - SwDoc* const pDoc = createSwDoc("tdf147723.docx"); + createSwDoc("tdf147723.docx"); + SwDoc* const pDoc = getSwDoc(); IDocumentMarkAccess& rIDMA(*pDoc->getIDocumentMarkAccess()); CPPUNIT_ASSERT_EQUAL(sal_Int32(3), rIDMA.getAllMarksCount()); @@ -912,7 +928,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf147723) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf147006) { - SwDoc* const pDoc = createSwDoc("tdf147006.rtf"); + createSwDoc("tdf147006.rtf"); + SwDoc* const pDoc = getSwDoc(); IDocumentMarkAccess& rIDMA(*pDoc->getIDocumentMarkAccess()); CPPUNIT_ASSERT_EQUAL(size_t(1), pDoc->GetFlyCount(FLYCNTTYPE_FRM)); @@ -982,7 +999,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testDocxAttributeTableExport) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf118699_redline_numbering) { - SwDoc* pDoc = createSwDoc("tdf118699.docx"); + createSwDoc("tdf118699.docx"); + SwDoc* pDoc = getSwDoc(); IDocumentRedlineAccess& rIDRA(pDoc->getIDocumentRedlineAccess()); rIDRA.AcceptAllRedline(true); @@ -1016,7 +1034,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf125881_redline_list_level) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf125916_redline_restart_numbering) { - SwDoc* pDoc = createSwDoc("tdf125916.docx"); + createSwDoc("tdf125916.docx"); + SwDoc* pDoc = getSwDoc(); // moveFrom/moveTo are imported as separated redlines from fixing tdf#145718. // Accept the first inline moveFrom redline before accepting the remaining ones @@ -1036,7 +1055,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf125916_redline_restart_numbering) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf125310) { - SwDoc* pDoc = createSwDoc("tdf125310.fodt"); + createSwDoc("tdf125310.fodt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT_EQUAL(OUString("Heading 1"), getProperty(getParagraph(1), "ParaStyleName")); @@ -1071,7 +1091,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf125310) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf125310b) { - SwDoc* pDoc = createSwDoc("tdf125310b.fodt"); + createSwDoc("tdf125310b.fodt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT_EQUAL(OUString("Standard"), @@ -1101,7 +1122,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf125310b) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf120336) { - SwDoc* pDoc = createSwDoc("tdf120336.docx"); + createSwDoc("tdf120336.docx"); + SwDoc* pDoc = getSwDoc(); // turn on red-lining and show changes pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowDelete @@ -1123,7 +1145,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf120336) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf106843) { - SwDoc* pDoc = createSwDoc("tdf106843.docx"); + createSwDoc("tdf106843.docx"); + SwDoc* pDoc = getSwDoc(); // try to turn off red-lining dispatchCommand(mxComponent, ".uno:TrackChanges", {}); @@ -1136,7 +1159,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf106843) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testImageComment) { // Load a document with an as-char image in it. - SwDoc* pDoc = createSwDoc("image-comment.odt"); + createSwDoc("image-comment.odt"); + SwDoc* pDoc = getSwDoc(); SwView* pView = pDoc->GetDocShell()->GetView(); // Test document has "beforeafter", remove the content before the image. @@ -1234,7 +1258,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testImageComment) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testImageCommentAtChar) { // Load a document with an at-char image in it. - SwDoc* pDoc = createSwDoc("image-comment-at-char.odt"); + createSwDoc("image-comment-at-char.odt"); + SwDoc* pDoc = getSwDoc(); SwView* pView = pDoc->GetDocShell()->GetView(); // Select the image. @@ -1303,7 +1328,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testImageCommentAtChar) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTrackImageDeletion) { // load a document with an image anchored to paragraph in it - SwDoc* pDoc = createSwDoc("image.odt"); + createSwDoc("image.odt"); + SwDoc* pDoc = getSwDoc(); SwView* pView = pDoc->GetDocShell()->GetView(); // select the image @@ -1334,7 +1360,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTrackImageDeletion) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTrackImageInsertion) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); // turn on red-lining and show changes IDocumentRedlineAccess& rIDRA(pDoc->getIDocumentRedlineAccess()); @@ -1432,7 +1459,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf120338_multiple_paragraph_join) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testShapePageMove) { // Load a document with 2 pages, shape on the first page. - SwDoc* pDoc = createSwDoc("shape-page-move.odt"); + createSwDoc("shape-page-move.odt"); + SwDoc* pDoc = getSwDoc(); SwView* pView = pDoc->GetDocShell()->GetView(); // Make sure that the 2nd page is below the 1st one. pView->SetViewLayout(/*nColumns=*/1, /*bBookMode=*/false); @@ -1477,7 +1505,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testShapePageMove) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testDateFormFieldInsertion) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); CPPUNIT_ASSERT(pMarkAccess); @@ -1514,7 +1543,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testDateFormFieldInsertion) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testDateFormFieldContentOperations) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); CPPUNIT_ASSERT(pMarkAccess); @@ -1547,7 +1577,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testDateFormFieldContentOperations) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testDateFormFieldCurrentDateHandling) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); CPPUNIT_ASSERT(pMarkAccess); @@ -1601,7 +1632,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testDateFormFieldCurrentDateHandling) #if !defined(_WIN32) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testDateFormFieldCurrentDateInvalidation) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); CPPUNIT_ASSERT(pMarkAccess); @@ -1664,7 +1696,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testOleSaveWhileEdit) comphelper::LibreOfficeKit::setActive(); // Load a document with a Draw doc in it. - SwDoc* pDoc = createSwDoc("ole-save-while-edit.odt"); + createSwDoc("ole-save-while-edit.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->GotoObj(/*bNext=*/true, GotoObjFlags::Any); @@ -1694,7 +1727,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testOleSaveWhileEdit) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf105330) { - SwDoc* pDoc = createSwDoc("tdf105330.odt"); + createSwDoc("tdf105330.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->Down(/*bSelect=*/false); @@ -1745,7 +1779,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testRedlineTableRowDeletion) // load a 1-row table, and delete the row with enabled change tracking: // now the row is not deleted silently, but keeps the deleted cell contents, // and only accepting all of them will result the deletion of the table row. - SwDoc* pDoc = createSwDoc("tdf118311.fodt"); + createSwDoc("tdf118311.fodt"); + SwDoc* pDoc = getSwDoc(); // turn on red-lining and show changes pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowDelete @@ -1856,7 +1891,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testRedlineTableRowDeletion) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf150976) { // load a 1-row table, and delete the row with track changes - SwDoc* pDoc = createSwDoc("select-row.fodt"); + createSwDoc("select-row.fodt"); + SwDoc* pDoc = getSwDoc(); // turn on red-lining and show changes pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowDelete @@ -1909,7 +1945,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf150976) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf151657) { // load a 1-row table, and delete the row with hidden track changes - SwDoc* pDoc = createSwDoc("select-row.fodt"); + createSwDoc("select-row.fodt"); + SwDoc* pDoc = getSwDoc(); // turn on red-lining and hide changes pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On); @@ -1989,7 +2026,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testSelectRowWithNestedTable) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf47979_row) { // load a 2-row table, and select row 2 by clicking before it - SwDoc* pDoc = createSwDoc("select-column.fodt"); + createSwDoc("select-column.fodt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -2023,7 +2061,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf47979_row) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf47979_column) { // load a 2-row table, and select column B by clicking before them - SwDoc* pDoc = createSwDoc("select-column.fodt"); + createSwDoc("select-column.fodt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -2061,7 +2100,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testRedlineTableRowDeletionWithExport) // load a 1-row table, and delete the row with enabled change tracking: // now the row is not deleted silently, but keeps the deleted cell contents, // and only accepting all of them will result the deletion of the table row. - SwDoc* pDoc = createSwDoc("tdf118311.fodt"); + createSwDoc("tdf118311.fodt"); + SwDoc* pDoc = getSwDoc(); // turn on red-lining and show changes pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowDelete @@ -2114,7 +2154,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testRedlineTableRowDeletionWithDOCXExport) // load a 1-row table, and delete the row with enabled change tracking: // now the row is not deleted silently, but keeps the deleted cell contents, // and only accepting all of them will result the deletion of the table row. - SwDoc* pDoc = createSwDoc("tdf118311.fodt"); + createSwDoc("tdf118311.fodt"); + SwDoc* pDoc = getSwDoc(); // turn on red-lining and show changes pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowDelete @@ -2167,7 +2208,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testRedlineTableRowDeletionWithDOCXExport) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testRedlineDOCXTableInsertion) { // load a 3-row table inserted with change tracking by text to table conversion - SwDoc* pDoc = createSwDoc("TC-table-converttotable.docx"); + createSwDoc("TC-table-converttotable.docx"); + SwDoc* pDoc = getSwDoc(); // check table count (1) uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); @@ -2191,7 +2233,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testRedlineDOCXTableMoveToFrame) { // load a table with tracked drag & drop: Table1 is the moveFrom, // Table2 is the moveTo - and framed - table - SwDoc* pDoc = createSwDoc("TC-table-DnD-move.docx"); + createSwDoc("TC-table-DnD-move.docx"); + SwDoc* pDoc = getSwDoc(); uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xTables(xTextTablesSupplier->getTextTables(), @@ -2219,7 +2262,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testRedlineDOCXTableMoveToFrame) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf143215) { // load a table with tracked insertion of an empty row - SwDoc* pDoc = createSwDoc("TC-table-rowadd.docx"); + createSwDoc("TC-table-rowadd.docx"); + SwDoc* pDoc = getSwDoc(); uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xTables(xTextTablesSupplier->getTextTables(), @@ -2253,7 +2297,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf143215) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf150666) { // load a table with tracked insertion of an empty row - SwDoc* pDoc = createSwDoc("TC-table-rowadd.docx"); + createSwDoc("TC-table-rowadd.docx"); + SwDoc* pDoc = getSwDoc(); // check table count uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); @@ -2292,7 +2337,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf150666) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf150666_regression) { // load a table with tracked insertion of an empty row - SwDoc* pDoc = createSwDoc("TC-table-rowadd.docx"); + createSwDoc("TC-table-rowadd.docx"); + SwDoc* pDoc = getSwDoc(); // check table count uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); @@ -2322,7 +2368,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf144748) { // load a table with an empty row, and an empty line before the table // (to allow the easy selection of the full text with the table) - SwDoc* pDoc = createSwDoc("tdf144748.fodt"); + createSwDoc("tdf144748.fodt"); + SwDoc* pDoc = getSwDoc(); // turn on red-lining and show changes pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowDelete @@ -2365,7 +2412,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf144748) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf128335) { // Load the bugdoc, which has 3 textboxes. - SwDoc* pDoc = createSwDoc("tdf128335.odt"); + createSwDoc("tdf128335.odt"); + SwDoc* pDoc = getSwDoc(); // Select the 3rd textbox. SwView* pView = pDoc->GetDocShell()->GetView(); @@ -2403,7 +2451,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testRedlineTableRowDeletionWithReject) // load a 1-row table, and delete the row with enabled change tracking: // now the row is not deleted silently, but keeps the deleted cell contents, // and only accepting all of them will result the deletion of the table row. - SwDoc* pDoc = createSwDoc("tdf118311.fodt"); + createSwDoc("tdf118311.fodt"); + SwDoc* pDoc = getSwDoc(); // turn on red-lining and show changes pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowDelete @@ -2476,7 +2525,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testRedlineTableRowDeletionWithReject) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testRedlineTableRowInsertionWithReject) { // load a 1-row table, and insert a row with enabled change tracking - SwDoc* pDoc = createSwDoc("tdf118311.fodt"); + createSwDoc("tdf118311.fodt"); + SwDoc* pDoc = getSwDoc(); // turn on red-lining and show changes pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowDelete @@ -2521,7 +2571,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testRedlineTableRowInsertionWithReject) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf145089_RedlineTableRowInsertionDOCX) { // load a 1-row table, and insert a row with enabled change tracking - SwDoc* pDoc = createSwDoc("tdf118311.fodt"); + createSwDoc("tdf118311.fodt"); + SwDoc* pDoc = getSwDoc(); // turn on red-lining and show changes pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowDelete @@ -2574,7 +2625,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf145089_RedlineTableRowInsertionDOCX CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testPasteTrackedTableRow) { // load a 1-row table - SwDoc* pDoc = createSwDoc("tdf118311.fodt"); + createSwDoc("tdf118311.fodt"); + SwDoc* pDoc = getSwDoc(); // turn on red-lining and show changes pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowDelete @@ -2621,7 +2673,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testPasteTrackedTableRow) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testPasteTrackedTableRowInHideChangesMode) { // load a 1-row table - SwDoc* pDoc = createSwDoc("tdf118311.fodt"); + createSwDoc("tdf118311.fodt"); + SwDoc* pDoc = getSwDoc(); // turn on red-lining and show changes pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On); @@ -2668,7 +2721,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf146966) { // load a 4-row table, select more than 1 row and copy them // to check insertion of unnecessary empty rows - SwDoc* pDoc = createSwDoc("tdf144748.fodt"); + createSwDoc("tdf144748.fodt"); + SwDoc* pDoc = getSwDoc(); // check table row count uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); @@ -2703,7 +2757,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf146966) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf145091) { // load a deleted table, reject them, and delete only its text and export to DOCX - SwDoc* pDoc = createSwDoc("tdf145091.docx"); + createSwDoc("tdf145091.docx"); + SwDoc* pDoc = getSwDoc(); // turn on red-lining and show changes pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowDelete @@ -2753,7 +2808,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf145091) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf128603) { // Load the bugdoc, which has 3 textboxes. - SwDoc* pDoc = createSwDoc("tdf128603.odt"); + createSwDoc("tdf128603.odt"); + SwDoc* pDoc = getSwDoc(); // Select the 3rd textbox. SwView* pView = pDoc->GetDocShell()->GetView(); @@ -2804,7 +2860,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testOfz18563) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf143904) { - SwDoc* pDoc = createSwDoc("tdf143904.odt"); + createSwDoc("tdf143904.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -2827,7 +2884,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf143904) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf90069) { - SwDoc* pDoc = createSwDoc("tdf90069.docx"); + createSwDoc("tdf90069.docx"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -2851,7 +2909,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf90069) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf109266) { // transliteration with redlining - SwDoc* pDoc = createSwDoc("lorem.fodt"); + createSwDoc("lorem.fodt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -3050,7 +3109,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf123218) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf93747) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtSh = pDoc->GetDocShell()->GetWrtShell(); uno::Sequence aArgs(comphelper::InitPropertySequence( @@ -3141,7 +3201,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf93747) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf145151) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtSh = pDoc->GetDocShell()->GetWrtShell(); uno::Sequence aArgs(comphelper::InitPropertySequence( @@ -3242,7 +3303,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf145151) CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf126735) { - SwDoc* pDoc = createSwDoc("tdf39721.fodt"); + createSwDoc("tdf39721.fodt"); + SwDoc* pDoc = getSwDoc(); //turn on red-lining and show changes pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowDelete diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx b/sw/qa/extras/uiwriter/uiwriter6.cxx index 62dee754002b..3adb30fa4032 100644 --- a/sw/qa/extras/uiwriter/uiwriter6.cxx +++ b/sw/qa/extras/uiwriter/uiwriter6.cxx @@ -152,7 +152,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testLinesMoveBackwardsInSectionInTable) { #if HAVE_MORE_FONTS // Assert that paragraph "4" is on page 1 and "5" is on page 2. - SwDoc* pDoc = createSwDoc("lines-in-section-in-table.odt"); + createSwDoc("lines-in-section-in-table.odt"); + SwDoc* pDoc = getSwDoc(); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "/root/page", 2); SwNodeOffset nPara4Node( @@ -257,7 +258,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf113445) { #if HAVE_MORE_FONTS // Force multiple-page view. - SwDoc* pDoc = createSwDoc("tdf113445.fodt"); + createSwDoc("tdf113445.fodt"); + SwDoc* pDoc = getSwDoc(); SwDocShell* pDocShell = pDoc->GetDocShell(); SwView* pView = pDocShell->GetView(); pView->SetViewLayout(/*nColumns=*/2, /*bBookMode=*/false); @@ -303,7 +305,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf113445) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf113686) { #if HAVE_MORE_FONTS - SwDoc* pDoc = createSwDoc("tdf113686.fodt"); + createSwDoc("tdf113686.fodt"); + SwDoc* pDoc = getSwDoc(); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "/root/page", 2); SwNodeOffset nPage1LastNode( @@ -416,7 +419,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testSectionInTableInTable3) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testSectionInTableInTable4) { #if HAVE_MORE_FONTS - SwDoc* pDoc = createSwDoc("tdf113520.fodt"); + createSwDoc("tdf113520.fodt"); + SwDoc* pDoc = getSwDoc(); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "/root/page", 3); SwNodeOffset nPage1LastNode( @@ -462,7 +466,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf112160) { #if HAVE_MORE_FONTS // Assert that the A2 cell is on page 1. - SwDoc* pDoc = createSwDoc("tdf112160.fodt"); + createSwDoc("tdf112160.fodt"); + SwDoc* pDoc = getSwDoc(); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); SwNodeOffset nA2CellNode(getXPath(pXmlDoc, "/root/page[1]/body/tab/row[2]/cell[1]/section/txt[last()]", @@ -500,7 +505,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf114536) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testParagraphOfTextRange) { - SwDoc* pDoc = createSwDoc("paragraph-of-text-range.odt"); + createSwDoc("paragraph-of-text-range.odt"); + SwDoc* pDoc = getSwDoc(); // Enter the table. SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); @@ -523,7 +529,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testParagraphOfTextRange) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf99689TableOfContents) { - SwDoc* pDoc = createSwDoc("tdf99689.odt"); + createSwDoc("tdf99689.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->GotoNextTOXBase(); const SwTOXBase* pTOXBase = pWrtShell->GetCurTOX(); @@ -550,7 +557,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf99689TableOfContents) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf99689TableOfFigures) { - SwDoc* pDoc = createSwDoc("tdf99689_figures.odt"); + createSwDoc("tdf99689_figures.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->GotoNextTOXBase(); const SwTOXBase* pTOXBase = pWrtShell->GetCurTOX(); @@ -575,7 +583,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf99689TableOfFigures) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf99689TableOfTables) { - SwDoc* pDoc = createSwDoc("tdf99689_tables.odt"); + createSwDoc("tdf99689_tables.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->GotoNextTOXBase(); const SwTOXBase* pTOXBase = pWrtShell->GetCurTOX(); @@ -613,7 +622,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf112448) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf113790) { - SwDoc* pDoc = createSwDoc("tdf113790.docx"); + createSwDoc("tdf113790.docx"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); // Create the clipboard document. SwDoc aClipboard; @@ -656,7 +666,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf108048) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf113481) { - SwDoc* pDoc = createSwDoc("tdf113481-IVS.odt"); + createSwDoc("tdf113481-IVS.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); // One backspace should completely remove the CJK ideograph variation sequence @@ -697,7 +708,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf115013) const OUString aWorkDir = aTempDir.GetURL(); //create new writer document - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); { // Load and register data source @@ -741,7 +753,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf115065) // In the document, the tables have table style assigned // Source table (first one) has two rows; // destination (second one) has only one row - SwDoc* pDoc = createSwDoc("tdf115065.odt"); + createSwDoc("tdf115065.odt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -766,7 +779,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf84806_MovingMultipleTableRows) // Moving of multiple table rows. // Source table (first one) has two rows; // destination (second one) has only one row - SwDoc* pDoc = createSwDoc("tdf115065.odt"); + createSwDoc("tdf115065.odt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -822,7 +836,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf147181_TrackedMovingOfMultipleTable // Tracked moving of multiple table rows. // Source table (first one) has two rows; // destination (second one) has only one row - SwDoc* pDoc = createSwDoc("tdf115065.odt"); + createSwDoc("tdf115065.odt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -900,7 +915,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf147181_TrackedMovingOfMultipleTable CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf115132) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -979,7 +995,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testXDrawPagesSupplier) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf116403) { - SwDoc* pDoc = createSwDoc("tdf116403-considerborders.odt"); + createSwDoc("tdf116403-considerborders.odt"); + SwDoc* pDoc = getSwDoc(); // Check that before ToX update, the tab stop position is the old one uno::Reference xParagraph = getParagraph(2, "1\t1"); auto aTabs = getProperty>(xParagraph, "ParaTabStops"); @@ -1003,7 +1020,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf116403) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testHtmlCopyImages) { // Load a document with an image. - SwDoc* pDoc = createSwDoc("image.odt"); + createSwDoc("image.odt"); + SwDoc* pDoc = getSwDoc(); // Trigger the copy part of HTML copy&paste. WriterRef xWrt = new SwHTMLWriter(/*rBaseURL=*/OUString()); @@ -1058,7 +1076,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf91801) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf51223) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); sw::UndoManager& rUndoManager = pDoc->GetUndoManager(); SwNodeOffset nIndex = pWrtShell->GetCursor()->GetPointNode().GetIndex(); @@ -1284,7 +1303,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testInconsistentBookmark) { // create test document with text and bookmark { - SwDoc* pDoc(createSwDoc("testInconsistentBookmark.ott")); + createSwDoc("testInconsistentBookmark.ott"); + SwDoc* pDoc = getSwDoc(); IDocumentMarkAccess& rIDMA(*pDoc->getIDocumentMarkAccess()); SwNodeIndex aIdx(pDoc->GetNodes().GetEndOfContent(), -1); SwCursor aPaM(SwPosition(aIdx), nullptr); @@ -1317,7 +1337,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testInconsistentBookmark) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testSpellOnlineParameter) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); const SwViewOption* pOpt = pWrtShell->GetViewOptions(); bool bSet = pOpt->IsOnlineSpell(); @@ -1337,7 +1358,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testSpellOnlineParameter) #if !defined(_WIN32) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf124603) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); const SwViewOption* pOpt = pWrtShell->GetViewOptions(); uno::Sequence params @@ -1386,7 +1408,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf124603) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testRedlineAutoCorrect) { - SwDoc* pDoc = createSwDoc("redline-autocorrect.fodt"); + createSwDoc("redline-autocorrect.fodt"); + SwDoc* pDoc = getSwDoc(); dispatchCommand(mxComponent, ".uno:GoToEndOfDoc", {}); @@ -1457,7 +1480,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testRedlineAutoCorrect) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testRedlineAutoCorrect2) { - SwDoc* pDoc = createSwDoc("redline-autocorrect2.fodt"); + createSwDoc("redline-autocorrect2.fodt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); SwXTextDocument& rXTextDocument = getSwXTextDocument(); @@ -1485,7 +1509,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testRedlineAutoCorrect2) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testEmojiAutoCorrect) { - SwDoc* pDoc = createSwDoc("redline-autocorrect3.fodt"); + createSwDoc("redline-autocorrect3.fodt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); SwXTextDocument& rXTextDocument = getSwXTextDocument(); @@ -1514,7 +1539,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testEmojiAutoCorrect) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf108423) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); SwXTextDocument& rXTextDocument = getSwXTextDocument(); @@ -1530,7 +1556,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf108423) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf106164) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); SwXTextDocument& rXTextDocument = getSwXTextDocument(); @@ -1541,7 +1568,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf106164) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf54409) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); SwXTextDocument& rXTextDocument = getSwXTextDocument(); @@ -1561,7 +1589,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf54409) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf38394) { - SwDoc* pDoc = createSwDoc("tdf38394.fodt"); + createSwDoc("tdf38394.fodt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); SwXTextDocument& rXTextDocument = getSwXTextDocument(); @@ -1577,7 +1606,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf38394) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf59666) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); SwXTextDocument& rXTextDocument = getSwXTextDocument(); @@ -1588,7 +1618,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf59666) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf133524) { - SwDoc* pDoc = createSwDoc("tdf133524.fodt"); + createSwDoc("tdf133524.fodt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); SwXTextDocument& rXTextDocument = getSwXTextDocument(); @@ -1646,7 +1677,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf133524) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf133524_Romanian) { - SwDoc* pDoc = createSwDoc("tdf133524_ro.fodt"); + createSwDoc("tdf133524_ro.fodt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); SwXTextDocument& rXTextDocument = getSwXTextDocument(); @@ -1680,7 +1712,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf133524_Romanian) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf128860) { - SwDoc* pDoc = createSwDoc("tdf128860.fodt"); + createSwDoc("tdf128860.fodt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); SwXTextDocument& rXTextDocument = getSwXTextDocument(); @@ -1700,7 +1733,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf128860) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf123786) { - SwDoc* pDoc = createSwDoc("tdf123786.fodt"); + createSwDoc("tdf123786.fodt"); + SwDoc* pDoc = getSwDoc(); // On Windows, it will detect that system input language is en-US (despite "typing" e.g. Cyrillic characters), // and will change Russian into English (US); in the latter language, @@ -1729,7 +1763,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf123786) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf133589) { // Hungarian test document with right-to-left paragraph setting - SwDoc* pDoc = createSwDoc("tdf133589.fodt"); + createSwDoc("tdf133589.fodt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); SwXTextDocument& rXTextDocument = getSwXTextDocument(); @@ -1792,7 +1827,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf133589) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testAutoCorr) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); SwXTextDocument& rXTextDocument = getSwXTextDocument(); @@ -1816,7 +1852,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testAutoCorr) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf130274) { - SwDoc* const pDoc(createSwDoc()); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); SwXTextDocument& rXTextDocument = getSwXTextDocument(); @@ -1840,7 +1877,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf130274) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf83260) { - SwDoc* const pDoc(createSwDoc("tdf83260-1.odt")); + createSwDoc("tdf83260-1.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); SwXTextDocument& rXTextDocument = getSwXTextDocument(); @@ -1898,7 +1936,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf83260) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf74363) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); SwXTextDocument& rXTextDocument = getSwXTextDocument(); @@ -1958,7 +1997,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testInsertLongDateFormat) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf129270) { - SwDoc* pDoc = createSwDoc("tdf129270.odt"); + createSwDoc("tdf129270.odt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -2013,7 +2053,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf143760WrapContourToOff) { // Actually, this is an ooxmlexport test. It is here because here is a ready environment // to change a shape by dispatchCommand. - SwDoc* pDoc = createSwDoc("tdf143760_ContourToWrapOff.docx"); + createSwDoc("tdf143760_ContourToWrapOff.docx"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); CPPUNIT_ASSERT_EQUAL(true, getProperty(getShape(1), "SurroundContour")); @@ -2089,7 +2130,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testNestedGroupTextBoxCopyCrash) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testCrashOnExit) { // Load the bugdoc with a table and a textbox shape inside. - CPPUNIT_ASSERT(createSwDoc("tdf142715.odt")); + createSwDoc("tdf142715.odt"); // Get the textbox selected CPPUNIT_ASSERT_EQUAL(1, getShapes()); diff --git a/sw/qa/extras/uiwriter/uiwriter7.cxx b/sw/qa/extras/uiwriter/uiwriter7.cxx index a54caedd32c6..bef4be924ad9 100644 --- a/sw/qa/extras/uiwriter/uiwriter7.cxx +++ b/sw/qa/extras/uiwriter/uiwriter7.cxx @@ -150,7 +150,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf77340) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf79236) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); sw::UndoManager& rUndoManager = pDoc->GetUndoManager(); //Getting some paragraph style SwTextFormatColl* pTextFormat = pDoc->FindTextFormatCollByName(u"Text Body"); @@ -209,7 +210,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf79236) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTextSearch) { // Create a new empty Writer document - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwPaM* pCursor = pDoc->GetEditShell()->GetCursor(); IDocumentContentOperations& rIDCO(pDoc->getIDocumentContentOperations()); // Insert some text @@ -357,10 +359,12 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTextSearch) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf69282) { - SwDoc* source = createSwDoc(); + createSwDoc(); + SwDoc* source = getSwDoc(); uno::Reference xSourceDoc = mxComponent; mxComponent.clear(); - SwDoc* target = createSwDoc(); + createSwDoc(); + SwDoc* target = getSwDoc(); SwPageDesc* sPageDesc = source->MakePageDesc("SourceStyle"); SwPageDesc* tPageDesc = target->MakePageDesc("TargetStyle"); sPageDesc->ChgFirstShare(false); @@ -415,10 +419,12 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf69282) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf69282WithMirror) { - SwDoc* source = createSwDoc(); + createSwDoc(); + SwDoc* source = getSwDoc(); uno::Reference xSourceDoc = mxComponent; mxComponent.clear(); - SwDoc* target = createSwDoc(); + createSwDoc(); + SwDoc* target = getSwDoc(); SwPageDesc* sPageDesc = source->MakePageDesc("SourceStyle"); SwPageDesc* tPageDesc = target->MakePageDesc("TargetStyle"); //Enabling Mirror @@ -505,7 +511,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf78742) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testUnoParagraph) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); //Inserting some text content in the document pWrtShell->Insert("This is initial text in paragraph one"); @@ -544,7 +551,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testUnoParagraph) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf72788) { //Create a new empty Writer document - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SwPaM* pCursor = pDoc->GetEditShell()->GetCursor(); IDocumentContentOperations& rIDCO(pDoc->getIDocumentContentOperations()); @@ -607,7 +615,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf72788) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf60967) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SwPaM* pCursor = pDoc->GetEditShell()->GetCursor(); sw::UndoManager& rUndoManager = pDoc->GetUndoManager(); @@ -659,7 +668,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf60967) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testSearchWithTransliterate) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); { SwNodeIndex aIdx(pDoc->GetNodes().GetEndOfContent(), -1); @@ -701,7 +711,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testSearchWithTransliterate) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf73660) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); OUString aData1 = "First" + OUStringChar(CHAR_SOFTHYPHEN) + "Word"; OUString aData2 = "Seco" + OUStringChar(CHAR_SOFTHYPHEN) + "nd"; @@ -757,7 +768,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testNewDocModifiedState) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf77342) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SwPaM* pCursor = pDoc->GetEditShell()->GetCursor(); //inserting first footnote @@ -1007,7 +1019,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf77342) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf63553) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SwPaM* pCursor = pDoc->GetEditShell()->GetCursor(); //inserting sequence field 1 @@ -1304,7 +1317,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf74230) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf80663) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); //Inserting 2x2 Table sw::UndoManager& rUndoManager = pDoc->GetUndoManager(); @@ -1391,7 +1405,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf80663) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf57197) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); //Inserting 1x1 Table sw::UndoManager& rUndoManager = pDoc->GetUndoManager(); @@ -1473,7 +1488,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf57197) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf131990) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(!pWrtShell->Up(false, 1, true)); @@ -1561,7 +1577,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf97601) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf75137) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SwShellCursor* pShellCursor = pWrtShell->getShellCursor(true); pWrtShell->InsertFootnote("This is first footnote"); @@ -1578,7 +1595,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf75137) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf83798) { - SwDoc* pDoc = createSwDoc("tdf83798.odt"); + createSwDoc("tdf83798.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->GotoNextTOXBase(); const SwTOXBase* pTOXBase = pWrtShell->GetCurTOX(); @@ -1630,7 +1648,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf89714) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf130287) { //create a new writer document - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); //insert a 1-cell table in the newly created document SwInsertTableOptions TableOpt(SwInsertTableFlags::DefaultBorder, 0); @@ -1699,7 +1718,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testPropertyDefaults) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTableBackgroundColor) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SwInsertTableOptions TableOpt(SwInsertTableFlags::DefaultBorder, 0); pWrtShell->InsertTable(TableOpt, 3, 3); //Inserting Table @@ -1775,7 +1795,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf88899) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf90362) { - SwDoc* pDoc = createSwDoc("tdf90362.fodt"); + createSwDoc("tdf90362.fodt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); // Ensure correct initial setting std::shared_ptr batch( @@ -1798,7 +1819,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf90362) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testUndoDelAsCharTdf107512) { - SwDoc* pDoc(createSwDoc()); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); sw::UndoManager& rUndoManager(pDoc->GetUndoManager()); IDocumentContentOperations& rIDCO(pDoc->getIDocumentContentOperations()); SwCursorShell* pShell(pDoc->GetEditShell()); @@ -1950,7 +1972,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testUndoDelAsCharTdf107512) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testUndoCharAttribute) { // Create a new empty Writer document - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwPaM* pCursor = pDoc->GetEditShell()->GetCursor(); sw::UndoManager& rUndoManager = pDoc->GetUndoManager(); IDocumentContentOperations& rIDCO(pDoc->getIDocumentContentOperations()); @@ -1985,7 +2008,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testUndoCharAttribute) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testUndoDelAsChar) { - SwDoc* pDoc(createSwDoc()); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); sw::UndoManager& rUndoManager(pDoc->GetUndoManager()); IDocumentContentOperations& rIDCO(pDoc->getIDocumentContentOperations()); SwCursorShell* pShell(pDoc->GetEditShell()); @@ -2018,7 +2042,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testUndoDelAsChar) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf86639) { - SwDoc* pDoc = createSwDoc("tdf86639.rtf"); + createSwDoc("tdf86639.rtf"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SwTextFormatColl* pColl = pDoc->FindTextFormatCollByName(u"Heading"); pWrtShell->SetTextFormatColl(pColl); @@ -2030,7 +2055,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf86639) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf90883TableBoxGetCoordinates) { - SwDoc* pDoc = createSwDoc("tdf90883.odt"); + createSwDoc("tdf90883.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->Down(true); SwSelBoxes aBoxes; @@ -2128,7 +2154,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTextTableCellNames) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testShapeAnchorUndo) { - SwDoc* pDoc = createSwDoc("draw-anchor-undo.odt"); + createSwDoc("draw-anchor-undo.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); SdrObject* pObject = pPage->GetObj(0); @@ -2153,7 +2180,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testShapeAnchorUndo) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf127635) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwXTextDocument* pXTextDocument = dynamic_cast(mxComponent.get()); CPPUNIT_ASSERT(pXTextDocument); @@ -2197,7 +2225,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testDde) { #if HAVE_FEATURE_UI // Type asdf and copy it. - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->Insert("asdf"); pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/true, 4, /*bBasicCall=*/false); @@ -2262,7 +2291,8 @@ IMPL_LINK(IdleTask, FlipFlag, Timer*, , void) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testDocModState) { //creating a new writer document via the XDesktop(to have more shells etc.) - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); //creating instance of IdleTask Class IdleTask idleTask; //checking the state of the document via IDocumentState @@ -2287,7 +2317,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testDocModState) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf94804) { //create new writer document - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); //get cursor for making bookmark at a particular location SwPaM* pCrsr = pDoc->GetEditShell()->GetCursor(); IDocumentMarkAccess* pIDMAccess(pDoc->getIDocumentMarkAccess()); @@ -2311,7 +2342,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf94804) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testUnicodeNotationToggle) { - SwDoc* pDoc = createSwDoc("unicodeAltX.odt"); + createSwDoc("unicodeAltX.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); OUString sOriginalDocString; OUString sDocString; @@ -2346,7 +2378,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf34957) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf89954) { - SwDoc* pDoc = createSwDoc("tdf89954.odt"); + createSwDoc("tdf89954.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->EndPara(); SwXTextDocument* pXTextDocument = dynamic_cast(mxComponent.get()); @@ -2367,7 +2400,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf89954) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf89720) { - SwDoc* pDoc = createSwDoc("tdf89720.odt"); + createSwDoc("tdf89720.odt"); + SwDoc* pDoc = getSwDoc(); SwView* pView = pDoc->GetDocShell()->GetView(); SwPostItMgr* pPostItMgr = pView->GetPostItMgr(); for (std::unique_ptr const& pItem : *pPostItMgr) @@ -2382,7 +2416,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf89720) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf88986) { // Create a text shell. - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwView* pView = pDoc->GetDocShell()->GetView(); SwTextShell aShell(*pView); @@ -2397,7 +2432,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf88986) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf78150) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->Insert("foobar"); @@ -2414,7 +2450,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf78150) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf138873) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->Insert("A B C"); @@ -2451,7 +2488,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf138873) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf87922) { // Create an SwDrawTextInfo. - SwDoc* pDoc = createSwDoc("tdf87922.odt"); + createSwDoc("tdf87922.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SwScriptInfo* pScriptInfo = nullptr; // Get access to the single paragraph in the document. @@ -2541,7 +2579,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf77014) // This test checks that the input field is in one piece and if the // input field has more words, it is broken up at the correct place. - SwDoc* pDoc = createSwDoc("tdf77014.odt"); + createSwDoc("tdf77014.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SwTextFrame* pTextFrame @@ -2681,7 +2720,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf77014) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf92648) { - SwDoc* pDoc = createSwDoc("tdf92648.docx"); + createSwDoc("tdf92648.docx"); + SwDoc* pDoc = getSwDoc(); SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); // Make sure we have ten draw shapes. // Yes, we have if the left/right pages have different header/footer, @@ -2703,7 +2743,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf92648) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf103978_backgroundTextShape) { - SwDoc* pDoc = createSwDoc("tdf103978_backgroundTextShape.docx"); + createSwDoc("tdf103978_backgroundTextShape.docx"); + SwDoc* pDoc = getSwDoc(); // there is only one shape. It has an attached textbox bool bShapeIsOpaque = getProperty(getShape(1), "Opaque"); @@ -2748,7 +2789,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf117225) CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf149184) { - SwDoc* pDoc = createSwDoc("simplefooter.docx"); + createSwDoc("simplefooter.docx"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); // Removing the footer for all styles diff --git a/sw/qa/extras/uiwriter/uiwriter8.cxx b/sw/qa/extras/uiwriter/uiwriter8.cxx index 014681eaac46..83698fa36a18 100644 --- a/sw/qa/extras/uiwriter/uiwriter8.cxx +++ b/sw/qa/extras/uiwriter/uiwriter8.cxx @@ -50,7 +50,8 @@ public: CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf131684) { - SwDoc* pDoc = createSwDoc("tdf131684.docx"); + createSwDoc("tdf131684.docx"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); @@ -111,7 +112,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf132420) CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf132744) { - SwDoc* pDoc = createSwDoc("tdf132744.odt"); + createSwDoc("tdf132744.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); // disable change tracking to cut the table @@ -142,7 +144,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf132744) CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf146622) { - SwDoc* pDoc = createSwDoc("TC-table-del-add.docx"); + createSwDoc("TC-table-del-add.docx"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -196,7 +199,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf146622) CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf146962) { // load a 2-row table, set Hide Changes mode and delete the first row with change tracking - SwDoc* pDoc = createSwDoc("tdf116789.fodt"); + createSwDoc("tdf116789.fodt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -249,7 +253,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf146962) CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf147347) { // load a 2-row table, set Hide Changes mode and delete the table with change tracking - SwDoc* pDoc = createSwDoc("tdf116789.fodt"); + createSwDoc("tdf116789.fodt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -302,7 +307,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf147347) CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf148345) { // load a 2-row table, set Hide Changes mode and delete the first row with change tracking - SwDoc* pDoc = createSwDoc("tdf116789.fodt"); + createSwDoc("tdf116789.fodt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -358,7 +364,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf141391) // overwrites the row content, instead of inserting a nested table // load a 2-row table - SwDoc* pDoc = createSwDoc("tdf116789.fodt"); + createSwDoc("tdf116789.fodt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -450,7 +457,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf148791) // test Paste as Rows Above with centered table alignment // load a 2-row table - SwDoc* pDoc = createSwDoc("tdf116789.fodt"); + createSwDoc("tdf116789.fodt"); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -627,7 +635,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf145584) { return; } - SwDoc* const pDoc = createSwDoc(); + createSwDoc(); + SwDoc* const pDoc = getSwDoc(); SwWrtShell* const pWrtSh = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtSh); @@ -663,7 +672,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf145584) CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf140731) { - SwDoc* const pDoc = createSwDoc(); + createSwDoc(); + SwDoc* const pDoc = getSwDoc(); SwWrtShell* const pWrtSh = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtSh); @@ -735,7 +745,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf140731) CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf116315) { - SwDoc* const pDoc = createSwDoc(); + createSwDoc(); + SwDoc* const pDoc = getSwDoc(); SwWrtShell* const pWrtSh = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtSh); @@ -776,7 +787,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf116315) CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf144364) { - SwDoc* const pDoc = createSwDoc(); + createSwDoc(); + SwDoc* const pDoc = getSwDoc(); SwWrtShell* const pWrtSh = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtSh); @@ -795,7 +807,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf144364) CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf141613) { - SwDoc* const pDoc = createSwDoc(); + createSwDoc(); + SwDoc* const pDoc = getSwDoc(); SwWrtShell* const pWrtSh = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtSh); @@ -872,7 +885,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf107494) CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf133358) { - SwDoc* const pDoc = createSwDoc(); + createSwDoc(); + SwDoc* const pDoc = getSwDoc(); SwWrtShell* const pWrtSh = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtSh); @@ -976,7 +990,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf80663) CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf130805) { - SwDoc* pDoc = createSwDoc("tdf130805.odt"); + createSwDoc("tdf130805.odt"); + SwDoc* pDoc = getSwDoc(); const SwFrameFormats& rFrmFormats = *pDoc->GetSpzFrameFormats(); CPPUNIT_ASSERT(rFrmFormats.size() >= size_t(o3tl::make_unsigned(1))); @@ -999,7 +1014,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf130805) CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf107893) { //Open the sample doc - SwDoc* pDoc = createSwDoc("tdf107893.odt"); + createSwDoc("tdf107893.odt"); + SwDoc* pDoc = getSwDoc(); //Get the format of the shape const SwFrameFormats& rFrmFormats = *pDoc->GetSpzFrameFormats(); @@ -1054,7 +1070,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf121031) CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, TestTextBoxCrashAfterLineDel) { // Open the desired file - SwDoc* pDoc = createSwDoc("txbx_crash.odt"); + createSwDoc("txbx_crash.odt"); + SwDoc* pDoc = getSwDoc(); // Get the format of the shape const SwFrameFormats& rFrmFormats = *pDoc->GetSpzFrameFormats(); @@ -1143,7 +1160,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf145621) CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf134626) { - SwDoc* pDoc = createSwDoc("tdf134626.odt"); + createSwDoc("tdf134626.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT_EQUAL(OUString("Apple"), getParagraph(1)->getString()); @@ -1156,7 +1174,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf134626) TransferableDataHelper aHelper(xTransfer); // Create a new document - pDoc = createSwDoc(); + createSwDoc(); + pDoc = getSwDoc(); pWrtShell = pDoc->GetDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -1187,7 +1206,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf134626) CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf139566) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtSh = pDoc->GetDocShell()->GetWrtShell(); uno::Sequence aArgs(comphelper::InitPropertySequence( @@ -1309,7 +1329,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf87199) CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf39828) { - SwDoc* pDoc = createSwDoc("tdf39828.fodt"); + createSwDoc("tdf39828.fodt"); + SwDoc* pDoc = getSwDoc(); // show changes pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::ShowDelete @@ -1340,7 +1361,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf39828) CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf146573) { - SwDoc* pDoc = createSwDoc("tdf39828.fodt"); + createSwDoc("tdf39828.fodt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); // remove redlines, add a footnote, and change the value @@ -1379,7 +1401,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf146573) CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf148799) { // load a document with table formulas with comma delimiter - SwDoc* pDoc = createSwDoc("tdf148799.docx"); + createSwDoc("tdf148799.docx"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); // check formula update @@ -1410,7 +1433,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf148799) CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf148849) { // load a document with a table and an empty paragraph before the table - SwDoc* pDoc = createSwDoc("tdf148849.fodt"); + createSwDoc("tdf148849.fodt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); // record changes @@ -1444,7 +1468,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf148849) CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf150576) { // load a document with a table and an empty paragraph before the table - SwDoc* pDoc = createSwDoc("tdf148849.fodt"); + createSwDoc("tdf148849.fodt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); // record changes @@ -1755,7 +1780,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf135623) CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf133490) { - SwDoc* pDoc = createSwDoc("tdf133490.odt"); + createSwDoc("tdf133490.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); @@ -1846,7 +1872,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf133490) CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf132637_protectTrackChanges) { - SwDoc* pDoc = createSwDoc("tdf132637_protectTrackChanges.doc"); + createSwDoc("tdf132637_protectTrackChanges.doc"); + SwDoc* pDoc = getSwDoc(); // The password should only prevent turning off track changes, not open as read-only CPPUNIT_ASSERT(!pDoc->GetDocShell()->IsReadOnly()); @@ -1854,7 +1881,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf132637_protectTrackChanges) CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf127652) { - SwDoc* pDoc = createSwDoc("tdf127652.odt"); + createSwDoc("tdf127652.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); // get a page cursor @@ -1894,7 +1922,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf127652) CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, AtPageTextBoxCrash) { // Load sample file - SwDoc* pDoc = createSwDoc("AtPageTextBoxCrash.odt"); + createSwDoc("AtPageTextBoxCrash.odt"); + SwDoc* pDoc = getSwDoc(); // Get the format of the shape const SwFrameFormats& rFrmFormats = *pDoc->GetSpzFrameFormats(); @@ -1982,7 +2011,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf133477) CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf137964) { - SwDoc* pDoc = createSwDoc("tdf137964.odt"); + createSwDoc("tdf137964.odt"); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); @@ -2262,8 +2292,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf136740) CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf128106) { - SwWrtShell* pWrtShell - = createSwDoc("cross_reference_demo_bmk.odt")->GetDocShell()->GetWrtShell(); + createSwDoc("cross_reference_demo_bmk.odt"); + SwWrtShell* pWrtShell = getSwDoc()->GetDocShell()->GetWrtShell(); utl::TempFileNamed tempDir(nullptr, true); @@ -2333,7 +2363,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf128106) CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf103612) { - SwDoc* const pGlobalDoc = createSwGlobalDoc("DUMMY.odm"); + createSwGlobalDoc("DUMMY.odm"); + SwDoc* pGlobalDoc = getSwDoc(); CPPUNIT_ASSERT_EQUAL( size_t(1), pGlobalDoc->getIDocumentLinksAdministration().GetLinkManager().GetLinks().size()); @@ -2361,7 +2392,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf103612) CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf97899) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SwPaM* pCursor = pDoc->GetEditShell()->GetCursor(); IDocumentContentOperations& rIDCO(pDoc->getIDocumentContentOperations()); diff --git a/sw/qa/extras/unowriter/unowriter.cxx b/sw/qa/extras/unowriter/unowriter.cxx index 931770282881..14ffc152d921 100644 --- a/sw/qa/extras/unowriter/unowriter.cxx +++ b/sw/qa/extras/unowriter/unowriter.cxx @@ -308,7 +308,7 @@ static bool ensureAutoTextExistsByName(const uno::Reference xAutoTextContainer = text::AutoTextContainer::create(comphelper::getProcessComponentContext()); @@ -376,7 +376,7 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testXAutoTextGroup) CPPUNIT_TEST_FIXTURE(SwUnoWriter, testSectionAnchorCopyTableAtStart) { // this contains a section that starts with a table - load("tdf134250.fodt"); + createSwDoc("tdf134250.fodt"); uno::Reference const xTextTablesSupplier(mxComponent, uno::UNO_QUERY); @@ -435,7 +435,7 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testSectionAnchorCopyTableAtStart) CPPUNIT_TEST_FIXTURE(SwUnoWriter, testSectionAnchorCopyTableAtEnd) { // this contains a section that ends with a table (plus another section) - load("tdf134252.fodt"); + createSwDoc("tdf134252.fodt"); uno::Reference const xTextTablesSupplier(mxComponent, uno::UNO_QUERY); @@ -498,7 +498,7 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testSectionAnchorCopyTableAtEnd) CPPUNIT_TEST_FIXTURE(SwUnoWriter, testSectionAnchorCopyTable) { // this contains a section that ends with a table (plus another section) - load("tdf134252_onlytable_protected.fodt"); + createSwDoc("tdf134252_onlytable_protected.fodt"); uno::Reference const xTextTablesSupplier(mxComponent, uno::UNO_QUERY); @@ -557,7 +557,7 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testSectionAnchorCopyTable) CPPUNIT_TEST_FIXTURE(SwUnoWriter, testTextRangeInTable) { - load("bookmarkintable.fodt"); + createSwDoc("bookmarkintable.fodt"); uno::Reference const xBS(mxComponent, uno::UNO_QUERY); uno::Reference const xMarks(xBS->getBookmarks()); @@ -726,7 +726,7 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testDeleteFlyAtCharAtStart) CPPUNIT_TEST_FIXTURE(SwUnoWriter, testSelectionInTableEnum) { - load("selection-in-table-enum.odt"); + createSwDoc("selection-in-table-enum.odt"); // Select the A1 cell's text. SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); @@ -760,7 +760,7 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testSelectionInTableEnum) CPPUNIT_TEST_FIXTURE(SwUnoWriter, testSelectionInTableEnumEnd) { - load("selection-in-table-enum.odt"); + createSwDoc("selection-in-table-enum.odt"); // Select from "Before" till the table end. SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); @@ -799,7 +799,7 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testSelectionInTableEnumEnd) CPPUNIT_TEST_FIXTURE(SwUnoWriter, testRenderablePagePosition) { - load("renderable-page-position.odt"); + createSwDoc("renderable-page-position.odt"); // Make sure that the document has 2 pages. uno::Reference xRenderable(mxComponent, uno::UNO_QUERY); CPPUNIT_ASSERT(mxComponent.is()); @@ -916,7 +916,7 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testPasteListener) CPPUNIT_TEST_FIXTURE(SwUnoWriter, testImageCommentAtChar) { // Load a document with an at-char image in it (and a comment on the image). - load("image-comment-at-char.odt"); + createSwDoc("image-comment-at-char.odt"); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); @@ -992,7 +992,7 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testChapterNumberingCharStyle) CPPUNIT_TEST_FIXTURE(SwUnoWriter, testViewCursorPageStyle) { // Load a document with 2 pages, but a single paragraph. - load("view-cursor-page-style.fodt"); + createSwDoc("view-cursor-page-style.fodt"); uno::Reference xModel(mxComponent, uno::UNO_QUERY); CPPUNIT_ASSERT(xModel.is()); uno::Reference xController(xModel->getCurrentController(), @@ -1072,7 +1072,7 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testTextConvertToTableLineSpacing) // Load a document which has a table with a single cell. // The cell has both a table style and a paragraph style, with different line spacing // heights. - load("table-line-spacing.docx"); + createSwDoc("table-line-spacing.docx"); uno::Reference xTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY); diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx index c5cdca760473..d1213f8230cf 100644 --- a/sw/qa/extras/ww8export/ww8export.cxx +++ b/sw/qa/extras/ww8export/ww8export.cxx @@ -1516,7 +1516,7 @@ CPPUNIT_TEST_FIXTURE(Test, testClearFramePams) CPPUNIT_TEST_FIXTURE(Test, testTdf94386) { - load("tdf94386.odt"); + createSwDoc("tdf94386.odt"); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx index f4eb995c8ab2..2618308e744b 100644 --- a/sw/qa/extras/ww8export/ww8export3.cxx +++ b/sw/qa/extras/ww8export/ww8export3.cxx @@ -190,7 +190,7 @@ DECLARE_WW8EXPORT_TEST(testGutterLeft, "gutter-left.doc") CPPUNIT_TEST_FIXTURE(Test, testGutterTop) { - load("gutter-top.doc"); + createSwDoc("gutter-top.doc"); reload(mpFilter, "gutter-top.doc"); uno::Reference xFactory(mxComponent, uno::UNO_QUERY); uno::Reference xSettings( @@ -863,7 +863,7 @@ CPPUNIT_TEST_FIXTURE(Test, testRtlGutter) }; // Given a document with RTL gutter, when loading it: - load("rtl-gutter.doc"); + createSwDoc("rtl-gutter.doc"); // Then make sure the section's gutter is still RTL: // Without the accompanying fix in place, this test would have failed as the SPRM was missing. verify(); @@ -1087,7 +1087,7 @@ CPPUNIT_TEST_FIXTURE(Test, testClearingBreak) // Given a document with a clearing break: // When loading that file: - load("clearing-break.doc"); + createSwDoc("clearing-break.doc"); // Then make sure that the clear property of the break is not ignored: verify(); reload(mpFilter, "clearing-break.doc"); diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx index cdf250e11a68..772df7a55a18 100644 --- a/sw/qa/extras/ww8import/ww8import.cxx +++ b/sw/qa/extras/ww8import/ww8import.cxx @@ -39,7 +39,7 @@ public: CPPUNIT_TEST_FIXTURE(Test, testFloatingTableSectionMargins) { - load("floating-table-section-margins.doc"); + createSwDoc("floating-table-section-margins.doc"); sal_Int32 pageLeft = parseDump("/root/page[2]/infos/bounds", "left").toInt32(); sal_Int32 pageWidth = parseDump("/root/page[2]/infos/bounds", "width").toInt32(); sal_Int32 tableLeft = parseDump("//tab/infos/bounds", "left").toInt32(); @@ -63,7 +63,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFloatingTableSectionMargins) CPPUNIT_TEST_FIXTURE(Test, testN816593) { - load("n816593.doc"); + createSwDoc("n816593.doc"); uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xIndexAccess(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); // Make sure that even if we import the two tables as non-floating, we @@ -73,7 +73,7 @@ CPPUNIT_TEST_FIXTURE(Test, testN816593) CPPUNIT_TEST_FIXTURE(Test, testBnc875715) { - load("bnc875715.doc"); + createSwDoc("bnc875715.doc"); uno::Reference xTextSectionsSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY); // Was incorrectly set as -1270. @@ -82,7 +82,7 @@ CPPUNIT_TEST_FIXTURE(Test, testBnc875715) CPPUNIT_TEST_FIXTURE(Test, testFloatingTableSectionColumns) { - load("floating-table-section-columns.doc"); + createSwDoc("floating-table-section-columns.doc"); OUString tableWidth = parseDump("/root/page[1]/body/section/column[2]/body/txt/anchored/fly/tab/infos/bounds", "width"); // table width was restricted by a column CPPUNIT_ASSERT( tableWidth.toInt32() > 10000 ); @@ -90,7 +90,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFloatingTableSectionColumns) CPPUNIT_TEST_FIXTURE(Test, testTdf124601) { - load("tdf124601.doc"); + createSwDoc("tdf124601.doc"); // Without the accompanying fix in place, this test would have failed, as the importer lost the // fLayoutInCell shape property for wrap-though shapes. CPPUNIT_ASSERT(getProperty(getShapeByName(u"Grafik 18"), "IsFollowingTextFlow")); @@ -99,7 +99,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf124601) CPPUNIT_TEST_FIXTURE(Test, testImageLazyRead) { - load("image-lazy-read.doc"); + createSwDoc("image-lazy-read.doc"); auto xGraphic = getProperty>(getShape(1), "Graphic"); Graphic aGraphic(xGraphic); // This failed, import loaded the graphic, it wasn't lazy-read. @@ -108,7 +108,7 @@ CPPUNIT_TEST_FIXTURE(Test, testImageLazyRead) CPPUNIT_TEST_FIXTURE(Test, testImageLazyRead0size) { - load("image-lazy-read-0size.doc"); + createSwDoc("image-lazy-read-0size.doc"); // Load a document with a single bitmap in it: it's declared as a WMF one, but actually a TGA // bitmap. SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); @@ -125,7 +125,7 @@ CPPUNIT_TEST_FIXTURE(Test, testImageLazyRead0size) CPPUNIT_TEST_FIXTURE(Test, testTdf106799) { - load("tdf106799.doc"); + createSwDoc("tdf106799.doc"); // Ensure that all text portions are calculated before testing. SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); @@ -149,7 +149,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf106799) CPPUNIT_TEST_FIXTURE(Test, testTdf121734) { - load("tdf121734.doc"); + createSwDoc("tdf121734.doc"); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); @@ -190,7 +190,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf121734) CPPUNIT_TEST_FIXTURE(Test, testTdf125281) { - load("tdf125281.doc"); + createSwDoc("tdf125281.doc"); #if !defined(_WIN32) // Windows fails with actual == 26171 for some reason; also lazy load isn't lazy in Windows // debug builds, reason is not known at the moment. @@ -216,7 +216,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf125281) CPPUNIT_TEST_FIXTURE(Test, testTdf122425_1) { - load("tdf122425_1.doc"); + createSwDoc("tdf122425_1.doc"); // This is for header text in case we use a hack for fixed-height headers // (see SwWW8ImplReader::Read_HdFtTextAsHackedFrame) SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); @@ -263,7 +263,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf122425_1) CPPUNIT_TEST_FIXTURE(Test, testTdf110987) { - load("tdf110987"); + createSwDoc("tdf110987"); // The input document is an empty .doc, but without file name // extension. Check that it was loaded as a normal .doc document, // and not a template. @@ -275,7 +275,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf110987) CPPUNIT_TEST_FIXTURE(Test, testTdf120761_zOrder) { - load("tdf120761_zOrder.dot"); + createSwDoc("tdf120761_zOrder.dot"); //The blue shape was covering everything (highest zorder = 2) instead of the lowest(0) uno::Reference xShape(getShapeByName(u"Picture 2"), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_uInt32(0), getProperty(xShape, "ZOrder")); @@ -283,7 +283,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf120761_zOrder) CPPUNIT_TEST_FIXTURE(Test, testTdf142003) { - load("changes-in-footnote.doc"); + createSwDoc("changes-in-footnote.doc"); SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); diff --git a/sw/qa/filter/html/html.cxx b/sw/qa/filter/html/html.cxx index 1726eab7e8c8..aeb38b8b3aa1 100644 --- a/sw/qa/filter/html/html.cxx +++ b/sw/qa/filter/html/html.cxx @@ -42,7 +42,7 @@ CPPUNIT_TEST_FIXTURE(Test, testEmptyParagraph) // Given a document with 2 paragraphs, the second is empty: setImportFilterOptions("xhtmlns=reqif-xhtml"); setImportFilterName("HTML (StarWriter)"); - load("empty-paragraph.xhtml"); + createSwDoc("empty-paragraph.xhtml"); // Then make sure that the resulting document has a 2nd empty paragraph: getParagraph(1, "a"); @@ -57,7 +57,7 @@ CPPUNIT_TEST_FIXTURE(Test, testRelativeKeepAspect) // Given a document with an OLE object, width set to 100%, height is not set: setImportFilterOptions("xhtmlns=reqif-xhtml"); setImportFilterName("HTML (StarWriter)"); - load("relative-keep-aspect.xhtml"); + createSwDoc("relative-keep-aspect.xhtml"); // Then make sure that the aspect ratio of the image is kept: auto pTextDocument = dynamic_cast(mxComponent.get()); @@ -78,7 +78,7 @@ CPPUNIT_TEST_FIXTURE(Test, testRelativeKeepAspectImage) // Given a document with an image, width set to 100%, height is not set: setImportFilterOptions("xhtmlns=reqif-xhtml"); setImportFilterName("HTML (StarWriter)"); - load("relative-keep-aspect-image.xhtml"); + createSwDoc("relative-keep-aspect-image.xhtml"); // Then make sure that the aspect ratio of the image is kept: auto pTextDocument = dynamic_cast(mxComponent.get()); diff --git a/sw/qa/inc/swmodeltestbase.hxx b/sw/qa/inc/swmodeltestbase.hxx index 87ae9b498ff1..d478902afdd9 100644 --- a/sw/qa/inc/swmodeltestbase.hxx +++ b/sw/qa/inc/swmodeltestbase.hxx @@ -296,12 +296,6 @@ protected: void header(); - void load(const char* pName, const char* pPassword = nullptr) - { - return loadURL(createFileURL(OUString::createFromAscii(pName)), pName, pPassword); - - } - void reload(const char* pFilter, const char* pName, const char* pPassword = nullptr); /// Save the loaded document to a tempfile. Can be used to check the resulting docx/odt directly as a ZIP file. @@ -337,20 +331,21 @@ protected: * Creates a new document to be used with the internal sw/ API. * * Examples: - * SwDoc* pDoc = createSwDoc(); - * SwDoc* pDoc = createSwDoc("test.fodt"); + * createSwDoc(); + * createSwDoc("test.fodt"); + * createSwDoc("test.fodt", "test"); */ - SwDoc* createSwDoc(const char* pName = nullptr); + void createSwDoc(const char* pName = nullptr, const char* pPassword = nullptr); /** * As createSwDoc except a Web Document in Browse Mode */ - SwDoc* createSwWebDoc(const char* pName = nullptr); + void createSwWebDoc(const char* pName = nullptr); /** * As createSwDoc except a Global Document */ - SwDoc* createSwGlobalDoc(const char* pName = nullptr); + void createSwGlobalDoc(const char* pName = nullptr); /** * Gets SwXTextDocument from loaded component @@ -375,6 +370,11 @@ private: void loadURL(OUString const& rURL, const char* pName, const char* pPassword); + void load(const char* pName, const char* pPassword = nullptr) + { + return loadURL(createFileURL(OUString::createFromAscii(pName)), pName, pPassword); + + } }; /** diff --git a/sw/qa/uibase/dochdl/dochdl.cxx b/sw/qa/uibase/dochdl/dochdl.cxx index 579bc5d84058..95314b48be1f 100644 --- a/sw/qa/uibase/dochdl/dochdl.cxx +++ b/sw/qa/uibase/dochdl/dochdl.cxx @@ -27,7 +27,8 @@ class SwUibaseDochdlTest : public SwModelTestBase CPPUNIT_TEST_FIXTURE(SwUibaseDochdlTest, testSelectPasteFormat) { // Create a new document and cut a character. - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwDocShell* pDocShell = pDoc->GetDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); pWrtShell->Insert2("x"); @@ -53,7 +54,8 @@ CPPUNIT_TEST_FIXTURE(SwUibaseDochdlTest, testSelectPasteFormat) CPPUNIT_TEST_FIXTURE(SwUibaseDochdlTest, testComplexSelection) { // Given a document where a text node has hints, but no as-char images. - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwDocShell* pDocShell = pDoc->GetDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); pWrtShell->Insert2("abc"); diff --git a/sw/qa/uibase/docvw/docvw.cxx b/sw/qa/uibase/docvw/docvw.cxx index 3ec8027c8468..677a5abd2a54 100644 --- a/sw/qa/uibase/docvw/docvw.cxx +++ b/sw/qa/uibase/docvw/docvw.cxx @@ -31,7 +31,8 @@ class Test : public SwModelTestBase CPPUNIT_TEST_FIXTURE(Test, testShiftClickOnImage) { // Given a document with a fly frame: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); uno::Reference xMSF(mxComponent, uno::UNO_QUERY); uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); @@ -140,7 +141,8 @@ int GraphicDialogInterceptor::GetGraphicDialogs() const { return m_nGraphicDialo CPPUNIT_TEST_FIXTURE(Test, testShiftDoubleClickOnImage) { // Given a document with a fly frame, and an interceptor to catch the graphic dialog: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); uno::Reference xMSF(mxComponent, uno::UNO_QUERY); uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); diff --git a/sw/qa/uibase/fldui/fldui.cxx b/sw/qa/uibase/fldui/fldui.cxx index 28f491e95f78..65e945fa61ab 100644 --- a/sw/qa/uibase/fldui/fldui.cxx +++ b/sw/qa/uibase/fldui/fldui.cxx @@ -32,7 +32,8 @@ class Test : public SwModelTestBase CPPUNIT_TEST_FIXTURE(Test, testBiblioPageNumberUpdate) { // Given a document with 2 biblio fields, same properties, but different page number in the URL: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); uno::Reference xFactory(mxComponent, uno::UNO_QUERY); uno::Reference xField( xFactory->createInstance("com.sun.star.text.TextField.Bibliography"), uno::UNO_QUERY); diff --git a/sw/qa/uibase/frmdlg/frmdlg.cxx b/sw/qa/uibase/frmdlg/frmdlg.cxx index b16728cf2ecc..f6b7653de824 100644 --- a/sw/qa/uibase/frmdlg/frmdlg.cxx +++ b/sw/qa/uibase/frmdlg/frmdlg.cxx @@ -26,7 +26,7 @@ public: CPPUNIT_TEST_FIXTURE(SwUibaseFrmdlgTest, testWrappedMathObject) { // The document includes a Math object with explicit wrapping. - load("wrapped-math-object.docx"); + createSwDoc("wrapped-math-object.docx"); uno::Reference xMath = getShape(1); // Without the accompanying fix in place, this test would have failed with: diff --git a/sw/qa/uibase/shells/shells.cxx b/sw/qa/uibase/shells/shells.cxx index 2f91ba4f8b38..55b388860adc 100644 --- a/sw/qa/uibase/shells/shells.cxx +++ b/sw/qa/uibase/shells/shells.cxx @@ -47,7 +47,8 @@ public: CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testTdf130179) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); IDocumentContentOperations& rIDCO = pDoc->getIDocumentContentOperations(); SwCursorShell* pShell(pDoc->GetEditShell()); SfxItemSet aFrameSet(pDoc->GetAttrPool(), svl::Items); @@ -78,7 +79,8 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testShapeTextAlignment) // FIXME find out why this fails on macOS/Windows #if !defined(MACOSX) && !defined(_WIN32) // Create a document with a rectangle in it. - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); Point aStartPos(1000, 1000); pWrtShell->BeginCreate(SdrObjKind::Rectangle, aStartPos); @@ -119,7 +121,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testOleSavePreviewUpdate) { // Load a document with 2 charts in it. The second is down enough that you have to scroll to // trigger its rendering. Previews are missing for both. - load("ole-save-preview-update.odt"); + createSwDoc("ole-save-preview-update.odt"); // Explicitly update OLE previews, etc. dispatchCommand(mxComponent, ".uno:UpdateAll", {}); @@ -140,7 +142,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testOleSavePreviewUpdate) CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testOlePreviewUpdate) { // Given a document with an embedded Writer object: - load("ole-preview-update.odt"); + createSwDoc("ole-preview-update.odt"); // When updating "all" (including OLE previews): dispatchCommand(mxComponent, ".uno:UpdateAll", {}); @@ -162,7 +164,8 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testOlePreviewUpdate) CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testBibliographyUrlContextMenu) { // Given a document with a bibliography field: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); uno::Reference xFactory(mxComponent, uno::UNO_QUERY); uno::Reference xField( xFactory->createInstance("com.sun.star.text.TextField.Bibliography"), uno::UNO_QUERY); @@ -199,7 +202,8 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testBibliographyUrlContextMenu) CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testBibliographyLocalCopyContextMenu) { // Given a document with a bibliography field's local copy: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); uno::Reference xFactory(mxComponent, uno::UNO_QUERY); uno::Reference xField( xFactory->createInstance("com.sun.star.text.TextField.Bibliography"), uno::UNO_QUERY); @@ -237,7 +241,8 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testBibliographyLocalCopyContextMenu) CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testContentControlPageBreak) { // Given a document with a content control and a cursor inside the content control: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); uno::Reference xMSF(mxComponent, uno::UNO_QUERY); uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference xText = xTextDocument->getText(); diff --git a/sw/qa/uibase/uiview/uiview.cxx b/sw/qa/uibase/uiview/uiview.cxx index 4dfae7772b26..348574b13f85 100644 --- a/sw/qa/uibase/uiview/uiview.cxx +++ b/sw/qa/uibase/uiview/uiview.cxx @@ -237,7 +237,8 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUiviewTest, testSwitchBetweenImages) { // Given a document with 2 images, and an interceptor catching an UNO command that specific to // the current selection: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); uno::Reference xMSF(mxComponent, uno::UNO_QUERY); uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); diff --git a/sw/qa/uibase/uno/uno.cxx b/sw/qa/uibase/uno/uno.cxx index 0535bb27c8f4..a1484b1ce629 100644 --- a/sw/qa/uibase/uno/uno.cxx +++ b/sw/qa/uibase/uno/uno.cxx @@ -48,7 +48,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testLockControllers) CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testCondFieldCachedValue) { - load("cond-field-cached-value.docx"); + createSwDoc("cond-field-cached-value.docx"); Scheduler::ProcessEventsToIdle(); // Without the accompanying fix in place, this test would have failed with: @@ -61,7 +61,8 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testCondFieldCachedValue) CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testCreateTextRangeByPixelPosition) { // Given a document with 2 characters, and the pixel position of the point between them: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwDocShell* pDocShell = pDoc->GetDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); pWrtShell->Insert2("AZ"); diff --git a/sw/qa/uibase/wrtsh/wrtsh.cxx b/sw/qa/uibase/wrtsh/wrtsh.cxx index e40f641e706a..d44cb23ce190 100644 --- a/sw/qa/uibase/wrtsh/wrtsh.cxx +++ b/sw/qa/uibase/wrtsh/wrtsh.cxx @@ -37,7 +37,8 @@ class Test : public SwModelTestBase CPPUNIT_TEST_FIXTURE(Test, testInsertLineBreak) { // Given an empty document: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); // When inserting a clearing break: SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); @@ -60,7 +61,8 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertLineBreak) CPPUNIT_TEST_FIXTURE(Test, testGotoContentControl) { // Given a document with a content control: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); uno::Reference xMSF(mxComponent, uno::UNO_QUERY); uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference xText = xTextDocument->getText(); @@ -96,7 +98,8 @@ CPPUNIT_TEST_FIXTURE(Test, testGotoContentControl) CPPUNIT_TEST_FIXTURE(Test, testTickCheckboxContentControl) { // Given a document with a checkbox (checked) content control: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); uno::Reference xMSF(mxComponent, uno::UNO_QUERY); uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference xText = xTextDocument->getText(); @@ -133,7 +136,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTickCheckboxContentControl) CPPUNIT_TEST_FIXTURE(Test, testInsertContentControl) { // Given an empty document: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); // When inserting a content control: SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); @@ -149,7 +153,8 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertContentControl) CPPUNIT_TEST_FIXTURE(Test, testInsertCheckboxContentControl) { // Given an empty document: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); // When inserting a content control: SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); @@ -170,7 +175,8 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertCheckboxContentControl) CPPUNIT_TEST_FIXTURE(Test, testSelectDropdownContentControl) { // Given a document with a dropdown content control: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); uno::Reference xMSF(mxComponent, uno::UNO_QUERY); uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference xText = xTextDocument->getText(); @@ -221,7 +227,8 @@ CPPUNIT_TEST_FIXTURE(Test, testSelectDropdownContentControl) CPPUNIT_TEST_FIXTURE(Test, testInsertDropdownContentControl) { // Given an empty document: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); // When inserting a content control: SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); @@ -244,7 +251,8 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertDropdownContentControl) CPPUNIT_TEST_FIXTURE(Test, testReplacePictureContentControl) { // Given a document with a picture content control: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); uno::Reference xMSF(mxComponent, uno::UNO_QUERY); uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference xText = xTextDocument->getText(); @@ -289,7 +297,8 @@ CPPUNIT_TEST_FIXTURE(Test, testReplacePictureContentControl) CPPUNIT_TEST_FIXTURE(Test, testInsertPictureContentControl) { // Given an empty document: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); // When inserting a content control: SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); @@ -311,7 +320,8 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertPictureContentControl) CPPUNIT_TEST_FIXTURE(Test, testSelectDateContentControl) { // Given a document with a date content control: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); uno::Reference xMSF(mxComponent, uno::UNO_QUERY); uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference xText = xTextDocument->getText(); @@ -350,7 +360,8 @@ CPPUNIT_TEST_FIXTURE(Test, testSelectDateContentControl) CPPUNIT_TEST_FIXTURE(Test, testInsertDateContentControl) { // Given an empty document: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); // When inserting a date content control: SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); @@ -371,7 +382,8 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertDateContentControl) CPPUNIT_TEST_FIXTURE(Test, testInsertPlainTextContentControl) { // Given an empty document: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); // When inserting a plain text content control: SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); @@ -392,7 +404,8 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertPlainTextContentControl) CPPUNIT_TEST_FIXTURE(Test, testInsertComboBoxContentControl) { // Given an empty document: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); // When inserting a combo box content control: dispatchCommand(mxComponent, ".uno:InsertComboBoxContentControl", {}); diff --git a/sw/qa/unit/swmodeltestbase.cxx b/sw/qa/unit/swmodeltestbase.cxx index b619b7e69779..e132efc9b3b8 100644 --- a/sw/qa/unit/swmodeltestbase.cxx +++ b/sw/qa/unit/swmodeltestbase.cxx @@ -608,20 +608,18 @@ void SwModelTestBase::registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx) BAD_CAST("http://www.w3.org/1999/xhtml")); } -SwDoc* SwModelTestBase::createSwDoc(const char* pName) +void SwModelTestBase::createSwDoc(const char* pName, const char* pPassword) { if (!pName) loadURL("private:factory/swriter", pName, nullptr); else - load(pName); + load(pName, pPassword); uno::Reference xServiceInfo(mxComponent, uno::UNO_QUERY); CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.text.TextDocument")); - - return getSwDoc(); } -SwDoc* SwModelTestBase::createSwWebDoc(const char* pName) +void SwModelTestBase::createSwWebDoc(const char* pName) { if (!pName) loadURL("private:factory/swriter/web", pName, nullptr); @@ -630,11 +628,9 @@ SwDoc* SwModelTestBase::createSwWebDoc(const char* pName) uno::Reference xServiceInfo(mxComponent, uno::UNO_QUERY); CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.text.WebDocument")); - - return getSwDoc(); } -SwDoc* SwModelTestBase::createSwGlobalDoc(const char* pName) +void SwModelTestBase::createSwGlobalDoc(const char* pName) { if (!pName) loadURL("private:factory/swriter/GlobalDocument", pName, nullptr); @@ -643,8 +639,6 @@ SwDoc* SwModelTestBase::createSwGlobalDoc(const char* pName) uno::Reference xServiceInfo(mxComponent, uno::UNO_QUERY); CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.text.GlobalDocument")); - - return getSwDoc(); } SwXTextDocument& SwModelTestBase::getSwXTextDocument() -- cgit v1.2.3