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

tdf#45904 Move XNameAccess Java tests to C++

Move XNameAccess Java tests to C++ for ScStyleFamilyObj.

Change-Id: Ib1e0481b4ea6fe63cb073948a444ddcc7f2eaa65
Reviewed-on: https://gerrit.libreoffice.org/69018
Tested-by: Jenkins
Reviewed-by: 's avatarJens Carl <j.carl43@gmx.de>
üst 7e5fe834
"ScStyleFamilyObj";"com::sun::star::container::XNameAccess";"getByName()"
"ScStyleFamilyObj";"com::sun::star::container::XNameAccess";"getElementNames()"
"ScStyleFamilyObj";"com::sun::star::container::XNameAccess";"hasByName()"
"ScStyleFamilyObj";"com::sun::star::container::XNameReplace#optional";"replaceByName()" "ScStyleFamilyObj";"com::sun::star::container::XNameReplace#optional";"replaceByName()"
"ScStyleFamilyObj";"com::sun::star::container::XNameContainer#optional";"insertByName()" "ScStyleFamilyObj";"com::sun::star::container::XNameContainer#optional";"insertByName()"
"ScStyleFamilyObj";"com::sun::star::container::XNameContainer#optional";"removeByName()" "ScStyleFamilyObj";"com::sun::star::container::XNameContainer#optional";"removeByName()"
......
# -*- 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_stylefamilyobj))
$(eval $(call gb_CppunitTest_use_external,sc_stylefamilyobj,boost_headers))
$(eval $(call gb_CppunitTest_add_exception_objects,sc_stylefamilyobj, \
sc/qa/extras/scstylefamilyobj \
))
$(eval $(call gb_CppunitTest_use_libraries,sc_stylefamilyobj, \
cppu \
sal \
subsequenttest \
test \
unotest \
))
$(eval $(call gb_CppunitTest_set_include,sc_stylefamilyobj,\
$$(INCLUDE) \
))
$(eval $(call gb_CppunitTest_use_sdk_api,sc_stylefamilyobj))
$(eval $(call gb_CppunitTest_use_ure,sc_stylefamilyobj))
$(eval $(call gb_CppunitTest_use_vcl,sc_stylefamilyobj))
$(eval $(call gb_CppunitTest_use_components,sc_stylefamilyobj,\
$(sc_unoapi_common_components) \
))
$(eval $(call gb_CppunitTest_use_configuration,sc_stylefamilyobj))
# vim: set noet sw=4 ts=4:
...@@ -188,6 +188,7 @@ $(eval $(call gb_Module_add_subsequentcheck_targets,sc,\ ...@@ -188,6 +188,7 @@ $(eval $(call gb_Module_add_subsequentcheck_targets,sc,\
CppunitTest_sc_spreadsheetsettings \ CppunitTest_sc_spreadsheetsettings \
CppunitTest_sc_spreadsheetsettingsobj \ CppunitTest_sc_spreadsheetsettingsobj \
CppunitTest_sc_stylefamiliesobj \ CppunitTest_sc_stylefamiliesobj \
CppunitTest_sc_stylefamilyobj \
CppunitTest_sc_subtotaldescriptorbaseobj \ CppunitTest_sc_subtotaldescriptorbaseobj \
CppunitTest_sc_subtotalfieldobj \ CppunitTest_sc_subtotalfieldobj \
CppunitTest_sc_tableconditionalentryobj \ CppunitTest_sc_tableconditionalentryobj \
......
/* -*- 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/container/XNameAccess.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
#include <com/sun/star/uno/XInterface.hpp>
#include <com/sun/star/uno/Reference.hxx>
using namespace css;
namespace sc_apitest
{
class ScStyleFamilyObj : public CalcUnoApiTest, public apitest::XNameAccess
{
public:
ScStyleFamilyObj();
virtual uno::Reference<uno::XInterface> init() override;
virtual void setUp() override;
virtual void tearDown() override;
CPPUNIT_TEST_SUITE(ScStyleFamilyObj);
// XNameAccess
CPPUNIT_TEST(testGetByName);
CPPUNIT_TEST(testGetElementNames);
CPPUNIT_TEST(testHasByName);
CPPUNIT_TEST_SUITE_END();
private:
uno::Reference<lang::XComponent> m_xComponent;
};
ScStyleFamilyObj::ScStyleFamilyObj()
: CalcUnoApiTest("/sc/qa/extras/testdocuemts")
, XNameAccess("Default")
{
}
uno::Reference<uno::XInterface> ScStyleFamilyObj::init()
{
uno::Reference<sheet::XSpreadsheetDocument> xDoc(m_xComponent, uno::UNO_QUERY_THROW);
uno::Reference<style::XStyleFamiliesSupplier> xSFS(xDoc, uno::UNO_QUERY_THROW);
uno::Reference<container::XNameAccess> xNA(xSFS->getStyleFamilies(), uno::UNO_QUERY_THROW);
uno::Reference<container::XIndexAccess> xIA(xNA, uno::UNO_QUERY_THROW);
uno::Reference<container::XNameAccess> xNA_SF(xIA->getByIndex(0), uno::UNO_QUERY_THROW);
uno::Reference<lang::XMultiServiceFactory> xMSF(m_xComponent, uno::UNO_QUERY_THROW);
uno::Reference<uno::XInterface> xCS(xMSF->createInstance("com.sun.star.style.CellStyle"),
uno::UNO_QUERY_THROW);
uno::Reference<container::XNameContainer> xNC(xNA_SF, uno::UNO_QUERY_THROW);
xNC->insertByName("ScStyleFamilyObj", uno::makeAny(xCS));
return xNA_SF;
}
void ScStyleFamilyObj::setUp()
{
CalcUnoApiTest::setUp();
// create calc document
m_xComponent = loadFromDesktop("private:factory/scalc");
}
void ScStyleFamilyObj::tearDown()
{
closeDocument(m_xComponent);
CalcUnoApiTest::tearDown();
}
CPPUNIT_TEST_SUITE_REGISTRATION(ScStyleFamilyObj);
} // 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