tdf#45904 Move XNameAccess Java test to C++
Move XNameAccess Java test to C++ for ScTableColumnsObj. Change-Id: I3c9acde1b9e390c6a088bde567996728db855c2e Reviewed-on: https://gerrit.libreoffice.org/69143 Tested-by: Jenkins Reviewed-by: Jens Carl <j.carl43@gmx.de>
This commit is contained in:
@@ -1,6 +1,3 @@
|
||||
"ScTableColumnsObj";"com::sun::star::container::XNameAccess#optional";"getByName()"
|
||||
"ScTableColumnsObj";"com::sun::star::container::XNameAccess#optional";"getElementNames()"
|
||||
"ScTableColumnsObj";"com::sun::star::container::XNameAccess#optional";"hasByName()"
|
||||
"ScTableColumnsObj";"com::sun::star::container::XIndexAccess";"getCount()"
|
||||
"ScTableColumnsObj";"com::sun::star::container::XIndexAccess";"getByIndex()"
|
||||
"ScTableColumnsObj";"com::sun::star::table::XTableColumns";"insertByIndex()"
|
||||
|
||||
|
@@ -0,0 +1,43 @@
|
||||
# -*- 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_tablecolumnsobj))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_external,sc_tablecolumnsobj,boost_headers))
|
||||
|
||||
$(eval $(call gb_CppunitTest_add_exception_objects,sc_tablecolumnsobj, \
|
||||
sc/qa/extras/sctablecolumnsobj \
|
||||
))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_libraries,sc_tablecolumnsobj, \
|
||||
cppu \
|
||||
sal \
|
||||
subsequenttest \
|
||||
test \
|
||||
unotest \
|
||||
))
|
||||
|
||||
$(eval $(call gb_CppunitTest_set_include,sc_tablecolumnsobj,\
|
||||
$$(INCLUDE) \
|
||||
))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_sdk_api,sc_tablecolumnsobj))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_ure,sc_tablecolumnsobj))
|
||||
$(eval $(call gb_CppunitTest_use_vcl,sc_tablecolumnsobj))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_components,sc_tablecolumnsobj,\
|
||||
$(sc_unoapi_common_components) \
|
||||
))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_configuration,sc_tablecolumnsobj))
|
||||
|
||||
# vim: set noet sw=4 ts=4:
|
||||
@@ -191,6 +191,7 @@ $(eval $(call gb_Module_add_subsequentcheck_targets,sc,\
|
||||
CppunitTest_sc_stylefamilyobj \
|
||||
CppunitTest_sc_subtotaldescriptorbaseobj \
|
||||
CppunitTest_sc_subtotalfieldobj \
|
||||
CppunitTest_sc_tablecolumnsobj \
|
||||
CppunitTest_sc_tableconditionalentryobj \
|
||||
CppunitTest_sc_tableconditionalformat \
|
||||
CppunitTest_sc_tablerowsobj \
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
/* -*- 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/xnameaccess.hxx>
|
||||
|
||||
#include <com/sun/star/container/XIndexAccess.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/XCellRange.hpp>
|
||||
#include <com/sun/star/table/XColumnRowRange.hpp>
|
||||
#include <com/sun/star/table/XTableColumns.hpp>
|
||||
#include <com/sun/star/uno/XInterface.hpp>
|
||||
|
||||
#include <com/sun/star/uno/Reference.hxx>
|
||||
|
||||
using namespace css;
|
||||
|
||||
namespace sc_apitest
|
||||
{
|
||||
class ScTableColumnsObj : public CalcUnoApiTest, public apitest::XNameAccess
|
||||
{
|
||||
public:
|
||||
ScTableColumnsObj();
|
||||
|
||||
virtual uno::Reference<uno::XInterface> init() override;
|
||||
virtual void setUp() override;
|
||||
virtual void tearDown() override;
|
||||
|
||||
CPPUNIT_TEST_SUITE(ScTableColumnsObj);
|
||||
|
||||
// XNameAccess
|
||||
CPPUNIT_TEST(testGetByName);
|
||||
CPPUNIT_TEST(testGetElementNames);
|
||||
CPPUNIT_TEST(testHasByName);
|
||||
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
private:
|
||||
uno::Reference<lang::XComponent> m_xComponent;
|
||||
};
|
||||
|
||||
ScTableColumnsObj::ScTableColumnsObj()
|
||||
: CalcUnoApiTest("/sc/qa/extras/testdocuments")
|
||||
, XNameAccess("ABC")
|
||||
{
|
||||
}
|
||||
|
||||
uno::Reference<uno::XInterface> ScTableColumnsObj::init()
|
||||
{
|
||||
uno::Reference<sheet::XSpreadsheetDocument> xDoc(m_xComponent, uno::UNO_QUERY_THROW);
|
||||
uno::Reference<sheet::XSpreadsheets> xSheets(xDoc->getSheets(), uno::UNO_QUERY_THROW);
|
||||
uno::Reference<container::XIndexAccess> xIA(xSheets, uno::UNO_QUERY_THROW);
|
||||
uno::Reference<sheet::XSpreadsheet> xSheet0(xIA->getByIndex(0), uno::UNO_QUERY_THROW);
|
||||
|
||||
uno::Reference<table::XColumnRowRange> xCRR(xSheet0, uno::UNO_QUERY_THROW);
|
||||
uno::Reference<table::XTableColumns> xTC(xCRR->getColumns(), uno::UNO_QUERY_THROW);
|
||||
|
||||
return xTC;
|
||||
}
|
||||
|
||||
void ScTableColumnsObj::setUp()
|
||||
{
|
||||
CalcUnoApiTest::setUp();
|
||||
// create calc document
|
||||
m_xComponent = loadFromDesktop("private:factory/scalc");
|
||||
}
|
||||
|
||||
void ScTableColumnsObj::tearDown()
|
||||
{
|
||||
closeDocument(m_xComponent);
|
||||
CalcUnoApiTest::tearDown();
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(ScTableColumnsObj);
|
||||
|
||||
} // namespace sc_apitest
|
||||
|
||||
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|
||||
Reference in New Issue
Block a user