diff options
author | Paul Trojahn <paul.trojahn@gmail.com> | 2017-06-08 16:30:08 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2017-06-20 19:52:10 +0200 |
commit | 2516285d2a9b6b992f24867d39402ca5c29cd71d (patch) | |
tree | ddae5004e3869124c3d16a2e3d54d350043fb756 /sc | |
parent | e89e3ca2a6ab1773a7221eac11cb60812c002005 (diff) |
tdf#45904 Move remaining XCellSeries test code to C++
Change-Id: Ie4ee1e52157dd38ac0defee2e9d5cfa822763183
Reviewed-on: https://gerrit.libreoffice.org/38807
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/CppunitTest_sc_cellcursorobj.mk | 105 | ||||
-rw-r--r-- | sc/Module_sc.mk | 1 | ||||
-rw-r--r-- | sc/qa/extras/sccellcursorobj.cxx | 92 | ||||
-rw-r--r-- | sc/qa/extras/sccellrangeobj.cxx | 13 | ||||
-rw-r--r-- | sc/qa/extras/sctablesheetobj.cxx | 26 | ||||
-rw-r--r-- | sc/qa/extras/testdocuments/ScCellCursorObj.ods | bin | 0 -> 7451 bytes | |||
-rw-r--r-- | sc/qa/extras/testdocuments/xcellrangesquery.ods | bin | 9558 -> 9519 bytes |
7 files changed, 229 insertions, 8 deletions
diff --git a/sc/CppunitTest_sc_cellcursorobj.mk b/sc/CppunitTest_sc_cellcursorobj.mk new file mode 100644 index 000000000000..fd2a0e874d5f --- /dev/null +++ b/sc/CppunitTest_sc_cellcursorobj.mk @@ -0,0 +1,105 @@ +# -*- 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_cellcursorobj)) + +$(eval $(call gb_CppunitTest_add_exception_objects,sc_cellcursorobj, \ + sc/qa/extras/sccellcursorobj \ +)) + +$(eval $(call gb_CppunitTest_use_external,sc_cellcursorobj,boost_headers)) + +$(eval $(call gb_CppunitTest_use_libraries,sc_cellcursorobj, \ + 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_cellcursorobj,\ + -I$(SRCDIR)/sc/source/ui/inc \ + -I$(SRCDIR)/sc/inc \ + $$(INCLUDE) \ +)) + +$(eval $(call gb_CppunitTest_use_sdk_api,sc_cellcursorobj)) + +$(eval $(call gb_CppunitTest_use_ure,sc_cellcursorobj)) +$(eval $(call gb_CppunitTest_use_vcl,sc_cellcursorobj)) + +$(eval $(call gb_CppunitTest_use_components,sc_cellcursorobj,\ + 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_cellcursorobj)) + +# vim: set noet sw=4 ts=4: diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk index 2f5cd5dd317b..e19747e05b3b 100644 --- a/sc/Module_sc.mk +++ b/sc/Module_sc.mk @@ -120,6 +120,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_cellcursorobj \ )) $(eval $(call gb_Module_add_perfcheck_targets,sc,\ diff --git a/sc/qa/extras/sccellcursorobj.cxx b/sc/qa/extras/sccellcursorobj.cxx new file mode 100644 index 000000000000..eedec6e58a97 --- /dev/null +++ b/sc/qa/extras/sccellcursorobj.cxx @@ -0,0 +1,92 @@ +/* -*- 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/xcellseries.hxx> + +#include <com/sun/star/table/XCellCursor.hpp> +#include <com/sun/star/sheet/XSpreadsheetDocument.hpp> +#include <com/sun/star/sheet/XSpreadsheet.hpp> + +using namespace css; +using namespace css::uno; + +namespace sc_apitest { + +#define NUMBER_OF_TESTS 2 + +class ScCellCursorObj : public CalcUnoApiTest, apitest::XCellSeries +{ +public: + ScCellCursorObj(); + + virtual void setUp() override; + virtual void tearDown() override; + virtual uno::Reference< uno::XInterface > init() override; + + CPPUNIT_TEST_SUITE(ScCellCursorObj); + CPPUNIT_TEST(testFillAuto); + CPPUNIT_TEST(testFillSeries); + CPPUNIT_TEST_SUITE_END(); + +private: + static sal_Int32 nTest; + static uno::Reference< lang::XComponent > mxComponent; +}; + +sal_Int32 ScCellCursorObj::nTest = 0; +uno::Reference< lang::XComponent > ScCellCursorObj::mxComponent; + +ScCellCursorObj::ScCellCursorObj(): + CalcUnoApiTest("/sc/qa/extras/testdocuments"), + apitest::XCellSeries(0, 0) +{ +} + +uno::Reference< uno::XInterface > ScCellCursorObj::init() +{ + OUString aFileURL; + createFileURL("ScCellCursorObj.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(0), UNO_QUERY_THROW); + uno::Reference< table::XCellCursor > xCellCursor( xSheet->createCursor(), UNO_QUERY_THROW); + + return xCellCursor; +} + +void ScCellCursorObj::setUp() +{ + nTest++; + CPPUNIT_ASSERT(nTest <= NUMBER_OF_TESTS); + CalcUnoApiTest::setUp(); +} + +void ScCellCursorObj::tearDown() +{ + if (nTest == NUMBER_OF_TESTS) + { + closeDocument(mxComponent); + mxComponent.clear(); + } + + CalcUnoApiTest::tearDown(); +} + +CPPUNIT_TEST_SUITE_REGISTRATION(ScCellCursorObj); + +} + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/qa/extras/sccellrangeobj.cxx b/sc/qa/extras/sccellrangeobj.cxx index e66882f40305..65c9c697ba07 100644 --- a/sc/qa/extras/sccellrangeobj.cxx +++ b/sc/qa/extras/sccellrangeobj.cxx @@ -13,6 +13,7 @@ #include <test/util/xreplaceable.hxx> #include <test/util/xsearchable.hxx> #include <test/sheet/xcellrangedata.hxx> +#include <test/sheet/xcellseries.hxx> #include <com/sun/star/sheet/XSpreadsheetDocument.hpp> #include <com/sun/star/sheet/XSpreadsheet.hpp> @@ -26,10 +27,11 @@ using namespace css::uno; namespace sc_apitest { -#define NUMBER_OF_TESTS 15 +#define NUMBER_OF_TESTS 17 class ScCellRangeObj : public CalcUnoApiTest, public apitest::XCellRangesQuery, public apitest::CellProperties, - public apitest::XSearchable, public apitest::XReplaceable, public apitest::XCellRangeData + public apitest::XSearchable, public apitest::XReplaceable, public apitest::XCellRangeData, + public apitest::XCellSeries { public: ScCellRangeObj(); @@ -58,6 +60,8 @@ public: CPPUNIT_TEST(testGetDataArray); CPPUNIT_TEST(testSetDataArray); CPPUNIT_TEST(testSortOOB); + CPPUNIT_TEST(testFillAuto); + CPPUNIT_TEST(testFillSeries); CPPUNIT_TEST_SUITE_END(); private: @@ -71,7 +75,8 @@ uno::Reference< lang::XComponent > ScCellRangeObj::mxComponent; ScCellRangeObj::ScCellRangeObj(): CalcUnoApiTest("/sc/qa/extras/testdocuments"), apitest::XSearchable("15", 1), - apitest::XReplaceable("15", "35") + apitest::XReplaceable("15", "35"), + apitest::XCellSeries(2, 1) { } @@ -89,7 +94,7 @@ uno::Reference< uno::XInterface > ScCellRangeObj::init() CPPUNIT_ASSERT_MESSAGE("Could not create interface of type XSpreadsheet", xSheet.is()); - uno::Reference<table::XCellRange> xReturn(xSheet->getCellRangeByPosition(0,0,3,4), UNO_QUERY_THROW); + uno::Reference<table::XCellRange> xReturn(xSheet->getCellRangeByPosition(0,0,4,4), UNO_QUERY_THROW); CPPUNIT_ASSERT_MESSAGE("Could not create object of type XCellRangesQuery", xReturn.is()); return xReturn; diff --git a/sc/qa/extras/sctablesheetobj.cxx b/sc/qa/extras/sctablesheetobj.cxx index d5bcde236bf5..fabe8b7b0d76 100644 --- a/sc/qa/extras/sctablesheetobj.cxx +++ b/sc/qa/extras/sctablesheetobj.cxx @@ -22,11 +22,14 @@ using namespace css::uno; namespace sc_apitest { +#define NUMBER_OF_TESTS 9 + class ScTableSheetObj : public CalcUnoApiTest, public apitest::XSearchable, public apitest::XReplaceable, public apitest::XPrintAreas, public apitest::XCellSeries { public: ScTableSheetObj(); + virtual void setUp() override; virtual void tearDown() override; virtual uno::Reference< uno::XInterface > init() override; @@ -46,13 +49,18 @@ public: CPPUNIT_TEST_SUITE_END(); private: - uno::Reference< lang::XComponent > mxComponent; + static sal_Int32 nTest; + static uno::Reference< lang::XComponent > mxComponent; }; +sal_Int32 ScTableSheetObj::nTest = 0; +uno::Reference< lang::XComponent > ScTableSheetObj::mxComponent; + ScTableSheetObj::ScTableSheetObj(): CalcUnoApiTest("/sc/qa/extras/testdocuments"), apitest::XSearchable("test", 4), - apitest::XReplaceable("searchReplaceString", "replaceReplaceString") + apitest::XReplaceable("searchReplaceString", "replaceReplaceString"), + apitest::XCellSeries(1, 0) { } @@ -71,10 +79,20 @@ uno::Reference< uno::XInterface > ScTableSheetObj::init() return xSheet; } +void ScTableSheetObj::setUp() +{ + nTest++; + CPPUNIT_ASSERT(nTest <= NUMBER_OF_TESTS); + CalcUnoApiTest::setUp(); +} + void ScTableSheetObj::tearDown() { - closeDocument(mxComponent); - mxComponent.clear(); + if (nTest == NUMBER_OF_TESTS) + { + closeDocument(mxComponent); + mxComponent.clear(); + } CalcUnoApiTest::tearDown(); } diff --git a/sc/qa/extras/testdocuments/ScCellCursorObj.ods b/sc/qa/extras/testdocuments/ScCellCursorObj.ods Binary files differnew file mode 100644 index 000000000000..fbb054f59f2e --- /dev/null +++ b/sc/qa/extras/testdocuments/ScCellCursorObj.ods diff --git a/sc/qa/extras/testdocuments/xcellrangesquery.ods b/sc/qa/extras/testdocuments/xcellrangesquery.ods Binary files differindex ec7335fb09d2..494d79d369fe 100644 --- a/sc/qa/extras/testdocuments/xcellrangesquery.ods +++ b/sc/qa/extras/testdocuments/xcellrangesquery.ods |