diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2020-01-17 14:32:49 +0100 |
---|---|---|
committer | Pranam Lashkari <lpranam@collabora.com> | 2021-03-16 05:46:15 +0100 |
commit | 8ff147f200e6514bbc7e7d7b5ca91694b9234bfc (patch) | |
tree | bf19842568df4965ddf8aef4a88bc722d35255fa /sc | |
parent | d7dcecb76b15e1df9a1f3afaf56164a8bf597b71 (diff) |
Clean up duplicated command dispatch test functionality
Used in both Writer and Calc at few different places, so host it in
unotest/.
Change-Id: I013e6df471deb8693cf4ae62f0958b12e16fda7b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86972
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112395
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Pranam Lashkari <lpranam@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/tiledrendering/tiledrendering.cxx | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 158754d51ffc..cfcefe7ccd71 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -594,20 +594,6 @@ void ScTiledRenderingTest::testSpellOnlineRenderParameter() CPPUNIT_ASSERT_EQUAL(!bSet, pDoc->GetDocOptions().IsAutoSpell()); } -void lcl_dispatchCommand(const uno::Reference<lang::XComponent>& xComponent, const OUString& rCommand, const uno::Sequence<beans::PropertyValue>& rArguments) -{ - uno::Reference<frame::XController> xController = uno::Reference<frame::XModel>(xComponent, uno::UNO_QUERY_THROW)->getCurrentController(); - CPPUNIT_ASSERT(xController.is()); - uno::Reference<frame::XDispatchProvider> xFrame(xController->getFrame(), uno::UNO_QUERY); - CPPUNIT_ASSERT(xFrame.is()); - - uno::Reference<uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext(); - uno::Reference<frame::XDispatchHelper> xDispatchHelper(frame::DispatchHelper::create(xContext)); - CPPUNIT_ASSERT(xDispatchHelper.is()); - - xDispatchHelper->executeDispatch(xFrame, rCommand, OUString(), 0, rArguments); -} - void ScTiledRenderingTest::testTextViewSelection() { comphelper::LibreOfficeKit::setActive(); @@ -621,7 +607,7 @@ void ScTiledRenderingTest::testTextViewSelection() // Create a selection on two cells in the second view, that's a text selection in LOK terms. aView1.m_bTextViewSelectionInvalidated = false; - lcl_dispatchCommand(mxComponent, ".uno:GoRightSel", {}); + dispatchCommand(mxComponent, ".uno:GoRightSel", {}); Scheduler::ProcessEventsToIdle(); // Make sure the first view got its notification. CPPUNIT_ASSERT(aView1.m_bTextViewSelectionInvalidated); @@ -640,7 +626,7 @@ void ScTiledRenderingTest::testDocumentSizeChanged() { comphelper::makePropertyValue("ToPoint", OUString("$A$30")), }; - lcl_dispatchCommand(mxComponent, ".uno:GoToCell", aPropertyValues); + dispatchCommand(mxComponent, ".uno:GoToCell", aPropertyValues); Scheduler::ProcessEventsToIdle(); // Assert that the size in the payload is not 0. CPPUNIT_ASSERT(m_aDocumentSize.getWidth() > 0); @@ -1687,7 +1673,7 @@ void ScTiledRenderingTest::testSpellOnlineParameter() { comphelper::makePropertyValue("Enable", uno::makeAny(!bSet)), }; - lcl_dispatchCommand(mxComponent, ".uno:SpellOnline", params); + dispatchCommand(mxComponent, ".uno:SpellOnline", params); CPPUNIT_ASSERT_EQUAL(!bSet, pDoc->GetDocOptions().IsAutoSpell()); // set the same state as now and we don't expect any change (no-toggle) @@ -1695,7 +1681,7 @@ void ScTiledRenderingTest::testSpellOnlineParameter() { comphelper::makePropertyValue("Enable", uno::makeAny(!bSet)), }; - lcl_dispatchCommand(mxComponent, ".uno:SpellOnline", params); + dispatchCommand(mxComponent, ".uno:SpellOnline", params); CPPUNIT_ASSERT_EQUAL(!bSet, pDoc->GetDocOptions().IsAutoSpell()); } |