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

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Fri May 10 14:24:59 UTC 2019


 sc/qa/unit/tiledrendering/tiledrendering.cxx |  161 ++++++++++++---------------
 1 file changed, 77 insertions(+), 84 deletions(-)

New commits:
commit 6eac1c9e3f4e801a3cfa75f85f7bc3944c7cd21e
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Fri May 10 14:09:56 2019 +0200
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri May 10 16:24:01 2019 +0200

    CppunitTest_sc_tiledrendering: close the document while LOK is still active
    
    This is the same type of problem that was fixed for
    CppunitTest_desktop_lib in commit
    da17ccaec39f50de68c3fdd431bc66a2bec04127 (CppunitTest_desktop_lib: close
    the document while LOK is still active, 2019-05-09).
    
    Change-Id: I2515e18713c9f20a4f70de478ab062bab5650608
    Reviewed-on: https://gerrit.libreoffice.org/72101
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Tested-by: Jenkins

diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 4e0c99ad5f97..8bc981982af5 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -157,7 +157,22 @@ void ScTiledRenderingTest::setUp()
 void ScTiledRenderingTest::tearDown()
 {
     if (mxComponent.is())
+    {
+        ScModelObj* pModelObj = static_cast<ScModelObj*>(mxComponent.get());
+        ScDocShell* pDocSh = dynamic_cast< ScDocShell* >( pModelObj->GetEmbeddedObject() );
+        if (pDocSh)
+        {
+            ScTabViewShell* pViewShell = pDocSh->GetBestViewShell(false);
+            if (pViewShell)
+            {
+                // The current view is unregistered here, multiple views have to be unregistered
+                // in the test function itself.
+                pViewShell->registerLibreOfficeKitViewCallback(nullptr, nullptr);
+            }
+        }
         mxComponent->dispose();
+    }
+    comphelper::LibreOfficeKit::setActive(false);
 
     test::BootstrapFixture::tearDown();
 }
@@ -309,8 +324,6 @@ void ScTiledRenderingTest::testRowColumnSelections()
     aResult = pModelObj->getTextSelection("text/plain;charset=utf-8", aUsedMimeType);
     aExpected = "1\t2\t3\t4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\n";
     CPPUNIT_ASSERT_EQUAL(aExpected, aResult);
-
-    comphelper::LibreOfficeKit::setActive(false);
 }
 
 void ScTiledRenderingTest::testSortAscendingDescending()
@@ -348,8 +361,6 @@ void ScTiledRenderingTest::testSortAscendingDescending()
     CPPUNIT_ASSERT_EQUAL(double(1), pDoc->GetValue(ScAddress(1, 0, 0)));
     CPPUNIT_ASSERT_EQUAL(double(3), pDoc->GetValue(ScAddress(1, 1, 0)));
     CPPUNIT_ASSERT_EQUAL(double(2), pDoc->GetValue(ScAddress(1, 2, 0)));
-
-    comphelper::LibreOfficeKit::setActive(false);
 }
 
 void ScTiledRenderingTest::testPartHash()
@@ -365,7 +376,6 @@ void ScTiledRenderingTest::testPartHash()
 
     // check part that it does not exists
     CPPUNIT_ASSERT(pModelObj->getPartHash(100).isEmpty());
-    comphelper::LibreOfficeKit::setActive(false);
 }
 
 void ScTiledRenderingTest::testDocumentSize()
@@ -396,8 +406,6 @@ void ScTiledRenderingTest::testDocumentSize()
     // 2 seconds
     aResult = m_aDocSizeCondition.wait(std::chrono::seconds(2));
     CPPUNIT_ASSERT_EQUAL(osl::Condition::result_ok, aResult);
-
-    comphelper::LibreOfficeKit::setActive(false);
 }
 
 void ScTiledRenderingTest::testEmptyColumnSelection()
@@ -417,8 +425,6 @@ void ScTiledRenderingTest::testEmptyColumnSelection()
     OString aResult = pModelObj->getTextSelection("text/plain;charset=utf-8", aUsedMimeType);
     // should be an empty string
     CPPUNIT_ASSERT_EQUAL(OString(), aResult);
-
-    comphelper::LibreOfficeKit::setActive(false);
 }
 
 /// A view callback tracks callbacks invoked on one specific view.
@@ -528,6 +534,7 @@ void ScTiledRenderingTest::testViewCursors()
     ScModelObj* pModelObj = createDoc("select-row-cols.ods");
     ViewCallback aView1;
     SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView1);
