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>
diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScDrawPagesObj.csv b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScDrawPagesObj.csv
index e1775ea..bdc6ddb 100644
--- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScDrawPagesObj.csv
+++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScDrawPagesObj.csv
@@ -1,5 +1,3 @@
"ScDrawPagesObj";"com::sun::star::container::XIndexAccess";"getCount()"
"ScDrawPagesObj";"com::sun::star::container::XIndexAccess";"getByIndex()"
"ScDrawPagesObj";"com::sun::star::drawing::XDrawPages";"insertNewByIndex()"
"ScDrawPagesObj";"com::sun::star::drawing::XDrawPages";"remove()"
"ScDrawPagesObj";"com::sun::star::container::XElementAccess";"getElementType()"
diff --git a/sc/CppunitTest_sc_drawpagesobj.mk b/sc/CppunitTest_sc_drawpagesobj.mk
new file mode 100644
index 0000000..db34447
--- /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 53c729e..8d7d327 100644
--- a/sc/Module_sc.mk
+++ b/sc/Module_sc.mk
@@ -131,6 +131,7 @@
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 0000000..471225e
--- /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: */