[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - sc/qa

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Fri May 10 16:15:38 UTC 2019


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

New commits:
commit 42977af4e50974e907db8a981f16a79d5fceddad
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Fri May 10 14:09:56 2019 +0200
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri May 10 18:14:59 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).
    
    (cherry picked from commit 6eac1c9e3f4e801a3cfa75f85f7bc3944c7cd21e)
    
    On cp-6.0, this is a regression from the cp-6.0-only commit
    49fe72fe93d6b292da275fd0508a01b49a86fa3b (sfx2: LOK: route the parent sidebar
    window instead of the deck, 2018-10-10).
    
    Conflicts:
            sc/qa/unit/tiledrendering/tiledrendering.cxx
    
    Change-Id: I2515e18713c9f20a4f70de478ab062bab5650608
    Reviewed-on: https://gerrit.libreoffice.org/72127
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 711d663b5892..d7cba12df804 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(aResult, osl::Condition::result_ok);
-
-    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();
@@ -1481,7 +1466,9 @@ void ScTiledRenderingTest::testDocumentRepair()
         CPPUNIT_ASSERT_EQUAL(true, dynamic_cast< const SfxBoolItem* >(pItem2.get())->GetValue());
     }
 
-    comphelper::LibreOfficeKit::setActive(false);
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
+    SfxLokHelper::setView(nView1);
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
 }
 
 void ScTiledRenderingTest::testLanguageStatus()
@@ -1496,6 +1483,7 @@ void ScTiledRenderingTest::testLanguageStatus()
     SfxViewShell* pView1 = SfxViewShell::Current();
 
     // view #2
+    int nView1 = SfxLokHelper::getView();
     SfxLokHelper::createView();
     SfxViewShell* pView2 = SfxViewShell::Current();
     CPPUNIT_ASSERT(pView1 != pView2);
@@ -1527,6 +1515,10 @@ void ScTiledRenderingTest::testLanguageStatus()
         CPPUNIT_ASSERT_EQUAL(aLangBolivia, dynamic_cast< const SfxStringItem* >(pItem1.get())->GetValue());
         CPPUNIT_ASSERT_EQUAL(aLangBolivia, dynamic_cast< const SfxStringItem* >(pItem1.get())->GetValue());
     }
+
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
+    SfxLokHelper::setView(nView1);
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
 }
 
 void ScTiledRenderingTest::testMultiViewCopyPaste()
@@ -1547,6 +1539,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
@@ -1574,7 +1567,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()
@@ -1608,8 +1603,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()
@@ -1648,7 +1641,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()
@@ -1669,8 +1664,6 @@ void ScTiledRenderingTest::testVbaRangeCopyPaste()
         aParams, aRet, aOutParamIndex, aOutParam);
 
     CPPUNIT_ASSERT(!pDocShell->GetClipData().is());
-
-    comphelper::LibreOfficeKit::setActive(false);
 }
 
 }


More information about the Libreoffice-commits mailing list