diff options
author | Jens Carl <j.carl43@gmx.de> | 2018-03-27 06:22:00 +0000 |
---|---|---|
committer | Jens Carl <j.carl43@gmx.de> | 2018-03-28 03:28:30 +0200 |
commit | 3fc835b79957b4ace99c1dc9526eda7549020951 (patch) | |
tree | 0cbc6d401ac96e8eb45cc1b51cab5c467e1b10d1 /sc | |
parent | e32b4c8a079e4b51b1028d2467b872ff5b8cdd3a (diff) |
tdf#45904 Move _XCalculatable Java test to C++
Change-Id: Ib1fac049d2a135074de45c17fbaa78b0af2bec91
Reviewed-on: https://gerrit.libreoffice.org/51929
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Jens Carl <j.carl43@gmx.de>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/extras/scmodelobj.cxx | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/sc/qa/extras/scmodelobj.cxx b/sc/qa/extras/scmodelobj.cxx index 9e57c88b0add..2927f2f9d9c2 100644 --- a/sc/qa/extras/scmodelobj.cxx +++ b/sc/qa/extras/scmodelobj.cxx @@ -9,10 +9,16 @@ #include <test/unoapi_test.hxx> #include <test/sheet/spreadsheetdocumentsettings.hxx> +#include <test/sheet/xcalculatable.hxx> #include <test/sheet/xconsolidatable.hxx> #include <test/sheet/xgoalseek.hxx> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/sheet/XSpreadsheetDocument.hpp> +#include <com/sun/star/sheet/XSpreadsheet.hpp> +#include <com/sun/star/sheet/XSpreadsheets.hpp> #include <com/sun/star/uno/XInterface.hpp> #include <com/sun/star/uno/Reference.hxx> @@ -24,6 +30,7 @@ namespace sc_apitest { class ScModelObj : public UnoApiTest, public apitest::SpreadsheetDocumentSettings, + public apitest::XCalculatable, public apitest::XConsolidatable, public apitest::XGoalSeek { @@ -32,6 +39,7 @@ public: virtual void tearDown() override; virtual uno::Reference< uno::XInterface > init() override; + virtual uno::Sequence<uno::Reference<table::XCell>> getXCells() override; ScModelObj(); @@ -40,6 +48,11 @@ public: // SpreadsheetDocumentSettings CPPUNIT_TEST(testSpreadsheetDocumentSettingsProperties); + // XCalculatable + CPPUNIT_TEST(testCalculate); + CPPUNIT_TEST(testCalculateAll); + CPPUNIT_TEST(testEnableAutomaticCaclulation); + // XConsolidatable CPPUNIT_TEST(testCreateConsolidationDescriptor); CPPUNIT_TEST(testConsolidate); @@ -51,6 +64,7 @@ public: private: uno::Reference< lang::XComponent > mxComponent; + uno::Sequence<uno::Reference<table::XCell>> m_xCells; }; ScModelObj::ScModelObj() @@ -60,9 +74,29 @@ ScModelObj::ScModelObj() uno::Reference< uno::XInterface > ScModelObj::init() { - CPPUNIT_ASSERT_MESSAGE("no component loaded", mxComponent.is()); + uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, UNO_QUERY_THROW); + CPPUNIT_ASSERT_MESSAGE("no calc document", xDoc.is()); + + uno::Reference<frame::XModel> xModel(xDoc, UNO_QUERY_THROW); + + uno::Reference<sheet::XSpreadsheets> xSheets(xDoc->getSheets(), UNO_QUERY_THROW); + uno::Reference<container::XIndexAccess> xIA(xSheets, UNO_QUERY_THROW); + uno::Reference<sheet::XSpreadsheet> xSheet(xIA->getByIndex(0), UNO_QUERY_THROW); + + m_xCells.realloc(3); + m_xCells[0] = xSheet->getCellByPosition(4, 5); + m_xCells[0]->setValue(15); + m_xCells[1] = xSheet->getCellByPosition(5, 5); + m_xCells[1]->setValue(10); + m_xCells[2] = xSheet->getCellByPosition(6, 5); + m_xCells[2]->setFormula("= E6 * F6"); - return mxComponent; + return xModel; +} + +uno::Sequence<uno::Reference<table::XCell>> ScModelObj::getXCells() +{ + return m_xCells; } void ScModelObj::setUp() |