summaryrefslogtreecommitdiff
path: root/sc/qa
diff options
context:
space:
mode:
authorJens Carl <j.carl43@gmx.de>2017-10-19 08:19:39 +0000
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-10-29 23:44:31 +0100
commita0b7cd137aac7529b328c813b011166a78074cb4 (patch)
treefcc63e82bfbbebef27e4c1a4b589117d9f4b6328 /sc/qa
parent7ff9b44d5d2fc2b641fd28d8878d27051cfd8d25 (diff)
tdf#45904: Move Java _XSheetOperation tests to C++
Change-Id: I5aaeebd074882bb05a78e6d4057162e1da61d673 Reviewed-on: https://gerrit.libreoffice.org/43539 Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc/qa')
-rw-r--r--sc/qa/extras/sccellcursorobj.cxx21
-rw-r--r--sc/qa/extras/sccellrangeobj.cxx28
-rw-r--r--sc/qa/extras/sccellrangesobj.cxx115
-rw-r--r--sc/qa/extras/sctablesheetobj.cxx8
4 files changed, 155 insertions, 17 deletions
diff --git a/sc/qa/extras/sccellcursorobj.cxx b/sc/qa/extras/sccellcursorobj.cxx
index 5ccc1722320a..517d4ca41131 100644
--- a/sc/qa/extras/sccellcursorobj.cxx
+++ b/sc/qa/extras/sccellcursorobj.cxx
@@ -9,9 +9,10 @@
#include <test/calc_unoapi_test.hxx>
#include <test/sheet/xcellseries.hxx>
+#include <test/sheet/xsheetoperation.hxx>
+#include <test/sheet/xsubtotalcalculatable.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>
@@ -22,11 +23,13 @@ using namespace css::uno;
namespace sc_apitest {
-#define NUMBER_OF_TESTS 7
+#define NUMBER_OF_TESTS 9
-class ScCellCursorObj : public CalcUnoApiTest,
- public apitest::XCellSeries, public apitest::XUsedAreaCursor,
- public apitest::XUniqueCellFormatRangesSupplier, public apitest::XSubTotalCalculatable
+class ScCellCursorObj : public CalcUnoApiTest, public apitest::XCellSeries,
+ public apitest::XSheetOperation,
+ public apitest::XSubTotalCalculatable,
+ public apitest::XUsedAreaCursor,
+ public apitest::XUniqueCellFormatRangesSupplier
{
public:
ScCellCursorObj();
@@ -46,13 +49,17 @@ public:
CPPUNIT_TEST(testFillAuto);
CPPUNIT_TEST(testFillSeries);
- // XUniqueCellFormatRangesSupplier
- CPPUNIT_TEST(testGetUniqueCellFormatRanges);
+ // XSheetOperation
+ CPPUNIT_TEST(testComputeFunction);
+ CPPUNIT_TEST(testClearContents);
// XSubTotalCalculatable
CPPUNIT_TEST(testCreateSubTotalDescriptor);
CPPUNIT_TEST(testApplyRemoveSubTotals);
+ // XUniqueCellFormatRangesSupplier
+ CPPUNIT_TEST(testGetUniqueCellFormatRanges);
+
CPPUNIT_TEST_SUITE_END();
private:
diff --git a/sc/qa/extras/sccellrangeobj.cxx b/sc/qa/extras/sccellrangeobj.cxx
index a062063c58b4..ad6df24af046 100644
--- a/sc/qa/extras/sccellrangeobj.cxx
+++ b/sc/qa/extras/sccellrangeobj.cxx
@@ -12,8 +12,9 @@
#include <test/sheet/xcellrangedata.hxx>
#include <test/sheet/xcellrangesquery.hxx>
#include <test/sheet/xcellseries.hxx>
-#include <test/sheet/xuniquecellformatrangessupplier.hxx>
+#include <test/sheet/xsheetoperation.hxx>
#include <test/sheet/xsubtotalcalculatable.hxx>
+#include <test/sheet/xuniquecellformatrangessupplier.hxx>
#include <test/util/xreplaceable.hxx>
#include <test/util/xsearchable.hxx>
@@ -29,12 +30,17 @@ using namespace css::uno;
namespace sc_apitest {
-#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::XSubTotalCalculatable
+#define NUMBER_OF_TESTS 22
+
+class ScCellRangeObj : public CalcUnoApiTest, public apitest::CellProperties,
+ public apitest::XCellRangeData,
+ public apitest::XCellRangesQuery,
+ public apitest::XCellSeries,
+ public apitest::XReplaceable,
+ public apitest::XSearchable,
+ public apitest::XSheetOperation,
+ public apitest::XSubTotalCalculatable,
+ public apitest::XUniqueCellFormatRangesSupplier
{
public:
ScCellRangeObj();
@@ -83,6 +89,10 @@ public:
// XUniqueCellFormatRangesSupplier
CPPUNIT_TEST(testGetUniqueCellFormatRanges);
+ // XSheetOperation
+ CPPUNIT_TEST(testComputeFunction);
+ CPPUNIT_TEST(testClearContents);
+
// XSubTotalCalculatable
CPPUNIT_TEST(testCreateSubTotalDescriptor);
CPPUNIT_TEST(testApplyRemoveSubTotals);
@@ -99,9 +109,9 @@ uno::Reference< lang::XComponent > ScCellRangeObj::mxComponent;
ScCellRangeObj::ScCellRangeObj():
CalcUnoApiTest("/sc/qa/extras/testdocuments"),
- apitest::XSearchable("15", 1),
+ apitest::XCellSeries(2, 1),
apitest::XReplaceable("15", "35"),
- apitest::XCellSeries(2, 1)
+ apitest::XSearchable("15", 1)
{
}
diff --git a/sc/qa/extras/sccellrangesobj.cxx b/sc/qa/extras/sccellrangesobj.cxx
new file mode 100644
index 000000000000..9e8d287e125d
--- /dev/null
+++ b/sc/qa/extras/sccellrangesobj.cxx
@@ -0,0 +1,115 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/calc_unoapi_test.hxx>
+#include <test/sheet/xsheetoperation.hxx>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+#include <com/sun/star/sheet/XSpreadsheet.hpp>
+#include <com/sun/star/table/XCellRange.hpp>
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+
+using namespace css;
+using namespace css::uno;
+
+namespace sc_apitest {
+
+#define NUMBER_OF_TESTS 2
+
+class ScCellRangesObj : public CalcUnoApiTest, public apitest::XSheetOperation
+{
+public:
+ ScCellRangesObj();
+
+ virtual void setUp() override;
+ virtual void tearDown() override;
+
+ virtual uno::Reference< uno::XInterface > init() override;
+
+ CPPUNIT_TEST_SUITE(ScCellRangesObj);
+
+ // XSheetOperation
+ CPPUNIT_TEST(testComputeFunction);
+ CPPUNIT_TEST(testClearContents);
+
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+ static sal_Int32 nTest;
+ static uno::Reference< lang::XComponent > mxComponent;
+};
+
+sal_Int32 ScCellRangesObj::nTest = 0;
+uno::Reference< lang::XComponent > ScCellRangesObj::mxComponent;
+
+ScCellRangesObj::ScCellRangesObj():
+ CalcUnoApiTest("/sc/qa/extras/testdocuments")
+{
+}
+
+uno::Reference< uno::XInterface > ScCellRangesObj::init()
+{
+ // create a calc document
+ if (!mxComponent.is())
+ mxComponent = loadFromDesktop("private:factory/scalc");
+
+ uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, uno::UNO_QUERY_THROW);
+ CPPUNIT_ASSERT_MESSAGE("no calc document", xDoc.is());
+
+ uno::Reference< container::XIndexAccess > xIndexAccess(xDoc->getSheets(), uno::UNO_QUERY_THROW);
+ uno::Reference< sheet::XSpreadsheet > xSheet(xIndexAccess->getByIndex(0), uno::UNO_QUERY_THROW);
+ uno::Reference< lang::XMultiServiceFactory > xMSF(xDoc, uno::UNO_QUERY_THROW);
+ uno::Reference< container::XNameContainer > xRanges(xMSF->createInstance("com.sun.star.sheet.SheetCellRanges"), uno::UNO_QUERY_THROW);
+
+ //uno::Reference< container::XNameContainer > xRanges(xSheet, uno::UNO_QUERY_THROW);
+ uno::Any xCellRange;
+
+ xCellRange <<= xSheet->getCellRangeByName("C1:D4");
+ xRanges->insertByName("Range1", xCellRange);
+ xCellRange <<= xSheet->getCellRangeByName("E2:F5");
+ xRanges->insertByName("Range2", xCellRange);
+ xCellRange <<= xSheet->getCellRangeByName("G2:H3");
+ xRanges->insertByName("Range3", xCellRange);
+ xCellRange <<= xSheet->getCellRangeByName("I7:J8");
+ xRanges->insertByName("Range4", xCellRange);
+
+
+ return xRanges;
+}
+
+void ScCellRangesObj::setUp()
+{
+ nTest++;
+ CPPUNIT_ASSERT(nTest <= NUMBER_OF_TESTS);
+ CalcUnoApiTest::setUp();
+}
+
+void ScCellRangesObj::tearDown()
+{
+ if (nTest == NUMBER_OF_TESTS)
+ {
+ closeDocument(mxComponent);
+ mxComponent.clear();
+ }
+
+ CalcUnoApiTest::tearDown();
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(ScCellRangesObj);
+
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/qa/extras/sctablesheetobj.cxx b/sc/qa/extras/sctablesheetobj.cxx
index 8f2a4647d26a..a3b246055965 100644
--- a/sc/qa/extras/sctablesheetobj.cxx
+++ b/sc/qa/extras/sctablesheetobj.cxx
@@ -10,6 +10,7 @@
#include <test/calc_unoapi_test.hxx>
#include <test/sheet/xcellseries.hxx>
#include <test/sheet/xprintareas.hxx>
+#include <test/sheet/xsheetoperation.hxx>
#include <test/sheet/xsheetpagebreak.hxx>
#include <test/sheet/xspreadsheet.hxx>
#include <test/sheet/xsubtotalcalculatable.hxx>
@@ -26,12 +27,13 @@ using namespace css::uno;
namespace sc_apitest
{
-#define NUMBER_OF_TESTS 17
+#define NUMBER_OF_TESTS 19
class ScTableSheetObj : public CalcUnoApiTest, public apitest::XCellSeries,
public apitest::XPrintAreas,
public apitest::XReplaceable,
public apitest::XSearchable,
+ public apitest::XSheetOperation,
public apitest::XSheetPageBreak,
public apitest::XSpreadsheet,
public apitest::XSubTotalCalculatable,
@@ -65,6 +67,10 @@ public:
CPPUNIT_TEST(testFillAuto);
CPPUNIT_TEST(testFillSeries);
+ // XSheetOperation
+ CPPUNIT_TEST(testComputeFunction);
+ CPPUNIT_TEST(testClearContents);
+
// XSheetPageBreak
CPPUNIT_TEST(testGetColumnPageBreaks);
CPPUNIT_TEST(testGetRowPageBreaks);