12#include <com/sun/star/sheet/XDatabaseRanges.hpp>
13#include <com/sun/star/table/CellRangeAddress.hpp>
14#include <com/sun/star/uno/RuntimeException.hpp>
15#include <com/sun/star/uno/Reference.hxx>
17#include <cppunit/TestAssert.h>
20using namespace css::uno;
26 uno::Reference<sheet::XDatabaseRanges> xDbRanges(
init(), UNO_QUERY_THROW);
28 xDbRanges->addNewByName(
"addNewRange", table::CellRangeAddress(0, 1, 2, 3, 4));
29 CPPUNIT_ASSERT_MESSAGE(
"Unable to add new db range", xDbRanges->hasByName(
"addNewRange"));
31 CPPUNIT_ASSERT_THROW_MESSAGE(
32 "No exception thrown, when adding range with existing name",
33 xDbRanges->addNewByName(
"addNewRange", table::CellRangeAddress(0, 1, 2, 3, 4)),
34 css::uno::RuntimeException);
36 xDbRanges->removeByName(
"addNewRange");
37 CPPUNIT_ASSERT_MESSAGE(
"Unable to remove db range", !xDbRanges->hasByName(
"addNewRange"));
39 CPPUNIT_ASSERT_THROW_MESSAGE(
"No exception, when removing none-existing range",
40 xDbRanges->removeByName(
"addNewRange"),
41 css::uno::RuntimeException);
virtual css::uno::Reference< css::uno::XInterface > init()=0
void testAddRemoveDbRanges()