+    int nView1 = SfxLokHelper::getView();
     SfxLokHelper::createView();
     pModelObj->initializeForTiledRendering(uno::Sequence<beans::PropertyValue>());
     ViewCallback aView2;
@@ -542,10 +549,8 @@ void ScTiledRenderingTest::testViewCursors()
     Scheduler::ProcessEventsToIdle();
     SfxLokHelper::destroyView(SfxLokHelper::getView());
     CPPUNIT_ASSERT(aView1.m_bViewCursorInvalidated);
-    mxComponent->dispose();
-    mxComponent.clear();
-
-    comphelper::LibreOfficeKit::setActive(false);
+    SfxLokHelper::setView(nView1);
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
 }
 
 void lcl_dispatchCommand(const uno::Reference<lang::XComponent>& xComponent, const OUString& rCommand, const uno::Sequence<beans::PropertyValue>& rArguments)
@@ -570,6 +575,7 @@ void ScTiledRenderingTest::testTextViewSelection()
     ScModelObj* pModelObj = createDoc("select-row-cols.ods");
     ViewCallback aView1;
     SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView1);
+    int nView1 = SfxLokHelper::getView();
     SfxLokHelper::createView();
     ViewCallback aView2;
     pModelObj->initializeForTiledRendering(uno::Sequence<beans::PropertyValue>());
@@ -581,10 +587,9 @@ void ScTiledRenderingTest::testTextViewSelection()
     Scheduler::ProcessEventsToIdle();
     // Make sure the first view got its notification.
     CPPUNIT_ASSERT(aView1.m_bTextViewSelectionInvalidated);
-
-    mxComponent->dispose();
-    mxComponent.clear();
-    comphelper::LibreOfficeKit::setActive(false);
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
+    SfxLokHelper::setView(nView1);
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
 }
 
 void ScTiledRenderingTest::testDocumentSizeChanged()
@@ -605,10 +610,6 @@ void ScTiledRenderingTest::testDocumentSizeChanged()
     // Assert that the size in the payload is not 0.
     CPPUNIT_ASSERT(m_aDocumentSize.getWidth() > 0);
     CPPUNIT_ASSERT(m_aDocumentSize.getHeight() > 0);
-
-    mxComponent->dispose();
-    mxComponent.clear();
-    comphelper::LibreOfficeKit::setActive(false);
 }
 
 void ScTiledRenderingTest::testViewLock()
@@ -619,6 +620,7 @@ void ScTiledRenderingTest::testViewLock()
     ScModelObj* pModelObj = createDoc("shape.ods");
     ViewCallback aView1;
     SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView1);
+    int nView1 = SfxLokHelper::getView();
     SfxLokHelper::createView();
     ViewCallback aView2;
     pModelObj->initializeForTiledRendering(uno::Sequence<beans::PropertyValue>());
@@ -641,10 +643,9 @@ void ScTiledRenderingTest::testViewLock()
     // the first view.
     pView->SdrEndTextEdit();
     CPPUNIT_ASSERT(!aView1.m_bViewLock);
-
-    mxComponent->dispose();
-    mxComponent.clear();
-    comphelper::LibreOfficeKit::setActive(false);
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
+    SfxLokHelper::setView(nView1);
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
 }
 
 void ScTiledRenderingTest::testColRowResize()
@@ -680,8 +681,6 @@ void ScTiledRenderingTest::testColRowResize()
 
     sal_uInt16 nHeight = rDoc.GetRowHeight(static_cast<SCROW>(4), static_cast<SCTAB>(0), false) * HMM_PER_TWIPS;
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(2000), nHeight);
-
-    comphelper::LibreOfficeKit::setActive(false);
 }
 
 void ScTiledRenderingTest::testUndoShells()
@@ -700,8 +699,6 @@ void ScTiledRenderingTest::testUndoShells()
     sal_Int32 nView1 = SfxLokHelper::getView();
     // This was -1: ScSimpleUndo did not remember what view shell created it.
     CPPUNIT_ASSERT_EQUAL(ViewShellId(nView1), pUndoManager->GetUndoAction()->GetViewShellId());
-
-    comphelper::LibreOfficeKit::setActive(false);
 }
 
 bool lcl_hasEditView(const ScViewData& rViewData)
@@ -736,6 +733,7 @@ void ScTiledRenderingTest::testTextEditViews()
     CPPUNIT_ASSERT(lcl_hasEditView(*pViewData));
 
     // view #2
+    int nView1 = SfxLokHelper::getView();
     SfxLokHelper::createView();
     ViewCallback aView2;
     pModelObj->initializeForTiledRendering(uno::Sequence<beans::PropertyValue>());
