[Libreoffice-commits] core.git: include/test qadevOOo/Jar_OOoRunner.mk qadevOOo/objdsc qadevOOo/tests sc/qa test/Library_subsequenttest.mk test/source
Jens Carl
j.carl43 at gmx.de
Sun Oct 29 21:09:08 UTC 2017
include/test/sheet/xsubtotalcalculatable.hxx | 39 +++
qadevOOo/Jar_OOoRunner.mk | 1
qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellCursorObj.csv | 3
qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellRangeObj.csv | 3
qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableSheetObj.csv | 3
qadevOOo/tests/java/ifc/sheet/_XSubTotalCalculatable.java | 117 ----------
sc/qa/extras/sccellcursorobj.cxx | 11
sc/qa/extras/sccellrangeobj.cxx | 26 ++
sc/qa/extras/sctablesheetobj.cxx | 28 ++
test/Library_subsequenttest.mk | 1
test/source/sheet/xsubtotalcalculatable.cxx | 74 ++++++
11 files changed, 173 insertions(+), 133 deletions(-)
New commits:
commit 80003831041fcd718d2dddc9b6409ff50b48facf
Author: Jens Carl <j.carl43 at gmx.de>
Date: Thu Sep 14 07:10:41 2017 +0000
tdf#45904 Move _XSubTotalCalculatable Java tests to C++
Change-Id: I18199a9cc79e6a109c8de0026b37a67f85cf778a
Reviewed-on: https://gerrit.libreoffice.org/42265
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/include/test/sheet/xsubtotalcalculatable.hxx b/include/test/sheet/xsubtotalcalculatable.hxx
new file mode 100644
index 000000000000..d083a85fc395
--- /dev/null
+++ b/include/test/sheet/xsubtotalcalculatable.hxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * 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/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XSUBTOTALCALCULATABLE_HXX
+#define INCLUDED_TEST_SHEET_XSUBTOTALCALCULATABLE_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/sheet/XSpreadsheet.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <test/testdllapi.hxx>
+
+using namespace css;
+using namespace css::uno;
+
+namespace apitest {
+
+class OOO_DLLPUBLIC_TEST XSubTotalCalculatable
+{
+public:
+ virtual uno::Reference< css::uno::XInterface > init() = 0;
+ virtual uno::Reference< css::uno::XInterface > getXSpreadsheet() = 0;
+
+ void testCreateSubTotalDescriptor();
+ void testApplyRemoveSubTotals();
+
+protected:
+ ~XSubTotalCalculatable() {}
+};
+
+}
+#endif // INCLUDED_TEST_SHEET_XSUBTOTALCALCULATABLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/qadevOOo/Jar_OOoRunner.mk b/qadevOOo/Jar_OOoRunner.mk
index 14c2ee32d281..4aa239d98ce0 100644
--- a/qadevOOo/Jar_OOoRunner.mk
+++ b/qadevOOo/Jar_OOoRunner.mk
@@ -632,7 +632,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
qadevOOo/tests/java/ifc/sheet/_XSheetPageBreak \
qadevOOo/tests/java/ifc/sheet/_XSpreadsheet \
qadevOOo/tests/java/ifc/sheet/_XSpreadsheetView \
- qadevOOo/tests/java/ifc/sheet/_XSubTotalCalculatable \
qadevOOo/tests/java/ifc/style/_CharacterProperties \
qadevOOo/tests/java/ifc/style/_CharacterPropertiesAsian \
qadevOOo/tests/java/ifc/style/_CharacterPropertiesComplex \
diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellCursorObj.csv b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellCursorObj.csv
index 3ce35d7a5460..1ed7325b2fca 100644
--- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellCursorObj.csv
+++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellCursorObj.csv
@@ -141,9 +141,6 @@
"ScCellCursorObj";"com::sun::star::table::XCellRange";"getCellByPosition()"
"ScCellCursorObj";"com::sun::star::table::XCellRange";"getCellRangeByPosition()"
"ScCellCursorObj";"com::sun::star::table::XCellRange";"getCellRangeByName()"
-"ScCellCursorObj";"com::sun::star::sheet::XSubTotalCalculatable";"createSubTotalDescriptor()"
-"ScCellCursorObj";"com::sun::star::sheet::XSubTotalCalculatable";"applySubTotals()"
-"ScCellCursorObj";"com::sun::star::sheet::XSubTotalCalculatable";"removeSubTotals()"
"ScCellCursorObj";"com::sun::star::sheet::SheetCellRange";"Position"
"ScCellCursorObj";"com::sun::star::sheet::SheetCellRange";"Size"
"ScCellCursorObj";"com::sun::star::sheet::SheetCellRange";"ConditionalFormat"
diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellRangeObj.csv b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellRangeObj.csv
index 396876793189..71f5f2647995 100644
--- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellRangeObj.csv
+++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellRangeObj.csv
@@ -136,9 +136,6 @@
"ScCellRangeObj";"com::sun::star::table::XCellRange";"getCellByPosition()"
"ScCellRangeObj";"com::sun::star::table::XCellRange";"getCellRangeByPosition()"
"ScCellRangeObj";"com::sun::star::table::XCellRange";"getCellRangeByName()"
-"ScCellRangeObj";"com::sun::star::sheet::XSubTotalCalculatable";"createSubTotalDescriptor()"
-"ScCellRangeObj";"com::sun::star::sheet::XSubTotalCalculatable";"applySubTotals()"
-"ScCellRangeObj";"com::sun::star::sheet::XSubTotalCalculatable";"removeSubTotals()"
"ScCellRangeObj";"com::sun::star::sheet::SheetCellRange";"Position"
"ScCellRangeObj";"com::sun::star::sheet::SheetCellRange";"Size"
"ScCellRangeObj";"com::sun::star::sheet::SheetCellRange";"ConditionalFormat"
diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableSheetObj.csv b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableSheetObj.csv
index 776469521bec..db2a2b9225bc 100644
--- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableSheetObj.csv
+++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableSheetObj.csv
@@ -167,9 +167,6 @@
"ScTableSheetObj";"com::sun::star::table::XCellRange";"getCellByPosition()"
"ScTableSheetObj";"com::sun::star::table::XCellRange";"getCellRangeByPosition()"
"ScTableSheetObj";"com::sun::star::table::XCellRange";"getCellRangeByName()"
-"ScTableSheetObj";"com::sun::star::sheet::XSubTotalCalculatable";"createSubTotalDescriptor()"
-"ScTableSheetObj";"com::sun::star::sheet::XSubTotalCalculatable";"applySubTotals()"
-"ScTableSheetObj";"com::sun::star::sheet::XSubTotalCalculatable";"removeSubTotals()"
"ScTableSheetObj";"com::sun::star::sheet::SheetCellRange";"Position"
"ScTableSheetObj";"com::sun::star::sheet::SheetCellRange";"Size"
"ScTableSheetObj";"com::sun::star::sheet::SheetCellRange";"ConditionalFormat"
diff --git a/qadevOOo/tests/java/ifc/sheet/_XSubTotalCalculatable.java b/qadevOOo/tests/java/ifc/sheet/_XSubTotalCalculatable.java
deleted file mode 100644
index b84798e995a6..000000000000
--- a/qadevOOo/tests/java/ifc/sheet/_XSubTotalCalculatable.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * 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/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package ifc.sheet;
-
-import lib.MultiMethodTest;
-import lib.Status;
-import lib.StatusException;
-
-import com.sun.star.sheet.SubTotalColumn;
-import com.sun.star.sheet.XSpreadsheet;
-import com.sun.star.sheet.XSubTotalCalculatable;
-import com.sun.star.sheet.XSubTotalDescriptor;
-import com.sun.star.uno.UnoRuntime;
-
-
-public class _XSubTotalCalculatable extends MultiMethodTest {
- public XSubTotalCalculatable oObj;
- protected XSubTotalDescriptor desc;
- protected XSpreadsheet oSheet;
-
- @Override
- protected void before() {
- oSheet = (XSpreadsheet) tEnv.getObjRelation("SHEET");
-
- if (oSheet == null) {
- log.println("Object relation oSheet is missing");
- log.println("Trying to query the needed Interface");
- oSheet = UnoRuntime.queryInterface(
- XSpreadsheet.class, tEnv.getTestObject());
-
- if (oSheet == null) {
- throw new StatusException(Status.failed(
- "Object relation oSheet is missing"));
- }
- }
- }
-
- public void _applySubTotals() {
- requiredMethod("createSubTotalDescriptor()");
-
- boolean res = true;
-
- try {
- oSheet.getCellByPosition(0, 0).setFormula("first");
- oSheet.getCellByPosition(1, 0).setFormula("second");
- oSheet.getCellByPosition(0, 3).setFormula("");
- oSheet.getCellByPosition(0, 1).setValue(5);
- oSheet.getCellByPosition(0, 2).setValue(5);
- oSheet.getCellByPosition(1, 1).setValue(17);
- oSheet.getCellByPosition(1, 2).setValue(25);
- oObj.applySubTotals(desc, true);
-
- String formula = oSheet.getCellByPosition(0, 3).getFormula();
- String expected = "=SUBTOTAL(9;$A$2:$A$3)";
- res = formula.equals(expected);
-
- if (!res) {
- log.println("getting: " + formula);
- log.println("expected: " + expected);
- }
- } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
- log.println("Couldn't fill cells" + e.getLocalizedMessage());
- res = false;
- }
-
- tRes.tested("applySubTotals()", res);
- }
-
- public void _createSubTotalDescriptor() {
- desc = oObj.createSubTotalDescriptor(true);
-
- SubTotalColumn[] columns = new SubTotalColumn[1];
- columns[0] = new SubTotalColumn();
- columns[0].Column = 0;
- columns[0].Function = com.sun.star.sheet.GeneralFunction.SUM;
- desc.addNew(columns, 0);
- tRes.tested("createSubTotalDescriptor()", true);
- }
-
- public void _removeSubTotals() {
- requiredMethod("applySubTotals()");
-
- boolean res = true;
-
- try {
- oObj.removeSubTotals();
-
- String formula = oSheet.getCellByPosition(0, 3).getFormula();
- String expected = "";
- res = formula.equals(expected);
-
- if (!res) {
- log.println("getting: " + formula);
- log.println("expected: " + expected);
- }
- } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
- log.println("Couldn't get cell" + e.getLocalizedMessage());
- }
-
- tRes.tested("removeSubTotals()", res);
- }
-}
\ No newline at end of file
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++;
diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk
index 7c3e6b514cf3..b9378036942c 100644
--- a/test/Library_subsequenttest.mk
+++ b/test/Library_subsequenttest.mk
@@ -77,6 +77,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\
test/source/sheet/xviewpane \
test/source/sheet/xviewfreezable \
test/source/sheet/xviewsplitable \
+ test/source/sheet/xsubtotalcalculatable \
test/source/sheet/xsubtotaldescriptor \
test/source/text/xtext \
test/source/text/xtextfield \
diff --git a/test/source/sheet/xsubtotalcalculatable.cxx b/test/source/sheet/xsubtotalcalculatable.cxx
new file mode 100644
index 000000000000..05071e95cb64
--- /dev/null
+++ b/test/source/sheet/xsubtotalcalculatable.cxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * 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/sheet/xsubtotalcalculatable.hxx>
+
+#include <com/sun/star/sheet/GeneralFunction.hpp>
+#include <com/sun/star/sheet/SubTotalColumn.hpp>
+#include <com/sun/star/sheet/XSpreadsheet.hpp>
+#include <com/sun/star/sheet/XSubTotalCalculatable.hpp>
+#include <com/sun/star/sheet/XSubTotalDescriptor.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <cppunit/extensions/HelperMacros.h>
+
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+
+namespace apitest {
+
+void XSubTotalCalculatable::testCreateSubTotalDescriptor()
+{
+ uno::Reference< sheet::XSubTotalCalculatable > xSTC(init(), uno::UNO_QUERY_THROW);
+ uno::Reference< sheet::XSubTotalDescriptor > xSTD = xSTC->createSubTotalDescriptor(true);
+
+ uno::Sequence< sheet::SubTotalColumn > xCols;
+ xCols.realloc(1);
+ xCols[0].Column = 5;
+ xCols[0].Function = sheet::GeneralFunction_SUM;
+
+ CPPUNIT_ASSERT_NO_THROW_MESSAGE("Unable to create XSubTotalDescriptor", xSTD->addNew(xCols, 1));
+}
+
+void XSubTotalCalculatable::testApplyRemoveSubTotals()
+{
+ uno::Reference< sheet::XSpreadsheet > xSheet(getXSpreadsheet(), UNO_QUERY_THROW);
+ uno::Reference< sheet::XSubTotalCalculatable > xSTC(xSheet, UNO_QUERY_THROW);
+
+ uno::Reference< sheet::XSubTotalDescriptor > xSTD = xSTC->createSubTotalDescriptor(true);
+ uno::Sequence< sheet::SubTotalColumn > xCols;
+ xCols.realloc(1);
+ xCols[0].Column = 0;
+ xCols[0].Function = sheet::GeneralFunction_SUM;
+ xSTD->addNew(xCols, 0);
+
+ xSheet->getCellByPosition(0, 0)->setFormula("first");
+ xSheet->getCellByPosition(1, 0)->setFormula("second");
+ xSheet->getCellByPosition(0, 3)->setFormula("");
+ xSheet->getCellByPosition(0, 1)->setValue(5);
+ xSheet->getCellByPosition(0, 2)->setValue(5);
+ xSheet->getCellByPosition(1, 1)->setValue(17);
+ xSheet->getCellByPosition(1, 2)->setValue(17);
+
+ xSTC->applySubTotals(xSTD, true);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to apply SubTotals",
+ OUString("=SUBTOTAL(9;$A$2:$A$3)"),
+ xSheet->getCellByPosition(0, 3)->getFormula());
+
+ xSTC->removeSubTotals();
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to remove SubTotals",
+ OUString(""),
+ xSheet->getCellByPosition(0, 3)->getFormula());
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
More information about the Libreoffice-commits
mailing list