Kaydet (Commit) c08dd17b authored tarafından Jens Carl's avatar Jens Carl Kaydeden (comit) Markus Mohrhard

tdf#45904 Move Java XCellAddressable test to C++

Change-Id: Ib68c7dd8087f19bd969cf5273c3a6e8664c6bb62
Reviewed-on: https://gerrit.libreoffice.org/39348Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
üst 01985fd8
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* 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/.
*/
#ifndef INCLUDE_TEST_SHEET_XCELLADDRESSABLE_HXX
#define INCLUDE_TEST_SHEET_XCELLADDRESSABLE_HXX
#include <com/sun/star/uno/XInterface.hpp>
#include <com/sun/star/uno/Reference.hxx>
#include <test/testdllapi.hxx>
using namespace css;
using namespace css::uno;
namespace apitest {
class OOO_DLLPUBLIC_TEST XCellAddressable
{
public:
virtual uno::Reference< uno::XInterface > init() = 0;
virtual ~XCellAddressable(){}
void testGetCellAddress();
};
}
#endif // INCLUDE_TEST_SHEET_XCELLADDRESSABLE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -592,7 +592,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
qadevOOo/tests/java/ifc/sheet/_XAreaLinks \
qadevOOo/tests/java/ifc/sheet/_XArrayFormulaRange \
qadevOOo/tests/java/ifc/sheet/_XCalculatable \
qadevOOo/tests/java/ifc/sheet/_XCellAddressable \
qadevOOo/tests/java/ifc/sheet/_XCellFormatRangesSupplier \
qadevOOo/tests/java/ifc/sheet/_XCellRangeAddressable \
qadevOOo/tests/java/ifc/sheet/_XCellRangeData \
......
......@@ -139,7 +139,6 @@
"ScCellObj";"com::sun::star::text::XTextRange";"getEnd()"
"ScCellObj";"com::sun::star::text::XTextRange";"getString()"
"ScCellObj";"com::sun::star::text::XTextRange";"setString()"
"ScCellObj";"com::sun::star::sheet::XCellAddressable";"getCellAddress()"
"ScCellObj";"com::sun::star::sheet::SheetCell";"Position"
"ScCellObj";"com::sun::star::sheet::SheetCell";"Size"
"ScCellObj";"com::sun::star::sheet::SheetCell";"FormulaLocal#optional"
......
# -*- 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_cellobj))
$(eval $(call gb_CppunitTest_add_exception_objects,sc_cellobj, \
sc/qa/extras/sccellobj \
))
$(eval $(call gb_CppunitTest_use_external,sc_cellobj,boost_headers))
$(eval $(call gb_CppunitTest_use_libraries,sc_cellobj, \
basegfx \
comphelper \
cppu \
cppuhelper \
drawinglayer \
editeng \
for \
forui \
i18nlangtag \
msfilter \
oox \
sal \
salhelper \
sax \
sb \
sc \
sfx \
sot \
subsequenttest \
svl \
svt \
svx \
svxcore \
test \
tk \
tl \
ucbhelper \
unotest \
utl \
vbahelper \
vcl \
xo \
))
$(eval $(call gb_CppunitTest_set_include,sc_cellobj,\
-I$(SRCDIR)/sc/source/ui/inc \
-I$(SRCDIR)/sc/inc \
$$(INCLUDE) \
))
$(eval $(call gb_CppunitTest_use_sdk_api,sc_cellobj))
$(eval $(call gb_CppunitTest_use_ure,sc_cellobj))
$(eval $(call gb_CppunitTest_use_vcl,sc_cellobj))
$(eval $(call gb_CppunitTest_use_components,sc_cellobj,\
basic/util/sb \
comphelper/util/comphelp \
configmgr/source/configmgr \
dbaccess/util/dba \
filter/source/config/cache/filterconfig1 \
filter/source/storagefilterdetect/storagefd \
forms/util/frm \
framework/util/fwk \
i18npool/util/i18npool \
linguistic/source/lng \
oox/util/oox \
package/source/xstor/xstor \
package/util/package2 \
sax/source/expatwrap/expwrap \
scripting/source/basprov/basprov \
scripting/util/scriptframe \
sc/util/sc \
sc/util/scd \
sc/util/scfilt \
$(call gb_Helper_optional,SCRIPTING, \
sc/util/vbaobj) \
sfx2/util/sfx \
sot/util/sot \
svl/source/fsstor/fsstorage \
toolkit/util/tk \
ucb/source/core/ucb1 \
ucb/source/ucp/file/ucpfile1 \
ucb/source/ucp/tdoc/ucptdoc1 \
unotools/util/utl \
unoxml/source/rdf/unordf \
unoxml/source/service/unoxml \
uui/util/uui \
xmloff/util/xo \
svtools/util/svt \
))
$(eval $(call gb_CppunitTest_use_configuration,sc_cellobj))
# vim: set noet sw=4 ts=4:
......@@ -121,6 +121,7 @@ $(eval $(call gb_Module_add_subsequentcheck_targets,sc,\
CppunitTest_sc_check_data_pilot_field \
CppunitTest_sc_check_data_pilot_table \
CppunitTest_sc_viewpaneobj \
CppunitTest_sc_cellobj \
CppunitTest_sc_cellcursorobj \
))
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* 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/sheet/xcelladdressable.hxx>
#include <com/sun/star/lang/XComponent.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/uno/XInterface.hpp>
using namespace css;
using namespace css::uno;
namespace sc_apitest {
#define NUMBER_OF_TESTS 1
class ScCellObj : public CalcUnoApiTest, public apitest::XCellAddressable
{
public:
ScCellObj();
virtual uno::Reference< uno::XInterface > init() override;
virtual void setUp() override;
virtual void tearDown() override;
CPPUNIT_TEST_SUITE(ScCellObj);
// XCellAddressable
CPPUNIT_TEST(testGetCellAddress);
CPPUNIT_TEST_SUITE_END();
private:
static sal_Int32 nTest;
static uno::Reference< lang::XComponent > mxComponent;
};
sal_Int32 ScCellObj::nTest = 0;
uno::Reference< lang::XComponent > ScCellObj::mxComponent;
ScCellObj::ScCellObj()
: CalcUnoApiTest("/sc/qa/extrax/testdocuments")
{
}
uno::Reference< uno::XInterface > ScCellObj::init()
{
// create a calc document
if (!mxComponent.is())
mxComponent = loadFromDesktop("private:factory/scalc");
uno::Reference< sheet::XSpreadsheetDocument > xSheetDoc(mxComponent, uno::UNO_QUERY_THROW);
CPPUNIT_ASSERT_MESSAGE("no calc document", xSheetDoc.is());
// get getSheets
uno::Reference< sheet::XSpreadsheets > xSheets (xSheetDoc->getSheets(), UNO_QUERY_THROW);
uno::Any rSheet = xSheets->getByName("Sheet1");
// query for the XCellRange interface
uno::Reference< table::XCellRange > rCellRange(rSheet, UNO_QUERY);
uno::Reference< table::XCellRange > xCellRange = rCellRange->getCellRangeByName("A1");
return xCellRange->getCellByPosition(0, 0);
}
void ScCellObj::setUp()
{
nTest++;
CalcUnoApiTest::setUp();
}
void ScCellObj::tearDown()
{
if (nTest == NUMBER_OF_TESTS)
{
closeDocument(mxComponent);
mxComponent.clear();
}
CalcUnoApiTest::tearDown();
}
CPPUNIT_TEST_SUITE_REGISTRATION(ScCellObj);
} // end namespace
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -44,6 +44,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\
test/source/container/xnamed \
test/source/sheet/cellproperties \
test/source/sheet/datapilotfield \
test/source/sheet/xcelladdressable \
test/source/sheet/xcellrangedata \
test/source/sheet/xcellrangereferrer \
test/source/sheet/xcellrangesquery \
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* 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/sheet/xcelladdressable.hxx>
#include <com/sun/star/sheet/XCellAddressable.hpp>
#include <com/sun/star/table/CellAddress.hpp>
#include "cppunit/extensions/HelperMacros.h"
using namespace com::sun::star;
using namespace com::sun::star::uno;
CPPUNIT_NS_BEGIN
template<> struct assertion_traits<table::CellAddress>
{
static bool equal(const table::CellAddress& x, const table::CellAddress& y)
{
return x == y;
}
static std::string toString( const table::CellAddress& x )
{
OStringStream ost;
ost << "Sheet: " << x.Sheet << " Column: " << x.Column << " Row: " << x.Row;
return ost.str();
}
};
CPPUNIT_NS_END
namespace apitest {
void XCellAddressable::testGetCellAddress()
{
uno::Reference< sheet::XCellAddressable > xCellAddressable(init(), UNO_QUERY_THROW);
table::CellAddress xCellAddress = xCellAddressable->getCellAddress();
table::CellAddress defaultCellAddress;
CPPUNIT_ASSERT_EQUAL_MESSAGE("getCellAddress() didn't returned default cell address",
defaultCellAddress, xCellAddress);
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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