@@ -748,11 +746,9 @@ void ScTiledRenderingTest::testTextEditViews()
 
     // check that text edit view in view #1 has not be killed
     CPPUNIT_ASSERT(lcl_hasEditView(*pViewData));
-
-    mxComponent->dispose();
-    mxComponent.clear();
-
-    comphelper::LibreOfficeKit::setActive(false);
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
+    SfxLokHelper::setView(nView1);
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
 }
 
 void ScTiledRenderingTest::testTextEditViewInvalidations()
@@ -772,6 +768,7 @@ void ScTiledRenderingTest::testTextEditViewInvalidations()
 
     // view #2
     SfxLokHelper::createView();
+    int nView2 = SfxLokHelper::getView();
     ViewCallback aView2;
     pModelObj->initializeForTiledRendering(uno::Sequence<beans::PropertyValue>());
     SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView2);
@@ -804,6 +801,7 @@ void ScTiledRenderingTest::testTextEditViewInvalidations()
 
     // view #3
     SfxLokHelper::createView();
+    int nView3 = SfxLokHelper::getView();
     ViewCallback aView3;
     pModelObj->initializeForTiledRendering(uno::Sequence<beans::PropertyValue>());
     SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView3);
@@ -816,10 +814,12 @@ void ScTiledRenderingTest::testTextEditViewInvalidations()
     Scheduler::ProcessEventsToIdle();
     CPPUNIT_ASSERT(aView3.m_bInvalidateTiles);
 
-    mxComponent->dispose();
-    mxComponent.clear();
-
-    comphelper::LibreOfficeKit::setActive(false);
+    SfxLokHelper::setView(nView1);
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
+    SfxLokHelper::setView(nView2);
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
+    SfxLokHelper::setView(nView3);
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
 }
 
 void ScTiledRenderingTest::testCreateViewGraphicSelection()
@@ -846,6 +846,7 @@ void ScTiledRenderingTest::testCreateViewGraphicSelection()
     CPPUNIT_ASSERT(aView1.m_bGraphicSelection);
 
     // Create a second view.
+    int nView1 = SfxLokHelper::getView();
     SfxLokHelper::createView();
     ViewCallback aView2;
     aView2.m_bGraphicViewSelection = false;
@@ -854,9 +855,9 @@ void ScTiledRenderingTest::testCreateViewGraphicSelection()
     CPPUNIT_ASSERT(aView2.m_bGraphicViewSelection);
     CPPUNIT_ASSERT(aView1.m_bGraphicViewSelection);
 
-    mxComponent->dispose();
-    mxComponent.clear();
-    comphelper::LibreOfficeKit::setActive(false);
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
+    SfxLokHelper::setView(nView1);
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
 }
 
 void ScTiledRenderingTest::testGraphicInvalidate()
@@ -887,10 +888,6 @@ void ScTiledRenderingTest::testGraphicInvalidate()
     // Check again
     Scheduler::ProcessEventsToIdle();
     CPPUNIT_ASSERT(!aView.m_bFullInvalidateTiles);
-
-    mxComponent->dispose();
-    mxComponent.clear();
-    comphelper::LibreOfficeKit::setActive(false);
 }
 
 void ScTiledRenderingTest::testAutoSum()
@@ -906,10 +903,6 @@ void ScTiledRenderingTest::testAutoSum()
     comphelper::dispatchCommand(".uno:AutoSum", aArgs);
     Scheduler::ProcessEventsToIdle();
     CPPUNIT_ASSERT(aView.m_sCellFormula.startsWith("=SUM("));
-
-    mxComponent->dispose();
-    mxComponent.clear();
-    comphelper::LibreOfficeKit::setActive(false);
 }
 
 void ScTiledRenderingTest::testHideColRow()
@@ -971,10 +964,6 @@ void ScTiledRenderingTest::testHideColRow()
     nNewCurY = ScDocShell::GetViewData()->GetCurY();
     CPPUNIT_ASSERT(nNewCurY > nOldCurY);
     CPPUNIT_ASSERT_EQUAL(nOldCurX, nNewCurX);
-
-    mxComponent->dispose();
-    mxComponent.clear();
-    comphelper::LibreOfficeKit::setActive(false);
 }
 
 void ScTiledRenderingTest::testInvalidateOnCopyPasteCells()
@@ -1013,10 +1002,6 @@ void ScTiledRenderingTest::testInvalidateOnCopyPasteCells()
     comphelper::dispatchCommand(".uno:Paste", aArgs);
     Scheduler::ProcessEventsToIdle();
     CPPUNIT_ASSERT(aView.m_bInvalidateTiles);
