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

tdf#45904 Move XIndexAccess Java tests to C++

Move XIndexAccess Java tests to C++ for ScTableRowsObj.

Change-Id: I90dc592ba7901dab9c402b56e9e992fe7593c71c
Reviewed-on: https://gerrit.libreoffice.org/65371
Tested-by: Jenkins
Reviewed-by: 's avatarJens Carl <j.carl43@gmx.de>
üst 2b9739b9
"ScTableRowsObj";"com::sun::star::container::XIndexAccess";"getCount()"
"ScTableRowsObj";"com::sun::star::container::XIndexAccess";"getByIndex()"
"ScTableRowsObj";"com::sun::star::container::XElementAccess";"getElementType()"
"ScTableRowsObj";"com::sun::star::container::XElementAccess";"hasElements()"
"ScTableRowsObj";"com::sun::star::table::XTableRows";"insertByIndex()"
......
# -*- 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_tablerowsobj))
$(eval $(call gb_CppunitTest_use_external,sc_tablerowsobj,boost_headers))
$(eval $(call gb_CppunitTest_add_exception_objects,sc_tablerowsobj, \
sc/qa/extras/sctablerowsobj \
))
$(eval $(call gb_CppunitTest_use_libraries,sc_tablerowsobj, \
cppu \
sal \
subsequenttest \
test \
unotest \
))
$(eval $(call gb_CppunitTest_set_include,sc_tablerowsobj,\
$$(INCLUDE) \
))
$(eval $(call gb_CppunitTest_use_sdk_api,sc_tablerowsobj))
$(eval $(call gb_CppunitTest_use_ure,sc_tablerowsobj))
$(eval $(call gb_CppunitTest_use_vcl,sc_tablerowsobj))
$(eval $(call gb_CppunitTest_use_components,sc_tablerowsobj,\
$(sc_unoapi_common_components) \
))
$(eval $(call gb_CppunitTest_use_configuration,sc_tablerowsobj))
# vim: set noet sw=4 ts=4:
......@@ -182,6 +182,7 @@ $(eval $(call gb_Module_add_subsequentcheck_targets,sc,\
CppunitTest_sc_subtotalfieldobj \
CppunitTest_sc_tableconditionalentryobj \
CppunitTest_sc_tableconditionalformatobj \
CppunitTest_sc_tablerowsobj \
CppunitTest_sc_tablesheetobj \
CppunitTest_sc_tablesheetsobj \
CppunitTest_sc_tablevalidationobj \
......
/* -*- 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/container/XNameAccess.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/sheet/XSpreadsheet.hpp>
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <com/sun/star/sheet/XSpreadsheets.hpp>
#include <com/sun/star/table/XColumnRowRange.hpp>
#include <com/sun/star/table/XTableRows.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 ScTableRowsObj : public CalcUnoApiTest, public apitest::XIndexAccess
{
public:
ScTableRowsObj();
virtual uno::Reference<uno::XInterface> init() override;
virtual void setUp() override;
virtual void tearDown() override;
CPPUNIT_TEST_SUITE(ScTableRowsObj);
// XIndexAccess
CPPUNIT_TEST(testGetByIndex);
CPPUNIT_TEST(testGetCount);
CPPUNIT_TEST_SUITE_END();
private:
uno::Reference<lang::XComponent> m_xCompoment;
};
ScTableRowsObj::ScTableRowsObj()
: CalcUnoApiTest("/sc/qa/extras/testdocuemts")
, XIndexAccess(1048576)
{
}
uno::Reference<uno::XInterface> ScTableRowsObj::init()
{
uno::Reference<sheet::XSpreadsheetDocument> xDoc(m_xCompoment, uno::UNO_QUERY_THROW);
CPPUNIT_ASSERT_MESSAGE("no calc document", xDoc.is());
uno::Reference<sheet::XSpreadsheets> xSheets(xDoc->getSheets(), uno::UNO_QUERY_THROW);
uno::Reference<container::XNameAccess> xNA(xSheets, uno::UNO_QUERY_THROW);
uno::Reference<sheet::XSpreadsheet> xSheet0(xSheets->getByName(xNA->getElementNames()[0]),
uno::UNO_QUERY_THROW);
uno::Reference<table::XColumnRowRange> xCRR(xSheet0, uno::UNO_QUERY_THROW);
uno::Reference<table::XTableRows> xTR(xCRR->getRows(), uno::UNO_QUERY_THROW);
return xTR;
}
void ScTableRowsObj::setUp()
{
CalcUnoApiTest::setUp();
m_xCompoment = loadFromDesktop("private:factory/scalc");
CPPUNIT_ASSERT_MESSAGE("no component", m_xCompoment.is());
}
void ScTableRowsObj::tearDown()
{
closeDocument(m_xCompoment);
CalcUnoApiTest::tearDown();
}
CPPUNIT_TEST_SUITE_REGISTRATION(ScTableRowsObj);
} // 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