sc/CppunitTest_sc_tablesheetobj.mk | 140 +++++++++++++++++++++++++ sc/CppunitTest_sc_tablesheetsobj.mk | 20 +-- sc/qa/extras/scdatapilottableobj.cxx | 16 ++ sc/qa/extras/sctablesheetobj.cxx | 87 +++++++++++++++ sc/qa/extras/testdocuments/ScTableSheetObj.ods |binary sc/qa/unoapi/knownissues.xcl | 13 ++ sc/source/ui/unoobj/cellsuno.cxx | 4 test/Library_subsequenttest.mk | 2 test/Package_inc.mk | 2 test/inc/test/container/xnamed.hxx | 53 +++++++++ test/inc/test/util/xsearchable.hxx | 55 +++++++++ test/source/container/xnamed.cxx | 58 ++++++++++ test/source/util/xsearchable.cxx | 79 ++++++++++++++ 13 files changed, 514 insertions(+), 15 deletions(-)
New commits: commit 3e82bf0e5e6a1d5dcbe6b7ebbbe124912e8e8700 Author: Markus Mohrhard <[email protected]> Date: Wed Jan 25 21:01:06 2012 +0100 add test for ScTableSheetObj diff --git a/sc/CppunitTest_sc_tablesheetobj.mk b/sc/CppunitTest_sc_tablesheetobj.mk new file mode 100644 index 0000000..9ccd9c8 --- /dev/null +++ b/sc/CppunitTest_sc_tablesheetobj.mk @@ -0,0 +1,140 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +#************************************************************************* +# Version: MPL 1.1 / GPLv3+ / LGPLv3+ +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License or as specified alternatively below. You may obtain a copy of +# the License at http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Initial Developer of the Original Code is +# Markus Mohrhard <[email protected]> +# Portions created by the Initial Developer are Copyright (C) 2011 the +# Initial Developer. All Rights Reserved. +# +# Major Contributor(s): +# +# For minor contributions see the git repository. +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 3 or later (the "GPLv3+"), or +# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), +# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable +# instead of those above. +#************************************************************************* + +$(eval $(call gb_CppunitTest_CppunitTest,sc_spreadsheetobj)) + +$(eval $(call gb_CppunitTest_add_exception_objects,sc_spreadsheetobj, \ + sc/qa/extras/sctablesheetobj \ +)) + +$(eval $(call gb_CppunitTest_add_linked_libs,sc_spreadsheetobj, \ + avmedia \ + basegfx \ + comphelper \ + cppu \ + cppuhelper \ + drawinglayer \ + editeng \ + fileacc \ + for \ + forui \ + i18nisolang1 \ + msfilter \ + oox \ + sal \ + salhelper \ + sax \ + sb \ + sc \ + sfx \ + sot \ + subsequenttest \ + svl \ + svt \ + svx \ + svxcore \ + test \ + tl \ + tk \ + ucbhelper \ + unotest \ + utl \ + vbahelper \ + vcl \ + xo \ + $(gb_STDLIBS) \ +)) + +$(eval $(call gb_CppunitTest_set_include,sc_spreadsheetobj,\ + -I$(realpath $(SRCDIR)/sc/source/ui/inc) \ + -I$(realpath $(SRCDIR)/sc/inc) \ + $$(INCLUDE) \ + -I$(OUTDIR)/inc \ +)) + +$(eval $(call gb_CppunitTest_add_api,sc_spreadsheetobj,\ + offapi \ + udkapi \ +)) + +$(eval $(call gb_CppunitTest_uses_ure,sc_spreadsheetobj)) + +$(eval $(call gb_CppunitTest_add_type_rdbs,sc_spreadsheetobj,\ + types \ +)) + +$(eval $(call gb_CppunitTest_add_components,sc_spreadsheetobj,\ + basic/util/sb \ + comphelper/util/comphelp \ + configmgr/source/configmgr \ + dbaccess/util/dba \ + fileaccess/source/fileacc \ + filter/source/config/cache/filterconfig1 \ + forms/util/frm \ + framework/util/fwk \ + i18npool/util/i18npool \ + i18npool/source/search/i18nsearch \ + oox/util/oox \ + package/source/xstor/xstor \ + package/util/package2 \ + sax/source/expatwrap/expwrap \ + sax/source/fastparser/fastsax \ + sc/util/sc \ + sc/util/scd \ + sc/util/scfilt \ + sc/util/vbaobj \ + scripting/source/basprov/basprov \ + scripting/util/scriptframe \ + 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 \ +)) + +$(eval $(call gb_CppunitTest_set_args,sc_spreadsheetobj,\ + --headless \ + --protector unoexceptionprotector$(gb_Library_DLLEXT) unoexceptionprotector \ + "-env:CONFIGURATION_LAYERS=xcsxcu:$(call gb_CppunitTarget__make_url,$(OUTDIR)/xml/registry) module:$(call gb_CppunitTarget__make_url,$(OUTDIR)/xml/registry/spool) xcsxcu:$(call gb_CppunitTarget__make_url,$(OUTDIR)/unittest/registry)" \ +)) + # .../spool is required for the (somewhat strange) filter configuration + +# we need to +# a) explicitly depend on library msword because it is not implied by a link +# relation +# b) explicitly depend on the sc resource files needed at unit-test runtime +$(call gb_CppunitTest_get_target,sc_spreadsheetobj) : $(call gb_Library_get_target,scfilt) $(WORKDIR)/AllLangRes/sc + +# vim: set noet sw=4 ts=4: diff --git a/sc/qa/extras/sctablesheetobj.cxx b/sc/qa/extras/sctablesheetobj.cxx new file mode 100644 index 0000000..6fae46f --- /dev/null +++ b/sc/qa/extras/sctablesheetobj.cxx @@ -0,0 +1,87 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * Major Contributor(s): + * Copyright (C) 2012 Markus Mohrhard <[email protected]> (initial developer) + * + * All Rights Reserved. + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include <test/unoapi_test.hxx> +#include <test/util/xsearchable.hxx> + +#include <com/sun/star/sheet/XSpreadsheetDocument.hpp> +#include <com/sun/star/sheet/XSpreadsheet.hpp> + +namespace sc_apitest +{ + +class ScTableSheetObj : public UnoApiTest, apitest::XSearchable +{ +public: + ScTableSheetObj(); + + virtual uno::Reference< uno::XInterface > init(); + + CPPUNIT_TEST_SUITE(ScTableSheetObj); + CPPUNIT_TEST(testFindAll); + CPPUNIT_TEST(testFindNext); + CPPUNIT_TEST(testFindFirst); + CPPUNIT_TEST_SUITE_END(); + +private: + static sal_Int32 nTest; + static uno::Reference< lang::XComponent > mxComponent; +}; + +sal_Int32 ScTableSheetObj::nTest = 0; +uno::Reference< lang::XComponent > ScTableSheetObj::mxComponent; + +ScTableSheetObj::ScTableSheetObj(): + apitest::XSearchable(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("test")), 4) +{ + +} + + +uno::Reference< uno::XInterface > ScTableSheetObj::init() +{ + rtl::OUString aFileURL; + createFileURL(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ScTableSheetObj.ods")), aFileURL); + if(!mxComponent.is()) + mxComponent = loadFromDesktop(aFileURL); + 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(0), UNO_QUERY_THROW); + + return xSheet; +} + +CPPUNIT_TEST_SUITE_REGISTRATION(ScTableSheetObj); + +CPPUNIT_PLUGIN_IMPLEMENT(); + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/qa/extras/testdocuments/ScTableSheetObj.ods b/sc/qa/extras/testdocuments/ScTableSheetObj.ods new file mode 100644 index 0000000..49863c0 Binary files /dev/null and b/sc/qa/extras/testdocuments/ScTableSheetObj.ods differ commit 1d60eea3831b3da45722e92839a3c1721d7605a4 Author: Markus Mohrhard <[email protected]> Date: Wed Jan 25 21:05:31 2012 +0100 adjust test name diff --git a/sc/CppunitTest_sc_tablesheetsobj.mk b/sc/CppunitTest_sc_tablesheetsobj.mk index c7f43d0..53f3337 100644 --- a/sc/CppunitTest_sc_tablesheetsobj.mk +++ b/sc/CppunitTest_sc_tablesheetsobj.mk @@ -28,13 +28,13 @@ # instead of those above. #************************************************************************* -$(eval $(call gb_CppunitTest_CppunitTest,sc_spreadsheetobj)) +$(eval $(call gb_CppunitTest_CppunitTest,sc_spreadsheetsobj)) -$(eval $(call gb_CppunitTest_add_exception_objects,sc_spreadsheetobj, \ +$(eval $(call gb_CppunitTest_add_exception_objects,sc_spreadsheetsobj, \ sc/qa/extras/sctablesheetsobj \ )) -$(eval $(call gb_CppunitTest_add_linked_libs,sc_spreadsheetobj, \ +$(eval $(call gb_CppunitTest_add_linked_libs,sc_spreadsheetsobj, \ avmedia \ basegfx \ comphelper \ @@ -72,25 +72,25 @@ $(eval $(call gb_CppunitTest_add_linked_libs,sc_spreadsheetobj, \ $(gb_STDLIBS) \ )) -$(eval $(call gb_CppunitTest_set_include,sc_spreadsheetobj,\ +$(eval $(call gb_CppunitTest_set_include,sc_spreadsheetsobj,\ -I$(realpath $(SRCDIR)/sc/source/ui/inc) \ -I$(realpath $(SRCDIR)/sc/inc) \ $$(INCLUDE) \ -I$(OUTDIR)/inc \ )) -$(eval $(call gb_CppunitTest_add_api,sc_spreadsheetobj,\ +$(eval $(call gb_CppunitTest_add_api,sc_spreadsheetsobj,\ offapi \ udkapi \ )) -$(eval $(call gb_CppunitTest_uses_ure,sc_spreadsheetobj)) +$(eval $(call gb_CppunitTest_uses_ure,sc_spreadsheetsobj)) -$(eval $(call gb_CppunitTest_add_type_rdbs,sc_spreadsheetobj,\ +$(eval $(call gb_CppunitTest_add_type_rdbs,sc_spreadsheetsobj,\ types \ )) -$(eval $(call gb_CppunitTest_add_components,sc_spreadsheetobj,\ +$(eval $(call gb_CppunitTest_add_components,sc_spreadsheetsobj,\ basic/util/sb \ comphelper/util/comphelp \ configmgr/source/configmgr \ @@ -123,7 +123,7 @@ $(eval $(call gb_CppunitTest_add_components,sc_spreadsheetobj,\ unoxml/source/service/unoxml \ )) -$(eval $(call gb_CppunitTest_set_args,sc_spreadsheetobj,\ +$(eval $(call gb_CppunitTest_set_args,sc_spreadsheetsobj,\ --headless \ --protector unoexceptionprotector$(gb_Library_DLLEXT) unoexceptionprotector \ "-env:CONFIGURATION_LAYERS=xcsxcu:$(call gb_CppunitTarget__make_url,$(OUTDIR)/xml/registry) module:$(call gb_CppunitTarget__make_url,$(OUTDIR)/xml/registry/spool) xcsxcu:$(call gb_CppunitTarget__make_url,$(OUTDIR)/unittest/registry)" \ @@ -134,6 +134,6 @@ $(eval $(call gb_CppunitTest_set_args,sc_spreadsheetobj,\ # a) explicitly depend on library msword because it is not implied by a link # relation # b) explicitly depend on the sc resource files needed at unit-test runtime -$(call gb_CppunitTest_get_target,sc_spreadsheetobj) : $(call gb_Library_get_target,scfilt) $(WORKDIR)/AllLangRes/sc +$(call gb_CppunitTest_get_target,sc_spreadsheetsobj) : $(call gb_Library_get_target,scfilt) $(WORKDIR)/AllLangRes/sc # vim: set noet sw=4 ts=4: commit b0af6fd51c644827593f3d69c46dc8074dca0ee3 Author: Markus Mohrhard <[email protected]> Date: Wed Jan 25 21:03:24 2012 +0100 ScTableSheetObj::findAll does not return the correct range, fdo#43462 diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 532bbbe..73419fc 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -3908,10 +3908,8 @@ uno::Reference<container::XIndexAccess> SAL_CALL ScCellRangesBase::findAll( *pSearchItem, nCol, nRow, nTab, aMark, aMatchedRanges, aDummyUndo, NULL); if (bFound) { - ScRangeList aNewRanges; - aMark.FillRangeListWithMarks( &aNewRanges, sal_True ); // bei findAll immer CellRanges, egal wieviel gefunden wurde - xRet.set(new ScCellRangesObj( pDocShell, aNewRanges )); + xRet.set(new ScCellRangesObj( pDocShell, aMatchedRanges )); } } } commit 80502d846247c81f8d58b575d7e6db9d824f215f Author: Markus Mohrhard <[email protected]> Date: Wed Jan 25 19:43:19 2012 +0100 add interface test for util::XSearchable diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk index 675a7e2..a8ac6fb 100644 --- a/test/Library_subsequenttest.mk +++ b/test/Library_subsequenttest.mk @@ -81,6 +81,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\ test/source/sheet/xnamedrange \ test/source/sheet/xnamedranges \ test/source/sheet/xspreadsheets2 \ + test/source/util/xsearchable \ )) # vim: set noet sw=4 ts=4: diff --git a/test/Package_inc.mk b/test/Package_inc.mk index e50f358..52d8ac3 100644 --- a/test/Package_inc.mk +++ b/test/Package_inc.mk @@ -43,5 +43,6 @@ $(eval $(call gb_Package_add_file,test_inc,inc/test/sheet/xdatapilottable.hxx,te $(eval $(call gb_Package_add_file,test_inc,inc/test/sheet/xdatapilotfieldgrouping.hxx,test/sheet/xdatapilotfieldgrouping.hxx)) $(eval $(call gb_Package_add_file,test_inc,inc/test/sheet/datapilotfield.hxx,test/sheet/datapilotfield.hxx)) $(eval $(call gb_Package_add_file,test_inc,inc/test/sheet/xspreadsheets2.hxx,test/sheet/xspreadsheets2.hxx)) +$(eval $(call gb_Package_add_file,test_inc,inc/test/util/xsearchable.hxx,test/util/xsearchable.hxx)) # vim: set noet sw=4 ts=4: diff --git a/test/inc/test/util/xsearchable.hxx b/test/inc/test/util/xsearchable.hxx new file mode 100644 index 0000000..f7b8758 --- /dev/null +++ b/test/inc/test/util/xsearchable.hxx @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * Major Contributor(s): + * Copyright (C) 2012 Markus Mohrhard <[email protected]> (initial developer) + * + * All Rights Reserved. + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include <rtl/ustring.hxx> +#include <test/testdllapi.hxx> + +using namespace com::sun::star; + +namespace apitest { + +class OOO_DLLPUBLIC_TEST XSearchable +{ +public: + XSearchable(const rtl::OUString& rString, sal_Int32 nCount) : maSearchString(rString), mnCount(nCount) {} + XSearchable() : maSearchString(RTL_CONSTASCII_USTRINGPARAM("SearchString")), mnCount(1) {} + + void testFindFirst(); + void testFindNext(); + void testFindAll(); + + virtual uno::Reference< uno::XInterface > init() = 0; + +private: + rtl::OUString maSearchString; + sal_Int32 mnCount; +}; + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/util/xsearchable.cxx b/test/source/util/xsearchable.cxx new file mode 100644 index 0000000..7f3fdb0 --- /dev/null +++ b/test/source/util/xsearchable.cxx @@ -0,0 +1,79 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * Major Contributor(s): + * Copyright (C) 2012 Markus Mohrhard <[email protected]> (initial developer) + * + * All Rights Reserved. + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include <com/sun/star/util/XSearchable.hpp> +#include <com/sun/star/util/XSearchDescriptor.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include "cppunit/extensions/HelperMacros.h" + +#include <test/util/xsearchable.hxx> + +using namespace com::sun::star::uno; + +namespace apitest { + +void XSearchable::testFindAll() +{ + uno::Reference< util::XSearchable > xSearchable(init(), UNO_QUERY_THROW); + uno::Reference< util::XSearchDescriptor> xSearchDescr = xSearchable->createSearchDescriptor(); + xSearchDescr->setSearchString(maSearchString); + + uno::Reference< container::XIndexAccess > xIndex = xSearchable->findAll(xSearchDescr); + CPPUNIT_ASSERT(xIndex.is()); + CPPUNIT_ASSERT(xIndex->getCount() == mnCount); +} + +void XSearchable::testFindFirst() +{ + uno::Reference< util::XSearchable > xSearchable(init(), UNO_QUERY_THROW); + uno::Reference< util::XSearchDescriptor> xSearchDescr = xSearchable->createSearchDescriptor(); + xSearchDescr->setSearchString(maSearchString); + + uno::Reference< uno::XInterface > xElement = xSearchable->findFirst(xSearchDescr); + CPPUNIT_ASSERT(xElement.is()); +} + +void XSearchable::testFindNext() +{ + uno::Reference< util::XSearchable > xSearchable(init(), UNO_QUERY_THROW); + uno::Reference< util::XSearchDescriptor> xSearchDescr = xSearchable->createSearchDescriptor(); + xSearchDescr->setSearchString(maSearchString); + + uno::Reference< uno::XInterface > xElement = xSearchable->findFirst(xSearchDescr); + CPPUNIT_ASSERT(xElement.is()); + + if (mnCount > 1) + { + uno::Reference< uno::XInterface > xElement2 = xSearchable->findNext(xElement, xSearchDescr); + CPPUNIT_ASSERT(xElement2.is()); + } +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit 811cddef5347069bf90ddc569ba2acc9883347ba Author: Markus Mohrhard <[email protected]> Date: Wed Jan 25 00:33:24 2012 +0100 disable all java based tests covered now by c++ based tests diff --git a/sc/qa/unoapi/knownissues.xcl b/sc/qa/unoapi/knownissues.xcl index 5ae37df..f232ee9 100644 --- a/sc/qa/unoapi/knownissues.xcl +++ b/sc/qa/unoapi/knownissues.xcl @@ -223,3 +223,16 @@ sc.ScDDELinkObj ### fdo44167 ### sc.ScDatabaseRangeObj::com::sun::star::sheet::XDatabaseRange sc.ScDatabaseRangeObj::com::sun::star::util::XRefreshable + +### c++ based tests ### +sc.ScDataPilotTableObj::com::sun::star::sheet::XDataPilotTable +sc.ScDataPilotTableObj::com::sun::star::sheet::XDataPilotDescriptor +sc.ScDataPilotTableObj::com::sun::star::container::XNamed +sc.ScDataPilotFieldObj::com::sun::star::sheet::XDataPilotFieldGrouping +sc.ScDataPilotFieldObj::com::sun::star::sheet::DataPilotField +sc.ScNamedRangeObj::com::sun::star::sheet::XNamedRange +sc.ScNamedRangesObj::com::sun::star::sheet::XNamedRanges +sc.ScTableSheetsObj::com::sun::star::container::XNamedContainer +sc.ScTableSheetsObj::com::sun::star::sheet::XSpreadsheet2 +sc.ScCellRangeObj::com::sun::star::sheet::sheet::XCellRangesQuery +sc.ScCellRangeObj::com::sun::star::table::CellProperties commit 1b973485e63717e875347f0ad33c8137f4bc05c7 Author: Markus Mohrhard <[email protected]> Date: Wed Jan 25 00:29:10 2012 +0100 add XNamed interface test and add this test to ScDataPilotTableObj diff --git a/sc/qa/extras/scdatapilottableobj.cxx b/sc/qa/extras/scdatapilottableobj.cxx index a09eb6e..0d1cf40 100644 --- a/sc/qa/extras/scdatapilottableobj.cxx +++ b/sc/qa/extras/scdatapilottableobj.cxx @@ -29,6 +29,7 @@ #include <test/unoapi_test.hxx> #include <test/sheet/xdatapilottable.hxx> #include <test/sheet/xdatapilotdescriptor.hxx> +#include <test/container/xnamed.hxx> #include <com/sun/star/sheet/XSpreadsheetDocument.hpp> #include <com/sun/star/sheet/XSpreadsheet.hpp> @@ -38,11 +39,14 @@ namespace sc_apitest { -#define NUMBER_OF_TESTS 10 +#define NUMBER_OF_TESTS 12 -class ScDataPilotTableObj : public UnoApiTest, apitest::XDataPilotDescriptor, apitest::XDataPilotTable +class ScDataPilotTableObj : public UnoApiTest, apitest::XDataPilotDescriptor, apitest::XDataPilotTable, + apitest::XNamed { public: + ScDataPilotTableObj(); + virtual void setUp(); virtual void tearDown(); virtual uno::Reference< uno::XInterface > init(); @@ -59,6 +63,8 @@ public: CPPUNIT_TEST(testGetRowFields); CPPUNIT_TEST(testGetPageFields); CPPUNIT_TEST(testGetDataFields); + CPPUNIT_TEST(testGetName); + CPPUNIT_TEST(testSetName); CPPUNIT_TEST_SUITE_END(); private: @@ -69,6 +75,12 @@ private: sal_Int32 ScDataPilotTableObj::nTest = 0; uno::Reference< lang::XComponent > ScDataPilotTableObj::mxComponent; +ScDataPilotTableObj::ScDataPilotTableObj() + : apitest::XNamed(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataPilotTable"))) +{ + +} + uno::Reference< uno::XInterface > ScDataPilotTableObj::init() { rtl::OUString aFileURL; diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk index d1c383d..675a7e2 100644 --- a/test/Library_subsequenttest.mk +++ b/test/Library_subsequenttest.mk @@ -70,6 +70,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\ test/source/container/xelementaccess \ test/source/container/xindexaccess \ test/source/container/xnamecontainer \ + test/source/container/xnamed \ test/source/sheet/cellproperties \ test/source/sheet/datapilotfield \ test/source/sheet/xcellrangesquery \ diff --git a/test/Package_inc.mk b/test/Package_inc.mk index 666a52b..e50f358 100644 --- a/test/Package_inc.mk +++ b/test/Package_inc.mk @@ -35,6 +35,7 @@ $(eval $(call gb_Package_add_file,test_inc,inc/test/sheet/xnamedranges.hxx,test/ $(eval $(call gb_Package_add_file,test_inc,inc/test/sheet/xnamedrange.hxx,test/sheet/xnamedrange.hxx)) $(eval $(call gb_Package_add_file,test_inc,inc/test/sheet/xdatabaserange.hxx,test/sheet/xdatabaserange.hxx)) $(eval $(call gb_Package_add_file,test_inc,inc/test/container/xelementaccess.hxx,test/container/xelementaccess.hxx)) +$(eval $(call gb_Package_add_file,test_inc,inc/test/container/xnamed.hxx,test/container/xnamed.hxx)) $(eval $(call gb_Package_add_file,test_inc,inc/test/container/xindexaccess.hxx,test/container/xindexaccess.hxx)) $(eval $(call gb_Package_add_file,test_inc,inc/test/container/xnamecontainer.hxx,test/container/xnamecontainer.hxx)) $(eval $(call gb_Package_add_file,test_inc,inc/test/sheet/cellproperties.hxx,test/sheet/cellproperties.hxx)) diff --git a/test/inc/test/container/xnamed.hxx b/test/inc/test/container/xnamed.hxx new file mode 100644 index 0000000..3944582 --- /dev/null +++ b/test/inc/test/container/xnamed.hxx @@ -0,0 +1,53 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * Major Contributor(s): + * Copyright (C) 2012 Markus Mohrhard <[email protected]> (initial developer) + * + * All Rights Reserved. + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include <rtl/ustring.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <test/testdllapi.hxx> + +using namespace com::sun::star; + +namespace apitest { + +class OOO_DLLPUBLIC_TEST XNamed +{ +public: + XNamed(const rtl::OUString& rName): maName(rName) {} + + void testGetName(); + void testSetName(); + + virtual uno::Reference< uno::XInterface > init() = 0; +private: + rtl::OUString maName; + +}; + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/container/xnamed.cxx b/test/source/container/xnamed.cxx new file mode 100644 index 0000000..1de01cb --- /dev/null +++ b/test/source/container/xnamed.cxx @@ -0,0 +1,58 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * Major Contributor(s): + * Copyright (C) 2012 Markus Mohrhard <[email protected]> (initial developer) + * + * All Rights Reserved. + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include <com/sun/star/container/XNamed.hpp> +#include <test/container/xnamed.hxx> +#include "cppunit/extensions/HelperMacros.h" + +using namespace com::sun::star::uno; + +namespace apitest { + +void XNamed::testGetName() +{ + uno::Reference< container::XNamed > xNamed(init(), UNO_QUERY_THROW); + CPPUNIT_ASSERT( maName == xNamed->getName() ); +} + +void XNamed::testSetName() +{ + uno::Reference< container::XNamed > xNamed(init(), UNO_QUERY_THROW); + rtl::OUString aName(RTL_CONSTASCII_USTRINGPARAM("NewName")); + + xNamed->setName(aName); + CPPUNIT_ASSERT( aName == xNamed->getName() ); + + // restore old name + xNamed->setName(maName); + CPPUNIT_ASSERT(maName == xNamed->getName()); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