-
-    mxComponent->dispose();
-    mxComponent.clear();
-    comphelper::LibreOfficeKit::setActive(false);
 }
 
 void ScTiledRenderingTest::testInvalidateOnInserRowCol()
@@ -1058,10 +1043,6 @@ void ScTiledRenderingTest::testInvalidateOnInserRowCol()
     comphelper::dispatchCommand(".uno:InsertColumns", aArgs);
     Scheduler::ProcessEventsToIdle();
     CPPUNIT_ASSERT(aView.m_bInvalidateTiles);
-
-    mxComponent->dispose();
-    mxComponent.clear();
-    comphelper::LibreOfficeKit::setActive(false);
 }
 
 void ScTiledRenderingTest::testCommentCallback()
@@ -1081,6 +1062,7 @@ void ScTiledRenderingTest::testCommentCallback()
     pModelObj->initializeForTiledRendering({});
     ViewCallback aView2;
     SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView2);
+    int nView2 = SfxLokHelper::getView();
 
     SfxLokHelper::setView(nView1);
 
@@ -1152,10 +1134,11 @@ void ScTiledRenderingTest::testCommentCallback()
     CPPUNIT_ASSERT_EQUAL(aCommentId, aView1.m_aCommentCallbackResult.get<std::string>("id"));
     CPPUNIT_ASSERT_EQUAL(aCommentId, aView2.m_aCommentCallbackResult.get<std::string>("id"));
 
-    mxComponent->dispose();
-    mxComponent.clear();
+    SfxLokHelper::setView(nView2);
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
+    SfxLokHelper::setView(nView1);
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
     comphelper::LibreOfficeKit::setTiledAnnotations(true);
-    comphelper::LibreOfficeKit::setActive(false);
 }
 
 void ScTiledRenderingTest::testUndoLimiting()
@@ -1223,10 +1206,10 @@ void ScTiledRenderingTest::testUndoLimiting()
     // check that redo has been executed on view #1
     CPPUNIT_ASSERT_EQUAL(std::size_t(0), pUndoManager->GetRedoActionCount());
 
-    mxComponent->dispose();
-    mxComponent.clear();
-
-    comphelper::LibreOfficeKit::setActive(false);
+    SfxLokHelper::setView(nView1);
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
+    SfxLokHelper::setView(nView2);
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
 }
 
 void ScTiledRenderingTest::testUndoRepairDispatch()
@@ -1281,9 +1264,9 @@ void ScTiledRenderingTest::testUndoRepairDispatch()
     // check that undo has been executed on view #2 in repair mode
     CPPUNIT_ASSERT_EQUAL(std::size_t(0), pUndoManager->GetUndoActionCount());
 
-    mxComponent->dispose();
-    mxComponent.clear();
-    comphelper::LibreOfficeKit::setActive(false);
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
+    SfxLokHelper::setView(nView1);
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
 }
 
 void ScTiledRenderingTest::testInsertGraphicInvalidations()
@@ -1323,10 +1306,6 @@ void ScTiledRenderingTest::testInsertGraphicInvalidations()
     comphelper::dispatchCommand(".uno:Undo", aArgs2);
     Scheduler::ProcessEventsToIdle();
     CPPUNIT_ASSERT(aView.m_bInvalidateTiles);
-
-    mxComponent->dispose();
-    mxComponent.clear();
-    comphelper::LibreOfficeKit::setActive(false);
 }
 
 void ScTiledRenderingTest::testDocumentSizeWithTwoViews()
@@ -1351,6 +1330,7 @@ void ScTiledRenderingTest::testDocumentSizeWithTwoViews()
     Scheduler::ProcessEventsToIdle();
 
     // Create a new view
+    int nView1 = SfxLokHelper::getView();
     SfxLokHelper::createView();
 
     std::vector<unsigned char> aBuffer2(nCanvasWidth * nCanvasHeight * 4);
@@ -1363,7 +1343,9 @@ void ScTiledRenderingTest::testDocumentSizeWithTwoViews()
     for (size_t i = 0; i < aBuffer1.size(); ++i)
         CPPUNIT_ASSERT_EQUAL(aBuffer1[i], aBuffer2[i]);
 
-    comphelper::LibreOfficeKit::setActive(false);
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
+    SfxLokHelper::setView(nView1);
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
 }
 
 void ScTiledRenderingTest::testDisableUndoRepair()
