diff options
author | Jens Carl <j.carl43@gmx.de> | 2019-01-21 22:47:27 +0000 |
---|---|---|
committer | Jens Carl <j.carl43@gmx.de> | 2019-01-22 01:41:50 +0100 |
commit | 835b854d74bcd9f9c6a87b24d533242433f7800b (patch) | |
tree | 01795b6c2c7484e7b504d6dd203cb62f88ad23dd /sc | |
parent | 2d33c7cb4b4835de77194650124a1cf046920f66 (diff) |
tdf#45904 Move XIndexAccess Java tests to C++
Move XIndexAccess Java tests to C++ for ScDrawPagesObj.
Change-Id: Ib9983f0f55c79856cf66091a4b4881fafaa1f0b9
Reviewed-on: https://gerrit.libreoffice.org/66707
Tested-by: Jenkins
Reviewed-by: Jens Carl <j.carl43@gmx.de>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/CppunitTest_sc_drawpagesobj.mk | 44 | ||||
-rw-r--r-- | sc/Module_sc.mk | 1 | ||||
-rw-r--r-- | sc/qa/extras/scdrawpagesobj.cxx | 85 |
3 files changed, 130 insertions, 0 deletions
diff --git a/sc/CppunitTest_sc_drawpagesobj.mk b/sc/CppunitTest_sc_drawpagesobj.mk new file mode 100644 index 000000000000..db344475b44b --- /dev/null +++ b/sc/CppunitTest_sc_drawpagesobj.mk @@ -0,0 +1,44 @@ +# -*- 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_drawpagesobj)) + +$(eval $(call gb_CppunitTest_use_external,sc_drawpagesobj,boost_headers)) + +$(eval $(call gb_CppunitTest_add_exception_objects,sc_drawpagesobj, \ + sc/qa/extras/scdrawpagesobj \ +)) + +$(eval $(call gb_CppunitTest_use_libraries,sc_drawpagesobj, \ + cppu \ + sal \ + subsequenttest \ + test \ + unotest \ + vcl \ +)) + +$(eval $(call gb_CppunitTest_set_include,sc_drawpagesobj,\ + $$(INCLUDE) \ +)) + +$(eval $(call gb_CppunitTest_use_sdk_api,sc_drawpagesobj)) + +$(eval $(call gb_CppunitTest_use_ure,sc_drawpagesobj)) +$(eval $(call gb_CppunitTest_use_vcl,sc_drawpagesobj)) + +$(eval $(call gb_CppunitTest_use_components,sc_drawpagesobj,\ + $(sc_unoapi_common_components) \ +)) + +$(eval $(call gb_CppunitTest_use_configuration,sc_drawpagesobj)) + +# vim: set noet sw=4 ts=4: diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk index 53c729e5ce78..8d7d327b0d1d 100644 --- a/sc/Module_sc.mk +++ b/sc/Module_sc.mk @@ -131,6 +131,7 @@ $(eval $(call gb_Module_add_subsequentcheck_targets,sc,\ CppunitTest_sc_ddelinkobj \ CppunitTest_sc_ddelinksobj \ CppunitTest_sc_documentconfigurationobj \ + CppunitTest_sc_drawpagesobj \ CppunitTest_sc_editfieldobj_cell \ CppunitTest_sc_editfieldobj_header \ CppunitTest_sc_filterdescriptorbaseobj \ diff --git a/sc/qa/extras/scdrawpagesobj.cxx b/sc/qa/extras/scdrawpagesobj.cxx new file mode 100644 index 000000000000..471225ec611a --- /dev/null +++ b/sc/qa/extras/scdrawpagesobj.cxx @@ -0,0 +1,85 @@ +/* -*- 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/calc_unoapi_test.hxx> +#include <test/container/xindexaccess.hxx> + +#include <com/sun/star/drawing/XDrawPages.hpp> +#include <com/sun/star/drawing/XDrawPagesSupplier.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/sheet/XSpreadsheetDocument.hpp> +#include <com/sun/star/uno/XInterface.hpp> + +#include <com/sun/star/uno/Reference.hxx> + +using namespace css; +using namespace css::uno; + +namespace sc_apitest +{ +class ScDrawPagesObj : public CalcUnoApiTest, public apitest::XIndexAccess +{ +public: + ScDrawPagesObj(); + + virtual uno::Reference<uno::XInterface> init() override; + virtual void setUp() override; + virtual void tearDown() override; + + CPPUNIT_TEST_SUITE(ScDrawPagesObj); + + // XIndexAccess + CPPUNIT_TEST(testGetByIndex); + CPPUNIT_TEST(testGetCount); + + CPPUNIT_TEST_SUITE_END(); + +private: + uno::Reference<lang::XComponent> m_xComponent; +}; + +ScDrawPagesObj::ScDrawPagesObj() + : CalcUnoApiTest("/sc/qa/extras/testdocuments") + , XIndexAccess(3) +{ +} + +uno::Reference<uno::XInterface> ScDrawPagesObj::init() +{ + uno::Reference<sheet::XSpreadsheetDocument> xDoc(m_xComponent, uno::UNO_QUERY_THROW); + + uno::Reference<drawing::XDrawPagesSupplier> xDPS(xDoc, uno::UNO_QUERY_THROW); + uno::Reference<drawing::XDrawPages> xDP(xDPS->getDrawPages(), uno::UNO_QUERY_THROW); + + xDP->insertNewByIndex(1); + xDP->insertNewByIndex(2); + + return xDP; +} + +void ScDrawPagesObj::setUp() +{ + CalcUnoApiTest::setUp(); + // create a calc document + m_xComponent = loadFromDesktop("private:factory/scalc"); +} + +void ScDrawPagesObj::tearDown() +{ + closeDocument(m_xComponent); + CalcUnoApiTest::tearDown(); +} + +CPPUNIT_TEST_SUITE_REGISTRATION(ScDrawPagesObj); + +} // namespace sc_apitest + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ |