[Libreoffice-commits] core.git: sw/qa

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Thu Jun 10 21:57:01 UTC 2021


 sw/qa/extras/uiwriter/uiwriter.cxx  |  209 +++++++++++++++------------------
 sw/qa/extras/uiwriter/uiwriter2.cxx |  105 +++++++---------
 sw/qa/extras/uiwriter/uiwriter4.cxx |  223 ++++++++++++++++--------------------
 3 files changed, 248 insertions(+), 289 deletions(-)

New commits:
commit b0712101351b084e5073d41052a0abc4f36f4789
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Thu Jun 10 22:39:48 2021 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Jun 10 23:56:18 2021 +0200

    sw_uiwriter: remove duplicated createDoc method
    
    Change-Id: Ie29cd4aa6907018d1bfe492c22ac1d431d0331ad
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117020
    Tested-by: Xisco Fauli <xiscofauli at libreoffice.org>
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index c6bac664bac3..0129e66630af 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -411,23 +411,10 @@ public:
     CPPUNIT_TEST_SUITE_END();
 
 private:
-    SwDoc* createDoc(const char* pName = nullptr);
     std::unique_ptr<SwTextBlocks> readDOCXAutotext(
         std::u16string_view sFileName, bool bEmpty = false);
 };
 
-SwDoc* SwUiWriterTest::createDoc(const char* pName)
-{
-    if (!pName)
-        loadURL("private:factory/swriter", nullptr);
-    else
-        load(DATA_DIRECTORY, pName);
-
-    SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
-    CPPUNIT_ASSERT(pTextDoc);
-    return pTextDoc->GetDocShell()->GetDoc();
-}
-
 std::unique_ptr<SwTextBlocks> SwUiWriterTest::readDOCXAutotext(std::u16string_view sFileName, bool bEmpty)
 {
     utl::TempFile tmp;
@@ -438,7 +425,7 @@ std::unique_ptr<SwTextBlocks> SwUiWriterTest::readDOCXAutotext(std::u16string_vi
         osl::File::copy(m_directories.getURLFromSrc(DATA_DIRECTORY) + sFileName, rURL));
 
     SfxMedium aSrcMed(rURL, StreamMode::STD_READ);
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
 
     SwReader aReader(aSrcMed, rURL, pDoc);
     Reader* pDOCXReader = SwReaderWriter::GetDOCXReader();
@@ -464,7 +451,7 @@ constexpr OUStringLiteral EXPECTED_REPLACE_CONTENT(u"toto toto tutu");
 
 void SwUiWriterTest::testReplaceForward()
 {
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
 
     sw::UndoManager& rUndoManager = pDoc->GetUndoManager();
 
@@ -486,7 +473,7 @@ void SwUiWriterTest::testReplaceForward()
 
 void SwUiWriterTest::testRedlineFrame(char const*const file)
 {
-    SwDoc * pDoc(createDoc(file));
+    SwDoc * pDoc(createSwDoc(DATA_DIRECTORY, file));
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
 
     // there is exactly one frame
@@ -557,7 +544,7 @@ void SwUiWriterTest::testThreadedException()
 
 void SwUiWriterTest::testBookmarkCopy()
 {
-    SwDoc * pDoc(createDoc());
+    SwDoc * pDoc(createSwDoc());
 
     // add text and bookmark
     IDocumentMarkAccess & rIDMA(*pDoc->getIDocumentMarkAccess());
@@ -614,7 +601,7 @@ void SwUiWriterTest::testBookmarkCopy()
 void SwUiWriterTest::testTdf67238()
 {
     //create a new writer document
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     sw::UndoManager& rUndoManager = pDoc->GetUndoManager();
     //insert a 3X3 table in the newly created document
@@ -706,7 +693,7 @@ void SwUiWriterTest::testTdf67238()
 
 void SwUiWriterTest::testFdo75110()
 {
-    SwDoc* pDoc = createDoc("fdo75110.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "fdo75110.odt");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
 
     pWrtShell->SelAll();
@@ -719,7 +706,7 @@ void SwUiWriterTest::testFdo75110()
 
 void SwUiWriterTest::testFdo75898()
 {
-    SwDoc* pDoc = createDoc("fdo75898.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "fdo75898.odt");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     pWrtShell->SelAll();
     pWrtShell->InsertRow(1, true);
@@ -734,7 +721,7 @@ void SwUiWriterTest::testFdo75898()
 
 void SwUiWriterTest::testReplaceBackward()
 {
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
 
     sw::UndoManager& rUndoManager = pDoc->GetUndoManager();
 
@@ -756,7 +743,7 @@ void SwUiWriterTest::testReplaceBackward()
 
 void SwUiWriterTest::testFdo69893()
 {
-    SwDoc* pDoc = createDoc("fdo69893.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "fdo69893.odt");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
 
     pWrtShell->SelAll(); // A1 is empty -> selects the whole table.
@@ -799,7 +786,7 @@ void SwUiWriterTest::testFdo70807()
 void SwUiWriterTest::testImportRTF()
 {
     // Insert "foobar" and position the cursor between "foo" and "bar".
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     pWrtShell->Insert("foobar");
     pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/false, 3, /*bBasicCall=*/false);
@@ -820,7 +807,7 @@ void SwUiWriterTest::testImportRTF()
 void SwUiWriterTest::testExportRTF()
 {
     // Insert "aaabbbccc" and select "bbb".
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     pWrtShell->Insert("aaabbbccc");
     pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/false, 3, /*bBasicCall=*/false);
@@ -938,7 +925,7 @@ void SwUiWriterTest::testDOCXAutoTextGallery()
 
 void SwUiWriterTest::testWatermarkDOCX()
 {
-    SwDoc* const pDoc = createDoc("watermark.docx");
+    SwDoc* const pDoc = createSwDoc(DATA_DIRECTORY, "watermark.docx");
     SwDocShell* pDocShell = pDoc->GetDocShell();
     const SfxPoolItem* pItem;
     SfxItemState eState = pDocShell->GetViewShell()->GetViewFrame()->GetDispatcher()->QueryState(SID_WATERMARK, pItem);
@@ -967,7 +954,7 @@ void SwUiWriterTest::testWatermarkPosition()
         int aPages = aPagesInDocument + aAdditionalPagesCount[i];
 
         // Empty document with one Page Break
-        SwDoc* pDoc = createDoc("watermark-position.odt");
+        SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "watermark-position.odt");
         SwEditShell* pEditShell = pDoc->GetEditShell();
         SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
         uno::Reference<frame::XModel> xModel = pDoc->GetDocShell()->GetBaseModel();
@@ -1035,7 +1022,7 @@ void SwUiWriterTest::testWatermarkPosition()
 void SwUiWriterTest::testFdo74981()
 {
     // create a document with an input field
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     SwInputField aField(static_cast<SwInputFieldType*>(pWrtShell->GetFieldType(0, SwFieldIds::Input)), "foo", "bar", 0, 0);
     pWrtShell->Insert(aField);
@@ -1064,7 +1051,7 @@ void SwUiWriterTest::testFdo74981()
 
 void SwUiWriterTest::testTdf98512()
 {
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     SwInputFieldType *const pType(static_cast<SwInputFieldType*>(
                 pWrtShell->GetFieldType(0, SwFieldIds::Input)));
@@ -1102,7 +1089,7 @@ void SwUiWriterTest::testTdf98512()
 
 void SwUiWriterTest::testShapeTextboxSelect()
 {
-    SwDoc* pDoc = createDoc("shape-textbox.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "shape-textbox.odt");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
     SdrObject* pObject = pPage->GetObj(1);
@@ -1120,7 +1107,7 @@ void SwUiWriterTest::testShapeTextboxSelect()
 
 void SwUiWriterTest::testShapeTextboxDelete()
 {
-    SwDoc* pDoc = createDoc("shape-textbox.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "shape-textbox.odt");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
     SdrObject* pObject = pPage->GetObj(0);
@@ -1137,7 +1124,7 @@ void SwUiWriterTest::testShapeTextboxDelete()
 
 void SwUiWriterTest::testAnchorChangeSelection()
 {
-    SwDoc* pDoc = createDoc("test_anchor_as_character.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "test_anchor_as_character.odt");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
     SdrObject* pObject = pPage->GetObj(0);
@@ -1156,7 +1143,7 @@ void SwUiWriterTest::testAnchorChangeSelection()
 
 void SwUiWriterTest::testCp1000071()
 {
-    SwDoc* pDoc = createDoc("cp1000071.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "cp1000071.odt");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
 
     const SwRedlineTable& rTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable();
@@ -1195,7 +1182,7 @@ void SwUiWriterTest::testCp1000071()
 
 void SwUiWriterTest::testShapeTextboxVertadjust()
 {
-    SwDoc* pDoc = createDoc("shape-textbox-vertadjust.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "shape-textbox-vertadjust.odt");
     SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
     SdrObject* pObject = pPage->GetObj(1);
     SwFrameFormat* pFormat = static_cast<SwContact*>(pObject->GetUserCall())->GetFormat();
@@ -1205,7 +1192,7 @@ void SwUiWriterTest::testShapeTextboxVertadjust()
 
 void SwUiWriterTest::testShapeTextboxAutosize()
 {
-    SwDoc* pDoc = createDoc("shape-textbox-autosize.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "shape-textbox-autosize.odt");
     SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
     // 0-1 is the first UI-visible shape+textbox.
     SdrObject* pFirst = pPage->GetObj(0);
@@ -1223,7 +1210,7 @@ void SwUiWriterTest::testShapeTextboxAutosize()
 
 void SwUiWriterTest::testFdo82191()
 {
-    SwDoc* pDoc = createDoc("fdo82191.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "fdo82191.odt");
     SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
     // Make sure we have a single draw shape.
     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), SwTextBoxHelper::getCount(pPage));
@@ -1244,7 +1231,7 @@ void SwUiWriterTest::testCommentedWord()
 {
     // This word is commented. <- string in document
     // 123456789 <- character positions
-    SwDoc* pDoc = createDoc("commented-word.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "commented-word.odt");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     // Move the cursor into the second word.
     pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/false, 5, /*bBasicCall=*/false);
@@ -1265,7 +1252,7 @@ void SwUiWriterTest::testCommentedWord()
 }
 
 void SwUiWriterTest::testTextFieldGetAnchorGetTextInFooter() {
-    createDoc("textfield-getanchor-gettext-in-footer.odt");
+    createSwDoc(DATA_DIRECTORY, "textfield-getanchor-gettext-in-footer.odt");
 
     uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
     uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields());
@@ -1287,7 +1274,7 @@ void SwUiWriterTest::testChineseConversionBlank()
 {
 
     // Given
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwView* pView = pDoc->GetDocShell()->GetView();
     const uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
     SwNodeIndex aIdx(pDoc->GetNodes().GetEndOfContent(), -1);
@@ -1310,7 +1297,7 @@ void SwUiWriterTest::testChineseConversionNonChineseText()
 {
 
     // Given
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwView* pView = pDoc->GetDocShell()->GetView();
     const uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
     SwNodeIndex aIdx(pDoc->GetNodes().GetEndOfContent(), -1);
@@ -1334,7 +1321,7 @@ void SwUiWriterTest::testChineseConversionTraditionalToSimplified()
 {
 
     // Given
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwView* pView = pDoc->GetDocShell()->GetView();
     const uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
     SwNodeIndex aIdx(pDoc->GetNodes().GetEndOfContent(), -1);
@@ -1358,7 +1345,7 @@ void SwUiWriterTest::testChineseConversionSimplifiedToTraditional()
 {
 
     // Given
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwView* pView = pDoc->GetDocShell()->GetView();
     const uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
     SwNodeIndex aIdx(pDoc->GetNodes().GetEndOfContent(), -1);
@@ -1400,7 +1387,7 @@ void SwUiWriterTest::testFdo85554()
 
 void SwUiWriterTest::testAutoCorr()
 {
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect());
     const sal_Unicode cIns = ' ';
@@ -1428,7 +1415,7 @@ void SwUiWriterTest::testAutoCorr()
 
 void SwUiWriterTest::testTdf83260()
 {
-    SwDoc* const pDoc(createDoc("tdf83260-1.odt"));
+    SwDoc* const pDoc(createSwDoc(DATA_DIRECTORY, "tdf83260-1.odt"));
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect());
 
@@ -1486,7 +1473,7 @@ void SwUiWriterTest::testTdf83260()
 
 void SwUiWriterTest::testTdf130274()
 {
-    SwDoc *const pDoc(createDoc());
+    SwDoc *const pDoc(createSwDoc());
     SwWrtShell *const pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect());
 
@@ -1509,7 +1496,7 @@ void SwUiWriterTest::testTdf130274()
 
 void SwUiWriterTest::testMergeDoc()
 {
-    SwDoc* const pDoc1(createDoc("merge-change1.odt"));
+    SwDoc* const pDoc1(createSwDoc(DATA_DIRECTORY, "merge-change1.odt"));
 
     auto xDoc2Component(loadFromDesktop(
             m_directories.getURLFromSrc(DATA_DIRECTORY) + "merge-change2.odt",
@@ -1540,7 +1527,7 @@ void SwUiWriterTest::testMergeDoc()
 
 void SwUiWriterTest::testCreatePortions()
 {
-    createDoc("uno-cycle.odt");
+    createSwDoc(DATA_DIRECTORY, "uno-cycle.odt");
     uno::Reference<text::XBookmarksSupplier> xBookmarksSupplier(mxComponent, uno::UNO_QUERY);
     uno::Reference<text::XTextContent> xText(xBookmarksSupplier->getBookmarks()->getByName("Mark"), uno::UNO_QUERY);
     uno::Reference<container::XEnumerationAccess> xTextCursor(xText->getAnchor(), uno::UNO_QUERY);
@@ -1555,7 +1542,7 @@ void SwUiWriterTest::testCreatePortions()
 
 void SwUiWriterTest::testBookmarkUndo()
 {
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     sw::UndoManager& rUndoManager = pDoc->GetUndoManager();
     IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
     SwPaM aPaM( SwNodeIndex(pDoc->GetNodes().GetEndOfContent(), -1) );
@@ -1599,7 +1586,7 @@ static void lcl_setWeight(SwWrtShell* pWrtShell, FontWeight aWeight)
 
 void SwUiWriterTest::testFdo85876()
 {
-    SwDoc* const pDoc = createDoc();
+    SwDoc* const pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     lcl_setWeight(pWrtShell, WEIGHT_BOLD);
     pWrtShell->Insert("test");
@@ -1627,7 +1614,7 @@ void SwUiWriterTest::testFdo85876()
 
 void SwUiWriterTest::testCaretPositionMovingUp()
 {
-    SwDoc* const pDoc = createDoc();
+    SwDoc* const pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     pWrtShell->Insert("after");
     pWrtShell->InsertLineBreak();
@@ -1639,7 +1626,7 @@ void SwUiWriterTest::testCaretPositionMovingUp()
 
 void SwUiWriterTest::testTdf93441()
 {
-    SwDoc* const pDoc = createDoc();
+    SwDoc* const pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     pWrtShell->Insert("Hello");
     pWrtShell->InsertLineBreak();
@@ -1655,7 +1642,7 @@ void SwUiWriterTest::testTdf93441()
 
 void SwUiWriterTest::testTdf81226()
 {
-    SwDoc* const pDoc = createDoc();
+    SwDoc* const pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     pWrtShell->Insert("before");
     pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/false, 4, /*bBasicCall=*/false);
@@ -1670,7 +1657,7 @@ void SwUiWriterTest::testTdf81226()
 
 void SwUiWriterTest::testTdf79717()
 {
-    SwDoc* const pDoc = createDoc();
+    SwDoc* const pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     pWrtShell->Insert("normal");
     lcl_setWeight(pWrtShell, WEIGHT_BOLD);
@@ -1717,7 +1704,7 @@ void SwUiWriterTest::testTdf79717()
 
 void SwUiWriterTest::testTdf137532()
 {
-    SwDoc* const pDoc = createDoc();
+    SwDoc* const pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     pWrtShell->Insert("test");
 
@@ -1761,7 +1748,7 @@ void SwUiWriterTest::testTdf137532()
 
 void SwUiWriterTest::testFdo87448()
 {
-    createDoc("fdo87448.odt");
+    createSwDoc(DATA_DIRECTORY, "fdo87448.odt");
 
     // Save the first shape to a metafile.
     uno::Reference<drawing::XGraphicExportFilter> xGraphicExporter = drawing::GraphicExportFilter::create(comphelper::getProcessComponentContext());
@@ -1800,8 +1787,8 @@ void SwUiWriterTest::testFdo87448()
 
 void SwUiWriterTest::testTextCursorInvalidation()
 {
-    createDoc();
-    SwDoc* pDoc = createDoc();
+    createSwDoc();
+    SwDoc* pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY);
     CPPUNIT_ASSERT(xPageStyle.is());
@@ -1823,7 +1810,7 @@ void SwUiWriterTest::testTextCursorInvalidation()
 void SwUiWriterTest::testTdf68183()
 {
     // First disable RSID and check if indeed no such attribute is inserted.
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SW_MOD()->GetModuleConfig()->SetStoreRsid(false);
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     pWrtShell->Insert2("X");
@@ -1844,7 +1831,7 @@ void SwUiWriterTest::testTdf68183()
 
 void SwUiWriterTest::testCp1000115()
 {
-    createDoc("cp1000115.fodt");
+    createSwDoc(DATA_DIRECTORY, "cp1000115.fodt");
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
     xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "/root/page[2]/body/tab/row/cell[2]/txt");
     xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
@@ -1858,7 +1845,7 @@ void SwUiWriterTest::testCp1000115()
 void SwUiWriterTest::testTdf63214()
 {
     //This is a crash test
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     sw::UndoManager& rUndoManager = pDoc->GetUndoManager();
     pWrtShell->Insert("V");
@@ -1884,7 +1871,7 @@ void SwUiWriterTest::testTdf63214()
 
 void SwUiWriterTest::testTdf90003()
 {
-    createDoc("tdf90003.odt");
+    createSwDoc(DATA_DIRECTORY, "tdf90003.odt");
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
     CPPUNIT_ASSERT(pXmlDoc);
     // This was 1: an unexpected fly portion was created, resulting in too
@@ -1894,7 +1881,7 @@ void SwUiWriterTest::testTdf90003()
 
 void SwUiWriterTest::testTdf51741()
 {
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     sw::UndoManager& rUndoManager = pDoc->GetUndoManager();
     IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
@@ -1981,7 +1968,7 @@ void SwUiWriterTest::testDefaultsOfOutlineNumbering()
 
 void SwUiWriterTest::testDeleteTableRedlines()
 {
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     SwInsertTableOptions TableOpt(SwInsertTableFlags::DefaultBorder, 0);
     const SwTable& rTable = pWrtShell->InsertTable(TableOpt, 1, 3);
@@ -2000,7 +1987,7 @@ void SwUiWriterTest::testDeleteTableRedlines()
 
 void SwUiWriterTest::testXFlatParagraph()
 {
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     //Inserting some text in the document
     pWrtShell->Insert("This is sample text");
@@ -2078,7 +2065,7 @@ void SwUiWriterTest::testTdf81995()
 
 void SwUiWriterTest::testForcepoint3()
 {
-    createDoc("flowframe_null_ptr_deref.sample");
+    createSwDoc(DATA_DIRECTORY, "flowframe_null_ptr_deref.sample");
     uno::Sequence<beans::PropertyValue> aDescriptor( comphelper::InitPropertySequence({
         { "FilterName", uno::Any(OUString("writer_pdf_Export")) },
     }));
@@ -2093,7 +2080,7 @@ void SwUiWriterTest::testForcepoint80()
 {
     try
     {
-        createDoc("forcepoint80-1.rtf");
+        createSwDoc(DATA_DIRECTORY, "forcepoint80-1.rtf");
         uno::Sequence<beans::PropertyValue> aDescriptor( comphelper::InitPropertySequence({
             { "FilterName", uno::Any(OUString("writer_pdf_Export")) },
         }));
@@ -2110,7 +2097,7 @@ void SwUiWriterTest::testForcepoint80()
 
 void SwUiWriterTest::testExportToPicture()
 {
-    createDoc();
+    createSwDoc();
     uno::Sequence<beans::PropertyValue> aFilterData( comphelper::InitPropertySequence({
         { "PixelWidth", uno::Any(sal_Int32(610)) },
         { "PixelHeight", uno::Any(sal_Int32(610)) }
@@ -2134,7 +2121,7 @@ void SwUiWriterTest::testExportToPicture()
 
 void SwUiWriterTest::testTdf77340()
 {
-    createDoc();
+    createSwDoc();
     //Getting some paragraph style in our document
     uno::Reference<css::lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY);
     uno::Reference<style::XStyle> xStyle(xFactory->createInstance("com.sun.star.style.ParagraphStyle"), uno::UNO_QUERY);
@@ -2156,7 +2143,7 @@ void SwUiWriterTest::testTdf77340()
 
 void SwUiWriterTest::testTdf79236()
 {
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     sw::UndoManager& rUndoManager = pDoc->GetUndoManager();
     //Getting some paragraph style
     SwTextFormatColl* pTextFormat = pDoc->FindTextFormatCollByName(u"Text Body");
@@ -2215,7 +2202,7 @@ void SwUiWriterTest::testTdf79236()
 void SwUiWriterTest::testTextSearch()
 {
     // Create a new empty Writer document
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwPaM* pCursor = pDoc->GetEditShell()->GetCursor();
     IDocumentContentOperations & rIDCO(pDoc->getIDocumentContentOperations());
     // Insert some text
@@ -2366,7 +2353,7 @@ void SwUiWriterTest::testTdf69282()
     SwDoc* source = pTextDoc->GetDocShell()->GetDoc();
     uno::Reference<lang::XComponent> xSourceDoc = mxComponent;
     mxComponent.clear();
-    SwDoc* target = createDoc();
+    SwDoc* target = createSwDoc();
     SwPageDesc* sPageDesc = source->MakePageDesc("SourceStyle");
     SwPageDesc* tPageDesc = target->MakePageDesc("TargetStyle");
     sPageDesc->ChgFirstShare(false);
@@ -2427,7 +2414,7 @@ void SwUiWriterTest::testTdf69282WithMirror()
     SwDoc* source = pTextDoc->GetDocShell()->GetDoc();
     uno::Reference<lang::XComponent> xSourceDoc = mxComponent;
     mxComponent.clear();
-    SwDoc* target = createDoc();
+    SwDoc* target = createSwDoc();
     SwPageDesc* sPageDesc = source->MakePageDesc("SourceStyle");
     SwPageDesc* tPageDesc = target->MakePageDesc("TargetStyle");
     //Enabling Mirror
@@ -2514,7 +2501,7 @@ void SwUiWriterTest::testTdf78742()
 
 void SwUiWriterTest::testUnoParagraph()
 {
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     //Inserting some text content in the document
     pWrtShell->Insert("This is initial text in paragraph one");
@@ -2549,7 +2536,7 @@ void SwUiWriterTest::testUnoParagraph()
 void SwUiWriterTest::testTdf72788()
 {
     //Create a new empty Writer document
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     SwPaM* pCursor = pDoc->GetEditShell()->GetCursor();
     IDocumentContentOperations & rIDCO(pDoc->getIDocumentContentOperations());
@@ -2609,7 +2596,7 @@ void SwUiWriterTest::testTdf72788()
 
 void SwUiWriterTest::testTdf60967()
 {
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     SwPaM* pCursor = pDoc->GetEditShell()->GetCursor();
     sw::UndoManager& rUndoManager = pDoc->GetUndoManager();
@@ -2661,7 +2648,7 @@ void SwUiWriterTest::testTdf60967()
 
 void SwUiWriterTest::testSearchWithTransliterate()
 {
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     {
         SwNodeIndex aIdx(pDoc->GetNodes().GetEndOfContent(), -1);
@@ -2701,7 +2688,7 @@ void SwUiWriterTest::testSearchWithTransliterate()
 
 void SwUiWriterTest::testTdf73660()
 {
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     OUString aData1 = "First" + OUStringChar(CHAR_SOFTHYPHEN) + "Word";
     OUString aData2 = "Seco" + OUStringChar(CHAR_SOFTHYPHEN) + "nd";
@@ -2747,7 +2734,7 @@ void SwUiWriterTest::testNewDocModifiedState()
 
 void SwUiWriterTest::testTdf77342()
 {
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     SwPaM* pCursor = pDoc->GetEditShell()->GetCursor();
     //inserting first footnote
@@ -2988,7 +2975,7 @@ void SwUiWriterTest::testTdf77342()
 
 void SwUiWriterTest::testTdf63553()
 {
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     SwPaM* pCursor = pDoc->GetEditShell()->GetCursor();
     //inserting sequence field 1
@@ -3248,7 +3235,7 @@ void SwUiWriterTest::testTdf63553()
 
 void SwUiWriterTest::testTdf74230()
 {
-    createDoc();
+    createSwDoc();
     //exporting the empty document to ODT via TempFile
     uno::Sequence<beans::PropertyValue> aDescriptor;
     utl::TempFile aTempFile;
@@ -3268,7 +3255,7 @@ void SwUiWriterTest::testTdf74230()
 
 void SwUiWriterTest::testTdf74363()
 {
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     //testing autocorrect of initial capitals on start of first paragraph
     SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect());
@@ -3283,7 +3270,7 @@ void SwUiWriterTest::testTdf74363()
 
 void SwUiWriterTest::testTdf80663()
 {
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     //Inserting 2x2 Table
     sw::UndoManager& rUndoManager = pDoc->GetUndoManager();
@@ -3370,7 +3357,7 @@ void SwUiWriterTest::testTdf80663()
 
 void SwUiWriterTest::testTdf57197()
 {
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     //Inserting 1x1 Table
     sw::UndoManager& rUndoManager = pDoc->GetUndoManager();
@@ -3452,7 +3439,7 @@ void SwUiWriterTest::testTdf57197()
 
 void SwUiWriterTest::testTdf131990()
 {
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
 
     CPPUNIT_ASSERT(!pWrtShell->Up( false, 1, true ));
@@ -3461,7 +3448,7 @@ void SwUiWriterTest::testTdf131990()
 
 void SwUiWriterTest::testTdf90808()
 {
-    createDoc();
+    createSwDoc();
     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     uno::Reference<text::XTextRange> xTextRange = xTextDocument->getText();
     uno::Reference<text::XText> xText = xTextRange->getText();
@@ -3507,7 +3494,7 @@ void SwUiWriterTest::testTdf90808()
 void SwUiWriterTest::testTdf97601()
 {
     // Instructions from the bugreport to trigger an infinite loop.
-    createDoc("tdf97601.odt");
+    createSwDoc(DATA_DIRECTORY, "tdf97601.odt");
     uno::Reference<text::XTextEmbeddedObjectsSupplier> xEmbeddedObjectsSupplier(mxComponent, uno::UNO_QUERY);
     uno::Reference<container::XNameAccess> xEmbeddedObjects = xEmbeddedObjectsSupplier->getEmbeddedObjects();
     uno::Reference<beans::XPropertySet> xChart;
@@ -3530,7 +3517,7 @@ void SwUiWriterTest::testTdf97601()
 
 void SwUiWriterTest::testTdf75137()
 {
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     SwShellCursor* pShellCursor = pWrtShell->getShellCursor(true);
     pWrtShell->InsertFootnote("This is first footnote");
@@ -3547,7 +3534,7 @@ void SwUiWriterTest::testTdf75137()
 
 void SwUiWriterTest::testTdf83798()
 {
-    SwDoc* pDoc = createDoc("tdf83798.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf83798.odt");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     pWrtShell->GotoNextTOXBase();
     const SwTOXBase* pTOXBase = pWrtShell->GetCurTOX();
@@ -3586,7 +3573,7 @@ void SwUiWriterTest::testTdf83798()
 
 void SwUiWriterTest::testTdf89714()
 {
-    createDoc();
+    createSwDoc();
     uno::Reference<lang::XMultiServiceFactory> xFact(mxComponent, uno::UNO_QUERY);
     uno::Reference<uno::XInterface> xInterface(xFact->createInstance("com.sun.star.text.Defaults"), uno::UNO_QUERY);
     uno::Reference<beans::XPropertyState> xPropState(xInterface, uno::UNO_QUERY);
@@ -3598,7 +3585,7 @@ void SwUiWriterTest::testTdf89714()
 void SwUiWriterTest::testTdf130287()
 {
     //create a new writer document
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     //insert a 1-cell table in the newly created document
     SwInsertTableOptions TableOpt(SwInsertTableFlags::DefaultBorder, 0);
@@ -3617,7 +3604,7 @@ void SwUiWriterTest::testTdf130287()
 
 void SwUiWriterTest::testPropertyDefaults()
 {
-    createDoc();
+    createSwDoc();
     uno::Reference<lang::XMultiServiceFactory> xFact(mxComponent, uno::UNO_QUERY);
     uno::Reference<uno::XInterface> xInterface(xFact->createInstance("com.sun.star.text.Defaults"), uno::UNO_QUERY);
     uno::Reference<beans::XPropertySet> xPropSet(xInterface, uno::UNO_QUERY_THROW);
@@ -3664,7 +3651,7 @@ void SwUiWriterTest::testPropertyDefaults()
 
 void SwUiWriterTest::testTableBackgroundColor()
 {
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     SwInsertTableOptions TableOpt(SwInsertTableFlags::DefaultBorder, 0);
     pWrtShell->InsertTable(TableOpt, 3, 3); //Inserting Table
@@ -3701,7 +3688,7 @@ void SwUiWriterTest::testTableBackgroundColor()
 
 void SwUiWriterTest::testTdf88899()
 {
-    createDoc();
+    createSwDoc();
     uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier(mxComponent, uno::UNO_QUERY);
     uno::Reference<document::XDocumentProperties> xProps(xDocumentPropertiesSupplier->getDocumentProperties());
     uno::Reference<beans::XPropertyContainer> xUserProps = xProps->getUserDefinedProperties();
@@ -3731,7 +3718,7 @@ void SwUiWriterTest::testTdf88899()
 
 void SwUiWriterTest::testTdf90362()
 {
-    SwDoc* pDoc = createDoc("tdf90362.fodt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf90362.fodt");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     uno::Reference<uno::XComponentContext> xComponentContext(comphelper::getProcessComponentContext());
     // Ensure correct initial setting
@@ -3750,7 +3737,7 @@ void SwUiWriterTest::testTdf90362()
 
 void SwUiWriterTest::testUndoDelAsCharTdf107512()
 {
-    SwDoc * pDoc(createDoc());
+    SwDoc * pDoc(createSwDoc());
     sw::UndoManager & rUndoManager(pDoc->GetUndoManager());
     IDocumentContentOperations & rIDCO(pDoc->getIDocumentContentOperations());
     SwCursorShell * pShell(pDoc->GetEditShell());
@@ -3870,7 +3857,7 @@ void SwUiWriterTest::testUndoDelAsCharTdf107512()
 void SwUiWriterTest::testUndoCharAttribute()
 {
     // Create a new empty Writer document
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwPaM* pCursor = pDoc->GetEditShell()->GetCursor();
     sw::UndoManager& rUndoManager = pDoc->GetUndoManager();
     IDocumentContentOperations & rIDCO(pDoc->getIDocumentContentOperations());
@@ -3904,7 +3891,7 @@ void SwUiWriterTest::testUndoCharAttribute()
 
 void SwUiWriterTest::testUndoDelAsChar()
 {
-    SwDoc * pDoc(createDoc());
+    SwDoc * pDoc(createSwDoc());
     sw::UndoManager & rUndoManager(pDoc->GetUndoManager());
     IDocumentContentOperations & rIDCO(pDoc->getIDocumentContentOperations());
     SwCursorShell * pShell(pDoc->GetEditShell());
@@ -3937,7 +3924,7 @@ void SwUiWriterTest::testUndoDelAsChar()
 
 void SwUiWriterTest::testTdf86639()
 {
-    SwDoc* pDoc = createDoc("tdf86639.rtf");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf86639.rtf");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     SwTextFormatColl* pColl = pDoc->FindTextFormatCollByName(u"Heading");
     pWrtShell->SetTextFormatColl(pColl);
@@ -3948,7 +3935,7 @@ void SwUiWriterTest::testTdf86639()
 
 void SwUiWriterTest::testTdf90883TableBoxGetCoordinates()
 {
-    SwDoc* pDoc = createDoc("tdf90883.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf90883.odt");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     pWrtShell->Down(true);
     SwSelBoxes aBoxes;
@@ -4045,7 +4032,7 @@ void SwUiWriterTest::testTextTableCellNames()
 
 void SwUiWriterTest::testShapeAnchorUndo()
 {
-    SwDoc* pDoc = createDoc("draw-anchor-undo.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "draw-anchor-undo.odt");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
     SdrObject* pObject = pPage->GetObj(0);
@@ -4070,7 +4057,7 @@ void SwUiWriterTest::testShapeAnchorUndo()
 
 void SwUiWriterTest::testTdf127635()
 {
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
 
     SwXTextDocument* pXTextDocument = dynamic_cast<SwXTextDocument *>(mxComponent.get());
     CPPUNIT_ASSERT(pXTextDocument);
@@ -4114,7 +4101,7 @@ void SwUiWriterTest::testDde()
 {
 #if HAVE_FEATURE_UI
     // Type asdf and copy it.
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     pWrtShell->Insert("asdf");
     pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/true, 4, /*bBasicCall=*/false);
@@ -4180,7 +4167,7 @@ IMPL_LINK(IdleTask, FlipFlag, Timer*, , void)
 void SwUiWriterTest::testDocModState()
 {
     //creating a new writer document via the XDesktop(to have more shells etc.)
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     //creating instance of IdleTask Class
     IdleTask idleTask;
     //checking the state of the document via IDocumentState
@@ -4205,7 +4192,7 @@ void SwUiWriterTest::testDocModState()
 void SwUiWriterTest::testTdf94804()
 {
     //create new writer document
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     //get cursor for making bookmark at a particular location
     SwPaM* pCrsr = pDoc->GetEditShell()->GetCursor();
     IDocumentMarkAccess* pIDMAccess(pDoc->getIDocumentMarkAccess());
@@ -4229,7 +4216,7 @@ void SwUiWriterTest::testTdf94804()
 
 void SwUiWriterTest::testUnicodeNotationToggle()
 {
-    SwDoc* pDoc = createDoc("unicodeAltX.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "unicodeAltX.odt");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     OUString sOriginalDocString;
     OUString sDocString;
@@ -4262,7 +4249,7 @@ void SwUiWriterTest::testTdf34957()
 
 void SwUiWriterTest::testTdf89954()
 {
-    SwDoc* pDoc = createDoc("tdf89954.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf89954.odt");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     pWrtShell->EndPara();
     SwXTextDocument* pXTextDocument = dynamic_cast<SwXTextDocument *>(mxComponent.get());
@@ -4283,7 +4270,7 @@ void SwUiWriterTest::testTdf89954()
 
 void SwUiWriterTest::testTdf89720()
 {
-    SwDoc* pDoc = createDoc("tdf89720.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf89720.odt");
     SwView* pView = pDoc->GetDocShell()->GetView();
     SwPostItMgr* pPostItMgr = pView->GetPostItMgr();
     for (std::unique_ptr<SwSidebarItem> const & pItem : *pPostItMgr)
@@ -4298,7 +4285,7 @@ void SwUiWriterTest::testTdf89720()
 void SwUiWriterTest::testTdf88986()
 {
     // Create a text shell.
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwView* pView = pDoc->GetDocShell()->GetView();
     SwTextShell aShell(*pView);
 
@@ -4314,7 +4301,7 @@ void SwUiWriterTest::testTdf88986()
 void SwUiWriterTest::testTdf87922()
 {
     // Create an SwDrawTextInfo.
-    SwDoc* pDoc = createDoc("tdf87922.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf87922.odt");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     SwScriptInfo* pScriptInfo = nullptr;
     // Get access to the single paragraph in the document.
@@ -4409,7 +4396,7 @@ void SwUiWriterTest::testTdf77014()
     // This test checks that the input field is in one piece and if the
     // input field has more words, it is broken up at the correct place.
 
-    SwDoc* pDoc = createDoc("tdf77014.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf77014.odt");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
 
     SwTextFrame* pTextFrame = static_cast<SwTextFrame*>(pWrtShell->GetLayout()->GetLower()->GetLower()->GetLower());
@@ -4550,7 +4537,7 @@ void SwUiWriterTest::testTdf77014()
 
 void SwUiWriterTest::testTdf92648()
 {
-    SwDoc* pDoc = createDoc("tdf92648.docx");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf92648.docx");
     SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
     // Make sure we have ten draw shapes.
     // Yes, we have if the left/right pages have different header/footer,
@@ -4572,7 +4559,7 @@ void SwUiWriterTest::testTdf92648()
 
 void SwUiWriterTest::testTdf103978_backgroundTextShape()
 {
-    SwDoc* pDoc = createDoc("tdf103978_backgroundTextShape.docx");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf103978_backgroundTextShape.docx");
 
     // there is only one shape. It has an attached textbox
     bool bShapeIsOpaque = getProperty<bool>(getShape(1), "Opaque");
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 5e6cfb1fc0f4..1a2f7cd693e1 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -99,24 +99,11 @@ public:
 
 protected:
     AllSettings m_aSavedSettings;
-    SwDoc* createDoc(const char* pName = nullptr);
 };
 
-SwDoc* SwUiWriterTest2::createDoc(const char* pName)
-{
-    if (!pName)
-        loadURL("private:factory/swriter", nullptr);
-    else
-        load(DATA_DIRECTORY, pName);
-
-    SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    CPPUNIT_ASSERT(pTextDoc);
-    return pTextDoc->GetDocShell()->GetDoc();
-}
-
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf47471_paraStyleBackground)
 {
-    SwDoc* pDoc = createDoc("tdf47471_paraStyleBackground.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf47471_paraStyleBackground.odt");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
 
     CPPUNIT_ASSERT_EQUAL(OUString("00Background"),
@@ -149,7 +136,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf47471_paraStyleBackground)
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdfChangeNumberingListAutoFormat)
 {
-    createDoc("tdf117923.docx");
+    createSwDoc(DATA_DIRECTORY, "tdf117923.docx");
     // Ensure that all text portions are calculated before testing.
     SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
     CPPUNIT_ASSERT(pTextDoc);
@@ -355,7 +342,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testRedlineSplitContentNode)
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf136704)
 {
-    SwDoc* const pDoc(createDoc());
+    SwDoc* const pDoc(createSwDoc());
     SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect());
     corr.GetSwFlags().bReplaceStyles = true;
@@ -655,7 +642,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf136453)
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137245)
 {
-    SwDoc* const pDoc(createDoc());
+    SwDoc* const pDoc(createSwDoc());
     SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect());
     corr.GetSwFlags().bSetBorder = true;
@@ -759,7 +746,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf132236)
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf131912)
 {
-    SwDoc* const pDoc = createDoc();
+    SwDoc* const pDoc = createSwDoc();
     SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell();
 
     sw::UndoManager& rUndoManager = pDoc->GetUndoManager();
@@ -1284,7 +1271,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf119571_keep_numbering_with_Reject)
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf109376_redline)
 {
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     CPPUNIT_ASSERT(pWrtShell);
     // need 2 paragraphs to get to the bMoveNds case
@@ -1335,7 +1322,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf109376_redline)
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf109376)
 {
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     CPPUNIT_ASSERT(pWrtShell);
     // need 2 paragraphs to get to the bMoveNds case
@@ -1382,7 +1369,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf109376)
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf64242_optimizeTable)
 {
-    SwDoc* pDoc = createDoc("tdf64242_optimizeTable.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf64242_optimizeTable.odt");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
 
     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
@@ -1423,7 +1410,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf64242_optimizeTable)
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf126784_distributeSelectedColumns)
 {
-    SwDoc* pDoc = createDoc("tdf126784_distributeSelectedColumns.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf126784_distributeSelectedColumns.odt");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
 
     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
@@ -1450,7 +1437,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf126784_distributeSelectedColumns)
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf108687_tabstop)
 {
-    SwDoc* pDoc = createDoc("tdf108687_tabstop.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf108687_tabstop.odt");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     sal_Int32 nStartIndex = pWrtShell->GetCursor()->GetNode().GetIndex();
     CPPUNIT_ASSERT_EQUAL(sal_Int32(9), nStartIndex);
@@ -1539,7 +1526,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf119019)
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf119824)
 {
     // check handling of overlapping redlines with Redo
-    SwDoc* pDoc = createDoc("tdf119019.docx");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf119019.docx");
 
     SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
     CPPUNIT_ASSERT(pTextDoc);
@@ -1870,7 +1857,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf76817_custom_outline)
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf123102)
 {
-    createDoc("tdf123102.odt");
+    createSwDoc(DATA_DIRECTORY, "tdf123102.odt");
     // insert a new row after a vertically merged cell
     dispatchCommand(mxComponent, ".uno:InsertRowsAfter", {});
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
@@ -2052,7 +2039,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testRTLparaStyle_LocaleArabic)
     // Set the locale to "ar" for this test - see preTest() at the top of this file.
     std::unique_ptr<Resetter> const pChanges(preTest("LocaleArabic"));
 
-    createDoc(); // new, empty doc - everything defaults to RTL with Arabic locale
+    createSwDoc(); // new, empty doc - everything defaults to RTL with Arabic locale
 
     // Save it and load it back.
     reload("Office Open XML Text", "tdf116404_paraStyleFrameDir.docx");
@@ -2320,7 +2307,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137503)
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf138605)
 {
-    SwDoc* const pDoc(createDoc());
+    SwDoc* const pDoc(createSwDoc());
     SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
     CPPUNIT_ASSERT(pTextDoc);
@@ -2539,7 +2526,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf142196)
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf139120)
 {
-    SwDoc* pDoc = createDoc("tdf54819.fodt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf54819.fodt");
 
     SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
     CPPUNIT_ASSERT(pTextDoc);
@@ -2731,7 +2718,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf139127)
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf138479)
 {
-    SwDoc* const pDoc = createDoc();
+    SwDoc* const pDoc = createSwDoc();
 
     SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
     CPPUNIT_ASSERT(pTextDoc);
@@ -2783,7 +2770,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf138479)
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf138666)
 {
-    SwDoc* pDoc = createDoc("tdf39721.fodt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf39721.fodt");
 
     SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
     CPPUNIT_ASSERT(pTextDoc);
@@ -2818,7 +2805,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf138666)
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf140982)
 {
-    SwDoc* pDoc = createDoc("tdf115815.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf115815.odt");
 
     SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
     CPPUNIT_ASSERT(pTextDoc);
@@ -2921,7 +2908,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf126206)
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf101873)
 {
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     CPPUNIT_ASSERT(pDoc);
 
     SwDocShell* pDocShell = pDoc->GetDocShell();
@@ -2955,7 +2942,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf101873)
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTextFormFieldInsertion)
 {
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     CPPUNIT_ASSERT(pDoc);
     IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess();
     CPPUNIT_ASSERT(pMarkAccess);
@@ -2992,7 +2979,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTextFormFieldInsertion)
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testCheckboxFormFieldInsertion)
 {
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     CPPUNIT_ASSERT(pDoc);
 
     IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess();
@@ -3031,7 +3018,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testCheckboxFormFieldInsertion)
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testDropDownFormFieldInsertion)
 {
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     CPPUNIT_ASSERT(pDoc);
 
     IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess();
@@ -3071,7 +3058,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testDropDownFormFieldInsertion)
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testMixedFormFieldInsertion)
 {
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     CPPUNIT_ASSERT(pDoc);
 
     IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess();
@@ -3101,7 +3088,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf124261)
 {
 #if !defined(_WIN32)
     // Make sure that pressing a key in a btlr cell frame causes an immediate, correct repaint.
-    SwDoc* pDoc = createDoc("tdf124261.docx");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf124261.docx");
     SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
     SwFrame* pPageFrame = pLayout->GetLower();
     CPPUNIT_ASSERT(pPageFrame->IsPageFrame());
@@ -3133,7 +3120,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf124261)
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testDocxAttributeTableExport)
 {
-    createDoc("floating-table-position.docx");
+    createSwDoc(DATA_DIRECTORY, "floating-table-position.docx");
 
     // get the table frame, set new values and dismiss the references
     {
@@ -3265,7 +3252,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf125310)
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf125310b)
 {
-    SwDoc* pDoc = createDoc("tdf125310b.fodt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf125310b.fodt");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
 
     SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
@@ -3342,7 +3329,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf106843)
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testImageComment)
 {
     // Load a document with an as-char image in it.
-    SwDoc* pDoc = createDoc("image-comment.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "image-comment.odt");
     SwView* pView = pDoc->GetDocShell()->GetView();
 
     // Test document has "before<image>after", remove the content before the image.
@@ -3441,7 +3428,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testImageComment)
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testImageCommentAtChar)
 {
     // Load a document with an at-char image in it.
-    SwDoc* pDoc = createDoc("image-comment-at-char.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "image-comment-at-char.odt");
     SwView* pView = pDoc->GetDocShell()->GetView();
 
     // Select the image.
@@ -3510,7 +3497,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testImageCommentAtChar)
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTrackImageDeletion)
 {
     // load a document with an image anchored to paragraph in it
-    SwDoc* pDoc = createDoc("image.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "image.odt");
     SwView* pView = pDoc->GetDocShell()->GetView();
 
     // select the image
@@ -3643,7 +3630,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf120338_multiple_paragraph_join)
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testShapePageMove)
 {
     // Load a document with 2 pages, shape on the first page.
-    SwDoc* pDoc = createDoc("shape-page-move.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "shape-page-move.odt");
     SwView* pView = pDoc->GetDocShell()->GetView();
     // Make sure that the 2nd page is below the 1st one.
     pView->SetViewLayout(/*nColumns=*/1, /*bBookMode=*/false);
@@ -3688,7 +3675,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testShapePageMove)
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testDateFormFieldInsertion)
 {
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     CPPUNIT_ASSERT(pDoc);
     IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess();
     CPPUNIT_ASSERT(pMarkAccess);
@@ -3725,7 +3712,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testDateFormFieldInsertion)
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testDateFormFieldContentOperations)
 {
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     CPPUNIT_ASSERT(pDoc);
     IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess();
     CPPUNIT_ASSERT(pMarkAccess);
@@ -3758,7 +3745,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testDateFormFieldContentOperations)
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testDateFormFieldCurrentDateHandling)
 {
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     CPPUNIT_ASSERT(pDoc);
     IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess();
     CPPUNIT_ASSERT(pMarkAccess);
@@ -3812,7 +3799,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testDateFormFieldCurrentDateHandling)
 #if !defined(_WIN32)
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testDateFormFieldCurrentDateInvalidation)
 {
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     CPPUNIT_ASSERT(pDoc);
     IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess();
     CPPUNIT_ASSERT(pMarkAccess);
@@ -3875,7 +3862,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testOleSaveWhileEdit)
     comphelper::LibreOfficeKit::setActive();
 
     // Load a document with a Draw doc in it.
-    SwDoc* pDoc = createDoc("ole-save-while-edit.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "ole-save-while-edit.odt");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     pWrtShell->GotoObj(/*bNext=*/true, GotoObjFlags::Any);
 
@@ -3969,7 +3956,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testRedlineTableRowDeletion)
     // load a 1-row table, and delete the row with enabled change tracking:
     // now the row is not deleted silently, but keeps the deleted cell contents,
     // and only accepting all of them will result the deletion of the table row.
-    SwDoc* pDoc = createDoc("tdf118311.fodt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf118311.fodt");
 
     SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
     CPPUNIT_ASSERT(pTextDoc);
@@ -4085,7 +4072,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testRedlineTableRowDeletionWithExport)
     // load a 1-row table, and delete the row with enabled change tracking:
     // now the row is not deleted silently, but keeps the deleted cell contents,
     // and only accepting all of them will result the deletion of the table row.
-    SwDoc* pDoc = createDoc("tdf118311.fodt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf118311.fodt");
 
     SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
     CPPUNIT_ASSERT(pTextDoc);
@@ -4142,7 +4129,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testRedlineTableRowDeletionWithDOCXExport)
     // load a 1-row table, and delete the row with enabled change tracking:
     // now the row is not deleted silently, but keeps the deleted cell contents,
     // and only accepting all of them will result the deletion of the table row.
-    SwDoc* pDoc = createDoc("tdf118311.fodt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf118311.fodt");
 
     SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
     CPPUNIT_ASSERT(pTextDoc);
@@ -4199,7 +4186,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testRedlineTableRowDeletionWithDOCXExport)
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf128335)
 {
     // Load the bugdoc, which has 3 textboxes.
-    SwDoc* pDoc = createDoc("tdf128335.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf128335.odt");
 
     // Select the 3rd textbox.
     SwView* pView = pDoc->GetDocShell()->GetView();
@@ -4236,7 +4223,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testRedlineTableRowDeletionWithReject)
     // load a 1-row table, and delete the row with enabled change tracking:
     // now the row is not deleted silently, but keeps the deleted cell contents,
     // and only accepting all of them will result the deletion of the table row.
-    SwDoc* pDoc = createDoc("tdf118311.fodt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf118311.fodt");
 
     SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
     CPPUNIT_ASSERT(pTextDoc);
@@ -4313,7 +4300,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testRedlineTableRowDeletionWithReject)
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf128603)
 {
     // Load the bugdoc, which has 3 textboxes.
-    SwDoc* pDoc = createDoc("tdf128603.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf128603.odt");
 
     // Select the 3rd textbox.
     SwView* pView = pDoc->GetDocShell()->GetView();
@@ -4364,7 +4351,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testOfz18563)
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf90069)
 {
-    SwDoc* pDoc = createDoc("tdf90069.docx");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf90069.docx");
 
     SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
     CPPUNIT_ASSERT(pTextDoc);
@@ -4394,7 +4381,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf90069)
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf109266)
 {
     // transliteration with redlining
-    SwDoc* pDoc = createDoc("lorem.fodt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "lorem.fodt");
 
     SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
     CPPUNIT_ASSERT(pTextDoc);
@@ -4462,7 +4449,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf109266)
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf129655)
 {
-    createDoc("tdf129655-vtextbox.odt");
+    createSwDoc(DATA_DIRECTORY, "tdf129655-vtextbox.odt");
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//anchored/fly/txt[@WritingMode='Vertical']", 1);
 }
@@ -4545,7 +4532,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf123218)
     ClockwisePieChartDirection::set(true, batch);
     batch->commit();
 
-    createDoc();
+    createSwDoc();
     SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
     CPPUNIT_ASSERT(pTextDoc);
 
@@ -4601,7 +4588,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf123218)
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf126735)
 {
-    SwDoc* pDoc = createDoc("tdf39721.fodt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf39721.fodt");
 
     SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
     CPPUNIT_ASSERT(pTextDoc);
diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx b/sw/qa/extras/uiwriter/uiwriter4.cxx
index 29b3fb69064b..b2a53d2242f2 100644
--- a/sw/qa/extras/uiwriter/uiwriter4.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter4.cxx
@@ -393,23 +393,8 @@ public:
     CPPUNIT_TEST(testEmojiAutoCorrect);
     CPPUNIT_TEST(testInsertPdf);
     CPPUNIT_TEST_SUITE_END();
-
-private:
-    SwDoc* createDoc(const char* pName = nullptr);
 };
 
-SwDoc* SwUiWriterTest4::createDoc(const char* pName)
-{
-    if (!pName)
-        loadURL("private:factory/swriter", nullptr);
-    else
-        load(DATA_DIRECTORY, pName);
-
-    SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
-    CPPUNIT_ASSERT(pTextDoc);
-    return pTextDoc->GetDocShell()->GetDoc();
-}
-
 static void lcl_selectCharacters(SwPaM& rPaM, sal_Int32 first, sal_Int32 end)
 {
     rPaM.GetPoint()->nContent.Assign(rPaM.GetContentNode(), first);
@@ -420,7 +405,7 @@ static void lcl_selectCharacters(SwPaM& rPaM, sal_Int32 first, sal_Int32 end)
 void SwUiWriterTest4::testTdf96515()
 {
     // Enable hide whitespace mode.
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     SwViewOption aViewOptions(*pWrtShell->GetViewOptions());
     aViewOptions.SetHideWhitespaceMode(true);
@@ -441,7 +426,7 @@ void SwUiWriterTest4::testTdf96515()
 void SwUiWriterTest4::testTdf96943()
 {
     // Enable hide whitespace mode.
-    SwDoc* pDoc = createDoc("tdf96943.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf96943.odt");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     SwViewOption aViewOptions(*pWrtShell->GetViewOptions());
     aViewOptions.SetHideWhitespaceMode(true);
@@ -458,7 +443,7 @@ void SwUiWriterTest4::testTdf96943()
 void SwUiWriterTest4::testTdf96536()
 {
     // Enable hide whitespace mode.
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     SwViewOption aViewOptions(*pWrtShell->GetViewOptions());
     aViewOptions.SetHideWhitespaceMode(true);
@@ -497,7 +482,7 @@ void SwUiWriterTest4::testTdf96479()
     static const OUString emptyInputTextField
         = OUStringChar(CH_TXT_ATR_INPUTFIELDSTART) + OUStringChar(CH_TXT_ATR_INPUTFIELDEND);
 
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
     CPPUNIT_ASSERT(pTextDoc);
 
@@ -614,7 +599,7 @@ void SwUiWriterTest4::testTdf96479()
 void SwUiWriterTest4::testBookmarkCollapsed()
 {
     // load document
-    SwDoc* pDoc = createDoc("collapsed_bookmark.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "collapsed_bookmark.odt");
     CPPUNIT_ASSERT(pDoc);
 
     // save original document
@@ -655,7 +640,7 @@ void SwUiWriterTest4::testRemoveBookmarkText()
     // create document
     {
         // create a text document with "abcdef"
-        SwDoc* pDoc = createDoc();
+        SwDoc* pDoc = createSwDoc();
         SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
         CPPUNIT_ASSERT(pTextDoc);
 
@@ -741,7 +726,7 @@ void SwUiWriterTest4::testRemoveBookmarkTextAndAddNew()
     // create document
     {
         // create a text document with "abcdef"
-        SwDoc* pDoc = createDoc();
+        SwDoc* pDoc = createSwDoc();
         SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
         CPPUNIT_ASSERT(pTextDoc);
 
@@ -845,7 +830,7 @@ void SwUiWriterTest4::testRemoveBookmarkTextAndAddNew()
 void SwUiWriterTest4::testRemoveBookmarkTextAndAddNewAfterReload()
 {
     // load document
-    SwDoc* pDoc = createDoc("collapsed_bookmark.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "collapsed_bookmark.odt");
     CPPUNIT_ASSERT(pDoc);
 
     // write "abc" to area marked with "testBookmark" bookmark
@@ -892,7 +877,7 @@ void SwUiWriterTest4::testRemoveBookmarkTextAndAddNewAfterReload()
 void SwUiWriterTest4::testTdf96961()
 {
     // Insert a page break.
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     pWrtShell->InsertPageBreak();
 
@@ -911,7 +896,7 @@ void SwUiWriterTest4::testTdf96961()
 
 void SwUiWriterTest4::testTdf88453()
 {
-    createDoc("tdf88453.odt");
+    createSwDoc(DATA_DIRECTORY, "tdf88453.odt");
     calcLayout();
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
     // This was 0: the table does not fit the first page, but it wasn't split
@@ -921,7 +906,7 @@ void SwUiWriterTest4::testTdf88453()
 
 void SwUiWriterTest4::testTdf88453Table()
 {
-    createDoc("tdf88453-table.odt");
+    createSwDoc(DATA_DIRECTORY, "tdf88453-table.odt");
     calcLayout();
     // This was 2: layout could not split the large outer table in the document
     // into 3 pages.
@@ -939,11 +924,11 @@ int checkShells(const SwDocShell* pSource, const SwDocShell* pDestination)
 
 void SwUiWriterTest4::testClassificationPaste()
 {
-    SwDocShell* pSourceShell = createDoc()->GetDocShell();
+    SwDocShell* pSourceShell = createSwDoc()->GetDocShell();
     uno::Reference<lang::XComponent> xSourceComponent = mxComponent;
     mxComponent.clear();
 
-    SwDocShell* pDestinationShell = createDoc()->GetDocShell();
+    SwDocShell* pDestinationShell = createSwDoc()->GetDocShell();
 
     // Not classified source, not classified destination.
     CPPUNIT_ASSERT_EQUAL(int(SfxClassificationCheckPasteResult::None),
@@ -969,8 +954,8 @@ void SwUiWriterTest4::testClassificationPaste()
 void SwUiWriterTest4::testSmallCaps()
 {
     // Create a document, add some characters and select them.
-    createDoc();
-    SwDoc* pDoc = createDoc();
+    createSwDoc();
+    SwDoc* pDoc = createSwDoc();
     SwDocShell* pDocShell = pDoc->GetDocShell();
     SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
     pWrtShell->Insert("text");
@@ -986,7 +971,7 @@ void SwUiWriterTest4::testSmallCaps()
 
 void SwUiWriterTest4::testTdf98987()
 {
-    createDoc("tdf98987.docx");
+    createSwDoc(DATA_DIRECTORY, "tdf98987.docx");
     calcLayout();
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "/root/page/body/txt/anchored/SwAnchoredDrawObject[2]/SdrObject", "name",
@@ -1012,7 +997,7 @@ void SwUiWriterTest4::testTdf98987()
 
 void SwUiWriterTest4::testTdf99004()
 {
-    createDoc("tdf99004.docx");
+    createSwDoc(DATA_DIRECTORY, "tdf99004.docx");
     calcLayout();
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
     sal_Int32 nTextbox1Top
@@ -1032,7 +1017,7 @@ void SwUiWriterTest4::testTdf99004()
 
 void SwUiWriterTest4::testTdf84695()
 {
-    SwDoc* pDoc = createDoc("tdf84695.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf84695.odt");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
     SdrObject* pObject = pPage->GetObj(1);
@@ -1057,7 +1042,7 @@ void SwUiWriterTest4::testTdf84695()
 
 void SwUiWriterTest4::testTdf84695NormalChar()
 {
-    SwDoc* pDoc = createDoc("tdf84695.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf84695.odt");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
     SdrObject* pObject = pPage->GetObj(1);
@@ -1081,7 +1066,7 @@ void SwUiWriterTest4::testTdf84695NormalChar()
 
 void SwUiWriterTest4::testTdf84695Tab()
 {
-    SwDoc* pDoc = createDoc("tdf84695-tab.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf84695-tab.odt");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
     SdrObject* pObject = pPage->GetObj(0);
@@ -1109,7 +1094,7 @@ void SwUiWriterTest4::testTdf84695Tab()
 
 void SwUiWriterTest4::testTableStyleUndo()
 {
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     sw::UndoManager& rUndoManager = pDoc->GetUndoManager();
 
     sal_Int32 nStyleCount = pDoc->GetTableStyles().size();
@@ -1166,7 +1151,7 @@ void SwUiWriterTest4::testTableStyleUndo()
 void SwUiWriterTest4::testRedlineCopyPaste()
 {
     // regressed in tdf#106746
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
 
     SwNodeIndex aIdx(pDoc->GetNodes().GetEndOfContent(), -1);
     SwPaM aPaM(aIdx);
@@ -1199,7 +1184,7 @@ void SwUiWriterTest4::testRedlineCopyPaste()
 
 void SwUiWriterTest4::testTdf135260()
 {
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwDocShell* pDocShell = pDoc->GetDocShell();
     SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
     pWrtShell->Insert("test");
@@ -1227,7 +1212,7 @@ void SwUiWriterTest4::testTdf135260()
 void SwUiWriterTest4::testRedlineParam()
 {
     // Create a document with minimal content.
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwDocShell* pDocShell = pDoc->GetDocShell();
     SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
     pWrtShell->Insert("middle");
@@ -1284,7 +1269,7 @@ void SwUiWriterTest4::testRedlineViewAuthor()
     // Test that setting an author at an SwView level has effect.
 
     // Create a document with minimal content.
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwDocShell* pDocShell = pDoc->GetDocShell();
     SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
     pWrtShell->Insert("middle");
@@ -1323,7 +1308,7 @@ void SwUiWriterTest4::testRedlineViewAuthor()
 
 void SwUiWriterTest4::testTdf91292()
 {
-    createDoc("tdf91292_paraBackground.docx");
+    createSwDoc(DATA_DIRECTORY, "tdf91292_paraBackground.docx");
     uno::Reference<beans::XPropertySet> xPropertySet(getParagraph(1), uno::UNO_QUERY);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("Solid background color", drawing::FillStyle_SOLID,
                                  getProperty<drawing::FillStyle>(xPropertySet, "FillStyle"));
@@ -1343,7 +1328,7 @@ void SwUiWriterTest4::testTdf91292()
 
 void SwUiWriterTest4::testTdf78727()
 {
-    SwDoc* pDoc = createDoc("tdf78727.docx");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf78727.docx");
     SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
     // This was 1: make sure we don't loose the TextBox anchored inside the
     // table that is moved inside a text frame.
@@ -1355,7 +1340,7 @@ void SwUiWriterTest4::testRedlineTimestamp()
     // Test that a redline timestamp's second is not always 0.
 
     // Create a document with minimal content.
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwDocShell* pDocShell = pDoc->GetDocShell();
     SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
     pWrtShell->Insert("middle");
@@ -1393,7 +1378,7 @@ void SwUiWriterTest4::testRedlineTimestamp()
 void SwUiWriterTest4::testCursorWindows()
 {
     // Create a new document with one window.
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwDocShell* pDocShell = pDoc->GetDocShell();
     SwWrtShell* pWrtShell1 = pDocShell->GetWrtShell();
 
@@ -1415,7 +1400,7 @@ void SwUiWriterTest4::testCursorWindows()
 void SwUiWriterTest4::testLandscape()
 {
     // Set page orientation to landscape.
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     uno::Sequence<beans::PropertyValue> aPropertyValues(
         comphelper::InitPropertySequence({ { "AttributePage.Landscape", uno::Any(true) } }));
     dispatchCommand(mxComponent, ".uno:AttributePage", aPropertyValues);
@@ -1434,7 +1419,7 @@ void SwUiWriterTest4::testTdf95699()
     // Open the document with single FORMCHECKBOX field, select all and copy to clipboard
     // then check that clipboard contains the FORMCHECKBOX in text body.
     // Previously that failed.
-    SwDoc* pDoc = createDoc("tdf95699.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf95699.odt");
     IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess();
     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pMarkAccess->getAllMarksCount());
     SwDoc aClipboard;
@@ -1454,7 +1439,7 @@ void SwUiWriterTest4::testTdf104032()
     // Open the document with FORMCHECKBOX field, select it and copy to clipboard
     // Go to end of document and paste it, then undo
     // Previously that asserted in debug build.
-    SwDoc* pDoc = createDoc("tdf104032.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf104032.odt");
     sw::UndoManager& rUndoManager = pDoc->GetUndoManager();
     SwDoc aClipboard;
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
@@ -1468,7 +1453,7 @@ void SwUiWriterTest4::testTdf104032()
 
 void SwUiWriterTest4::testTdf104440()
 {
-    createDoc("tdf104440.odt");
+    createSwDoc(DATA_DIRECTORY, "tdf104440.odt");
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
     xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//page[2]/body/txt/anchored");
     xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
@@ -1481,7 +1466,7 @@ void SwUiWriterTest4::testTdf104440()
 
 void SwUiWriterTest4::testTdf104425()
 {
-    createDoc("tdf104425.odt");
+    createSwDoc(DATA_DIRECTORY, "tdf104425.odt");
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
     // The document contains one top-level 1-cell table with minimum row height set to 70 cm,
     // and the cell contents does not exceed the minimum row height.
@@ -1500,7 +1485,7 @@ void SwUiWriterTest4::testTdf104425()
 // accepting change tracking gets stuck on change
 void SwUiWriterTest4::testTdf104814()
 {
-    SwDoc* const pDoc1(createDoc("tdf104814.docx"));
+    SwDoc* const pDoc1(createSwDoc(DATA_DIRECTORY, "tdf104814.docx"));
 
     SwEditShell* const pEditShell(pDoc1->GetEditShell());
 
@@ -1512,7 +1497,7 @@ void SwUiWriterTest4::testTdf104814()
 void SwUiWriterTest4::testTdf66405()
 {
     // Imported formula should have zero margins
-    createDoc("tdf66405.docx");
+    createSwDoc(DATA_DIRECTORY, "tdf66405.docx");
     uno::Reference<text::XTextEmbeddedObjectsSupplier> xEmbeddedObjectsSupplier(mxComponent,
                                                                                 uno::UNO_QUERY);
     uno::Reference<container::XNameAccess> xEmbeddedObjects
@@ -1547,7 +1532,7 @@ void SwUiWriterTest4::testTdf66405()
 void SwUiWriterTest4::testTdf35021_tabOverMarginDemo()
 {
 #if HAVE_MORE_FONTS
-    createDoc("tdf35021_tabOverMarginDemo.doc");
+    createSwDoc(DATA_DIRECTORY, "tdf35021_tabOverMarginDemo.doc");
     calcLayout();
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
     // Tabs should go past the margin @ ~3381
@@ -1570,7 +1555,7 @@ void SwUiWriterTest4::testTdf35021_tabOverMarginDemo()
 
 void SwUiWriterTest4::testTdf106701_tabOverMarginAutotab()
 {
-    createDoc("tdf106701_tabOverMarginAutotab.doc");
+    createSwDoc(DATA_DIRECTORY, "tdf106701_tabOverMarginAutotab.doc");
     calcLayout();
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
     // The right margin is ~3378
@@ -1583,7 +1568,7 @@ void SwUiWriterTest4::testTdf106701_tabOverMarginAutotab()
 
 void SwUiWriterTest4::testTdf104492()
 {
-    createDoc("tdf104492.docx");
+    createSwDoc(DATA_DIRECTORY, "tdf104492.docx");
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
     // The document should split table over 3 pages.
     assertXPath(pXmlDoc, "//page", 3);
@@ -1595,7 +1580,7 @@ void SwUiWriterTest4::testTdf107025()
     // they are cluttered because of negative value or
     // break into multiple lines because of overflow.
     // The test document uses DFKAI-SB shipped with Windows.
-    createDoc("tdf107025.odt");
+    createSwDoc(DATA_DIRECTORY, "tdf107025.odt");
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
     // Verify the number of characters in each line.
     CPPUNIT_ASSERT_EQUAL(
@@ -1622,7 +1607,7 @@ void SwUiWriterTest4::testTdf107025()
 
 void SwUiWriterTest4::testTdf107362()
 {
-    createDoc("tdf107362.odt");
+    createSwDoc(DATA_DIRECTORY, "tdf107362.odt");
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
     sal_Int32 nHeight
         = getXPath(pXmlDoc, "(//Text[@nType='PortionType::Text'])[1]", "nHeight").toInt32();
@@ -1642,7 +1627,7 @@ void SwUiWriterTest4::testTdf107362()
 
 void SwUiWriterTest4::testTdf105417()
 {
-    SwDoc* pDoc = createDoc("tdf105417.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf105417.odt");
     CPPUNIT_ASSERT(pDoc);
     SwView* pView = pDoc->GetDocShell()->GetView();
     CPPUNIT_ASSERT(pView);
@@ -1666,7 +1651,7 @@ void SwUiWriterTest4::testTdf105417()
 
 void SwUiWriterTest4::testTdf105625()
 {
-    SwDoc* pDoc = createDoc("tdf105625.fodt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf105625.fodt");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     uno::Reference<uno::XComponentContext> xComponentContext(
         comphelper::getProcessComponentContext());
@@ -1701,7 +1686,7 @@ void SwUiWriterTest4::testTdf125151_protected()
 {
     // Similar to testTdf105625 except this is in a protected section,
     // so read-only is already true when fieldmarks are considered.
-    SwDoc* pDoc = createDoc("tdf125151_protected.fodt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf125151_protected.fodt");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     uno::Reference<uno::XComponentContext> xComponentContext(
         comphelper::getProcessComponentContext());
@@ -1720,7 +1705,7 @@ void SwUiWriterTest4::testTdf125151_protected()
 void SwUiWriterTest4::testTdf125151_protectedB()
 {
     // Similar to testTdf105625 except this is protected with the Protect_Form compat setting
-    SwDoc* pDoc = createDoc("tdf125151_protectedB.fodt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf125151_protectedB.fodt");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     uno::Reference<uno::XComponentContext> xComponentContext(
         comphelper::getProcessComponentContext());
@@ -1737,7 +1722,7 @@ void SwUiWriterTest4::testTdf125151_protectedB()
 
 void SwUiWriterTest4::testTdf106736()
 {
-    createDoc("tdf106736-grid.odt");
+    createSwDoc(DATA_DIRECTORY, "tdf106736-grid.odt");
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
     sal_Int32 nWidth
         = getXPath(pXmlDoc, "(//Text[@nType='PortionType::TabLeft'])[1]", "nWidth").toInt32();
@@ -1749,7 +1734,7 @@ void SwUiWriterTest4::testTdf106736()
 void SwUiWriterTest4::testMsWordCompTrailingBlanks()
 {
     // The option is true in settings.xml
-    SwDoc* pDoc = createDoc("MsWordCompTrailingBlanksTrue.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "MsWordCompTrailingBlanksTrue.odt");
     CPPUNIT_ASSERT_EQUAL(true, pDoc->getIDocumentSettingAccess().get(
                                    DocumentSettingId::MS_WORD_COMP_TRAILING_BLANKS));
     calcLayout();
@@ -1761,7 +1746,7 @@ void SwUiWriterTest4::testMsWordCompTrailingBlanks()
     CPPUNIT_ASSERT_EQUAL(OUString(), parseDump("/root/page/body/txt[3]/Text[5]", "nWidth"));
 
     // The option is false in settings.xml
-    pDoc = createDoc("MsWordCompTrailingBlanksFalse.odt");
+    pDoc = createSwDoc(DATA_DIRECTORY, "MsWordCompTrailingBlanksFalse.odt");
     CPPUNIT_ASSERT_EQUAL(false, pDoc->getIDocumentSettingAccess().get(
                                     DocumentSettingId::MS_WORD_COMP_TRAILING_BLANKS));
     calcLayout();
@@ -1772,19 +1757,19 @@ void SwUiWriterTest4::testMsWordCompTrailingBlanks()
     CPPUNIT_ASSERT(!parseDump("/root/page/body/txt[3]/Text[5]", "nWidth").isEmpty());
 
     // MsWordCompTrailingBlanks option should be false by default in new documents
-    pDoc = createDoc();
+    pDoc = createSwDoc();
     CPPUNIT_ASSERT_EQUAL(false, pDoc->getIDocumentSettingAccess().get(
                                     DocumentSettingId::MS_WORD_COMP_TRAILING_BLANKS));
 
     // The option should be true if a .docx, .doc or .rtf document is opened
-    pDoc = createDoc("MsWordCompTrailingBlanks.docx");
+    pDoc = createSwDoc(DATA_DIRECTORY, "MsWordCompTrailingBlanks.docx");
     CPPUNIT_ASSERT_EQUAL(true, pDoc->getIDocumentSettingAccess().get(
                                    DocumentSettingId::MS_WORD_COMP_TRAILING_BLANKS));
 }
 
 void SwUiWriterTest4::testCreateDocxAnnotation()
 {
-    createDoc();
+    createSwDoc();
 
     // insert an annotation with a text
     const OUString aSomeText("some text");
@@ -1811,7 +1796,7 @@ void SwUiWriterTest4::testCreateDocxAnnotation()
 void SwUiWriterTest4::testTdf107976()
 {
     // Create a document and create two transferables.
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwWrtShell& rShell = *pDoc->GetDocShell()->GetWrtShell();
     rtl::Reference<SwTransferable> pTransferable(new SwTransferable(rShell));
     rtl::Reference<SwTransferable> pTransferable2(new SwTransferable(rShell));
@@ -2099,7 +2084,7 @@ void SwUiWriterTest4::testTdf142157()
 
 void SwUiWriterTest4::testTdf108524()
 {
-    createDoc("tdf108524.odt");
+    createSwDoc(DATA_DIRECTORY, "tdf108524.odt");
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
     // In total we expect two cells containing a section.
     assertXPath(pXmlDoc, "/root/page/body/tab/row/cell/section", 2);
@@ -2115,7 +2100,7 @@ void SwUiWriterTest4::testLinesInSectionInTable()
     // This is similar to testTdf108524(), but the page boundary now is not in
     // the middle of a multi-line paragraph: the section only contains oneliner
     // paragraphs instead.
-    createDoc("lines-in-section-in-table.odt");
+    createSwDoc(DATA_DIRECTORY, "lines-in-section-in-table.odt");
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
     // In total we expect two cells containing a section.
     assertXPath(pXmlDoc, "/root/page/body/tab/row/cell/section", 2);
@@ -2130,7 +2115,7 @@ void SwUiWriterTest4::testLinesMoveBackwardsInSectionInTable()
 {
 #if HAVE_MORE_FONTS
     // Assert that paragraph "4" is on page 1 and "5" is on page 2.
-    SwDoc* pDoc = createDoc("lines-in-section-in-table.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "lines-in-section-in-table.odt");
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "/root/page", 2);
     sal_uInt32 nPara4Node
@@ -2167,7 +2152,7 @@ void SwUiWriterTest4::testTableInSection()
 {
 #if HAVE_MORE_FONTS
     // The document has a section, containing a table that spans over 2 pages.
-    createDoc("table-in-sect.odt");
+    createSwDoc(DATA_DIRECTORY, "table-in-sect.odt");
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
     // In total we expect 4 cells.
     assertXPath(pXmlDoc, "/root/page/body/section/tab/row/cell", 4);
@@ -2183,7 +2168,7 @@ void SwUiWriterTest4::testTableInNestedSection()
 #if HAVE_MORE_FONTS
     // The document has a nested section, containing a table that spans over 2 pages.
     // This crashed the layout.
-    createDoc("rhbz739252-3.odt");
+    createSwDoc(DATA_DIRECTORY, "rhbz739252-3.odt");
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
     // Make sure the table is inside a section and spans over 2 pages.
     assertXPath(pXmlDoc, "//page[1]//section/tab", 1);
@@ -2194,7 +2179,7 @@ void SwUiWriterTest4::testTableInNestedSection()
 void SwUiWriterTest4::testTdf112741()
 {
 #if HAVE_MORE_FONTS
-    createDoc("tdf112741.fodt");
+    createSwDoc(DATA_DIRECTORY, "tdf112741.fodt");
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
     // This was 5 pages.
     assertXPath(pXmlDoc, "//page", 4);
@@ -2212,14 +2197,14 @@ void SwUiWriterTest4::testTdf112860()
     // The document has a split section inside a nested table, and also a table
     // in the footer.
     // This crashed the layout.
-    createDoc("tdf112860.fodt");
+    createSwDoc(DATA_DIRECTORY, "tdf112860.fodt");
 #endif
 }
 
 void SwUiWriterTest4::testTdf113287()
 {
 #if HAVE_MORE_FONTS
-    createDoc("tdf113287.fodt");
+    createSwDoc(DATA_DIRECTORY, "tdf113287.fodt");
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "//page", 2);
     sal_uInt32 nCellTop
@@ -2237,7 +2222,7 @@ void SwUiWriterTest4::testTdf113445()
 {
 #if HAVE_MORE_FONTS
     // Force multiple-page view.
-    SwDoc* pDoc = createDoc("tdf113445.fodt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf113445.fodt");
     SwDocShell* pDocShell = pDoc->GetDocShell();
     SwView* pView = pDocShell->GetView();
     pView->SetViewLayout(/*nColumns=*/2, /*bBookMode=*/false);
@@ -2283,7 +2268,7 @@ void SwUiWriterTest4::testTdf113445()
 void SwUiWriterTest4::testTdf113686()
 {
 #if HAVE_MORE_FONTS
-    SwDoc* pDoc = createDoc("tdf113686.fodt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf113686.fodt");
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "/root/page", 2);
     sal_uInt32 nPage1LastNode
@@ -2321,7 +2306,7 @@ void SwUiWriterTest4::testTableInSectionInTable()
     // The document has a table, containing a section, containing a nested
     // table.
     // This crashed the layout.
-    createDoc("i95698.odt");
+    createSwDoc(DATA_DIRECTORY, "i95698.odt");
 #endif
 }
 
@@ -2331,14 +2316,14 @@ void SwUiWriterTest4::testSectionInTableInTable()
     // The document has a nested table, containing a multi-line section at a
     // page boundary.
     // This crashed the layout later in SwFrame::IsFootnoteAllowed().
-    createDoc("tdf112109.fodt");
+    createSwDoc(DATA_DIRECTORY, "tdf112109.fodt");
 #endif
 }
 
 void SwUiWriterTest4::testSectionInTableInTable2()
 {
 #if HAVE_MORE_FONTS
-    createDoc("split-section-in-nested-table.fodt");
+    createSwDoc(DATA_DIRECTORY, "split-section-in-nested-table.fodt");
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
     sal_uInt32 nSection1
         = getXPath(pXmlDoc, "//page[1]//body/tab/row/cell/tab/row/cell/section", "id").toUInt32();
@@ -2361,7 +2346,7 @@ void SwUiWriterTest4::testSectionInTableInTable2()
 void SwUiWriterTest4::testSectionInTableInTable3()
 {
 #if HAVE_MORE_FONTS
-    createDoc("tdf113153.fodt");
+    createSwDoc(DATA_DIRECTORY, "tdf113153.fodt");
 
     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(),
@@ -2396,7 +2381,7 @@ void SwUiWriterTest4::testSectionInTableInTable3()
 void SwUiWriterTest4::testSectionInTableInTable4()
 {
 #if HAVE_MORE_FONTS
-    SwDoc* pDoc = createDoc("tdf113520.fodt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf113520.fodt");
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
     assertXPath(pXmlDoc, "/root/page", 3);
     sal_uInt32 nPage1LastNode
@@ -2443,7 +2428,7 @@ void SwUiWriterTest4::testTdf112160()
 {
 #if HAVE_MORE_FONTS
     // Assert that the A2 cell is on page 1.
-    SwDoc* pDoc = createDoc("tdf112160.fodt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf112160.fodt");
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
     sal_uInt32 nA2CellNode
         = getXPath(pXmlDoc, "/root/page[1]/body/tab/row[2]/cell[1]/section/txt[last()]",
@@ -2476,12 +2461,12 @@ void SwUiWriterTest4::testTdf114536()
 {
     // This crashed in SwTextFormatter::MergeCharacterBorder() due to a
     // use after free.
-    createDoc("tdf114536.odt");
+    createSwDoc(DATA_DIRECTORY, "tdf114536.odt");
 }
 
 void SwUiWriterTest4::testParagraphOfTextRange()
 {
-    SwDoc* pDoc = createDoc("paragraph-of-text-range.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "paragraph-of-text-range.odt");
 
     // Enter the table.
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
@@ -2504,7 +2489,7 @@ void SwUiWriterTest4::testParagraphOfTextRange()
 
 void SwUiWriterTest4::testTdf99689TableOfContents()
 {
-    SwDoc* pDoc = createDoc("tdf99689.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf99689.odt");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     pWrtShell->GotoNextTOXBase();
     const SwTOXBase* pTOXBase = pWrtShell->GetCurTOX();
@@ -2531,7 +2516,7 @@ void SwUiWriterTest4::testTdf99689TableOfContents()
 
 void SwUiWriterTest4::testTdf99689TableOfFigures()
 {
-    SwDoc* pDoc = createDoc("tdf99689_figures.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf99689_figures.odt");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     pWrtShell->GotoNextTOXBase();
     const SwTOXBase* pTOXBase = pWrtShell->GetCurTOX();
@@ -2556,7 +2541,7 @@ void SwUiWriterTest4::testTdf99689TableOfFigures()
 
 void SwUiWriterTest4::testTdf99689TableOfTables()
 {
-    SwDoc* pDoc = createDoc("tdf99689_tables.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf99689_tables.odt");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     pWrtShell->GotoNextTOXBase();
     const SwTOXBase* pTOXBase = pWrtShell->GetCurTOX();
@@ -2585,7 +2570,7 @@ void SwUiWriterTest4::testTdf99689TableOfTables()
 // before usage of the Height() and GetRealHeight().
 void SwUiWriterTest4::testTdf112448()
 {
-    createDoc("tdf112448.odt");
+    createSwDoc(DATA_DIRECTORY, "tdf112448.odt");
 
     // check actual number of line breaks in the paragraph
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
@@ -2594,7 +2579,7 @@ void SwUiWriterTest4::testTdf112448()
 
 void SwUiWriterTest4::testTdf113790()
 {
-    SwDoc* pDoc = createDoc("tdf113790.docx");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf113790.docx");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     // Create the clipboard document.
     SwDoc aClipboard;
@@ -2617,7 +2602,7 @@ void SwUiWriterTest4::testTdf113790()
 
 void SwUiWriterTest4::testTdf108048()
 {
-    createDoc();
+    createSwDoc();
 
     uno::Sequence<beans::PropertyValue> aPropertyValues = comphelper::InitPropertySequence({
         { "Kind", uno::makeAny(sal_Int16(3)) },
@@ -2638,7 +2623,7 @@ void SwUiWriterTest4::testTdf108048()
 
 void SwUiWriterTest4::testTdf113481()
 {
-    SwDoc* pDoc = createDoc("tdf113481-IVS.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf113481-IVS.odt");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
 
     // One backspace should completely remove the CJK ideograph variation sequence
@@ -2678,7 +2663,7 @@ void SwUiWriterTest4::testTdf115013()
     const OUString aWorkDir = aTempDir.GetURL();
 
     //create new writer document
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
 
     {
         // Load and register data source
@@ -2728,7 +2713,7 @@ void SwUiWriterTest4::testTdf115065()
     // In the document, the tables have table style assigned
     // Source table (first one) has two rows;
     // destination (second one) has only one row
-    SwDoc* pDoc = createDoc("tdf115065.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf115065.odt");
     CPPUNIT_ASSERT(pDoc);
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     CPPUNIT_ASSERT(pWrtShell);
@@ -2750,7 +2735,7 @@ void SwUiWriterTest4::testTdf115065()
 
 void SwUiWriterTest4::testTdf115132()
 {
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     CPPUNIT_ASSERT(pDoc);
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     CPPUNIT_ASSERT(pWrtShell);
@@ -2807,7 +2792,7 @@ void SwUiWriterTest4::testTdf115132()
 
 void SwUiWriterTest4::testXDrawPagesSupplier()
 {
-    createDoc();
+    createSwDoc();
     uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(mxComponent, uno::UNO_QUERY);
     CPPUNIT_ASSERT_MESSAGE("XDrawPagesSupplier interface is unavailable", xDrawPagesSupplier.is());
     uno::Reference<drawing::XDrawPages> xDrawPages = xDrawPagesSupplier->getDrawPages();
@@ -2827,7 +2812,7 @@ void SwUiWriterTest4::testXDrawPagesSupplier()
 
 void SwUiWriterTest4::testTdf116403()
 {
-    createDoc("tdf116403-considerborders.odt");
+    createSwDoc(DATA_DIRECTORY, "tdf116403-considerborders.odt");
     // Check that before ToX update, the tab stop position is the old one
     uno::Reference<text::XTextRange> xParagraph = getParagraph(2, "1\t1");
     auto aTabs = getProperty<uno::Sequence<style::TabStop>>(xParagraph, "ParaTabStops");
@@ -2853,7 +2838,7 @@ void SwUiWriterTest4::testTdf116403()
 void SwUiWriterTest4::testHtmlCopyImages()
 {
     // Load a document with an image.
-    SwDoc* pDoc = createDoc("image.odt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "image.odt");
 
     // Trigger the copy part of HTML copy&paste.
     WriterRef xWrt = new SwHTMLWriter(/*rBaseURL=*/OUString());
@@ -2879,7 +2864,7 @@ void SwUiWriterTest4::testHtmlCopyImages()
 
 void SwUiWriterTest4::testTdf116789()
 {
-    createDoc("tdf116789.fodt");
+    createSwDoc(DATA_DIRECTORY, "tdf116789.fodt");
     uno::Reference<text::XBookmarksSupplier> xBookmarksSupplier(mxComponent, uno::UNO_QUERY);
     uno::Reference<text::XText> xText1;
     uno::Reference<text::XText> xText2;
@@ -2900,7 +2885,7 @@ void SwUiWriterTest4::testTdf116789()
 void SwUiWriterTest4::testTdf91801()
 {
     // Tests calculation with several user field variables without prior user fields
-    createDoc("tdf91801.fodt");
+    createSwDoc(DATA_DIRECTORY, "tdf91801.fodt");
     uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1), uno::UNO_QUERY);
     uno::Reference<table::XCell> xCell(xTable->getCellByName("A1"));
     CPPUNIT_ASSERT_EQUAL(555.0, xCell->getValue());
@@ -2908,7 +2893,7 @@ void SwUiWriterTest4::testTdf91801()
 
 void SwUiWriterTest4::testTdf51223()
 {
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     sw::UndoManager& rUndoManager = pDoc->GetUndoManager();
     sal_uLong nIndex = pWrtShell->GetCursor()->GetNode().GetIndex();
@@ -2924,7 +2909,7 @@ void SwUiWriterTest4::testTdf51223()
 void SwUiWriterTest4::testFontEmbedding()
 {
 #if HAVE_MORE_FONTS && !defined(MACOSX)
-    createDoc("testFontEmbedding.odt");
+    createSwDoc(DATA_DIRECTORY, "testFontEmbedding.odt");
 
     OString aContentBaseXpath("/office:document-content/office:font-face-decls");
     OString aSettingsBaseXpath("/office:document-settings/office:settings/config:config-item-set");
@@ -3138,7 +3123,7 @@ void SwUiWriterTest4::testInconsistentBookmark()
 {
     // create test document with text and bookmark
     {
-        SwDoc* pDoc(createDoc("testInconsistentBookmark.ott"));
+        SwDoc* pDoc(createSwDoc(DATA_DIRECTORY, "testInconsistentBookmark.ott"));
         IDocumentMarkAccess& rIDMA(*pDoc->getIDocumentMarkAccess());
         SwNodeIndex aIdx(pDoc->GetNodes().GetEndOfContent(), -1);
         SwCursor aPaM(SwPosition(aIdx), nullptr);
@@ -3174,7 +3159,7 @@ void SwUiWriterTest4::testInconsistentBookmark()
 
 void SwUiWriterTest4::testSpellOnlineParameter()
 {
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     const SwViewOption* pOpt = pWrtShell->GetViewOptions();
     bool bSet = pOpt->IsOnlineSpell();
@@ -3192,7 +3177,7 @@ void SwUiWriterTest4::testSpellOnlineParameter()
 
 void SwUiWriterTest4::testRedlineAutoCorrect()
 {
-    SwDoc* pDoc = createDoc("redline-autocorrect.fodt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "redline-autocorrect.fodt");
 
     dispatchCommand(mxComponent, ".uno:GoToEndOfDoc", {});
 
@@ -3273,7 +3258,7 @@ void SwUiWriterTest4::testRedlineAutoCorrect()
 
 void SwUiWriterTest4::testRedlineAutoCorrect2()
 {
-    SwDoc* pDoc = createDoc("redline-autocorrect2.fodt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "redline-autocorrect2.fodt");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
 
     dispatchCommand(mxComponent, ".uno:GoToEndOfDoc", {});
@@ -3305,7 +3290,7 @@ void SwUiWriterTest4::testRedlineAutoCorrect2()
 
 void SwUiWriterTest4::testEmojiAutoCorrect()
 {
-    SwDoc* pDoc = createDoc("redline-autocorrect2.fodt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "redline-autocorrect2.fodt");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
 
     // Emoji replacement (:snowman: -> ☃)
@@ -3338,7 +3323,7 @@ void SwUiWriterTest4::testEmojiAutoCorrect()
 
 void SwUiWriterTest4::testTdf108423()
 {
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     // testing autocorrect of i' -> I' on start of first paragraph
     SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect());
@@ -3358,7 +3343,7 @@ void SwUiWriterTest4::testTdf108423()
 
 void SwUiWriterTest4::testTdf106164()
 {
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     // testing autocorrect of we're -> We're on start of first paragraph
     SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect());
@@ -3372,7 +3357,7 @@ void SwUiWriterTest4::testTdf106164()
 
 void SwUiWriterTest4::testTdf54409()
 {
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     // testing autocorrect of "tset -> "test with typographical double quotation mark U+201C
     SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect());
@@ -3396,7 +3381,7 @@ void SwUiWriterTest4::testTdf54409()
 
 void SwUiWriterTest4::testTdf38394()
 {
-    SwDoc* pDoc = createDoc("tdf38394.fodt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf38394.fodt");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     // testing autocorrect of French l'" -> l'« (instead of l'»)
     SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect());
@@ -3415,7 +3400,7 @@ void SwUiWriterTest4::testTdf38394()
 
 void SwUiWriterTest4::testTdf59666()
 {
-    SwDoc* pDoc = createDoc();
+    SwDoc* pDoc = createSwDoc();
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     // testing missing autocorrect of single Greek letters
     SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect());
@@ -3429,7 +3414,7 @@ void SwUiWriterTest4::testTdf59666()
 
 void SwUiWriterTest4::testTdf133524()
 {
-    SwDoc* pDoc = createDoc("tdf133524.fodt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf133524.fodt");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     // 1. Testing autocorrect of >> and <<
     // Example: »word«
@@ -3481,7 +3466,7 @@ void SwUiWriterTest4::testTdf133524()
 
 void SwUiWriterTest4::testTdf133524_Romanian()
 {
-    SwDoc* pDoc = createDoc("tdf133524_ro.fodt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf133524_ro.fodt");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect());
     // 1. Testing autocorrect of " to << and >> inside „...”
@@ -3520,7 +3505,7 @@ void SwUiWriterTest4::testTdf133524_Romanian()
 
 void SwUiWriterTest4::testTdf128860()
 {
-    SwDoc* pDoc = createDoc("tdf128860.fodt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf128860.fodt");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     // Second level ending quote: ‚word' -> ,word‘
     SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect());
@@ -3543,7 +3528,7 @@ void SwUiWriterTest4::testTdf128860()
 
 void SwUiWriterTest4::testTdf123786()
 {
-    SwDoc* pDoc = createDoc("tdf123786.fodt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf123786.fodt");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     // Second level ending quote: „word' -> „word“
     SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect());
@@ -3567,7 +3552,7 @@ void SwUiWriterTest4::testTdf123786()
 void SwUiWriterTest4::testTdf133589()
 {
     // Hungarian test document with right-to-left paragraph setting
-    SwDoc* pDoc = createDoc("tdf133589.fodt");
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf133589.fodt");
     SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
     // translitere words to Old Hungarian
     SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect());
@@ -3599,7 +3584,7 @@ void SwUiWriterTest4::testTdf133589()
 void SwUiWriterTest4::testInsertLongDateFormat()
 {
     // only for Hungarian, yet
-    createDoc("tdf133524.fodt");
+    createSwDoc(DATA_DIRECTORY, "tdf133524.fodt");
     dispatchCommand(mxComponent, ".uno:InsertDateField", {});
     // Make sure that the document starts with a field now, and its expanded string value contains space
     const uno::Reference<text::XTextRange> xField = getRun(getParagraph(1), 1);
@@ -3616,7 +3601,7 @@ void SwUiWriterTest4::testInsertPdf()
         return;
     }
 
-    createDoc();
+    createSwDoc();
     SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
     CPPUNIT_ASSERT(pTextDoc);
 


More information about the Libreoffice-commits mailing list