@@ -1432,7 +1414,9 @@ void ScTiledRenderingTest::testDisableUndoRepair()
         CPPUNIT_ASSERT(dynamic_cast< const SfxStringItem* >(aSet2.GetItem(SID_UNDO)));
     }
 
-    comphelper::LibreOfficeKit::setActive(false);
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
+    SfxLokHelper::setView(nView1);
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
 }
 
 void ScTiledRenderingTest::testDocumentRepair()
@@ -1447,6 +1431,7 @@ void ScTiledRenderingTest::testDocumentRepair()
     SfxViewShell* pView1 = SfxViewShell::Current();
 
     // view #2
+    int nView1 = SfxLokHelper::getView();
     SfxLokHelper::createView();
     SfxViewShell* pView2 = SfxViewShell::Current();
     int nView2 = SfxLokHelper::getView();
@@ -1485,7 +1470,9 @@ void ScTiledRenderingTest::testDocumentRepair()
         CPPUNIT_ASSERT_EQUAL(true, pItem2->GetValue());
     }
 
-    comphelper::LibreOfficeKit::setActive(false);
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
+    SfxLokHelper::setView(nView1);
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
 }
 
 void ScTiledRenderingTest::testLanguageStatus()
@@ -1500,6 +1487,7 @@ void ScTiledRenderingTest::testLanguageStatus()
     SfxViewShell* pView1 = SfxViewShell::Current();
 
     // view #2
+    int nView1 = SfxLokHelper::getView();
     SfxLokHelper::createView();
     SfxViewShell* pView2 = SfxViewShell::Current();
     CPPUNIT_ASSERT(pView1 != pView2);
@@ -1535,6 +1523,10 @@ void ScTiledRenderingTest::testLanguageStatus()
         CPPUNIT_ASSERT_EQUAL(aLangBolivia, pItem1->GetValue());
         CPPUNIT_ASSERT_EQUAL(aLangBolivia, pItem2->GetValue());
     }
+
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
+    SfxLokHelper::setView(nView1);
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
 }
 
 void ScTiledRenderingTest::testMultiViewCopyPaste()
@@ -1555,6 +1547,7 @@ void ScTiledRenderingTest::testMultiViewCopyPaste()
     pView1->GetViewData().GetActiveWin()->SetClipboard(css::datatransfer::clipboard::SystemClipboard::create(comphelper::getProcessComponentContext()));
 
     // view #2
+    int nView1 = SfxLokHelper::getView();
     SfxLokHelper::createView();
     ScTabViewShell* pView2 = dynamic_cast<ScTabViewShell*>(SfxViewShell::Current());
     // emulate clipboard
@@ -1582,7 +1575,9 @@ void ScTiledRenderingTest::testMultiViewCopyPaste()
     CPPUNIT_ASSERT_EQUAL(OUString("TestCopy1"), pDoc->GetString(ScAddress(0, 1, 0)));
     CPPUNIT_ASSERT_EQUAL(OUString("TestCopy2"), pDoc->GetString(ScAddress(1, 1, 0)));
 
-    comphelper::LibreOfficeKit::setActive(false);
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
+    SfxLokHelper::setView(nView1);
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
 }
 
 void ScTiledRenderingTest::testIMESupport()
@@ -1616,8 +1611,6 @@ void ScTiledRenderingTest::testIMESupport()
     Scheduler::ProcessEventsToIdle();
 
     CPPUNIT_ASSERT_EQUAL(aInputs[aInputs.size() - 1], pDoc->GetString(ScAddress(0, 0, 0)));
-
-    comphelper::LibreOfficeKit::setActive(false);
 }
 
 void ScTiledRenderingTest::testFilterDlg()
@@ -1653,7 +1646,9 @@ void ScTiledRenderingTest::testFilterDlg()
     CPPUNIT_ASSERT_EQUAL(false, pView2->GetViewFrame()->GetDispatcher()->IsLocked());
     CPPUNIT_ASSERT_EQUAL(false, pView1->GetViewFrame()->GetDispatcher()->IsLocked());
 
-    comphelper::LibreOfficeKit::setActive(false);
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
+    SfxLokHelper::setView(nView1);
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
 }
 
 void ScTiledRenderingTest::testVbaRangeCopyPaste()
@@ -1674,8 +1669,6 @@ void ScTiledRenderingTest::testVbaRangeCopyPaste()
         aParams, aRet, aOutParamIndex, aOutParam);
 
     CPPUNIT_ASSERT(!pDocShell->GetClipData().is());
-
-    comphelper::LibreOfficeKit::setActive(false);
 }
 
 void ScTiledRenderingTest::testInvalidationLoop()


More information about the Libreoffice-commits mailing list