Kaydet (Commit) ed6a71ea authored tarafından Jens Carl's avatar Jens Carl

tdf#45904 Move XIndexAccess Java tests to C++

Move XIndexAccess Java tests to C++ for ScDrawPageObj.

Change-Id: I8b0c80b9213130870ce5445bcf52705df367cb0e
Reviewed-on: https://gerrit.libreoffice.org/69864
Tested-by: Jenkins
Reviewed-by: 's avatarJens Carl <j.carl43@gmx.de>
üst 0c44946a
"ScDrawPageObj";"com::sun::star::container::XIndexAccess";"getCount()"
"ScDrawPageObj";"com::sun::star::container::XIndexAccess";"getByIndex()"
"ScDrawPageObj";"com::sun::star::lang::XServiceInfo";"getImplementationName()"
"ScDrawPageObj";"com::sun::star::lang::XServiceInfo";"supportsService()"
"ScDrawPageObj";"com::sun::star::lang::XServiceInfo";"getSupportedServiceNames()"
......
# -*- 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_drawpageobj))
$(eval $(call gb_CppunitTest_use_external,sc_drawpageobj,boost_headers))
$(eval $(call gb_CppunitTest_add_exception_objects,sc_drawpageobj, \
sc/qa/extras/scdrawpageobj \
))
$(eval $(call gb_CppunitTest_use_libraries,sc_drawpageobj, \
cppu \
sal \
subsequenttest \
test \
unotest \
))
$(eval $(call gb_CppunitTest_set_include,sc_drawpageobj,\
$$(INCLUDE) \
))
$(eval $(call gb_CppunitTest_use_sdk_api,sc_drawpageobj))
$(eval $(call gb_CppunitTest_use_ure,sc_drawpageobj))
$(eval $(call gb_CppunitTest_use_vcl,sc_drawpageobj))
$(eval $(call gb_CppunitTest_use_components,sc_drawpageobj,\
$(sc_unoapi_common_components) \
))
$(eval $(call gb_CppunitTest_use_configuration,sc_drawpageobj))
# vim: set noet sw=4 ts=4:
......@@ -140,6 +140,7 @@ $(eval $(call gb_Module_add_subsequentcheck_targets,sc,\
CppunitTest_sc_ddelinkobj \
CppunitTest_sc_ddelinksobj \
CppunitTest_sc_documentconfigurationobj \
CppunitTest_sc_drawpageobj \
CppunitTest_sc_drawpagesobj \
CppunitTest_sc_editfieldobj_cell \
CppunitTest_sc_editfieldobj_header \
......
/* -*- 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/helper/shape.hxx>
#include <test/container/xindexaccess.hxx>
#include <com/sun/star/drawing/XDrawPage.hpp>
#include <com/sun/star/drawing/XDrawPages.hpp>
#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
#include <com/sun/star/drawing/XShape.hpp>
#include <com/sun/star/drawing/XShapes.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;
namespace sc_apitest
{
class ScDrawPageObj : public CalcUnoApiTest, public apitest::XIndexAccess
{
public:
ScDrawPageObj();
virtual uno::Reference<uno::XInterface> init() override;
virtual void setUp() override;
virtual void tearDown() override;
CPPUNIT_TEST_SUITE(ScDrawPageObj);
// XIndexAccess
CPPUNIT_TEST(testGetByIndex);
CPPUNIT_TEST(testGetCount);
CPPUNIT_TEST_SUITE_END();
private:
uno::Reference<lang::XComponent> m_xComponent;
};
ScDrawPageObj::ScDrawPageObj()
: CalcUnoApiTest("/sc/qa/extras/testdocuments")
, XIndexAccess(2)
{
}
uno::Reference<uno::XInterface> ScDrawPageObj::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(0);
xDP->insertNewByIndex(1);
uno::Reference<drawing::XDrawPage> xDrawPage(xDP->getByIndex(0), uno::UNO_QUERY_THROW);
uno::Reference<drawing::XShapes> xShapes(xDrawPage, uno::UNO_QUERY_THROW);
uno::Reference<drawing::XShape> xRectangle0(
apitest::helper::shape::createRectangle(m_xComponent, 7500, 5000, 5000, 3500),
uno::UNO_QUERY_THROW);
xShapes->add(xRectangle0);
uno::Reference<drawing::XShape> xRectangle1(
apitest::helper::shape::createRectangle(m_xComponent, 5000, 5000, 5000, 5500),
uno::UNO_QUERY_THROW);
xShapes->add(xRectangle1);
return xDrawPage;
}
void ScDrawPageObj::setUp()
{
CalcUnoApiTest::setUp();
// create calc document
m_xComponent = loadFromDesktop("private:factory/scalc");
}
void ScDrawPageObj::tearDown()
{
closeDocument(m_xComponent);
CalcUnoApiTest::tearDown();
}
CPPUNIT_TEST_SUITE_REGISTRATION(ScDrawPageObj);
} // namespace sc_apitest
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment