sw/qa/core/macros-test.cxx | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
New commits: commit 2aa9e6a778c742cbc080dbefdf471e6771688661 Author: Xisco Fauli <[email protected]> AuthorDate: Wed Feb 4 21:39:59 2026 +0100 Commit: Xisco Fauli <[email protected]> CommitDate: Thu Feb 5 08:53:45 2026 +0100 CppunitTest_sw_macros_test: fix tests fail when running individually They fail if run with make CppunitTest_sw_macros_test CPPUNIT_TEST_NAME="SwMacrosTest::testFdo55289" make CppunitTest_sw_macros_test CPPUNIT_TEST_NAME="SwMacrosTest::testBookmarkDeleteTdf90816" make CppunitTest_sw_macros_test CPPUNIT_TEST_NAME="SwMacrosTest::testBookmarkDeleteAndJoin" Change-Id: I16d7581137a57ce4d7721e6b32ca9081724ff062 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198705 Tested-by: Jenkins Reviewed-by: Xisco Fauli <[email protected]> diff --git a/sw/qa/core/macros-test.cxx b/sw/qa/core/macros-test.cxx index 51c30ade0012..2ad0e7d2186c 100644 --- a/sw/qa/core/macros-test.cxx +++ b/sw/qa/core/macros-test.cxx @@ -49,10 +49,9 @@ #include <IDocumentUndoRedo.hxx> #include <IDocumentContentOperations.hxx> #include <docsh.hxx> +#include <swdll.hxx> #include <unotxdoc.hxx> -typedef rtl::Reference<SwDocShell> SwDocShellRef; - using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -177,7 +176,11 @@ void SwMacrosTest::testModernVBADelete() void SwMacrosTest::testBookmarkDeleteAndJoin() { - rtl::Reference<SwDoc> const pDoc(new SwDoc); + loadFromURL(u"private:factory/swriter"_ustr); + + SwXTextDocument *const pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + SwDoc *const pDoc = pTextDoc->GetDocShell()->GetDoc(); pDoc->GetIDocumentUndoRedo().DoUndo(true); // bug is in SwUndoDelete SwNodeIndex aIdx(pDoc->GetNodes().GetEndOfContent(), -1); SwPaM aPaM(aIdx); @@ -217,7 +220,11 @@ void SwMacrosTest::testBookmarkDeleteAndJoin() void SwMacrosTest::testBookmarkDeleteTdf90816() { - rtl::Reference<SwDoc> const pDoc(new SwDoc); + loadFromURL(u"private:factory/swriter"_ustr); + + SwXTextDocument *const pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + SwDoc *const pDoc = pTextDoc->GetDocShell()->GetDoc(); pDoc->GetIDocumentUndoRedo().DoUndo(true); // bug is in SwUndoDelete SwNodeIndex aIdx(pDoc->GetNodes().GetEndOfContent(), -1); SwPaM aPaM(aIdx); @@ -387,8 +394,9 @@ void SwMacrosTest::testTdf162431() void SwMacrosTest::testFdo55289() { + SwGlobals::ensure(); SwDoc* const pDoc = new SwDoc; - SwDocShellRef pDocShell = new SwDocShell(*pDoc, SfxObjectCreateMode::EMBEDDED); + rtl::Reference<SwDocShell> pDocShell = new SwDocShell(*pDoc, SfxObjectCreateMode::EMBEDDED); // this needs to run with no layout to tickle the bugs in the special // cases in SwXShape re-anchoring assert(!pDoc->getIDocumentLayoutAccess().GetCurrentLayout());
