Kaydet (Commit) a0b7cd13 authored tarafından Jens Carl's avatar Jens Carl Kaydeden (comit) Markus Mohrhard

tdf#45904: Move Java _XSheetOperation tests to C++

Change-Id: I5aaeebd074882bb05a78e6d4057162e1da61d673
Reviewed-on: https://gerrit.libreoffice.org/43539Reviewed-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
üst 7ff9b44d
/* -*- 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/.
*/
#ifndef INCLUDED_TEST_SHEET_XSHEETOPERATION_HXX
#define INCLUDED_TEST_SHEET_XSHEETOPERATION_HXX
#include <com/sun/star/uno/XInterface.hpp>
#include <com/sun/star/uno/Reference.hxx>
#include <test/testdllapi.hxx>
namespace apitest {
class OOO_DLLPUBLIC_TEST XSheetOperation
{
public:
virtual css::uno::Reference< css::uno::XInterface > init() = 0;
void testComputeFunction();
void testClearContents();
protected:
~XSheetOperation() {}
};
}
#endif // INCLUDED_TEST_SHEET_XSHEETOPERATION_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -628,7 +628,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\ ...@@ -628,7 +628,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
qadevOOo/tests/java/ifc/sheet/_XSheetFilterableEx \ qadevOOo/tests/java/ifc/sheet/_XSheetFilterableEx \
qadevOOo/tests/java/ifc/sheet/_XSheetFilterDescriptor \ qadevOOo/tests/java/ifc/sheet/_XSheetFilterDescriptor \
qadevOOo/tests/java/ifc/sheet/_XSheetLinkable \ qadevOOo/tests/java/ifc/sheet/_XSheetLinkable \
qadevOOo/tests/java/ifc/sheet/_XSheetOperation \
qadevOOo/tests/java/ifc/sheet/_XSpreadsheetView \ qadevOOo/tests/java/ifc/sheet/_XSpreadsheetView \
qadevOOo/tests/java/ifc/style/_CharacterProperties \ qadevOOo/tests/java/ifc/style/_CharacterProperties \
qadevOOo/tests/java/ifc/style/_CharacterPropertiesAsian \ qadevOOo/tests/java/ifc/style/_CharacterPropertiesAsian \
......
...@@ -108,8 +108,6 @@ ...@@ -108,8 +108,6 @@
"ScCellCursorObj";"com::sun::star::style::ParagraphProperties";"ParaUserDefinedAttributes#optional" "ScCellCursorObj";"com::sun::star::style::ParagraphProperties";"ParaUserDefinedAttributes#optional"
"ScCellCursorObj";"com::sun::star::style::ParagraphProperties";"NumberingIsNumber#optional" "ScCellCursorObj";"com::sun::star::style::ParagraphProperties";"NumberingIsNumber#optional"
"ScCellCursorObj";"com::sun::star::style::ParagraphProperties";"ParaIsConnectBorder#optional" "ScCellCursorObj";"com::sun::star::style::ParagraphProperties";"ParaIsConnectBorder#optional"
"ScCellCursorObj";"com::sun::star::sheet::XSheetOperation";"computeFunction()"
"ScCellCursorObj";"com::sun::star::sheet::XSheetOperation";"clearContents()"
"ScCellCursorObj";"com::sun::star::style::CharacterPropertiesComplex";"CharHeightComplex" "ScCellCursorObj";"com::sun::star::style::CharacterPropertiesComplex";"CharHeightComplex"
"ScCellCursorObj";"com::sun::star::style::CharacterPropertiesComplex";"CharWeightComplex" "ScCellCursorObj";"com::sun::star::style::CharacterPropertiesComplex";"CharWeightComplex"
"ScCellCursorObj";"com::sun::star::style::CharacterPropertiesComplex";"CharFontNameComplex" "ScCellCursorObj";"com::sun::star::style::CharacterPropertiesComplex";"CharFontNameComplex"
......
...@@ -103,8 +103,6 @@ ...@@ -103,8 +103,6 @@
"ScCellRangeObj";"com::sun::star::style::ParagraphProperties";"ParaUserDefinedAttributes#optional" "ScCellRangeObj";"com::sun::star::style::ParagraphProperties";"ParaUserDefinedAttributes#optional"
"ScCellRangeObj";"com::sun::star::style::ParagraphProperties";"NumberingIsNumber#optional" "ScCellRangeObj";"com::sun::star::style::ParagraphProperties";"NumberingIsNumber#optional"
"ScCellRangeObj";"com::sun::star::style::ParagraphProperties";"ParaIsConnectBorder#optional" "ScCellRangeObj";"com::sun::star::style::ParagraphProperties";"ParaIsConnectBorder#optional"
"ScCellRangeObj";"com::sun::star::sheet::XSheetOperation";"computeFunction()"
"ScCellRangeObj";"com::sun::star::sheet::XSheetOperation";"clearContents()"
"ScCellRangeObj";"com::sun::star::style::CharacterPropertiesComplex";"CharHeightComplex" "ScCellRangeObj";"com::sun::star::style::CharacterPropertiesComplex";"CharHeightComplex"
"ScCellRangeObj";"com::sun::star::style::CharacterPropertiesComplex";"CharWeightComplex" "ScCellRangeObj";"com::sun::star::style::CharacterPropertiesComplex";"CharWeightComplex"
"ScCellRangeObj";"com::sun::star::style::CharacterPropertiesComplex";"CharFontNameComplex" "ScCellRangeObj";"com::sun::star::style::CharacterPropertiesComplex";"CharFontNameComplex"
......
...@@ -107,8 +107,6 @@ ...@@ -107,8 +107,6 @@
"ScCellRangesObj";"com::sun::star::style::ParagraphProperties";"ParaUserDefinedAttributes#optional" "ScCellRangesObj";"com::sun::star::style::ParagraphProperties";"ParaUserDefinedAttributes#optional"
"ScCellRangesObj";"com::sun::star::style::ParagraphProperties";"NumberingIsNumber#optional" "ScCellRangesObj";"com::sun::star::style::ParagraphProperties";"NumberingIsNumber#optional"
"ScCellRangesObj";"com::sun::star::style::ParagraphProperties";"ParaIsConnectBorder#optional" "ScCellRangesObj";"com::sun::star::style::ParagraphProperties";"ParaIsConnectBorder#optional"
"ScCellRangesObj";"com::sun::star::sheet::XSheetOperation";"computeFunction()"
"ScCellRangesObj";"com::sun::star::sheet::XSheetOperation";"clearContents()"
"ScCellRangesObj";"com::sun::star::style::CharacterPropertiesComplex";"CharHeightComplex" "ScCellRangesObj";"com::sun::star::style::CharacterPropertiesComplex";"CharHeightComplex"
"ScCellRangesObj";"com::sun::star::style::CharacterPropertiesComplex";"CharWeightComplex" "ScCellRangesObj";"com::sun::star::style::CharacterPropertiesComplex";"CharWeightComplex"
"ScCellRangesObj";"com::sun::star::style::CharacterPropertiesComplex";"CharFontNameComplex" "ScCellRangesObj";"com::sun::star::style::CharacterPropertiesComplex";"CharFontNameComplex"
......
...@@ -104,8 +104,6 @@ ...@@ -104,8 +104,6 @@
"ScTableSheetObj";"com::sun::star::style::ParagraphProperties";"ParaUserDefinedAttributes#optional" "ScTableSheetObj";"com::sun::star::style::ParagraphProperties";"ParaUserDefinedAttributes#optional"
"ScTableSheetObj";"com::sun::star::style::ParagraphProperties";"NumberingIsNumber#optional" "ScTableSheetObj";"com::sun::star::style::ParagraphProperties";"NumberingIsNumber#optional"
"ScTableSheetObj";"com::sun::star::style::ParagraphProperties";"ParaIsConnectBorder#optional" "ScTableSheetObj";"com::sun::star::style::ParagraphProperties";"ParaIsConnectBorder#optional"
"ScTableSheetObj";"com::sun::star::sheet::XSheetOperation";"computeFunction()"
"ScTableSheetObj";"com::sun::star::sheet::XSheetOperation";"clearContents()"
"ScTableSheetObj";"com::sun::star::style::CharacterPropertiesComplex";"CharHeightComplex" "ScTableSheetObj";"com::sun::star::style::CharacterPropertiesComplex";"CharHeightComplex"
"ScTableSheetObj";"com::sun::star::style::CharacterPropertiesComplex";"CharWeightComplex" "ScTableSheetObj";"com::sun::star::style::CharacterPropertiesComplex";"CharWeightComplex"
"ScTableSheetObj";"com::sun::star::style::CharacterPropertiesComplex";"CharFontNameComplex" "ScTableSheetObj";"com::sun::star::style::CharacterPropertiesComplex";"CharFontNameComplex"
......
/*
* 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 com.sun.star.sheet.CellFlags;
import com.sun.star.sheet.GeneralFunction;
import com.sun.star.sheet.XSheetOperation;
/**
* Testing <code>com.sun.star.sheet.XSheetOperation</code>
* interface methods :
* <ul>
* <li><code> computeFunction()</code></li>
* <li><code> clearContents()</code></li>
* </ul> <p>
* @see com.sun.star.sheet.XSheetOperation
*/
public class _XSheetOperation extends MultiMethodTest {
public XSheetOperation oObj = null;
/**
* Test clears formula and value contents, calls the method
* <code>computeFunction</code> and checks returned value. <p>
* Has <b> OK </b> status if returned value is equal to zero
* and no exceptions were thrown. <p>
*/
public void _clearContents() {
boolean result = true;
double resultVal = -1;
log.println("Testing clearContents() ...");
int allFlags;
allFlags = CellFlags.VALUE | CellFlags.FORMULA;
oObj.clearContents (allFlags) ;
try {
resultVal = oObj.computeFunction(GeneralFunction.SUM);
result &= (resultVal == 0.0) || (resultVal == 0);
} catch (com.sun.star.uno.Exception e) {
result &= false ;
log.println(
"Exception occurred while checking results of method");
e.printStackTrace(log);
}
tRes.tested("clearContents()", result);
} // finished clearContents
/**
* Test calls the method and checks returned value. <p>
* Has <b> OK </b> status if returned value is equal or greater than zero
* and no exceptions were thrown. <p>
*/
public void _computeFunction() {
log.println("Testing computeFunction() ...");
double resultVal = -1;
boolean result = true;
try {
resultVal = oObj.computeFunction (GeneralFunction.COUNT) ;
result = resultVal >= 0;
} catch (com.sun.star.uno.Exception e) {
result = false;
log.println("Exception occurred in method computeFunction.");
e.printStackTrace(log);
}
tRes.tested("computeFunction()", result);
} // finished computeFunction
} // finished class _XSheetOperation
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#*************************************************************************
#
# 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/.
#
#*************************************************************************
$(eval $(call gb_CppunitTest_CppunitTest,sc_cellrangesobj))
$(eval $(call gb_CppunitTest_use_external,sc_cellrangesobj,boost_headers))
$(eval $(call gb_CppunitTest_add_exception_objects,sc_cellrangesobj, \
sc/qa/extras/sccellrangesobj\
))
$(eval $(call gb_CppunitTest_use_libraries,sc_cellrangesobj, \
basegfx \
comphelper \
cppu \
cppuhelper \
drawinglayer \
editeng \
for \
forui \
i18nlangtag \
msfilter \
oox \
sal \
salhelper \
sax \
sb \
sc \
sfx \
sot \
subsequenttest \
svl \
svt \
svx \
svxcore \
test \
tk \
tl \
ucbhelper \
unotest \
utl \
vbahelper \
vcl \
xo \
))
$(eval $(call gb_CppunitTest_set_include,sc_cellrangesobj,\
-I$(SRCDIR)/sc/source/ui/inc \
-I$(SRCDIR)/sc/inc \
$$(INCLUDE) \
))
$(eval $(call gb_CppunitTest_use_sdk_api,sc_cellrangesobj))
$(eval $(call gb_CppunitTest_use_ure,sc_cellrangesobj))
$(eval $(call gb_CppunitTest_use_vcl,sc_cellrangesobj))
$(eval $(call gb_CppunitTest_use_components,sc_cellrangesobj,\
basic/util/sb \
comphelper/util/comphelp \
configmgr/source/configmgr \
dbaccess/util/dba \
filter/source/config/cache/filterconfig1 \
filter/source/storagefilterdetect/storagefd \
forms/util/frm \
framework/util/fwk \
i18npool/source/search/i18nsearch \
i18npool/util/i18npool \
oox/util/oox \
package/source/xstor/xstor \
package/util/package2 \
sax/source/expatwrap/expwrap \
scripting/source/basprov/basprov \
scripting/util/scriptframe \
sc/util/sc \
sc/util/scd \
sc/util/scfilt \
$(call gb_Helper_optional,SCRIPTING, \
sc/util/vbaobj) \
sfx2/util/sfx \
sot/util/sot \
svl/source/fsstor/fsstorage \
toolkit/util/tk \
ucb/source/core/ucb1 \
ucb/source/ucp/file/ucpfile1 \
ucb/source/ucp/tdoc/ucptdoc1 \
unotools/util/utl \
unoxml/source/rdf/unordf \
unoxml/source/service/unoxml \
uui/util/uui \
xmloff/util/xo \
svtools/util/svt \
))
$(eval $(call gb_CppunitTest_use_configuration,sc_cellrangesobj))
# vim: set noet sw=4 ts=4:
...@@ -132,6 +132,7 @@ $(eval $(call gb_Module_add_subsequentcheck_targets,sc,\ ...@@ -132,6 +132,7 @@ $(eval $(call gb_Module_add_subsequentcheck_targets,sc,\
CppunitTest_sc_datapilotitemobj \ CppunitTest_sc_datapilotitemobj \
CppunitTest_sc_subtotalfieldobj \ CppunitTest_sc_subtotalfieldobj \
CppunitTest_sc_arealinksobj \ CppunitTest_sc_arealinksobj \
CppunitTest_sc_cellrangesobj \
)) ))
$(eval $(call gb_Module_add_perfcheck_targets,sc,\ $(eval $(call gb_Module_add_perfcheck_targets,sc,\
......
...@@ -9,9 +9,10 @@ ...@@ -9,9 +9,10 @@
#include <test/calc_unoapi_test.hxx> #include <test/calc_unoapi_test.hxx>
#include <test/sheet/xcellseries.hxx> #include <test/sheet/xcellseries.hxx>
#include <test/sheet/xsheetoperation.hxx>
#include <test/sheet/xsubtotalcalculatable.hxx>
#include <test/sheet/xusedareacursor.hxx> #include <test/sheet/xusedareacursor.hxx>
#include <test/sheet/xuniquecellformatrangessupplier.hxx> #include <test/sheet/xuniquecellformatrangessupplier.hxx>
#include <test/sheet/xsubtotalcalculatable.hxx>
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp> #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <com/sun/star/sheet/XSpreadsheet.hpp> #include <com/sun/star/sheet/XSpreadsheet.hpp>
...@@ -22,11 +23,13 @@ using namespace css::uno; ...@@ -22,11 +23,13 @@ using namespace css::uno;
namespace sc_apitest { namespace sc_apitest {
#define NUMBER_OF_TESTS 7 #define NUMBER_OF_TESTS 9
class ScCellCursorObj : public CalcUnoApiTest, class ScCellCursorObj : public CalcUnoApiTest, public apitest::XCellSeries,
public apitest::XCellSeries, public apitest::XUsedAreaCursor, public apitest::XSheetOperation,
public apitest::XUniqueCellFormatRangesSupplier, public apitest::XSubTotalCalculatable public apitest::XSubTotalCalculatable,
public apitest::XUsedAreaCursor,
public apitest::XUniqueCellFormatRangesSupplier
{ {
public: public:
ScCellCursorObj(); ScCellCursorObj();
...@@ -46,13 +49,17 @@ public: ...@@ -46,13 +49,17 @@ public:
CPPUNIT_TEST(testFillAuto); CPPUNIT_TEST(testFillAuto);
CPPUNIT_TEST(testFillSeries); CPPUNIT_TEST(testFillSeries);
// XUniqueCellFormatRangesSupplier // XSheetOperation
CPPUNIT_TEST(testGetUniqueCellFormatRanges); CPPUNIT_TEST(testComputeFunction);
CPPUNIT_TEST(testClearContents);
// XSubTotalCalculatable // XSubTotalCalculatable
CPPUNIT_TEST(testCreateSubTotalDescriptor); CPPUNIT_TEST(testCreateSubTotalDescriptor);
CPPUNIT_TEST(testApplyRemoveSubTotals); CPPUNIT_TEST(testApplyRemoveSubTotals);
// XUniqueCellFormatRangesSupplier
CPPUNIT_TEST(testGetUniqueCellFormatRanges);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
private: private:
......
...@@ -12,8 +12,9 @@ ...@@ -12,8 +12,9 @@
#include <test/sheet/xcellrangedata.hxx> #include <test/sheet/xcellrangedata.hxx>
#include <test/sheet/xcellrangesquery.hxx> #include <test/sheet/xcellrangesquery.hxx>
#include <test/sheet/xcellseries.hxx> #include <test/sheet/xcellseries.hxx>
#include <test/sheet/xuniquecellformatrangessupplier.hxx> #include <test/sheet/xsheetoperation.hxx>
#include <test/sheet/xsubtotalcalculatable.hxx> #include <test/sheet/xsubtotalcalculatable.hxx>
#include <test/sheet/xuniquecellformatrangessupplier.hxx>
#include <test/util/xreplaceable.hxx> #include <test/util/xreplaceable.hxx>
#include <test/util/xsearchable.hxx> #include <test/util/xsearchable.hxx>
...@@ -29,12 +30,17 @@ using namespace css::uno; ...@@ -29,12 +30,17 @@ using namespace css::uno;
namespace sc_apitest { namespace sc_apitest {
#define NUMBER_OF_TESTS 20 #define NUMBER_OF_TESTS 22
class ScCellRangeObj : public CalcUnoApiTest, public apitest::XCellRangesQuery, public apitest::CellProperties, class ScCellRangeObj : public CalcUnoApiTest, public apitest::CellProperties,
public apitest::XSearchable, public apitest::XReplaceable, public apitest::XCellRangeData, public apitest::XCellRangeData,
public apitest::XCellSeries, public apitest::XUniqueCellFormatRangesSupplier, public apitest::XCellRangesQuery,
public apitest::XSubTotalCalculatable public apitest::XCellSeries,
public apitest::XReplaceable,
public apitest::XSearchable,
public apitest::XSheetOperation,
public apitest::XSubTotalCalculatable,
public apitest::XUniqueCellFormatRangesSupplier
{ {
public: public:
ScCellRangeObj(); ScCellRangeObj();
...@@ -83,6 +89,10 @@ public: ...@@ -83,6 +89,10 @@ public:
// XUniqueCellFormatRangesSupplier // XUniqueCellFormatRangesSupplier
CPPUNIT_TEST(testGetUniqueCellFormatRanges); CPPUNIT_TEST(testGetUniqueCellFormatRanges);
// XSheetOperation
CPPUNIT_TEST(testComputeFunction);
CPPUNIT_TEST(testClearContents);
// XSubTotalCalculatable // XSubTotalCalculatable
CPPUNIT_TEST(testCreateSubTotalDescriptor); CPPUNIT_TEST(testCreateSubTotalDescriptor);
CPPUNIT_TEST(testApplyRemoveSubTotals); CPPUNIT_TEST(testApplyRemoveSubTotals);
...@@ -99,9 +109,9 @@ uno::Reference< lang::XComponent > ScCellRangeObj::mxComponent; ...@@ -99,9 +109,9 @@ uno::Reference< lang::XComponent > ScCellRangeObj::mxComponent;
ScCellRangeObj::ScCellRangeObj(): ScCellRangeObj::ScCellRangeObj():
CalcUnoApiTest("/sc/qa/extras/testdocuments"), CalcUnoApiTest("/sc/qa/extras/testdocuments"),
apitest::XSearchable("15", 1), apitest::XCellSeries(2, 1),
apitest::XReplaceable("15", "35"), apitest::XReplaceable("15", "35"),
apitest::XCellSeries(2, 1) apitest::XSearchable("15", 1)
{ {
} }
......
/* -*- 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: */
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <test/calc_unoapi_test.hxx> #include <test/calc_unoapi_test.hxx>
#include <test/sheet/xcellseries.hxx> #include <test/sheet/xcellseries.hxx>
#include <test/sheet/xprintareas.hxx> #include <test/sheet/xprintareas.hxx>
#include <test/sheet/xsheetoperation.hxx>
#include <test/sheet/xsheetpagebreak.hxx> #include <test/sheet/xsheetpagebreak.hxx>
#include <test/sheet/xspreadsheet.hxx> #include <test/sheet/xspreadsheet.hxx>
#include <test/sheet/xsubtotalcalculatable.hxx> #include <test/sheet/xsubtotalcalculatable.hxx>
...@@ -26,12 +27,13 @@ using namespace css::uno; ...@@ -26,12 +27,13 @@ using namespace css::uno;
namespace sc_apitest namespace sc_apitest
{ {
#define NUMBER_OF_TESTS 17 #define NUMBER_OF_TESTS 19
class ScTableSheetObj : public CalcUnoApiTest, public apitest::XCellSeries, class ScTableSheetObj : public CalcUnoApiTest, public apitest::XCellSeries,
public apitest::XPrintAreas, public apitest::XPrintAreas,
public apitest::XReplaceable, public apitest::XReplaceable,
public apitest::XSearchable, public apitest::XSearchable,
public apitest::XSheetOperation,
public apitest::XSheetPageBreak, public apitest::XSheetPageBreak,
public apitest::XSpreadsheet, public apitest::XSpreadsheet,
public apitest::XSubTotalCalculatable, public apitest::XSubTotalCalculatable,
...@@ -65,6 +67,10 @@ public: ...@@ -65,6 +67,10 @@ public:
CPPUNIT_TEST(testFillAuto); CPPUNIT_TEST(testFillAuto);
CPPUNIT_TEST(testFillSeries); CPPUNIT_TEST(testFillSeries);
// XSheetOperation
CPPUNIT_TEST(testComputeFunction);
CPPUNIT_TEST(testClearContents);
// XSheetPageBreak // XSheetPageBreak
CPPUNIT_TEST(testGetColumnPageBreaks); CPPUNIT_TEST(testGetColumnPageBreaks);
CPPUNIT_TEST(testGetRowPageBreaks); CPPUNIT_TEST(testGetRowPageBreaks);
......
...@@ -71,6 +71,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\ ...@@ -71,6 +71,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\
test/source/sheet/xsheetannotations \ test/source/sheet/xsheetannotations \
test/source/sheet/xsheetannotationshapesupplier \ test/source/sheet/xsheetannotationshapesupplier \
test/source/sheet/xsheetoutline \ test/source/sheet/xsheetoutline \
test/source/sheet/xsheetoperation \
test/source/sheet/xsheetpagebreak \ test/source/sheet/xsheetpagebreak \
test/source/sheet/xstyleloader \ test/source/sheet/xstyleloader \
test/source/sheet/xsubtotalfield \ test/source/sheet/xsubtotalfield \
......
/* -*- 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/sheet/xsheetoperation.hxx>
#include <com/sun/star/sheet/CellFlags.hpp>
#include <com/sun/star/sheet/GeneralFunction.hpp>
#include <com/sun/star/sheet/XSheetOperation.hpp>
#include <com/sun/star/uno/Reference.hxx>
#include <cppunit/extensions/HelperMacros.h>
using namespace css;
using namespace css::uno;
namespace apitest {
void XSheetOperation::testClearContents()
{
uno::Reference< sheet::XSheetOperation > xSheetOperation(init(), UNO_QUERY_THROW);
xSheetOperation->clearContents( sheet::CellFlags::VALUE | sheet::CellFlags::FORMULA );
double sum = xSheetOperation->computeFunction( sheet::GeneralFunction_SUM );
CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to clean contents", 0.0, sum);
}
void XSheetOperation::testComputeFunction()
{
uno::Reference< sheet::XSheetOperation > xSheetOperation(init(), UNO_QUERY_THROW);
double count = xSheetOperation->computeFunction( sheet::GeneralFunction_COUNT );
CPPUNIT_ASSERT_MESSAGE("Unable to compute function", count >= 0.0);
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment