diff options
author | Jens Carl <j.carl43@gmx.de> | 2017-09-14 07:10:41 +0000 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2017-10-29 22:08:44 +0100 |
commit | 80003831041fcd718d2dddc9b6409ff50b48facf (patch) | |
tree | 091dd77e9306f6cb3d8326b1019c8464fae5d335 /sc/qa/extras | |
parent | a060947e8c1538cedae5dee6b2a4e7a15d434d66 (diff) |
tdf#45904 Move _XSubTotalCalculatable Java tests to C++
Change-Id: I18199a9cc79e6a109c8de0026b37a67f85cf778a
Reviewed-on: https://gerrit.libreoffice.org/42265
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc/qa/extras')
-rw-r--r-- | sc/qa/extras/sccellcursorobj.cxx | 11 | ||||
-rw-r--r-- | sc/qa/extras/sccellrangeobj.cxx | 26 | ||||
-rw-r--r-- | sc/qa/extras/sctablesheetobj.cxx | 28 |
3 files changed, 59 insertions, 6 deletions
diff --git a/sc/qa/extras/sccellcursorobj.cxx b/sc/qa/extras/sccellcursorobj.cxx index 674c9eff0b98..5ccc1722320a 100644 --- a/sc/qa/extras/sccellcursorobj.cxx +++ b/sc/qa/extras/sccellcursorobj.cxx @@ -11,6 +11,7 @@ #include <test/sheet/xcellseries.hxx> #include <test/sheet/xusedareacursor.hxx> #include <test/sheet/xuniquecellformatrangessupplier.hxx> +#include <test/sheet/xsubtotalcalculatable.hxx> #include <com/sun/star/sheet/XSpreadsheetDocument.hpp> #include <com/sun/star/sheet/XSpreadsheet.hpp> @@ -21,9 +22,11 @@ using namespace css::uno; namespace sc_apitest { -#define NUMBER_OF_TESTS 5 +#define NUMBER_OF_TESTS 7 -class ScCellCursorObj : public CalcUnoApiTest, private apitest::XCellSeries, public apitest::XUsedAreaCursor, public apitest::XUniqueCellFormatRangesSupplier +class ScCellCursorObj : public CalcUnoApiTest, + public apitest::XCellSeries, public apitest::XUsedAreaCursor, + public apitest::XUniqueCellFormatRangesSupplier, public apitest::XSubTotalCalculatable { public: ScCellCursorObj(); @@ -46,6 +49,10 @@ public: // XUniqueCellFormatRangesSupplier CPPUNIT_TEST(testGetUniqueCellFormatRanges); + // XSubTotalCalculatable + CPPUNIT_TEST(testCreateSubTotalDescriptor); + CPPUNIT_TEST(testApplyRemoveSubTotals); + CPPUNIT_TEST_SUITE_END(); private: diff --git a/sc/qa/extras/sccellrangeobj.cxx b/sc/qa/extras/sccellrangeobj.cxx index fff430036bda..a062063c58b4 100644 --- a/sc/qa/extras/sccellrangeobj.cxx +++ b/sc/qa/extras/sccellrangeobj.cxx @@ -13,6 +13,7 @@ #include <test/sheet/xcellrangesquery.hxx> #include <test/sheet/xcellseries.hxx> #include <test/sheet/xuniquecellformatrangessupplier.hxx> +#include <test/sheet/xsubtotalcalculatable.hxx> #include <test/util/xreplaceable.hxx> #include <test/util/xsearchable.hxx> @@ -28,11 +29,12 @@ using namespace css::uno; namespace sc_apitest { -#define NUMBER_OF_TESTS 18 +#define NUMBER_OF_TESTS 20 class ScCellRangeObj : public CalcUnoApiTest, public apitest::XCellRangesQuery, public apitest::CellProperties, public apitest::XSearchable, public apitest::XReplaceable, public apitest::XCellRangeData, - public apitest::XCellSeries, public apitest::XUniqueCellFormatRangesSupplier + public apitest::XCellSeries, public apitest::XUniqueCellFormatRangesSupplier, + public apitest::XSubTotalCalculatable { public: ScCellRangeObj(); @@ -41,6 +43,7 @@ public: virtual void tearDown() override; virtual uno::Reference< uno::XInterface > init() override; virtual uno::Reference< uno::XInterface > getXCellRangeData() override; + virtual uno::Reference< uno::XInterface > getXSpreadsheet() override; void testSortOOB(); CPPUNIT_TEST_SUITE(ScCellRangeObj); @@ -80,6 +83,10 @@ public: // XUniqueCellFormatRangesSupplier CPPUNIT_TEST(testGetUniqueCellFormatRanges); + // XSubTotalCalculatable + CPPUNIT_TEST(testCreateSubTotalDescriptor); + CPPUNIT_TEST(testApplyRemoveSubTotals); + CPPUNIT_TEST_SUITE_END(); private: @@ -118,6 +125,21 @@ uno::Reference< uno::XInterface > ScCellRangeObj::init() return xReturn; } +uno::Reference< uno::XInterface > ScCellRangeObj::getXSpreadsheet() +{ + OUString aFileURL; + const OUString aFileBase("xcellrangesquery.ods"); + createFileURL(aFileBase, aFileURL); + std::cout << OUStringToOString(aFileURL, RTL_TEXTENCODING_UTF8).getStr() << std::endl; + if( !mxComponent.is()) + mxComponent = loadFromDesktop(aFileURL, "com.sun.star.sheet.SpreadsheetDocument"); + uno::Reference< sheet::XSpreadsheetDocument> xDoc (mxComponent, UNO_QUERY_THROW); + uno::Reference< container::XIndexAccess > xIndex (xDoc->getSheets(), UNO_QUERY_THROW); + uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(0), UNO_QUERY_THROW); + + return xSheet; +} + uno::Reference< uno::XInterface > ScCellRangeObj::getXCellRangeData() { OUString aFileURL; diff --git a/sc/qa/extras/sctablesheetobj.cxx b/sc/qa/extras/sctablesheetobj.cxx index c97e5230fbe3..1566dce64fc4 100644 --- a/sc/qa/extras/sctablesheetobj.cxx +++ b/sc/qa/extras/sctablesheetobj.cxx @@ -13,6 +13,7 @@ #include <test/sheet/xuniquecellformatrangessupplier.hxx> #include <test/util/xreplaceable.hxx> #include <test/util/xsearchable.hxx> +#include <test/sheet/xsubtotalcalculatable.hxx> #include <com/sun/star/sheet/XSpreadsheetDocument.hpp> #include <com/sun/star/sheet/XSpreadsheet.hpp> @@ -23,9 +24,12 @@ using namespace css::uno; namespace sc_apitest { -#define NUMBER_OF_TESTS 10 +#define NUMBER_OF_TESTS 12 -class ScTableSheetObj : public CalcUnoApiTest, public apitest::XSearchable, public apitest::XReplaceable, public apitest::XPrintAreas, public apitest::XCellSeries, public apitest::XUniqueCellFormatRangesSupplier +class ScTableSheetObj : public CalcUnoApiTest, + public apitest::XSearchable, public apitest::XReplaceable, + public apitest::XPrintAreas, public apitest::XCellSeries, + public apitest::XUniqueCellFormatRangesSupplier, public apitest::XSubTotalCalculatable { public: ScTableSheetObj(); @@ -34,6 +38,7 @@ public: virtual void tearDown() override; virtual uno::Reference< uno::XInterface > init() override; + virtual uno::Reference< uno::XInterface > getXSpreadsheet() override; CPPUNIT_TEST_SUITE(ScTableSheetObj); @@ -57,6 +62,10 @@ public: // XUniqueCellFormatRangesSupplier CPPUNIT_TEST(testGetUniqueCellFormatRanges); + // XSubTotalCalculatable + CPPUNIT_TEST(testCreateSubTotalDescriptor); + CPPUNIT_TEST(testApplyRemoveSubTotals); + CPPUNIT_TEST_SUITE_END(); private: @@ -90,6 +99,21 @@ uno::Reference< uno::XInterface > ScTableSheetObj::init() return xSheet; } +uno::Reference< uno::XInterface > ScTableSheetObj::getXSpreadsheet() +{ + OUString aFileURL; + createFileURL("ScTableSheetObj.ods", aFileURL); + if(!mxComponent.is()) + mxComponent = loadFromDesktop(aFileURL, "com.sun.star.sheet.SpreadsheetDocument"); + CPPUNIT_ASSERT(mxComponent.is()); + + uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, UNO_QUERY_THROW); + uno::Reference< container::XIndexAccess > xIndex (xDoc->getSheets(), UNO_QUERY_THROW); + uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(1), UNO_QUERY_THROW); + + return xSheet; +} + void ScTableSheetObj::setUp() { nTest++; |