sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx | 31 - sw/qa/core/attr/attr.cxx | 9 sw/qa/core/crsr/crsr.cxx | 9 sw/qa/core/doc/doc.cxx | 23 - sw/qa/core/docnode/docnode.cxx | 11 sw/qa/core/draw/draw.cxx | 28 - sw/qa/core/edit/edit.cxx | 9 sw/qa/core/fields/fields.cxx | 11 sw/qa/core/frmedt/frmedt.cxx | 11 sw/qa/core/layout/layout.cxx | 58 +-- sw/qa/core/objectpositioning/objectpositioning.cxx | 15 sw/qa/core/text/text.cxx | 36 +- sw/qa/core/txtnode/txtnode.cxx | 17 sw/qa/core/undo/undo.cxx | 13 sw/qa/core/unocore/unocore.cxx | 20 - sw/qa/core/view/view.cxx | 9 sw/qa/extras/htmlexport/htmlexport.cxx | 67 +-- sw/qa/extras/htmlimport/htmlimport.cxx | 51 +- sw/qa/extras/indexing/IndexingExportTest.cxx | 16 sw/qa/extras/indexing/SearchResultLocatorTest.cxx | 10 sw/qa/extras/layout/layout.cxx | 265 ++++++--------- sw/qa/extras/layout/layout2.cxx | 204 +++++------ sw/qa/extras/mailmerge/mailmerge.cxx | 6 sw/qa/extras/mailmerge/mailmerge2.cxx | 6 sw/qa/extras/odfexport/odfexport.cxx | 2 sw/qa/extras/odfexport/odfexport2.cxx | 4 sw/qa/extras/odfimport/odffeatures.cxx | 16 sw/qa/extras/odfimport/odfimport.cxx | 161 ++++----- sw/qa/extras/ooxmlexport/ooxmlexport10.cxx | 2 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 32 - sw/qa/extras/ooxmlexport/ooxmlexport15.cxx | 4 sw/qa/extras/ooxmlexport/ooxmlexport16.cxx | 16 sw/qa/extras/ooxmlexport/ooxmlexport17.cxx | 8 sw/qa/extras/ooxmlexport/ooxmlexport18.cxx | 10 sw/qa/extras/ooxmlexport/ooxmlexport4.cxx | 4 sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx | 13 sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 191 +++++----- 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 | 191 +++++----- sw/qa/extras/tiledrendering/tiledrendering.cxx | 7 sw/qa/extras/txtimport/txtimport.cxx | 16 sw/qa/extras/uiwriter/uiwriter.cxx | 59 +-- sw/qa/extras/uiwriter/uiwriter2.cxx | 118 +++--- sw/qa/extras/uiwriter/uiwriter3.cxx | 140 +++---- sw/qa/extras/uiwriter/uiwriter4.cxx | 90 ++--- sw/qa/extras/uiwriter/uiwriter5.cxx | 127 +++---- sw/qa/extras/uiwriter/uiwriter6.cxx | 113 +++--- sw/qa/extras/uiwriter/uiwriter7.cxx | 48 +- sw/qa/extras/uiwriter/uiwriter8.cxx | 84 ++-- sw/qa/extras/unowriter/unowriter.cxx | 35 - 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/filter/ww8/ww8.cxx | 9 sw/qa/inc/swmodeltestbase.hxx | 23 - sw/qa/uibase/frmdlg/frmdlg.cxx | 12 sw/qa/uibase/shells/shells.cxx | 11 sw/qa/uibase/uiview/uiview.cxx | 19 - sw/qa/uibase/uno/uno.cxx | 9 sw/qa/unit/swmodeltestbase.cxx | 28 - 66 files changed, 1332 insertions(+), 1387 deletions(-)
New commits: commit c44f64621fe11d6a46c79b9793c7c67c60bb66e8 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Fri Nov 4 10:45:08 2022 +0100 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Fri Nov 4 17:14:38 2022 +0100 SwModelTestBase: make mpTestDocumentPath private in preparation for future inheritance from UnoApiTest Change-Id: Ie5dee5af3609d8490d7d7bad0d6dbc4c8fc17bb9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142280 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx index b7561ad01764..cc8b3742be74 100644 --- a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx +++ b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx @@ -10,15 +10,18 @@ #include <swmodeltestbase.hxx> #include <AccessibilityCheck.hxx> -constexpr OUStringLiteral DATA_DIRECTORY = u"/sw/qa/core/accessibilitycheck/data/"; - class AccessibilityCheckTest : public SwModelTestBase { +public: + AccessibilityCheckTest() + : SwModelTestBase("/sw/qa/core/accessibilitycheck/data/") + { + } }; CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckDocumentIssues) { - SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "DocumentTest.odt"); + SwDoc* pDoc = createSwDoc("DocumentTest.odt"); CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); @@ -30,7 +33,7 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckDocumentIssues) CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testTableSplitMergeAndAltText) { - SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "AccessibilityTests1.odt"); + SwDoc* pDoc = createSwDoc("AccessibilityTests1.odt"); CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); @@ -50,7 +53,7 @@ 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(DATA_DIRECTORY, "ParagraphTest.odt"); + SwDoc* pDoc = createSwDoc("ParagraphTest.odt"); CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); @@ -61,7 +64,7 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckParagraphIssues) CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckBackgroundImage) { - SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "BackgroundImageTest.odt"); + SwDoc* pDoc = createSwDoc("BackgroundImageTest.odt"); CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); @@ -72,7 +75,7 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckBackgroundImage) CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckNewlineSpace) { - SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "NewlineTest.odt"); + SwDoc* pDoc = createSwDoc("NewlineTest.odt"); CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); @@ -84,7 +87,7 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckNewlineSpace) CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckSpacebarSpace) { - SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "SpaceTest.odt"); + SwDoc* pDoc = createSwDoc("SpaceTest.odt"); CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); @@ -95,7 +98,7 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckSpacebarSpace) CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testHyperlinks) { - SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "HyperlinkTest.odt"); + SwDoc* pDoc = createSwDoc("HyperlinkTest.odt"); CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); @@ -107,7 +110,7 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testHyperlinks) CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckHighlightedText) { - SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "HighlightTest.odt"); + SwDoc* pDoc = createSwDoc("HighlightTest.odt"); CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); @@ -118,7 +121,7 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckHighlightedText) CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testNumberingCheck) { - SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "AccessibilityTests_NumberingCheck.odt"); + SwDoc* pDoc = createSwDoc("AccessibilityTests_NumberingCheck.odt"); CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); @@ -133,7 +136,7 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testNumberingCheck) CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckFakeFootnote) { - SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "FakeFootnoteTest.odt"); + SwDoc* pDoc = createSwDoc("FakeFootnoteTest.odt"); CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); @@ -145,7 +148,7 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckFakeFootnote) CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckFakeCaption) { - SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "FakeCaptionTest.odt"); + SwDoc* pDoc = createSwDoc("FakeCaptionTest.odt"); CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); @@ -156,7 +159,7 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckFakeCaption) CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckTableFormatting) { - SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "TableFormattingTest.odt"); + SwDoc* pDoc = createSwDoc("TableFormattingTest.odt"); 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 0df9d9ef0451..0b60c1424092 100644 --- a/sw/qa/core/attr/attr.cxx +++ b/sw/qa/core/attr/attr.cxx @@ -15,17 +15,20 @@ namespace { -constexpr OUStringLiteral DATA_DIRECTORY = u"/sw/qa/core/attr/data/"; - /// Covers sw/source/core/attr/ fixes. class Test : public SwModelTestBase { +public: + Test() + : SwModelTestBase("/sw/qa/core/attr/data/") + { + } }; CPPUNIT_TEST_FIXTURE(Test, testSwAttrSet) { // Given a document with track changes and the whole document is selected: - SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "attr-set.docx"); + SwDoc* pDoc = createSwDoc("attr-set.docx"); 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 eba0ac114b47..eec0f9a42c31 100644 --- a/sw/qa/core/crsr/crsr.cxx +++ b/sw/qa/core/crsr/crsr.cxx @@ -27,11 +27,14 @@ #include <ndtxt.hxx> #include <formatcontentcontrol.hxx> -constexpr OUStringLiteral DATA_DIRECTORY = u"/sw/qa/core/crsr/data/"; - /// Covers sw/source/core/crsr/ fixes. class SwCoreCrsrTest : public SwModelTestBase { +public: + SwCoreCrsrTest() + : SwModelTestBase("/sw/qa/core/crsr/data/") + { + } }; CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testFindReplace) @@ -87,7 +90,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testFindReplace) CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testSelAllStartsWithTable) { - load(DATA_DIRECTORY, "sel-all-starts-with-table.odt"); + load("sel-all-starts-with-table.odt"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwDocShell* pDocShell = pTextDoc->GetDocShell(); SwDoc* pDoc = pDocShell->GetDoc(); diff --git a/sw/qa/core/doc/doc.cxx b/sw/qa/core/doc/doc.cxx index 4a7324e7905f..67523084d9f7 100644 --- a/sw/qa/core/doc/doc.cxx +++ b/sw/qa/core/doc/doc.cxx @@ -36,11 +36,14 @@ #include <UndoManager.hxx> #include <IDocumentRedlineAccess.hxx> -constexpr OUStringLiteral DATA_DIRECTORY = u"/sw/qa/core/doc/data/"; - /// Covers sw/source/core/doc/ fixes. class SwCoreDocTest : public SwModelTestBase { +public: + SwCoreDocTest() + : SwModelTestBase("/sw/qa/core/doc/data/") + { + } }; CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testMathInsertAnchorType) @@ -69,7 +72,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testMathInsertAnchorType) CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testTextboxTextRotateAngle) { // Check the writing direction of the only TextFrame in the document. - SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "textbox-textrotateangle.odt"); + SwDoc* pDoc = createSwDoc("textbox-textrotateangle.odt"); SwFrameFormats& rFrameFormats = *pDoc->GetSpzFrameFormats(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), rFrameFormats.size()); CPPUNIT_ASSERT_EQUAL(o3tl::narrowing<sal_uInt16>(RES_DRAWFRMFMT), rFrameFormats[0]->Which()); @@ -87,7 +90,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testTextboxTextRotateAngle) CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testNumDownIndent) { - SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "num-down-indent.docx"); + SwDoc* pDoc = createSwDoc("num-down-indent.docx"); SwDocShell* pDocShell = pDoc->GetDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); pWrtShell->Down(/*bSelect=*/false); @@ -106,7 +109,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testNumDownIndent) CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testLocaleIndependentTemplate) { - SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "locale-independent-template.odt"); + SwDoc* pDoc = createSwDoc("locale-independent-template.odt"); SwDocShell* pDocShell = pDoc->GetDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); SfxItemSet aSet(pWrtShell->GetAttrPool(), svl::Items<RES_CHRATR_LANGUAGE, RES_CHRATR_LANGUAGE>); @@ -126,7 +129,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testLocaleIndependentTemplate) CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testTextBoxZOrder) { - SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "textbox-zorder.docx"); + SwDoc* pDoc = createSwDoc("textbox-zorder.docx"); SwFrameFormats& rFormats = *pDoc->GetSpzFrameFormats(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), rFormats.size()); const SwFrameFormat* pEllipse = rFormats[2]; @@ -143,7 +146,7 @@ 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(DATA_DIRECTORY, "textbox-makeflyframe.docx"); + SwDoc* pDoc = createSwDoc("textbox-makeflyframe.docx"); // When cutting the textbox and pasting it to a new document: SwView* pView = pDoc->GetDocShell()->GetView(); @@ -262,7 +265,7 @@ 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(DATA_DIRECTORY, "copy-bookmarks.docx"); + SwDoc* pDoc = createSwDoc("copy-bookmarks.docx"); // When checking the # of non-copy bookmarks in the resulting doc model: sal_Int32 nActual = 0; @@ -417,7 +420,7 @@ 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(DATA_DIRECTORY, "bookmark-delete-redline.doc"); + SwDoc* pDoc = createSwDoc("bookmark-delete-redline.doc"); // 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 @@ -432,7 +435,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testHeaderFooterDelete) // Then make sure that we don't crash: // Without the accompanying fix in place, this test would have crashed, an invalidated iterator // was used in sw::mark::MarkManager::deleteMarks(). - createSwDoc(DATA_DIRECTORY, "header-footer-delete.docx"); + createSwDoc("header-footer-delete.docx"); } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/qa/core/docnode/docnode.cxx b/sw/qa/core/docnode/docnode.cxx index 4967b95d955d..12363e756f12 100644 --- a/sw/qa/core/docnode/docnode.cxx +++ b/sw/qa/core/docnode/docnode.cxx @@ -14,18 +14,21 @@ #include <doc.hxx> #include <docary.hxx> -constexpr OUStringLiteral DATA_DIRECTORY = u"/sw/qa/core/docnode/data/"; - /// Covers sw/source/core/docnode/ fixes. class Test : public SwModelTestBase { +public: + Test() + : SwModelTestBase("/sw/qa/core/docnode/data/") + { + } }; 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(DATA_DIRECTORY, "redline-ends-before-toc.docx"); + SwDoc* pDoc = createSwDoc("redline-ends-before-toc.docx"); 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. @@ -38,7 +41,7 @@ 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(DATA_DIRECTORY, "tdf150086.docx"); + SwDoc* pDoc = createSwDoc("tdf150086.docx"); const SwRedlineTable& rTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable(); CPPUNIT_ASSERT_EQUAL(static_cast<SwRedlineTable::size_type>(8), rTable.size()); diff --git a/sw/qa/core/draw/draw.cxx b/sw/qa/core/draw/draw.cxx index 25f7e1bd442d..799400c85ee9 100644 --- a/sw/qa/core/draw/draw.cxx +++ b/sw/qa/core/draw/draw.cxx @@ -23,17 +23,20 @@ #include <com/sun/star/table/BorderLine2.hpp> #include <com/sun/star/text/XTextFramesSupplier.hpp> -constexpr OUStringLiteral DATA_DIRECTORY = u"/sw/qa/core/draw/data/"; - /// Covers sw/source/core/draw/ fixes. class SwCoreDrawTest : public SwModelTestBase { +public: + SwCoreDrawTest() + : SwModelTestBase("/sw/qa/core/draw/data/") + { + } }; 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(DATA_DIRECTORY, "as-char-textbox.docx"); + SwDoc* pDoc = createSwDoc("as-char-textbox.docx"); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); sal_Int32 nActual = pPage->GetObjCount(); @@ -59,7 +62,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreDrawTest, testTextboxUndoOrdNum) // - picture // - draw format + fly format and a picture in it // - picture - SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "textbox-undo-ordnum.docx"); + SwDoc* pDoc = createSwDoc("textbox-undo-ordnum.docx"); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); const SwFrameFormats& rFormats = *pDoc->GetSpzFrameFormats(); // Test the state before del + undo. @@ -106,17 +109,10 @@ CPPUNIT_TEST_FIXTURE(SwCoreDrawTest, testTextboxUndoOrdNum) CPPUNIT_TEST_FIXTURE(SwCoreDrawTest, testTdf107727FrameBorder) { // Load a document with a textframe without border, one with only left border - OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf107727_FrameBorder.odt"; - mxComponent = loadFromDesktop(aURL, "com.sun.star.text.TextDocument", {}); + load("tdf107727_FrameBorder.odt"); // Export to RTF and reload - uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); - utl::TempFileNamed aTempFile; - aTempFile.EnableKillingFile(); - utl::MediaDescriptor aMediaDescriptor; - aMediaDescriptor["FilterName"] <<= OUString("Rich Text Format"); - xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); - mxComponent = loadFromDesktop(aTempFile.GetURL(), "com.sun.star.text.TextDocument", {}); + reload("Rich Text Format", nullptr); // Get frame without border and inspect it. uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY); @@ -144,12 +140,10 @@ CPPUNIT_TEST_FIXTURE(SwCoreDrawTest, testTdf107727FrameBorder) CPPUNIT_TEST_FIXTURE(SwCoreDrawTest, testSdtTextboxHeader) { // Given a 2 page document, same header on both pages, content control in the header and - // shape+fly pair (textbox) anchored in the same header: - OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "sdt-textbox-header.docx"; - + // 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: - mxComponent = loadFromDesktop(aURL, "com.sun.star.text.TextDocument", {}); + load("sdt-textbox-header.docx"); } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/qa/core/edit/edit.cxx b/sw/qa/core/edit/edit.cxx index 9f0b3d4dd62b..9edbdb8ceb6e 100644 --- a/sw/qa/core/edit/edit.cxx +++ b/sw/qa/core/edit/edit.cxx @@ -13,20 +13,23 @@ #include <view.hxx> #include <wrtsh.hxx> -constexpr OUStringLiteral DATA_DIRECTORY = u"/sw/qa/core/edit/data/"; - namespace { /// Covers sw/source/core/edit/ fixes. class Test : public SwModelTestBase { +public: + Test() + : SwModelTestBase("/sw/qa/core/edit/data/") + { + } }; } CPPUNIT_TEST_FIXTURE(Test, testRedlineHidden) { // Given a document with ShowRedlineChanges=false: - SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "redline-hidden.fodt"); + SwDoc* pDoc = createSwDoc("redline-hidden.fodt"); // 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 6875b1b2c1ae..b9e4e28287a2 100644 --- a/sw/qa/core/fields/fields.cxx +++ b/sw/qa/core/fields/fields.cxx @@ -26,10 +26,13 @@ namespace /// Covers sw/source/core/fields/ fixes. class Test : public SwModelTestBase { +public: + Test() + : SwModelTestBase("/sw/qa/core/fields/data/") + { + } }; -constexpr OUStringLiteral DATA_DIRECTORY = u"/sw/qa/core/fields/data/"; - CPPUNIT_TEST_FIXTURE(Test, testAuthorityTooltip) { // Create a document with a bibliography reference in it. @@ -69,7 +72,7 @@ CPPUNIT_TEST_FIXTURE(Test, testAuthorityTooltip) CPPUNIT_TEST_FIXTURE(Test, testTdf143424) { - createSwDoc(DATA_DIRECTORY, "tdf143424.odt"); + createSwDoc("tdf143424.odt"); uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XEnumerationAccess> xFieldsAccess( @@ -97,7 +100,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf143424) CPPUNIT_TEST_FIXTURE(Test, testChapterFieldsFollowedBy) { - createSwDoc(DATA_DIRECTORY, "chapter_field_followedby.odt"); + createSwDoc("chapter_field_followedby.odt"); uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XEnumerationAccess> xFieldsAccess( diff --git a/sw/qa/core/frmedt/frmedt.cxx b/sw/qa/core/frmedt/frmedt.cxx index e6fd394b81fa..86f19a0ae17d 100644 --- a/sw/qa/core/frmedt/frmedt.cxx +++ b/sw/qa/core/frmedt/frmedt.cxx @@ -24,17 +24,20 @@ #include <docsh.hxx> #include <swdtflvr.hxx> -constexpr OUStringLiteral DATA_DIRECTORY = u"/sw/qa/core/frmedt/data/"; - /// Covers sw/source/core/frmedt/ fixes. class SwCoreFrmedtTest : public SwModelTestBase { +public: + SwCoreFrmedtTest() + : SwModelTestBase("/sw/qa/core/frmedt/data/") + { + } }; CPPUNIT_TEST_FIXTURE(SwCoreFrmedtTest, testTextboxReanchor) { // Load a document with a textframe and a textbox(shape+textframe). - load(DATA_DIRECTORY, "textbox-reanchor.odt"); + load("textbox-reanchor.odt"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); SdrPage* pDrawPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); @@ -111,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(DATA_DIRECTORY, "paste-fly-in-textbox.docx"); + load("paste-fly-in-textbox.docx"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwDocShell* pDocShell = pTextDoc->GetDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx index d75157f2b860..d6763199e76c 100644 --- a/sw/qa/core/layout/layout.cxx +++ b/sw/qa/core/layout/layout.cxx @@ -24,18 +24,21 @@ #include <IDocumentLayoutAccess.hxx> #include <rootfrm.hxx> -constexpr OUStringLiteral DATA_DIRECTORY = u"/sw/qa/core/layout/data/"; - /// Covers sw/source/core/layout/ fixes. class SwCoreLayoutTest : public SwModelTestBase { +public: + SwCoreLayoutTest() + : SwModelTestBase("/sw/qa/core/layout/data/") + { + } }; 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(DATA_DIRECTORY, "table-fly-overlap.docx"); + load("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; @@ -54,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(DATA_DIRECTORY, "tdf128195.docx"); + load("tdf128195.docx"); sal_Int32 nTxtHeight = parseDump("//header/txt[2]/infos/bounds", "height").toInt32(); sal_Int32 nTxtBottom = parseDump("//header/txt[2]/infos/bounds", "bottom").toInt32(); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2269), nTxtHeight); @@ -64,14 +67,14 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTdf128195) CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testBIRT) { // this looped - load(DATA_DIRECTORY, "birt_min.odt"); + load("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(DATA_DIRECTORY, "border-collapse-compat.docx"); + load("border-collapse-compat.docx"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwDocShell* pShell = pTextDoc->GetDocShell(); std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); @@ -91,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(DATA_DIRECTORY, "btlr-table-row-span.odt"); + load("btlr-table-row-span.odt"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwDocShell* pShell = pTextDoc->GetDocShell(); std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); @@ -108,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(DATA_DIRECTORY, "table-fly-overlap-spacing.docx"); + load("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; @@ -125,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(DATA_DIRECTORY, "tables-move-backwards.odt"); + load("tables-move-backwards.odt"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwDocShell* pDocShell = pTextDoc->GetDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); @@ -149,7 +152,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTablesMoveBackwards) CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testContinuousEndnotesMoveBackwards) { // Load a document with the ContinuousEndnotes flag turned on. - load(DATA_DIRECTORY, "continuous-endnotes-move-backwards.doc"); + load("continuous-endnotes-move-backwards.doc"); xmlDocUniquePtr pLayout = parseLayoutDump(); // We have 2 pages. assertXPath(pLayout, "/root/page", 2); @@ -167,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(DATA_DIRECTORY, "tdf134783_testAnchorPositionBasedOnParagraph.fodt"); + load("tdf134783_testAnchorPositionBasedOnParagraph.fodt"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "(//anchored/SwAnchoredDrawObject)[1]/bounds", "top", "1671"); @@ -181,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(DATA_DIRECTORY, "shape-textbox.odt"); + load("shape-textbox.odt"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); CPPUNIT_ASSERT(pXmlDoc); @@ -196,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(DATA_DIRECTORY, "textbox-phantom-change.docx"); + load("textbox-phantom-change.docx"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); @@ -207,7 +210,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextBoxNotModifiedOnOpen) CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextBoxAutoGrowVertical) { - load(DATA_DIRECTORY, "textbox-autogrow-vertical.docx"); + load("textbox-autogrow-vertical.docx"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); @@ -230,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(DATA_DIRECTORY, "textbox-modification.docx"); + load("textbox-modification.docx"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwDocShell* pDocShell = pTextDoc->GetDocShell(); @@ -242,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(DATA_DIRECTORY, "btlr-nested-cell.odt"); + load("btlr-nested-cell.odt"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); @@ -269,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(DATA_DIRECTORY, "keepwithnext-fullheight.fodt"); + load("keepwithnext-fullheight.fodt"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); CPPUNIT_ASSERT(pXmlDoc); @@ -424,13 +427,13 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testGutterMarginPageBorder) CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTdf45908_invoice) { // without the fix, this was hanging (and slowly consuming memory) on fileopen. - load(DATA_DIRECTORY, "tdf45908_invoice.odt"); + load("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(DATA_DIRECTORY, "vmerge-cell-border.docx"); + SwDoc* pDoc = createSwDoc("vmerge-cell-border.docx"); SwDocShell* pShell = pDoc->GetDocShell(); // When rendering the table: @@ -501,15 +504,12 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testVerticallyMergedCellBorder) } } -CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testCrashRemoveFromLayout) -{ - load(DATA_DIRECTORY, "tdf122894-4.doc"); -} +CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testCrashRemoveFromLayout) { load("tdf122894-4.doc"); } CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testLinkedBullet) { // Given a document with a graphic bullet, where the image is a linked one: - load(DATA_DIRECTORY, "linked-bullet.odt"); + load("linked-bullet.odt"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwDocShell* pShell = pTextDoc->GetDocShell(); @@ -529,7 +529,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testLinkedBullet) CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testInnerCellBorderIntersect) { // Given a table with both outer and inner borders: - SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "inner-border.docx"); + SwDoc* pDoc = createSwDoc("inner-border.docx"); SwDocShell* pShell = pDoc->GetDocShell(); // When rendering table borders: @@ -582,7 +582,7 @@ 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(DATA_DIRECTORY, "double-border-vertical.docx"); + SwDoc* pDoc = createSwDoc("double-border-vertical.docx"); SwDocShell* pShell = pDoc->GetDocShell(); // When rendering that document: @@ -630,7 +630,7 @@ 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(DATA_DIRECTORY, "double-border-horizontal.docx"); + SwDoc* pDoc = createSwDoc("double-border-horizontal.docx"); SwDocShell* pShell = pDoc->GetDocShell(); // When rendering table borders: @@ -678,7 +678,7 @@ 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(DATA_DIRECTORY, "para-border-in-cell-clip.docx"); + SwDoc* pDoc = createSwDoc("para-border-in-cell-clip.docx"); SwDocShell* pShell = pDoc->GetDocShell(); // When rendering those borders: @@ -698,7 +698,7 @@ 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(DATA_DIRECTORY, "double-page-border.docx"); + SwDoc* pDoc = createSwDoc("double-page-border.docx"); 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 e3aace4ffc87..94cb96e449ca 100644 --- a/sw/qa/core/objectpositioning/objectpositioning.cxx +++ b/sw/qa/core/objectpositioning/objectpositioning.cxx @@ -16,17 +16,20 @@ #include <unotxdoc.hxx> #include <docsh.hxx> -constexpr OUStringLiteral DATA_DIRECTORY = u"/sw/qa/core/objectpositioning/data/"; - /// Covers sw/source/core/objectpositioning/ fixes. class SwCoreObjectpositioningTest : public SwModelTestBase { +public: + SwCoreObjectpositioningTest() + : SwModelTestBase("/sw/qa/core/objectpositioning/data/") + { + } }; CPPUNIT_TEST_FIXTURE(SwCoreObjectpositioningTest, testOverlapCrash) { // Load a document with 2 images. - load(DATA_DIRECTORY, "overlap-crash.odt"); + load("overlap-crash.odt"); // Change their anchor type to to-char. uno::Reference<beans::XPropertySet> xShape1(getShape(1), uno::UNO_QUERY); @@ -145,7 +148,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreObjectpositioningTest, testVertAlignBottomMargin) CPPUNIT_TEST_FIXTURE(SwCoreObjectpositioningTest, testVertAlignBottomMarginWithFooter) { // Load an empty document with footer. - load(DATA_DIRECTORY, "bottom-margin-with-footer.docx"); + load("bottom-margin-with-footer.docx"); uno::Reference<css::lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); // Insert three shapes and align it the bottom,center,top of page print area bottom. @@ -218,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(DATA_DIRECTORY, "inside-outside-vert-align.docx"); + load("inside-outside-vert-align.docx"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); sal_Int32 nBodyBottom = getXPath(pXmlDoc, "//body/infos/bounds", "bottom").toInt32(); //15704 @@ -241,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(DATA_DIRECTORY, "vml-vertical-alignment.docx"); + load("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 0bece6e95f2b..4127a3c1c108 100644 --- a/sw/qa/core/text/text.cxx +++ b/sw/qa/core/text/text.cxx @@ -41,16 +41,19 @@ #include <txatbase.hxx> #include <textcontentcontrol.hxx> -constexpr OUStringLiteral DATA_DIRECTORY = u"/sw/qa/core/text/data/"; - /// Covers sw/source/core/text/ fixes. class SwCoreTextTest : public SwModelTestBase { +public: + SwCoreTextTest() + : SwModelTestBase("/sw/qa/core/text/data/") + { + } }; CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testFootnoteConnect) { - SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "footnote-connect.fodt"); + SwDoc* pDoc = createSwDoc("footnote-connect.fodt"); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); // Jump to the start of the next page. pWrtShell->SttNxtPg(); @@ -134,7 +137,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testBibliographyUrlPdfExport) CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTabOverMarginSection) { - createSwDoc(DATA_DIRECTORY, "tabovermargin-section.fodt"); + createSwDoc("tabovermargin-section.fodt"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); sal_Int32 nWidth = getXPath(pXmlDoc, "//Text[@nType='PortionType::TabRight']", "nWidth").toInt32(); @@ -149,7 +152,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTabOverMarginSection) CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testLineHeight) { // Given a document with an as-char image, height in twips not fitting into sal_uInt16: - createSwDoc(DATA_DIRECTORY, "line-height.fodt"); + createSwDoc("line-height.fodt"); // When laying out that document: xmlDocUniquePtr pXmlDoc = parseLayoutDump(); @@ -165,7 +168,7 @@ 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(DATA_DIRECTORY, "line-width.fodt"); + SwDoc* pDoc = createSwDoc("line-width.fodt"); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); sal_Int32 nOldLeft = pWrtShell->GetCharRect().Left(); @@ -186,7 +189,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testChineseAutoFirstLineIndent) // The test document contains two simple multi-line paragraph. For both paragraphs, the first line indent // is set to 'auto'. Line spacing is 100% for the 1st paragraph and 200% for the 2nd paragraph. // Also, there is a "AutoFirstLineIndentDisregardLineSpace" capability flag set in the document. - createSwDoc(DATA_DIRECTORY, "firstLineIndent-withFlag.fodt"); + createSwDoc("firstLineIndent-withFlag.fodt"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); @@ -205,7 +208,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testChineseAutoFirstLineIndent) CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testRuby) { // Given a document with multiple ruby portions: - SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "ruby.fodt"); + SwDoc* pDoc = createSwDoc("ruby.fodt"); // When laying out that document: SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); @@ -246,13 +249,12 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testEmptyNumberingPageSplit) { // Given a document with 2 pages: the only para on page 1 is a numbering without a number // portion: - createSwDoc(DATA_DIRECTORY, "empty-numbering-page-split.fodt"); + createSwDoc("empty-numbering-page-split.fodt"); // When inserting an image that doesn't fit the body frame: // Then make sure that the layout update after insertion finishes: uno::Sequence<beans::PropertyValue> aArgs = { - comphelper::makePropertyValue("FileName", - m_directories.getURLFromSrc(DATA_DIRECTORY) + "image.png"), + comphelper::makePropertyValue("FileName", createFileURL(u"image.png")), }; // Without the accompanying fix in place, this never finished. dispatchCommand(mxComponent, ".uno:InsertGraphic", aArgs); @@ -261,7 +263,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testEmptyNumberingPageSplit) CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testClearingLineBreak) { // Given a document with a fly frame and two characters wrapped around it: - createSwDoc(DATA_DIRECTORY, "clearing-break.fodt"); + createSwDoc("clearing-break.fodt"); // Insert a clearing break between "A" and "B": uno::Reference<text::XTextDocument> xDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XText> xText = xDocument->getText(); @@ -291,7 +293,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testClearingLineBreak) CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testClearingLineBreakAtStart) { // Given a document with a fly frame and a character wrapped around it: - createSwDoc(DATA_DIRECTORY, "clearing-break-start.fodt"); + createSwDoc("clearing-break-start.fodt"); // Insert a clearing break before "X": uno::Reference<text::XTextDocument> xDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XText> xText = xDocument->getText(); @@ -457,7 +459,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testClearingLineBreakVertical) CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testClearingLineBreakHeader) { // Given a document with a shape in the header and a clearing break in the body text: - createSwDoc(DATA_DIRECTORY, "clearing-break-header.fodt"); + createSwDoc("clearing-break-header.fodt"); // When laying out that document: xmlDocUniquePtr pXmlDoc = parseLayoutDump(); @@ -556,7 +558,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testRedlineDelete) CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf120715_CursorMoveWhenTypingSpaceAtCenteredLineEnd) { - SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf43100_tdf120715_cursorOnSpacesOverMargin.docx"); + SwDoc* pDoc = createSwDoc("tdf43100_tdf120715_cursorOnSpacesOverMargin.docx"); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); // Make a paint to force the call of AddExtraBlankWidth, that calculate width for holePortions. @@ -578,7 +580,7 @@ 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(DATA_DIRECTORY, "tdf43100_tdf120715_cursorOnSpacesOverMargin.docx"); + SwDoc* pDoc = createSwDoc("tdf43100_tdf120715_cursorOnSpacesOverMargin.docx"); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); // Make a paint to force the call of AddExtraBlankWidth, that calculate width for holePortions. @@ -827,7 +829,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testNumberPortionFormat) { // Given a document with a single paragraph, direct formatting asks 24pt font size for the // numbering and the text portion: - createSwDoc(DATA_DIRECTORY, "number-portion-format.odt"); + createSwDoc("number-portion-format.odt"); // When laying out that document: xmlDocUniquePtr pXmlDoc = parseLayoutDump(); diff --git a/sw/qa/core/txtnode/txtnode.cxx b/sw/qa/core/txtnode/txtnode.cxx index f9a95640e865..d8da288ad8bf 100644 --- a/sw/qa/core/txtnode/txtnode.cxx +++ b/sw/qa/core/txtnode/txtnode.cxx @@ -31,11 +31,14 @@ #include <ndtxt.hxx> #include <textcontentcontrol.hxx> -constexpr OUStringLiteral DATA_DIRECTORY = u"/sw/qa/core/txtnode/data/"; - /// Covers sw/source/core/txtnode/ fixes. class SwCoreTxtnodeTest : public SwModelTestBase { +public: + SwCoreTxtnodeTest() + : SwModelTestBase("/sw/qa/core/txtnode/data/") + { + } }; CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testBtlrCellChinese) @@ -44,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(DATA_DIRECTORY, "btlr-cell-chinese.doc"); + load("btlr-cell-chinese.doc"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwDocShell* pShell = pTextDoc->GetDocShell(); std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); @@ -60,7 +63,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testBtlrCellChinese) CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testTextBoxCopyAnchor) { - load(DATA_DIRECTORY, "textbox-copy-anchor.docx"); + load("textbox-copy-anchor.docx"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwDocShell* pShell = pTextDoc->GetDocShell(); SwWrtShell* pWrtShell = pShell->GetWrtShell(); @@ -88,7 +91,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testTextBoxCopyAnchor) CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testTextBoxNodeSplit) { - load(DATA_DIRECTORY, "textbox-node-split.docx"); + load("textbox-node-split.docx"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwDocShell* pShell = pTextDoc->GetDocShell(); SwWrtShell* pWrtShell = pShell->GetWrtShell(); @@ -132,7 +135,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testTitleFieldInvalidate) comphelper::LibreOfficeKit::setActive(true); // Given a document with a title field: - load(DATA_DIRECTORY, "title-field-invalidate.fodt"); + load("title-field-invalidate.fodt"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); pTextDoc->initializeForTiledRendering({}); SwDocShell* pShell = pTextDoc->GetDocShell(); @@ -168,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(DATA_DIRECTORY, "fly-anchor-undo.odt"); + load("fly-anchor-undo.odt"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwDocShell* pShell = pTextDoc->GetDocShell(); SwDoc* pDoc = pShell->GetDoc(); diff --git a/sw/qa/core/undo/undo.cxx b/sw/qa/core/undo/undo.cxx index 0e9ef5b0231e..12d316c49259 100644 --- a/sw/qa/core/undo/undo.cxx +++ b/sw/qa/core/undo/undo.cxx @@ -22,17 +22,20 @@ #include <view.hxx> #include <cmdid.h> -constexpr OUStringLiteral DATA_DIRECTORY = u"/sw/qa/core/undo/data/"; - /// Covers sw/source/core/undo/ fixes. class SwCoreUndoTest : public SwModelTestBase { +public: + SwCoreUndoTest() + : SwModelTestBase("/sw/qa/core/undo/data/") + { + } }; CPPUNIT_TEST_FIXTURE(SwCoreUndoTest, testTextboxCutSave) { // Load the document and select all. - load(DATA_DIRECTORY, "textbox-cut-save.docx"); + load("textbox-cut-save.docx"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwDocShell* pDocShell = pTextDoc->GetDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); @@ -58,7 +61,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUndoTest, testTextboxCutSave) CPPUNIT_TEST_FIXTURE(SwCoreUndoTest, testTextboxCutUndo) { - load(DATA_DIRECTORY, "textbox-cut-undo.docx"); + load("textbox-cut-undo.docx"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwDocShell* pDocShell = pTextDoc->GetDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); @@ -87,7 +90,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUndoTest, testTextboxCutUndo) CPPUNIT_TEST_FIXTURE(SwCoreUndoTest, testTableCopyRedline) { // Given a document with two table cells and redlining enabled: - load(DATA_DIRECTORY, "table-copy-redline.odt"); + load("table-copy-redline.odt"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwDocShell* pDocShell = pTextDoc->GetDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); diff --git a/sw/qa/core/unocore/unocore.cxx b/sw/qa/core/unocore/unocore.cxx index ee1592110157..fdab71600312 100644 --- a/sw/qa/core/unocore/unocore.cxx +++ b/sw/qa/core/unocore/unocore.cxx @@ -31,20 +31,20 @@ using namespace ::com::sun::star; -namespace -{ -constexpr OUStringLiteral DATA_DIRECTORY = u"/sw/qa/core/unocore/data/"; -} - /// Covers sw/source/core/unocore/ fixes. class SwCoreUnocoreTest : public SwModelTestBase { +public: + SwCoreUnocoreTest() + : SwModelTestBase("/sw/qa/core/unocore/data/") + { + } }; CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testTdf119081) { // Load a doc with a nested table in it. - load(DATA_DIRECTORY, "tdf119081.odt"); + load("tdf119081.odt"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); SwDocShell* pDocShell = pTextDoc->GetDocShell(); @@ -169,8 +169,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testViewCursorTextFrame) { // Given a document with a graphic and holding a reference to that graphic frame: createSwDoc(); - uno::Sequence<beans::PropertyValue> aInsertArgs = { comphelper::makePropertyValue( - "FileName", m_directories.getURLFromSrc(DATA_DIRECTORY) + "graphic.png") }; + uno::Sequence<beans::PropertyValue> aInsertArgs + = { comphelper::makePropertyValue("FileName", createFileURL(u"graphic.png")) }; dispatchCommand(mxComponent, ".uno:InsertGraphic", aInsertArgs); uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier( @@ -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(DATA_DIRECTORY, "broken-embedded-object.odt"); + load("broken-embedded-object.odt"); uno::Reference<text::XTextEmbeddedObjectsSupplier> xSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xObjects(xSupplier->getEmbeddedObjects(), uno::UNO_QUERY); @@ -544,7 +544,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testInsertFileInContentControlException) // Reject inserting a document inside the content control: xCursor->goLeft(1, false); - OUString aURL(m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf119081.odt"); + OUString aURL(createFileURL(u"tdf119081.odt")); uno::Reference<document::XDocumentInsertable> xInsertable(xCursor, uno::UNO_QUERY); CPPUNIT_ASSERT_THROW(xInsertable->insertDocumentFromURL(aURL, {}), uno::RuntimeException); diff --git a/sw/qa/core/view/view.cxx b/sw/qa/core/view/view.cxx index 3ff399a0f8ea..d2ba15d9b458 100644 --- a/sw/qa/core/view/view.cxx +++ b/sw/qa/core/view/view.cxx @@ -24,20 +24,23 @@ #include <nodeoffset.hxx> #include <wrtsh.hxx> -constexpr OUStringLiteral DATA_DIRECTORY = u"/sw/qa/core/view/data/"; - namespace { /// Covers sw/source/core/view/ fixes. class Test : public SwModelTestBase { +public: + Test() + : SwModelTestBase("/sw/qa/core/view/data/") + { + } }; } CPPUNIT_TEST_FIXTURE(Test, testUpdateOleObjectPreviews) { // Given a document with two embedded objects, both with broken native data: - SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "update-ole-object-previews.odt"); + SwDoc* pDoc = createSwDoc("update-ole-object-previews.odt"); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); // When updating the previews of those embedded objects (right after document load, before diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx index db78ecc8d22a..9900f4886011 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -258,6 +258,11 @@ private: class SwHtmlDomExportTest : public SwModelTestBase, public HtmlTestTools { public: + SwHtmlDomExportTest() + : SwModelTestBase("/sw/qa/extras/htmlexport/data/") + { + } + /// Get the .ole path, assuming maTempFile is an XHTML export result. OUString GetOlePath(); OUString GetPngPath(); @@ -326,8 +331,6 @@ void SwHtmlDomExportTest::ImportFromReqif(const OUString& rUrl) mxComponent = loadFromDesktop(rUrl, "com.sun.star.text.TextDocument", aLoadProperties); } -constexpr OUStringLiteral DATA_DIRECTORY = u"/sw/qa/extras/htmlexport/data/"; - DECLARE_HTMLEXPORT_ROUNDTRIP_TEST(testFdo81276, "fdo81276.html") { uno::Reference<container::XNameAccess> xPageStyles(getStyles("PageStyles")); @@ -748,8 +751,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIfPngImg) CPPUNIT_ASSERT(aStream.indexOf("image/png") != -1); }; - OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "reqif-png-img.xhtml"; - ImportFromReqif(aURL); + ImportFromReqif(createFileURL(u"reqif-png-img.xhtml")); verify(/*bExported=*/false); uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); uno::Sequence<beans::PropertyValue> aStoreProperties = { @@ -941,8 +943,7 @@ DECLARE_HTMLEXPORT_TEST(testTransparentImage, "transparent-image.odt") CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testTransparentImageReqIf) { - OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "transparent-image.odt"; - mxComponent = loadFromDesktop(aURL, "com.sun.star.text.TextDocument", {}); + load("transparent-image.odt"); uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); uno::Sequence<beans::PropertyValue> aStoreProperties = { comphelper::makePropertyValue("FilterName", OUString("HTML (StarWriter)")), @@ -1071,8 +1072,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testRTFOLEMimeType) { // Import a document with an embedded object. OUString aType("test/rtf"); - OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "reqif-ole-data.xhtml"; - ImportFromReqif(aURL); + ImportFromReqif(createFileURL(u"reqif-ole-data.xhtml")); // Export it. uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); @@ -1098,8 +1098,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testRTFOLEMimeType) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testChinese) { // Load a document with Chinese text in it. - OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "reqif-chinese.odt"; - mxComponent = loadFromDesktop(aURL, "com.sun.star.text.TextDocument", {}); + load("reqif-chinese.odt"); // Export it. ExportToReqif(); @@ -1187,8 +1186,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifParagraphAlignment) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifOle1PDF) { // Save to reqif-xhtml. - OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "pdf-ole.odt"; - mxComponent = loadFromDesktop(aURL, "com.sun.star.text.TextDocument", {}); + load("pdf-ole.odt"); ExportToReqif(); OUString aRtfUrl = GetOlePath(); @@ -1229,8 +1227,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifOle1PDF) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifOle1Paint) { // Load the bug document, which has OLE1 data in it, which is not a wrapper around OLE2 data. - OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "paint-ole.xhtml"; - ImportFromReqif(aURL); + ImportFromReqif(createFileURL(u"paint-ole.xhtml")); // Save it as ODT to inspect the result of the OLE1 -> OLE2 conversion. save("writer8"); @@ -1276,8 +1273,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifOle1Paint) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifOle1PaintBitmapFormat) { // Given a document with a 8bpp bitmap: - OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "paint-ole-bitmap-format.odt"; - mxComponent = loadFromDesktop(aURL, "com.sun.star.text.TextDocument", {}); + load("paint-ole-bitmap-format.odt"); // When exporting to reqif-xhtml with ExportImagesAsOLE enabled: uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); @@ -1374,8 +1370,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testUnderlineNone) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifOle1PresDataNoOle2) { // Save to reqif-xhtml. - OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "no-ole2-pres-data.odt"; - mxComponent = loadFromDesktop(aURL, "com.sun.star.text.TextDocument", {}); + load("no-ole2-pres-data.odt"); ExportToReqif(); OUString aRtfUrl = GetOlePath(); SvMemoryStream aOle1; @@ -1391,8 +1386,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifOle1PresDataNoOle2) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifOle1PresDataWmfOnly) { // Save to reqif-xhtml. - OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "ole1-pres-data-wmf.odt"; - mxComponent = loadFromDesktop(aURL, "com.sun.star.text.TextDocument", {}); + load("ole1-pres-data-wmf.odt"); ExportToReqif(); OUString aRtfUrl = GetOlePath(); SvMemoryStream aOle1; @@ -1409,8 +1403,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifOle1PresDataWmfOnly) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifAscharObjsize) { // Given a document with an as-char anchored embedded object: - OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "reqif-aschar-objsize.odt"; - mxComponent = loadFromDesktop(aURL, "com.sun.star.text.TextDocument", {}); + load("reqif-aschar-objsize.odt"); // When exporting to reqif-xhtml: ExportToReqif(); @@ -1432,9 +1425,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifAscharObjsize) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifObjdataPresentationDataSize) { // Given a document with an OLE2 embedded object, containing a preview: - OUString aURL - = m_directories.getURLFromSrc(DATA_DIRECTORY) + "reqif-objdata-presentationdatasize.odt"; - mxComponent = loadFromDesktop(aURL, "com.sun.star.text.TextDocument", {}); + load("reqif-objdata-presentationdatasize.odt"); // When exporting to ReqIF: ExportToReqif(); @@ -1600,9 +1591,8 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifImageToOle) { // Given a document with an image: loadURL("private:factory/swriter", nullptr); - OUString aImageURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "ole2.png"; uno::Sequence<beans::PropertyValue> aArgs = { - comphelper::makePropertyValue("FileName", aImageURL), + comphelper::makePropertyValue("FileName", createFileURL(u"ole2.png")), }; dispatchCommand(mxComponent, ".uno:InsertGraphic", aArgs); @@ -1644,9 +1634,8 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifEmbedPNGDirectly) { // Given a document with an image: loadURL("private:factory/swriter", nullptr); - OUString aImageURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "ole2.png"; uno::Sequence<beans::PropertyValue> aArgs = { - comphelper::makePropertyValue("FileName", aImageURL), + comphelper::makePropertyValue("FileName", createFileURL(u"ole2.png")), }; dispatchCommand(mxComponent, ".uno:InsertGraphic", aArgs); @@ -1669,9 +1658,8 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifEmbedJPGDirectly) { // Given a document with an image: loadURL("private:factory/swriter", nullptr); - OUString aImageURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "reqif-ole-img.jpg"; uno::Sequence<beans::PropertyValue> aArgs = { - comphelper::makePropertyValue("FileName", aImageURL), + comphelper::makePropertyValue("FileName", createFileURL(u"reqif-ole-img.jpg")), }; dispatchCommand(mxComponent, ".uno:InsertGraphic", aArgs); @@ -1696,13 +1684,12 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifEmbedPNGShapeDirectly) { // Given a document with an image shape: loadURL("private:factory/swriter", nullptr); - OUString aImageURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "ole2.png"; uno::Reference<css::lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<drawing::XShape> xShape( xFactory->createInstance("com.sun.star.drawing.GraphicObjectShape"), uno::UNO_QUERY); xShape->setSize(awt::Size(10000, 10000)); uno::Reference<beans::XPropertySet> xShapeProps(xShape, uno::UNO_QUERY); - xShapeProps->setPropertyValue("GraphicURL", uno::Any(aImageURL)); + xShapeProps->setPropertyValue("GraphicURL", uno::Any(createFileURL(u"ole2.png"))); uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); xDrawPageSupplier->getDrawPage()->add(xShape); @@ -1724,13 +1711,12 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifEmbedJPGShapeDirectly) { // Given a document with an image: loadURL("private:factory/swriter", nullptr); - OUString aImageURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "reqif-ole-img.jpg"; uno::Reference<css::lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<drawing::XShape> xShape( xFactory->createInstance("com.sun.star.drawing.GraphicObjectShape"), uno::UNO_QUERY); xShape->setSize(awt::Size(10000, 10000)); uno::Reference<beans::XPropertySet> xShapeProps(xShape, uno::UNO_QUERY); - xShapeProps->setPropertyValue("GraphicURL", uno::Any(aImageURL)); + xShapeProps->setPropertyValue("GraphicURL", uno::Any(createFileURL(u"reqif-ole-img.jpg"))); uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); xDrawPageSupplier->getDrawPage()->add(xShape); @@ -1755,13 +1741,12 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifEmbedPNGShapeAsOLE) { // Given a document with an image shape: loadURL("private:factory/swriter", nullptr); - OUString aImageURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "ole2.png"; uno::Reference<css::lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<drawing::XShape> xShape( xFactory->createInstance("com.sun.star.drawing.GraphicObjectShape"), uno::UNO_QUERY); xShape->setSize(awt::Size(10000, 10000)); uno::Reference<beans::XPropertySet> xShapeProps(xShape, uno::UNO_QUERY); - xShapeProps->setPropertyValue("GraphicURL", uno::Any(aImageURL)); + xShapeProps->setPropertyValue("GraphicURL", uno::Any(createFileURL(u"ole2.png"))); uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); xDrawPageSupplier->getDrawPage()->add(xShape); @@ -1922,9 +1907,8 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifOleBmpTransparent) { // Given a document with a transparent image: loadURL("private:factory/swriter", nullptr); - OUString aImageURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "transparent.png"; uno::Sequence<beans::PropertyValue> aArgs = { - comphelper::makePropertyValue("FileName", aImageURL), + comphelper::makePropertyValue("FileName", createFileURL(u"transparent.png")), }; dispatchCommand(mxComponent, ".uno:InsertGraphic", aArgs); @@ -2051,8 +2035,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testListsHeading) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testOleEmfPreviewToHtml) { // Given a document containing an embedded object, with EMF preview: - OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "ole2.odt"; - mxComponent = loadFromDesktop(aURL, "com.sun.star.text.TextDocument", {}); + load("ole2.odt"); // When exporting to HTML: uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); @@ -2243,7 +2226,7 @@ CPPUNIT_TEST_FIXTURE(HtmlExportTest, testClearingBreak) // Given a document with an at-para anchored image + a clearing break: // When loading that file: - load(mpTestDocumentPath, "clearing-break.html"); + load("clearing-break.html"); // Then make sure that the clear property of the break is not ignored: verify(); reload(mpFilter, "clearing-break.html"); diff --git a/sw/qa/extras/htmlimport/htmlimport.cxx b/sw/qa/extras/htmlimport/htmlimport.cxx index f5b4f5605729..c1e4981cf983 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(mpTestDocumentPath, "picture.html"); + load("picture.html"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); // The document contains two pictures stored as a link. @@ -57,7 +57,7 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testPictureImport) CPPUNIT_TEST_FIXTURE(HtmlImportTest, testInlinedImage) { - load(mpTestDocumentPath, "inlined_image.html"); + load("inlined_image.html"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); // The document contains only one embedded picture inlined in img's src attribute. @@ -95,7 +95,7 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testInlinedImage) CPPUNIT_TEST_FIXTURE(HtmlImportTest, testInlinedImagesPageAndParagraph) { - load(mpTestDocumentPath, "PageAndParagraphFilled.html"); + load("PageAndParagraphFilled.html"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); @@ -136,7 +136,7 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testInlinedImagesPageAndParagraph) CPPUNIT_TEST_FIXTURE(HtmlImportTest, testListStyleType) { - load(mpTestDocumentPath, "list-style.html"); + load("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(mpTestDocumentPath, "meta-ISO8601-dates.html"); + load("meta-ISO8601-dates.html"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); SwDocShell* pDocShell(pTextDoc->GetDocShell()); @@ -202,7 +202,7 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testMetaIsoDates) CPPUNIT_TEST_FIXTURE(HtmlImportTest, testImageWidthAuto) { - load(mpTestDocumentPath, "image-width-auto.html"); + load("image-width-auto.html"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); SwTextAttr const*const pAttr(pTextDoc->GetDocShell()->GetDoc()->GetEditShell()-> @@ -215,7 +215,7 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testImageWidthAuto) CPPUNIT_TEST_FIXTURE(HtmlImportTest, testImageLazyRead) { - load(mpTestDocumentPath, "image-lazy-read.html"); + load("image-lazy-read.html"); auto xGraphic = getProperty<uno::Reference<graphic::XGraphic>>(getShape(1), "Graphic"); Graphic aGraphic(xGraphic); // This failed, import loaded the graphic, it wasn't lazy-read. @@ -224,7 +224,7 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testImageLazyRead) CPPUNIT_TEST_FIXTURE(HtmlImportTest, testChangedby) { - load(mpTestDocumentPath, "meta-changedby.html"); + load("meta-changedby.html"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); SwDocShell* pDocShell(pTextDoc->GetDocShell()); @@ -250,7 +250,7 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testChangedby) CPPUNIT_TEST_FIXTURE(HtmlImportTest, testTableBorder1px) { - load(mpTestDocumentPath, "table_border_1px.html"); + load("table_border_1px.html"); uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount()); @@ -301,7 +301,7 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testTableBorder1px) CPPUNIT_TEST_FIXTURE(HtmlImportTest, testOutlineLevel) { - load(mpTestDocumentPath, "outline-level.html"); + load("outline-level.html"); // This was 0, HTML imported into Writer lost the outline numbering for // Heading 1 styles. CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), @@ -312,14 +312,14 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testReqIfBr) { setImportFilterOptions("xhtmlns=reqif-xhtml"); setImportFilterName("HTML (StarWriter)"); - load(mpTestDocumentPath, "reqif-br.xhtml"); + load("reqif-br.xhtml"); // <reqif-xhtml:br/> was not recognized as a line break from a ReqIf file. CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("aaa\nbbb")); } CPPUNIT_TEST_FIXTURE(HtmlImportTest, testTdf80194_subscript) { - load(mpTestDocumentPath, "tdf80194_subscript.html"); + load("tdf80194_subscript.html"); uno::Reference<text::XTextRange> xPara = getParagraph(1); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.f, getProperty<float>(getRun(xPara, 1), "CharEscapement"), 0); // Most recently, the default subscript was 33%, which is much too large for a subscript. @@ -341,7 +341,7 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testReqIfTable) { setImportFilterOptions("xhtmlns=reqif-xhtml"); setImportFilterName("HTML (StarWriter)"); - load(mpTestDocumentPath, "reqif-table.xhtml"); + load("reqif-table.xhtml"); // to see this: soffice --infilter="HTML (StarWriter):xhtmlns=reqif-xhtml" sw/qa/extras/htmlimport/data/reqif-table.xhtml // Load a table with xhtmlns=reqif-xhtml filter param. uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY); @@ -365,7 +365,7 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testReqIfTable) CPPUNIT_TEST_FIXTURE(HtmlImportTest, testImageSize) { - load(mpTestDocumentPath, "image-size.html"); + load("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(mpTestDocumentPath, "tdf142781.html"); + load("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(mpTestDocumentPath, "tdf122789.html"); + load("tdf122789.html"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); @@ -410,7 +410,7 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testTdf122789) CPPUNIT_TEST_FIXTURE(HtmlImportTest, testTdf118579) { - load(mpTestDocumentPath, "tdf118579.html"); + load("tdf118579.html"); //Without the fix in place, the file fails to load SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); @@ -420,7 +420,7 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testReqIfPageStyle) { setImportFilterOptions("xhtmlns=reqif-xhtml"); setImportFilterName("HTML (StarWriter)"); - load(mpTestDocumentPath, "reqif-page-style.xhtml"); + load("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"), @@ -442,8 +442,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlOptionsImportTest, testAllowedRTFOLEMimeTypes) comphelper::makePropertyValue("FilterOptions", OUString("xhtmlns=reqif-xhtml")), comphelper::makePropertyValue("AllowedRTFOLEMimeTypes", aTypes), }; - OUString aURL - = m_directories.getURLFromSrc(mpTestDocumentPath) + "allowed-rtf-ole-mime-types.xhtml"; + OUString aURL = createFileURL(u"allowed-rtf-ole-mime-types.xhtml"); mxComponent = loadFromDesktop(aURL, "com.sun.star.text.TextDocument", aLoadProperties); uno::Reference<text::XTextEmbeddedObjectsSupplier> xSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xObjects(xSupplier->getEmbeddedObjects(), @@ -462,7 +461,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlOptionsImportTest, testAllowedRTFOLEMimeTypes) CPPUNIT_TEST_FIXTURE(SwHtmlOptionsImportTest, testHiddenTextframe) { // Load HTML content into Writer, similar to HTML paste. - load(mpTestDocumentPath, "hidden-textframe.html"); + load("hidden-textframe.html"); // Check the content of the draw page. uno::Reference<drawing::XDrawPageSupplier> xSupplier(mxComponent, uno::UNO_QUERY); @@ -481,7 +480,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlOptionsImportTest, testOleImg) // ignored): setImportFilterOptions("xhtmlns=reqif-xhtml"); setImportFilterName("HTML (StarWriter)"); - load(mpTestDocumentPath, "ole-img.xhtml"); + load("ole-img.xhtml"); // Then make sure the result is a single Writer image: uno::Reference<text::XTextGraphicObjectsSupplier> xSupplier(mxComponent, uno::UNO_QUERY); @@ -500,7 +499,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlOptionsImportTest, testOleImgSvg) // ignored): setImportFilterOptions("xhtmlns=reqif-xhtml"); setImportFilterName("HTML (StarWriter)"); - load(mpTestDocumentPath, "ole-img-svg.xhtml"); + load("ole-img-svg.xhtml"); // Then make sure the result is a single Writer image: uno::Reference<text::XTextGraphicObjectsSupplier> xSupplier(mxComponent, uno::UNO_QUERY); @@ -515,7 +514,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlOptionsImportTest, testOleImgSvg) CPPUNIT_TEST_FIXTURE(HtmlImportTest, testUTF16_nonBMP) { - load(mpTestDocumentPath, "emojis16BE.html"); + load("emojis16BE.html"); // tdf#146173: non-BMP characters' surrogates didn't combine correctly CPPUNIT_ASSERT_EQUAL(OUString(u"a text with emojis: ๐พ โ๐จ๐ผโ๐พ๐๐ผโโ๏ธ๐ค๐ฝ๐"), getParagraph(1)->getString()); @@ -527,7 +526,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlOptionsImportTest, testOleData) // (containing PNG): setImportFilterOptions("xhtmlns=reqif-xhtml"); setImportFilterName("HTML (StarWriter)"); - load(mpTestDocumentPath, "ole-data.xhtml"); + load("ole-data.xhtml"); // Then make sure the result is a single clickable Writer image: uno::Reference<text::XTextGraphicObjectsSupplier> xSupplier(mxComponent, uno::UNO_QUERY); @@ -548,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(mpTestDocumentPath, "ole-data2.xhtml"); + load("ole-data2.xhtml"); // Then make sure that the second image doesn't have a link set: uno::Reference<text::XTextGraphicObjectsSupplier> xSupplier(mxComponent, uno::UNO_QUERY); diff --git a/sw/qa/extras/indexing/IndexingExportTest.cxx b/sw/qa/extras/indexing/IndexingExportTest.cxx index c38f5f1bd413..2161f7476967 100644 --- a/sw/qa/extras/indexing/IndexingExportTest.cxx +++ b/sw/qa/extras/indexing/IndexingExportTest.cxx @@ -44,7 +44,7 @@ public: void IndexingExportTest::testIndexingExport_Paragraphs() { - SwDoc* pDoc = createSwDoc(mpTestDocumentPath, "IndexingExport_VariousParagraphs.odt"); + SwDoc* pDoc = createSwDoc("IndexingExport_VariousParagraphs.odt"); CPPUNIT_ASSERT(pDoc); SvMemoryStream aMemoryStream; @@ -79,7 +79,7 @@ void IndexingExportTest::testIndexingExport_Paragraphs() void IndexingExportTest::testIndexingExport_Images() { - SwDoc* pDoc = createSwDoc(mpTestDocumentPath, "IndexingExport_Images.odt"); + SwDoc* pDoc = createSwDoc("IndexingExport_Images.odt"); CPPUNIT_ASSERT(pDoc); SvMemoryStream aMemoryStream; @@ -101,7 +101,7 @@ void IndexingExportTest::testIndexingExport_Images() void IndexingExportTest::testIndexingExport_OLE() { - SwDoc* pDoc = createSwDoc(mpTestDocumentPath, "IndexingExport_OLE.odt"); + SwDoc* pDoc = createSwDoc("IndexingExport_OLE.odt"); CPPUNIT_ASSERT(pDoc); SvMemoryStream aMemoryStream; @@ -120,7 +120,7 @@ void IndexingExportTest::testIndexingExport_OLE() void IndexingExportTest::testIndexingExport_Shapes() { - SwDoc* pDoc = createSwDoc(mpTestDocumentPath, "IndexingExport_Shapes.odt"); + SwDoc* pDoc = createSwDoc("IndexingExport_Shapes.odt"); CPPUNIT_ASSERT(pDoc); SvMemoryStream aMemoryStream; @@ -159,7 +159,7 @@ void IndexingExportTest::testIndexingExport_Shapes() void IndexingExportTest::testIndexingExport_Tables() { - SwDoc* pDoc = createSwDoc(mpTestDocumentPath, "IndexingExport_Tables.odt"); + SwDoc* pDoc = createSwDoc("IndexingExport_Tables.odt"); CPPUNIT_ASSERT(pDoc); SvMemoryStream aMemoryStream; @@ -226,7 +226,7 @@ void IndexingExportTest::testIndexingExport_Tables() void IndexingExportTest::testIndexingExport_Sections() { - SwDoc* pDoc = createSwDoc(mpTestDocumentPath, "IndexingExport_Sections.odt"); + SwDoc* pDoc = createSwDoc("IndexingExport_Sections.odt"); CPPUNIT_ASSERT(pDoc); SvMemoryStream aMemoryStream; @@ -257,7 +257,7 @@ void IndexingExportTest::testIndexingExport_Sections() void IndexingExportTest::testIndexingExport_Fontwork() { - SwDoc* pDoc = createSwDoc(mpTestDocumentPath, "IndexingExport_Fontwork.odt"); + SwDoc* pDoc = createSwDoc("IndexingExport_Fontwork.odt"); CPPUNIT_ASSERT(pDoc); SvMemoryStream aMemoryStream; @@ -281,7 +281,7 @@ void IndexingExportTest::testIndexingExport_Fontwork() void IndexingExportTest::testIndexingExport_Header_Footer() { - SwDoc* pDoc = createSwDoc(mpTestDocumentPath, "IndexingExport_Header_Footer.odt"); + SwDoc* pDoc = createSwDoc("IndexingExport_Header_Footer.odt"); CPPUNIT_ASSERT(pDoc); SvMemoryStream aMemoryStream; diff --git a/sw/qa/extras/indexing/SearchResultLocatorTest.cxx b/sw/qa/extras/indexing/SearchResultLocatorTest.cxx index a4de60444c10..670069318ab8 100644 --- a/sw/qa/extras/indexing/SearchResultLocatorTest.cxx +++ b/sw/qa/extras/indexing/SearchResultLocatorTest.cxx @@ -41,7 +41,7 @@ void SearchResultLocatorTest::testSearchResultLocator() if (!IsDefaultDPI()) return; - SwDoc* pDoc = createSwDoc(mpTestDocumentPath, "IndexingExport_VariousParagraphs.odt"); + SwDoc* pDoc = createSwDoc("IndexingExport_VariousParagraphs.odt"); CPPUNIT_ASSERT(pDoc); sw::search::SearchResultLocator aLocator(pDoc); @@ -68,7 +68,7 @@ void SearchResultLocatorTest::testSearchResultLocatorUsingXmlPayload() if (!IsDefaultDPI()) return; - SwDoc* pDoc = createSwDoc(mpTestDocumentPath, "IndexingExport_VariousParagraphs.odt"); + SwDoc* pDoc = createSwDoc("IndexingExport_VariousParagraphs.odt"); CPPUNIT_ASSERT(pDoc); sw::search::SearchResultLocator aLocator(pDoc); @@ -96,7 +96,7 @@ void SearchResultLocatorTest::testSearchResultLocatorUsingJsonPayload() if (!IsDefaultDPI()) return; - SwDoc* pDoc = createSwDoc(mpTestDocumentPath, "IndexingExport_VariousParagraphs.odt"); + SwDoc* pDoc = createSwDoc("IndexingExport_VariousParagraphs.odt"); CPPUNIT_ASSERT(pDoc); sw::search::SearchResultLocator aLocator(pDoc); @@ -124,7 +124,7 @@ void SearchResultLocatorTest::testSearchResultLocatorForSdrObjects() if (!IsDefaultDPI()) return; - SwDoc* pDoc = createSwDoc(mpTestDocumentPath, "IndexingExport_Shapes.odt"); + SwDoc* pDoc = createSwDoc("IndexingExport_Shapes.odt"); CPPUNIT_ASSERT(pDoc); sw::search::SearchResultLocator aLocator(pDoc); @@ -151,7 +151,7 @@ void SearchResultLocatorTest::testSearchResultLocatorForSdrObjectsUsingJsonPaylo if (!IsDefaultDPI()) return; - SwDoc* pDoc = createSwDoc(mpTestDocumentPath, "IndexingExport_Shapes.odt"); + SwDoc* pDoc = createSwDoc("IndexingExport_Shapes.odt"); 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 7d8f76698cb0..190478c40063 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -43,11 +43,15 @@ #include <svx/svdotext.hxx> #include <dcontact.hxx> -constexpr OUStringLiteral DATA_DIRECTORY = u"/sw/qa/extras/layout/data/"; - /// Test to assert layout / rendering result of Writer. class SwLayoutWriter : public SwModelTestBase { +public: + SwLayoutWriter() + : SwModelTestBase("/sw/qa/extras/layout/data/") + { + } + protected: void CheckRedlineFootnotesHidden(); void CheckRedlineSectionsHidden(); @@ -119,7 +123,7 @@ void SwLayoutWriter::CheckRedlineSectionsHidden() CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFootnotes) { - createSwDoc(DATA_DIRECTORY, "redline_footnotes.odt"); + createSwDoc("redline_footnotes.odt"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); SwDoc* pDoc(pTextDoc->GetDocShell()->GetDoc()); @@ -279,7 +283,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFootnotes) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf136588) { - load(DATA_DIRECTORY, "tdf136588.docx"); + load("tdf136588.docx"); auto pXMLLayoutDump = parseLayoutDump(); CPPUNIT_ASSERT(pXMLLayoutDump); @@ -696,7 +700,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInBody) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf134272) { - SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf134472.odt"); + SwDoc* pDoc = createSwDoc("tdf134472.odt"); CPPUNIT_ASSERT(pDoc); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "/root/page[1]/header/txt[2]/infos/bounds", "height", "843"); @@ -705,7 +709,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf134272) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestNestedTableMoveFwd) { - SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tabellen_test_windows_1.odt"); + SwDoc* pDoc = createSwDoc("tabellen_test_windows_1.odt"); CPPUNIT_ASSERT(pDoc); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // the row with the nested table should not be split but be the first row on page 2 @@ -718,7 +722,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestNestedTableMoveFwd) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf136613) { - SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf136613.docx"); + SwDoc* pDoc = createSwDoc("tdf136613.docx"); CPPUNIT_ASSERT(pDoc); //get the flys and the root frame @@ -749,7 +753,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf136613) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf88496) { - SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf88496.docx"); + SwDoc* pDoc = createSwDoc("tdf88496.docx"); CPPUNIT_ASSERT(pDoc); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // This was 4, table fallback "switch off repeating header" started on a new page @@ -1189,7 +1193,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInHeader) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf137025) { // Check the padding of the textbox - SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf137025.docx"); + SwDoc* pDoc = createSwDoc("tdf137025.docx"); CPPUNIT_ASSERT(pDoc); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); CPPUNIT_ASSERT(pXmlDoc); @@ -1874,7 +1878,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFootnote) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf143239) { - SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf143239-1-min.odt"); + SwDoc* pDoc = createSwDoc("tdf143239-1-min.odt"); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); // These are unstable on macOS and Win64 builds, @@ -1934,7 +1938,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(DATA_DIRECTORY, "footer-fly-table.fodt"); + load("footer-fly-table.fodt"); xmlDocUniquePtr pLayout = parseLayoutDump(); // no fly portions, was: 8 assertXPath(pLayout, @@ -1961,7 +1965,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTableOverlapFooterFly) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf134277) { - SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf134277.docx"); + SwDoc* pDoc = createSwDoc("tdf134277.docx"); CPPUNIT_ASSERT(pDoc); SwDocShell* pShell = pDoc->GetDocShell(); @@ -1979,7 +1983,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf134277) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf116486) { - SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf116486.docx"); + SwDoc* pDoc = createSwDoc("tdf116486.docx"); CPPUNIT_ASSERT(pDoc); OUString aTop = parseDump( "/root/page/body/txt/SwParaPortion/SwLineLayout[1]/child::*[@type='PortionType::Fly']", @@ -1990,7 +1994,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf116486) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf142080) { // this caused an infinite loop - load(DATA_DIRECTORY, "fdo43573-2-min.docx"); + load("fdo43573-2-min.docx"); xmlDocUniquePtr pLayout = parseLayoutDump(); // check the first paragraph on page 9 with its fly; the column was empty too @@ -2008,7 +2012,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf142080) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf128198) { - SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf128198-1.docx"); + SwDoc* pDoc = createSwDoc("tdf128198-1.docx"); CPPUNIT_ASSERT(pDoc); xmlDocUniquePtr pLayout = parseLayoutDump(); // the problem was that line 5 was truncated at "this " @@ -2022,7 +2026,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf128198) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testNoLineBreakAtSlash) { - load(DATA_DIRECTORY, "no-line-break-at-slash.fodt"); + load("no-line-break-at-slash.fodt"); xmlDocUniquePtr pLayout = parseLayoutDump(); // the line break was between "Foostrasseย 13/c/" and "2" @@ -2046,7 +2050,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testNoLineBreakAtSlash) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf106153) { - load(DATA_DIRECTORY, "tdf106153.docx"); + load("tdf106153.docx"); xmlDocUniquePtr pDump = parseLayoutDump(); const sal_Int64 nPageValLeft = getXPath(pDump, "/root/page/infos/bounds", "left").toInt64(); @@ -3056,7 +3060,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysAtFlys) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineSections) { - createSwDoc(DATA_DIRECTORY, "redline_sections.fodt"); + createSwDoc("redline_sections.fodt"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); SwDoc* pDoc(pTextDoc->GetDocShell()->GetDoc()); @@ -3157,7 +3161,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineSections) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TDF69647_images) { - createSwDoc(DATA_DIRECTORY, "tdf69647_images.odt"); + createSwDoc("tdf69647_images.odt"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); CPPUNIT_ASSERT_EQUAL_MESSAGE("Number of pages does not match!", 2, getPages()); @@ -3165,7 +3169,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TDF69647_images) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TDF69647_text) { - createSwDoc(DATA_DIRECTORY, "tdf69647_text.docx"); + createSwDoc("tdf69647_text.docx"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); CPPUNIT_ASSERT_EQUAL_MESSAGE("Number of pages does not match!", 2, getPages()); @@ -3173,7 +3177,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TDF69647_text) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineTables) { - createSwDoc(DATA_DIRECTORY, "redline_table.fodt"); + createSwDoc("redline_table.fodt"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); SwDoc* pDoc(pTextDoc->GetDocShell()->GetDoc()); @@ -3259,7 +3263,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineTables) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf144057) { - createSwDoc(DATA_DIRECTORY, "tdf144057.fodt"); + createSwDoc("tdf144057.fodt"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); SwDoc* pDoc(pTextDoc->GetDocShell()->GetDoc()); @@ -3320,7 +3324,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf144057) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf144347) { - createSwDoc(DATA_DIRECTORY, "tdf144057.fodt"); + createSwDoc("tdf144057.fodt"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); SwDoc* pDoc(pTextDoc->GetDocShell()->GetDoc()); @@ -3374,7 +3378,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf144347) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf109137) { - createSwDoc(DATA_DIRECTORY, "tdf109137.docx"); + createSwDoc("tdf109137.docx"); uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); @@ -3390,124 +3394,79 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf109137) } //just care it doesn't crash/assert -CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint72) -{ - createSwDoc(DATA_DIRECTORY, "forcepoint72-1.rtf"); -} +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint72) { createSwDoc("forcepoint72-1.rtf"); } //just care it doesn't crash/assert -CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint75) -{ - createSwDoc(DATA_DIRECTORY, "forcepoint75-1.rtf"); -} +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint75) { createSwDoc("forcepoint75-1.rtf"); } //just care it doesn't crash/assert -CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testUXTSOREL) -{ - createSwDoc(DATA_DIRECTORY, "LIBREOFFICE-UXTSOREL.rtf"); -} +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testUXTSOREL) { createSwDoc("LIBREOFFICE-UXTSOREL.rtf"); } //just care it doesn't crash/assert CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepointFootnoteFrame) { - createSwDoc(DATA_DIRECTORY, "forcepoint-swfootnoteframe-1.rtf"); + createSwDoc("forcepoint-swfootnoteframe-1.rtf"); } //just care it doesn't crash/assert -CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint76) -{ - createSwDoc(DATA_DIRECTORY, "forcepoint76-1.rtf"); -} +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint76) { createSwDoc("forcepoint76-1.rtf"); } //just care it doesn't crash/assert -CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testN4LA0OHZ) -{ - createSwDoc(DATA_DIRECTORY, "LIBREOFFICE-N4LA0OHZ.rtf"); -} +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testN4LA0OHZ) { createSwDoc("LIBREOFFICE-N4LA0OHZ.rtf"); } //just care it doesn't crash/assert -CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint89) -{ - createSwWebDoc(DATA_DIRECTORY, "forcepoint89.html"); -} +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint89) { createSwWebDoc("forcepoint89.html"); } //just care it doesn't crash/assert -CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint90) -{ - createSwDoc(DATA_DIRECTORY, "forcepoint90.rtf"); -} +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint90) { createSwDoc("forcepoint90.rtf"); } //just care it doesn't crash/assert -CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint91) -{ - createSwWebDoc(DATA_DIRECTORY, "forcepoint91.html"); -} +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint91) { createSwWebDoc("forcepoint91.html"); } //just care it doesn't crash/assert -CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint92) -{ - createSwDoc(DATA_DIRECTORY, "forcepoint92.doc"); -} +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint92) { createSwDoc("forcepoint92.doc"); } //just care it doesn't crash/assert CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint93) { - createSwDoc(DATA_DIRECTORY, "forcepoint93-1.rtf"); - createSwDoc(DATA_DIRECTORY, "forcepoint93-2.rtf"); + createSwDoc("forcepoint93-1.rtf"); + createSwDoc("forcepoint93-2.rtf"); } //just care it doesn't crash/assert -CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint94) -{ - createSwWebDoc(DATA_DIRECTORY, "forcepoint94.html"); -} +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint94) { createSwWebDoc("forcepoint94.html"); } //just care it doesn't crash/assert -CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint98) -{ - createSwWebDoc(DATA_DIRECTORY, "forcepoint98.html"); -} +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint98) { createSwWebDoc("forcepoint98.html"); } //just care it doesn't crash/assert -CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint100) -{ - createSwWebDoc(DATA_DIRECTORY, "forcepoint100.html"); -} +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint100) { createSwWebDoc("forcepoint100.html"); } //just care it doesn't crash/assert -CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint102) -{ - createSwDoc(DATA_DIRECTORY, "forcepoint102.rtf"); -} +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint102) { createSwDoc("forcepoint102.rtf"); } //just care it doesn't crash/assert -CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint103) -{ - createSwWebDoc(DATA_DIRECTORY, "forcepoint103.html"); -} +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint103) { createSwWebDoc("forcepoint103.html"); } //just care it doesn't crash/assert CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf147485Forcepoint) { - createSwDoc(DATA_DIRECTORY, "tdf147485-forcepoint.docx"); + createSwDoc("tdf147485-forcepoint.docx"); } CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf118058) { - SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf118058.fodt"); + SwDoc* pDoc = createSwDoc("tdf118058.fodt"); // This resulted in a layout loop. pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout(); } //just care it doesn't crash/assert -CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint99) -{ - createSwWebDoc(DATA_DIRECTORY, "forcepoint99.html"); -} +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint99) { createSwWebDoc("forcepoint99.html"); } CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf128611) { - createSwDoc(DATA_DIRECTORY, "tdf128611.fodt"); + createSwDoc("tdf128611.fodt"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); CPPUNIT_ASSERT(pXmlDoc); // Without the accompanying fix in place, this test would have failed with: @@ -3520,7 +3479,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf128611) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf125893) { - createSwDoc(DATA_DIRECTORY, "tdf125893.docx"); + createSwDoc("tdf125893.docx"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // This was 400. The paragraph must have zero top border. assertXPath(pXmlDoc, "/root/page/body/txt[4]/infos/prtBounds", "top", "0"); @@ -3528,7 +3487,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf125893) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf134463) { - createSwDoc(DATA_DIRECTORY, "tdf134463.docx"); + createSwDoc("tdf134463.docx"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // This was 621. The previous paragraph must have zero bottom border. assertXPath(pXmlDoc, "/root/page/body/txt[3]/infos/prtBounds", "top", "21"); @@ -3536,7 +3495,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf134463) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf117188) { - createSwDoc(DATA_DIRECTORY, "tdf117188.docx"); + createSwDoc("tdf117188.docx"); uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); @@ -3557,7 +3516,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf117188) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf117187) { - createSwDoc(DATA_DIRECTORY, "tdf117187.odt"); + createSwDoc("tdf117187.odt"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // there should be no fly portions @@ -3568,7 +3527,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf117187) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf119875) { - createSwDoc(DATA_DIRECTORY, "tdf119875.odt"); + createSwDoc("tdf119875.odt"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); sal_Int32 nFirstTop = getXPath(pXmlDoc, "/root/page[2]/body/section[1]/infos/bounds", "top").toInt32(); @@ -3581,7 +3540,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf119875) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf120287) { - createSwDoc(DATA_DIRECTORY, "tdf120287.fodt"); + createSwDoc("tdf120287.fodt"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // This was 2, TabOverMargin Word-specific compat flag did not imply // default-in-Word printer-independent layout, resulting in an additional @@ -3591,7 +3550,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf120287) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf106234) { - createSwDoc(DATA_DIRECTORY, "tdf106234.fodt"); + createSwDoc("tdf106234.fodt"); // Ensure that all text portions are calculated before testing. SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); @@ -3616,7 +3575,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf106234) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf120287b) { - createSwDoc(DATA_DIRECTORY, "tdf120287b.fodt"); + createSwDoc("tdf120287b.fodt"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // This was 1418, TabOverMargin did the right split of the paragraph to two // lines, but then calculated a too large tab portion size on the first @@ -3629,7 +3588,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf120287b) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf120287c) { - createSwDoc(DATA_DIRECTORY, "tdf120287c.fodt"); + createSwDoc("tdf120287c.fodt"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // This was 2, the second line was not broken into a 2nd and a 3rd one, // rendering text outside the paragraph frame. @@ -3638,7 +3597,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf120287c) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf122878) { - createSwDoc(DATA_DIRECTORY, "tdf122878.docx"); + createSwDoc("tdf122878.docx"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // FIXME: the XPath should be adjusted when the proper floating table would be imported const sal_Int32 nTblTop @@ -3660,7 +3619,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf122878) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf115094) { - createSwDoc(DATA_DIRECTORY, "tdf115094.docx"); + createSwDoc("tdf115094.docx"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); sal_Int32 nTopOfD1 @@ -3687,7 +3646,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf115094) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf112290) { - SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf112290.docx"); + SwDoc* pDoc = createSwDoc("tdf112290.docx"); CPPUNIT_ASSERT(pDoc); auto pXml = parseLayoutDump(); assertXPath(pXml, "/root/page/body/txt/SwParaPortion/SwLineLayout[2]", "portion", "Xxxx Xxxx"); @@ -3695,7 +3654,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf112290) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testKeepWithNextPlusFlyFollowTextFlow) { - createSwDoc(DATA_DIRECTORY, "keep-with-next-fly.fodt"); + createSwDoc("keep-with-next-fly.fodt"); { xmlDocUniquePtr pXmlDoc = parseLayoutDump(); @@ -3747,7 +3706,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testKeepWithNextPlusFlyFollowTextFlow) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf122607) { - createSwDoc(DATA_DIRECTORY, "tdf122607.odt"); + createSwDoc("tdf122607.odt"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "/root/page[1]/anchored/fly/txt[1]/anchored/fly/tab/row[2]/cell/txt[7]/anchored/" @@ -3769,9 +3728,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf122607_regression) if (mxComponent.is()) mxComponent->dispose(); - OUString const pName("tdf122607_leerzeile.odt"); - - OUString const url(m_directories.getURLFromSrc(DATA_DIRECTORY) + pName); + OUString const url(createFileURL(u"tdf122607_leerzeile.odt")); // note: must set Hidden property, so that SfxFrameViewWindow_Impl::Resize() // does *not* forward initial VCL Window Resize and thereby triggers a @@ -3780,8 +3737,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf122607_regression) { beans::PropertyValue("Hidden", -1, uno::Any(true), beans::PropertyState_DIRECT_VALUE) }, ... etc. - the rest is truncated