From 34568738bbaf1e82dbb53fdf516f4d57416bb5b0 Mon Sep 17 00:00:00 2001 From: Jens Carl Date: Sun, 1 Apr 2018 07:20:34 +0000 Subject: tdf#45904 Move _XActivationBroadcaster Java tests to C++ Change-Id: If8f44b24e58663bacb1cf6b2a1ec533e87fb8a38 Reviewed-on: https://gerrit.libreoffice.org/52216 Tested-by: Jenkins Reviewed-by: Jens Carl --- sc/qa/extras/sctabviewobj.cxx | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) (limited to 'sc') diff --git a/sc/qa/extras/sctabviewobj.cxx b/sc/qa/extras/sctabviewobj.cxx index 8217c4e915a9..6f3f3b01ae16 100644 --- a/sc/qa/extras/sctabviewobj.cxx +++ b/sc/qa/extras/sctabviewobj.cxx @@ -9,15 +9,16 @@ #include #include +#include #include #include #include +#include #include #include #include #include -#include #include #include @@ -25,10 +26,11 @@ using namespace css; using namespace css::uno; -namespace sc_apitest { - +namespace sc_apitest +{ class ScTabViewObj : public CalcUnoApiTest, public apitest::SpreadsheetViewSettings, + public apitest::XActivationBroadcaster, public apitest::XSpreadsheetView, public apitest::XViewFreezable, public apitest::XViewSplitable @@ -37,6 +39,8 @@ public: ScTabViewObj(); virtual uno::Reference< uno::XInterface > init() override; + virtual uno::Reference getXSpreadsheet(const sal_Int16 nNumber = 0) override; + virtual void setUp() override; virtual void tearDown() override; @@ -45,6 +49,9 @@ public: // SpreadsheetViewSettings CPPUNIT_TEST(testSpreadsheetViewSettingsProperties); + // XActivationBroadcaster + CPPUNIT_TEST(testAddRemoveActivationEventListener); + // XSpreadsheetView CPPUNIT_TEST(testGetSetActiveSheet); @@ -67,12 +74,27 @@ ScTabViewObj::ScTabViewObj() uno::Reference< uno::XInterface > ScTabViewObj::init() { - uno::Reference< sheet::XSpreadsheetDocument > xSheetDoc(mxComponent, uno::UNO_QUERY_THROW); - uno::Reference< frame::XModel > xModel(xSheetDoc, uno::UNO_QUERY_THROW); + uno::Reference xDoc(mxComponent, uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT_MESSAGE("no calc document", xDoc.is()); + + uno::Reference xModel(xDoc, uno::UNO_QUERY_THROW); return xModel->getCurrentController(); } +uno::Reference ScTabViewObj::getXSpreadsheet(const sal_Int16 nNumber) +{ + uno::Reference xDoc(mxComponent, UNO_QUERY_THROW); + CPPUNIT_ASSERT_MESSAGE("no calc document", xDoc.is()); + + uno::Reference xSheets(xDoc->getSheets(), UNO_QUERY_THROW); + xSheets->insertNewByName("Sheet2", 2); + uno::Reference xIndex(xDoc->getSheets(), UNO_QUERY_THROW); + uno::Reference xSheet(xIndex->getByIndex(nNumber), UNO_QUERY_THROW); + + return xSheet; +} + void ScTabViewObj::setUp() { CalcUnoApiTest::setUp(); @@ -87,7 +109,7 @@ void ScTabViewObj::tearDown() CPPUNIT_TEST_SUITE_REGISTRATION(ScTabViewObj); -} // end namespace +} // namespace sc_apitest CPPUNIT_PLUGIN_IMPLEMENT(); -- cgit