diff options
-rw-r--r-- | include/test/sheet/xcelladdressable.hxx | 35 | ||||
-rw-r--r-- | qadevOOo/Jar_OOoRunner.mk | 1 | ||||
-rw-r--r-- | qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellObj.csv | 1 | ||||
-rw-r--r-- | sc/CppunitTest_sc_cellobj.mk | 106 | ||||
-rw-r--r-- | sc/Module_sc.mk | 1 | ||||
-rw-r--r-- | sc/qa/extras/sccellobj.cxx | 98 | ||||
-rw-r--r-- | test/Library_subsequenttest.mk | 1 | ||||
-rw-r--r-- | test/source/sheet/xcelladdressable.cxx | 53 |
8 files changed, 294 insertions, 2 deletions
diff --git a/include/test/sheet/xcelladdressable.hxx b/include/test/sheet/xcelladdressable.hxx new file mode 100644 index 000000000000..cf2da7eadc1f --- /dev/null +++ b/include/test/sheet/xcelladdressable.hxx @@ -0,0 +1,35 @@ +/* -*- 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 INCLUDE_TEST_SHEET_XCELLADDRESSABLE_HXX +#define INCLUDE_TEST_SHEET_XCELLADDRESSABLE_HXX + +#include <com/sun/star/uno/XInterface.hpp> +#include <com/sun/star/uno/Reference.hxx> +#include <test/testdllapi.hxx> + +using namespace css; +using namespace css::uno; + +namespace apitest { + +class OOO_DLLPUBLIC_TEST XCellAddressable +{ +public: + virtual uno::Reference< uno::XInterface > init() = 0; + virtual ~XCellAddressable(){} + + void testGetCellAddress(); +}; + +} + +#endif // INCLUDE_TEST_SHEET_XCELLADDRESSABLE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/qadevOOo/Jar_OOoRunner.mk b/qadevOOo/Jar_OOoRunner.mk index da5822fcd1bd..458ebf1b7cf9 100644 --- a/qadevOOo/Jar_OOoRunner.mk +++ b/qadevOOo/Jar_OOoRunner.mk @@ -592,7 +592,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\ qadevOOo/tests/java/ifc/sheet/_XAreaLinks \ qadevOOo/tests/java/ifc/sheet/_XArrayFormulaRange \ qadevOOo/tests/java/ifc/sheet/_XCalculatable \ - qadevOOo/tests/java/ifc/sheet/_XCellAddressable \ qadevOOo/tests/java/ifc/sheet/_XCellFormatRangesSupplier \ qadevOOo/tests/java/ifc/sheet/_XCellRangeAddressable \ qadevOOo/tests/java/ifc/sheet/_XCellRangeData \ diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellObj.csv b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellObj.csv index 583f9f622b18..ef1c845ab31b 100644 --- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellObj.csv +++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellObj.csv @@ -139,7 +139,6 @@ "ScCellObj";"com::sun::star::text::XTextRange";"getEnd()" "ScCellObj";"com::sun::star::text::XTextRange";"getString()" "ScCellObj";"com::sun::star::text::XTextRange";"setString()" -"ScCellObj";"com::sun::star::sheet::XCellAddressable";"getCellAddress()" "ScCellObj";"com::sun::star::sheet::SheetCell";"Position" "ScCellObj";"com::sun::star::sheet::SheetCell";"Size" "ScCellObj";"com::sun::star::sheet::SheetCell";"FormulaLocal#optional" diff --git a/sc/CppunitTest_sc_cellobj.mk b/sc/CppunitTest_sc_cellobj.mk new file mode 100644 index 000000000000..62183c32b4c9 --- /dev/null +++ b/sc/CppunitTest_sc_cellobj.mk @@ -0,0 +1,106 @@ +# -*- 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_cellobj)) + +$(eval $(call gb_CppunitTest_add_exception_objects,sc_cellobj, \ + sc/qa/extras/sccellobj \ +)) + +$(eval $(call gb_CppunitTest_use_external,sc_cellobj,boost_headers)) + +$(eval $(call gb_CppunitTest_use_libraries,sc_cellobj, \ + 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_cellobj,\ + -I$(SRCDIR)/sc/source/ui/inc \ + -I$(SRCDIR)/sc/inc \ + $$(INCLUDE) \ +)) + +$(eval $(call gb_CppunitTest_use_sdk_api,sc_cellobj)) + +$(eval $(call gb_CppunitTest_use_ure,sc_cellobj)) +$(eval $(call gb_CppunitTest_use_vcl,sc_cellobj)) + +$(eval $(call gb_CppunitTest_use_components,sc_cellobj,\ + 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/util/i18npool \ + linguistic/source/lng \ + 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_cellobj)) + +# vim: set noet sw=4 ts=4: + diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk index d1248eaca7d7..edb72275e6a9 100644 --- a/sc/Module_sc.mk +++ b/sc/Module_sc.mk @@ -121,6 +121,7 @@ $(eval $(call gb_Module_add_subsequentcheck_targets,sc,\ CppunitTest_sc_check_data_pilot_field \ CppunitTest_sc_check_data_pilot_table \ CppunitTest_sc_viewpaneobj \ + CppunitTest_sc_cellobj \ CppunitTest_sc_cellcursorobj \ )) diff --git a/sc/qa/extras/sccellobj.cxx b/sc/qa/extras/sccellobj.cxx new file mode 100644 index 000000000000..3ee66bb19789 --- /dev/null +++ b/sc/qa/extras/sccellobj.cxx @@ -0,0 +1,98 @@ +/* -*- 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/xcelladdressable.hxx> + +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/sheet/XSpreadsheetDocument.hpp> +#include <com/sun/star/sheet/XSpreadsheets.hpp> +#include <com/sun/star/table/XCellRange.hpp> +#include <com/sun/star/uno/XInterface.hpp> + +using namespace css; +using namespace css::uno; + +namespace sc_apitest { + +#define NUMBER_OF_TESTS 1 + +class ScCellObj : public CalcUnoApiTest, public apitest::XCellAddressable +{ +public: + ScCellObj(); + + virtual uno::Reference< uno::XInterface > init() override; + virtual void setUp() override; + virtual void tearDown() override; + + CPPUNIT_TEST_SUITE(ScCellObj); + // XCellAddressable + CPPUNIT_TEST(testGetCellAddress); + CPPUNIT_TEST_SUITE_END(); + +private: + + static sal_Int32 nTest; + static uno::Reference< lang::XComponent > mxComponent; + +}; + +sal_Int32 ScCellObj::nTest = 0; +uno::Reference< lang::XComponent > ScCellObj::mxComponent; + +ScCellObj::ScCellObj() + : CalcUnoApiTest("/sc/qa/extrax/testdocuments") +{ +} + +uno::Reference< uno::XInterface > ScCellObj::init() +{ + // create a calc document + if (!mxComponent.is()) + mxComponent = loadFromDesktop("private:factory/scalc"); + + uno::Reference< sheet::XSpreadsheetDocument > xSheetDoc(mxComponent, uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT_MESSAGE("no calc document", xSheetDoc.is()); + + // get getSheets + uno::Reference< sheet::XSpreadsheets > xSheets (xSheetDoc->getSheets(), UNO_QUERY_THROW); + uno::Any rSheet = xSheets->getByName("Sheet1"); + // query for the XCellRange interface + uno::Reference< table::XCellRange > rCellRange(rSheet, UNO_QUERY); + uno::Reference< table::XCellRange > xCellRange = rCellRange->getCellRangeByName("A1"); + + return xCellRange->getCellByPosition(0, 0); +} + +void ScCellObj::setUp() +{ + nTest++; + CalcUnoApiTest::setUp(); +} + +void ScCellObj::tearDown() +{ + if (nTest == NUMBER_OF_TESTS) + { + closeDocument(mxComponent); + mxComponent.clear(); + } + + CalcUnoApiTest::tearDown(); +} + + +CPPUNIT_TEST_SUITE_REGISTRATION(ScCellObj); + +} // end namespace + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk index e5ab18b166f2..1f68fd395ba5 100644 --- a/test/Library_subsequenttest.mk +++ b/test/Library_subsequenttest.mk @@ -44,6 +44,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\ test/source/container/xnamed \ test/source/sheet/cellproperties \ test/source/sheet/datapilotfield \ + test/source/sheet/xcelladdressable \ test/source/sheet/xcellrangedata \ test/source/sheet/xcellrangereferrer \ test/source/sheet/xcellrangesquery \ diff --git a/test/source/sheet/xcelladdressable.cxx b/test/source/sheet/xcelladdressable.cxx new file mode 100644 index 000000000000..0d92b1ae2333 --- /dev/null +++ b/test/source/sheet/xcelladdressable.cxx @@ -0,0 +1,53 @@ +/* -*- 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/xcelladdressable.hxx> + +#include <com/sun/star/sheet/XCellAddressable.hpp> +#include <com/sun/star/table/CellAddress.hpp> + +#include "cppunit/extensions/HelperMacros.h" + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +CPPUNIT_NS_BEGIN + +template<> struct assertion_traits<table::CellAddress> +{ + static bool equal(const table::CellAddress& x, const table::CellAddress& y) + { + return x == y; + } + + static std::string toString( const table::CellAddress& x ) + { + OStringStream ost; + ost << "Sheet: " << x.Sheet << " Column: " << x.Column << " Row: " << x.Row; + return ost.str(); + } +}; + +CPPUNIT_NS_END + +namespace apitest { + +void XCellAddressable::testGetCellAddress() +{ + uno::Reference< sheet::XCellAddressable > xCellAddressable(init(), UNO_QUERY_THROW); + table::CellAddress xCellAddress = xCellAddressable->getCellAddress(); + table::CellAddress defaultCellAddress; + + CPPUNIT_ASSERT_EQUAL_MESSAGE("getCellAddress() didn't returned default cell address", + defaultCellAddress, xCellAddress); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |