tdf#45904 Move _XDatabaseRanges Java tests to C++
Change-Id: Iee6753fd60fefc1ecd17ba8fe0acef58f17d64e6 Reviewed-on: https://gerrit.libreoffice.org/46076 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Jens Carl <j.carl43@gmx.de>
This commit is contained in:
34
include/test/sheet/xdatabaseranges.hxx
Normal file
34
include/test/sheet/xdatabaseranges.hxx
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
/* -*- 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/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef INCLUDED_TEST_SHEET_XDATABASERANGES_HXX
|
||||||
|
#define INCLUDED_TEST_SHEET_XDATABASERANGES_HXX
|
||||||
|
|
||||||
|
#include <com/sun/star/uno/XInterface.hpp>
|
||||||
|
#include <com/sun/star/uno/Reference.hxx>
|
||||||
|
|
||||||
|
#include <test/testdllapi.hxx>
|
||||||
|
|
||||||
|
namespace apitest
|
||||||
|
{
|
||||||
|
class OOO_DLLPUBLIC_TEST XDatabaseRanges
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual css::uno::Reference<css::uno::XInterface> init() = 0;
|
||||||
|
|
||||||
|
void testAddRemoveDbRanges();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
~XDatabaseRanges() {}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // INCLUDED_TEST_SHEET_XDATABASERANGES_HXX
|
||||||
|
|
||||||
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|
@@ -595,7 +595,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
|
|||||||
qadevOOo/tests/java/ifc/sheet/_XCellRangesQuery \
|
qadevOOo/tests/java/ifc/sheet/_XCellRangesQuery \
|
||||||
qadevOOo/tests/java/ifc/sheet/_XConsolidatable \
|
qadevOOo/tests/java/ifc/sheet/_XConsolidatable \
|
||||||
qadevOOo/tests/java/ifc/sheet/_XConsolidationDescriptor \
|
qadevOOo/tests/java/ifc/sheet/_XConsolidationDescriptor \
|
||||||
qadevOOo/tests/java/ifc/sheet/_XDatabaseRanges \
|
|
||||||
qadevOOo/tests/java/ifc/sheet/_XDDELink \
|
qadevOOo/tests/java/ifc/sheet/_XDDELink \
|
||||||
qadevOOo/tests/java/ifc/sheet/_XDocumentAuditing \
|
qadevOOo/tests/java/ifc/sheet/_XDocumentAuditing \
|
||||||
qadevOOo/tests/java/ifc/sheet/_XEnhancedMouseClickBroadcaster \
|
qadevOOo/tests/java/ifc/sheet/_XEnhancedMouseClickBroadcaster \
|
||||||
|
@@ -3,8 +3,6 @@
|
|||||||
"ScDatabaseRangesObj";"com::sun::star::container::XNameAccess";"hasByName()"
|
"ScDatabaseRangesObj";"com::sun::star::container::XNameAccess";"hasByName()"
|
||||||
"ScDatabaseRangesObj";"com::sun::star::container::XIndexAccess";"getCount()"
|
"ScDatabaseRangesObj";"com::sun::star::container::XIndexAccess";"getCount()"
|
||||||
"ScDatabaseRangesObj";"com::sun::star::container::XIndexAccess";"getByIndex()"
|
"ScDatabaseRangesObj";"com::sun::star::container::XIndexAccess";"getByIndex()"
|
||||||
"ScDatabaseRangesObj";"com::sun::star::sheet::XDatabaseRanges";"addNewByName()"
|
|
||||||
"ScDatabaseRangesObj";"com::sun::star::sheet::XDatabaseRanges";"removeByName()"
|
|
||||||
"ScDatabaseRangesObj";"com::sun::star::container::XElementAccess";"getElementType()"
|
"ScDatabaseRangesObj";"com::sun::star::container::XElementAccess";"getElementType()"
|
||||||
"ScDatabaseRangesObj";"com::sun::star::container::XElementAccess";"hasElements()"
|
"ScDatabaseRangesObj";"com::sun::star::container::XElementAccess";"hasElements()"
|
||||||
"ScDatabaseRangesObj";"com::sun::star::container::XEnumerationAccess";"createEnumeration()"
|
"ScDatabaseRangesObj";"com::sun::star::container::XEnumerationAccess";"createEnumeration()"
|
||||||
|
|
@@ -1,112 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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/.
|
|
||||||
*
|
|
||||||
* This file incorporates work covered by the following license notice:
|
|
||||||
*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file distributed
|
|
||||||
* with this work for additional information regarding copyright
|
|
||||||
* ownership. The ASF licenses this file to you under the Apache
|
|
||||||
* License, Version 2.0 (the "License"); you may not use this file
|
|
||||||
* except in compliance with the License. You may obtain a copy of
|
|
||||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
||||||
*/
|
|
||||||
|
|
||||||
package ifc.sheet;
|
|
||||||
|
|
||||||
import lib.MultiMethodTest;
|
|
||||||
|
|
||||||
import com.sun.star.sheet.XDatabaseRanges;
|
|
||||||
import com.sun.star.table.CellRangeAddress;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Testing <code>com.sun.star.sheet.XDatabaseRanges</code>
|
|
||||||
* interface methods :
|
|
||||||
* <ul>
|
|
||||||
* <li><code> addNewByName()</code></li>
|
|
||||||
* <li><code> removeByName()</code></li>
|
|
||||||
* </ul> <p>
|
|
||||||
* @see com.sun.star.sheet.XDatabaseRanges
|
|
||||||
*/
|
|
||||||
public class _XDatabaseRanges extends MultiMethodTest {
|
|
||||||
|
|
||||||
public XDatabaseRanges oObj = null;
|
|
||||||
CellRangeAddress CRA = null;
|
|
||||||
String name = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test adds a new database range to the collection, checks that range with
|
|
||||||
* this name exist in collection and then tries to add range with the same
|
|
||||||
* name. <p>
|
|
||||||
* Has <b> OK </b> status if the added range exists in collection and
|
|
||||||
* exception was thrown when trying to add range with name that is same as name
|
|
||||||
* of existent range. <p>
|
|
||||||
*/
|
|
||||||
public void _addNewByName() {
|
|
||||||
boolean bResult = true;
|
|
||||||
log.println("Trying to add range with proper name.");
|
|
||||||
|
|
||||||
CRA = new CellRangeAddress((short)0, 1, 2, 3, 4);
|
|
||||||
name = "_XDatabaseRanges_addNewByRange";
|
|
||||||
|
|
||||||
oObj.addNewByName(name, CRA);
|
|
||||||
|
|
||||||
bResult &= oObj.hasByName(name);
|
|
||||||
|
|
||||||
if (bResult) log.println("Ok");
|
|
||||||
log.println("Trying to add existing element.");
|
|
||||||
|
|
||||||
try {
|
|
||||||
oObj.addNewByName(name, CRA);
|
|
||||||
log.println("Exception expected... Test failed.");
|
|
||||||
bResult = false;
|
|
||||||
} catch(com.sun.star.uno.RuntimeException e) {
|
|
||||||
log.println("Exception occurred while testing addNewByName() : " + e);
|
|
||||||
bResult = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
tRes.tested("addNewByName()", bResult);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test removes the database range with name that exist exactly and then
|
|
||||||
* tries to remove the range with name that doesn't exist exactly. <p>
|
|
||||||
* Has <b> OK </b> status if first range was successfully removed and
|
|
||||||
* exception was thrown when trying to remove non-existent database range.<p>
|
|
||||||
* The following method tests are to be completed successfully before :
|
|
||||||
* <ul>
|
|
||||||
* <li> <code> addNewByName() </code> : to have definitely existed database
|
|
||||||
* range </li>
|
|
||||||
* </ul>
|
|
||||||
*/
|
|
||||||
public void _removeByName(){
|
|
||||||
boolean bResult = true;
|
|
||||||
requiredMethod("addNewByName()");
|
|
||||||
|
|
||||||
log.println("Remove inserted element.");
|
|
||||||
|
|
||||||
try {
|
|
||||||
oObj.removeByName(name);
|
|
||||||
bResult &= !oObj.hasByName(name);
|
|
||||||
} catch (com.sun.star.uno.RuntimeException e) {
|
|
||||||
log.println("Exception occurred while testing removeByName() : " + e);
|
|
||||||
bResult = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
log.println("OK.\nTrying to remove unexistant element.");
|
|
||||||
|
|
||||||
try {
|
|
||||||
oObj.removeByName(name);
|
|
||||||
log.println("Exception expected... - FAILED");
|
|
||||||
bResult = false;
|
|
||||||
} catch (com.sun.star.uno.RuntimeException e) {
|
|
||||||
log.println("Expected exception. - OK : " + e);
|
|
||||||
}
|
|
||||||
tRes.tested("removeByName()", bResult);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
105
sc/CppunitTest_sc_databaserangesobj.mk
Normal file
105
sc/CppunitTest_sc_databaserangesobj.mk
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
# -*- 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_databaserangesobj))
|
||||||
|
|
||||||
|
$(eval $(call gb_CppunitTest_use_external,sc_databaserangesobj,boost_headers))
|
||||||
|
|
||||||
|
$(eval $(call gb_CppunitTest_add_exception_objects,sc_databaserangesobj, \
|
||||||
|
sc/qa/extras/scdatabaserangesobj \
|
||||||
|
))
|
||||||
|
|
||||||
|
$(eval $(call gb_CppunitTest_use_libraries,sc_databaserangesobj, \
|
||||||
|
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_databaserangesobj,\
|
||||||
|
-I$(SRCDIR)/sc/source/ui/inc \
|
||||||
|
-I$(SRCDIR)/sc/inc \
|
||||||
|
$$(INCLUDE) \
|
||||||
|
))
|
||||||
|
|
||||||
|
$(eval $(call gb_CppunitTest_use_sdk_api,sc_databaserangesobj))
|
||||||
|
|
||||||
|
$(eval $(call gb_CppunitTest_use_ure,sc_databaserangesobj))
|
||||||
|
$(eval $(call gb_CppunitTest_use_vcl,sc_databaserangesobj))
|
||||||
|
|
||||||
|
$(eval $(call gb_CppunitTest_use_components,sc_databaserangesobj,\
|
||||||
|
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_databaserangesobj))
|
||||||
|
|
||||||
|
# vim: set noet sw=4 ts=4:
|
@@ -145,6 +145,7 @@ $(eval $(call gb_Module_add_subsequentcheck_targets,sc,\
|
|||||||
CppunitTest_sc_recentfunctionsobj \
|
CppunitTest_sc_recentfunctionsobj \
|
||||||
CppunitTest_sc_functionlistobj \
|
CppunitTest_sc_functionlistobj \
|
||||||
CppunitTest_sc_datapilottablesobj \
|
CppunitTest_sc_datapilottablesobj \
|
||||||
|
CppunitTest_sc_databaserangesobj \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(eval $(call gb_Module_add_perfcheck_targets,sc,\
|
$(eval $(call gb_Module_add_perfcheck_targets,sc,\
|
||||||
|
102
sc/qa/extras/scdatabaserangesobj.cxx
Normal file
102
sc/qa/extras/scdatabaserangesobj.cxx
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
/* -*- 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/sheet/xdatabaseranges.hxx>
|
||||||
|
|
||||||
|
#include <com/sun/star/beans/XPropertySet.hpp>
|
||||||
|
#include <com/sun/star/lang/XComponent.hpp>
|
||||||
|
#include <com/sun/star/sheet/XDatabaseRanges.hpp>
|
||||||
|
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
|
||||||
|
#include <com/sun/star/table/CellRangeAddress.hpp>
|
||||||
|
#include <com/sun/star/uno/XInterface.hpp>
|
||||||
|
|
||||||
|
#include <com/sun/star/uno/Reference.hxx>
|
||||||
|
|
||||||
|
using namespace css;
|
||||||
|
using namespace css::uno;
|
||||||
|
using namespace com::sun::star;
|
||||||
|
|
||||||
|
namespace sc_apitest
|
||||||
|
{
|
||||||
|
#define NUMBER_OF_TESTS 1
|
||||||
|
|
||||||
|
class ScDatabaseRangesObj : public CalcUnoApiTest, public apitest::XDatabaseRanges
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ScDatabaseRangesObj();
|
||||||
|
|
||||||
|
virtual uno::Reference<uno::XInterface> init() override;
|
||||||
|
virtual void setUp() override;
|
||||||
|
virtual void tearDown() override;
|
||||||
|
|
||||||
|
CPPUNIT_TEST_SUITE(ScDatabaseRangesObj);
|
||||||
|
|
||||||
|
// XDatabaseRanges
|
||||||
|
CPPUNIT_TEST(testAddRemoveDbRanges);
|
||||||
|
|
||||||
|
CPPUNIT_TEST_SUITE_END();
|
||||||
|
|
||||||
|
private:
|
||||||
|
static sal_Int32 nTest;
|
||||||
|
static uno::Reference<lang::XComponent> mxComponent;
|
||||||
|
};
|
||||||
|
|
||||||
|
sal_Int32 ScDatabaseRangesObj::nTest = 0;
|
||||||
|
uno::Reference<lang::XComponent> ScDatabaseRangesObj::mxComponent;
|
||||||
|
|
||||||
|
ScDatabaseRangesObj::ScDatabaseRangesObj()
|
||||||
|
: CalcUnoApiTest("/sc/qa/extras/testdocuments")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
uno::Reference<uno::XInterface> ScDatabaseRangesObj::init()
|
||||||
|
{
|
||||||
|
// create a calc document
|
||||||
|
if (!mxComponent.is())
|
||||||
|
mxComponent = loadFromDesktop("private:factory/scalc");
|
||||||
|
CPPUNIT_ASSERT_MESSAGE("no calc document", mxComponent.is());
|
||||||
|
|
||||||
|
uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, UNO_QUERY_THROW);
|
||||||
|
uno::Reference<beans::XPropertySet> xPropSet(xDoc, UNO_QUERY_THROW);
|
||||||
|
|
||||||
|
uno::Reference<sheet::XDatabaseRanges> xDbRanges(xPropSet->getPropertyValue("DatabaseRanges"),
|
||||||
|
UNO_QUERY_THROW);
|
||||||
|
|
||||||
|
if (!xDbRanges->hasByName("DbRange"))
|
||||||
|
xDbRanges->addNewByName("DbRange", table::CellRangeAddress(0, 2, 4, 5, 6));
|
||||||
|
|
||||||
|
return xDbRanges;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScDatabaseRangesObj::setUp()
|
||||||
|
{
|
||||||
|
nTest++;
|
||||||
|
CPPUNIT_ASSERT(nTest <= NUMBER_OF_TESTS);
|
||||||
|
CalcUnoApiTest::setUp();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScDatabaseRangesObj::tearDown()
|
||||||
|
{
|
||||||
|
if (nTest == NUMBER_OF_TESTS)
|
||||||
|
{
|
||||||
|
closeDocument(mxComponent);
|
||||||
|
mxComponent.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
CalcUnoApiTest::tearDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
CPPUNIT_TEST_SUITE_REGISTRATION(ScDatabaseRangesObj);
|
||||||
|
|
||||||
|
} // end namespace
|
||||||
|
|
||||||
|
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||||
|
|
||||||
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|
@@ -56,6 +56,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\
|
|||||||
test/source/sheet/xcellseries \
|
test/source/sheet/xcellseries \
|
||||||
test/source/sheet/xgoalseek \
|
test/source/sheet/xgoalseek \
|
||||||
test/source/sheet/xdatabaserange \
|
test/source/sheet/xdatabaserange \
|
||||||
|
test/source/sheet/xdatabaseranges \
|
||||||
test/source/sheet/xdatapilotdescriptor \
|
test/source/sheet/xdatapilotdescriptor \
|
||||||
test/source/sheet/xdatapilotfield \
|
test/source/sheet/xdatapilotfield \
|
||||||
test/source/sheet/xdatapilotfieldgrouping \
|
test/source/sheet/xdatapilotfieldgrouping \
|
||||||
|
47
test/source/sheet/xdatabaseranges.cxx
Normal file
47
test/source/sheet/xdatabaseranges.cxx
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
/* -*- 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 <random>
|
||||||
|
|
||||||
|
#include <test/sheet/xdatabaseranges.hxx>
|
||||||
|
|
||||||
|
#include <com/sun/star/sheet/XDatabaseRanges.hpp>
|
||||||
|
#include <com/sun/star/table/CellRangeAddress.hpp>
|
||||||
|
#include <com/sun/star/uno/RuntimeException.hpp>
|
||||||
|
#include <com/sun/star/uno/Reference.hxx>
|
||||||
|
|
||||||
|
#include <cppunit/extensions/HelperMacros.h>
|
||||||
|
|
||||||
|
using namespace css;
|
||||||
|
using namespace css::uno;
|
||||||
|
|
||||||
|
namespace apitest
|
||||||
|
{
|
||||||
|
void XDatabaseRanges::testAddRemoveDbRanges()
|
||||||
|
{
|
||||||
|
uno::Reference<sheet::XDatabaseRanges> xDbRanges(init(), UNO_QUERY_THROW);
|
||||||
|
|
||||||
|
xDbRanges->addNewByName("addNewRange", table::CellRangeAddress(0, 1, 2, 3, 4));
|
||||||
|
CPPUNIT_ASSERT_MESSAGE("Unable to add new db range", xDbRanges->hasByName("addNewRange"));
|
||||||
|
|
||||||
|
CPPUNIT_ASSERT_THROW_MESSAGE(
|
||||||
|
"No execption thrown, when adding range with existing name",
|
||||||
|
xDbRanges->addNewByName("addNewRange", table::CellRangeAddress(0, 1, 2, 3, 4)),
|
||||||
|
css::uno::RuntimeException);
|
||||||
|
|
||||||
|
xDbRanges->removeByName("addNewRange");
|
||||||
|
CPPUNIT_ASSERT_MESSAGE("Unable to remove db range", !xDbRanges->hasByName("addNewRange"));
|
||||||
|
|
||||||
|
CPPUNIT_ASSERT_THROW_MESSAGE("No execption, when removing none-existing range",
|
||||||
|
xDbRanges->removeByName("addNewRange"),
|
||||||
|
css::uno::RuntimeException);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|
Reference in New Issue
Block a user