13#include <com/sun/star/sheet/XSheetCellRangeContainer.hpp>
15#include <com/sun/star/uno/Reference.hxx>
16#include <com/sun/star/uno/Sequence.hxx>
18#include <cppunit/TestAssert.h>
27 uno::Reference<sheet::XSheetCellRangeContainer> xSCRC(
init(), UNO_QUERY_THROW);
28 xSCRC->removeRangeAddresses(xSCRC->getRangeAddresses());
31 sal_Int32 cnt = xSCRC->getCount();
32 xSCRC->addRangeAddress(aAddr[0],
false);
33 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Unable to add CellRangeAddress (count)", cnt + 1,
36 uno::Sequence<table::CellRangeAddress> aAfterAddAddr = xSCRC->getRangeAddresses();
37 cnt = xSCRC->getCount();
38 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Unable to add CellRangeAddress (entry)", aAddr[0],
39 aAfterAddAddr[cnt - 1]);
41 xSCRC->removeRangeAddress(aAddr[0]);
42 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Unable to remove CellRangeAddress (count)", cnt - 1,
45 const uno::Sequence<table::CellRangeAddress> aAfterRemoveAddr = xSCRC->getRangeAddresses();
46 for (
auto const& addr : aAfterRemoveAddr)
48 CPPUNIT_ASSERT_MESSAGE(
"Unable to remove CellRangeAddress (entry)", aAddr[0] != addr);
54 uno::Reference<sheet::XSheetCellRangeContainer> xSCRC(
init(), UNO_QUERY_THROW);
55 xSCRC->removeRangeAddresses(xSCRC->getRangeAddresses());
58 sal_Int32 cnt = xSCRC->getCount();
59 xSCRC->addRangeAddresses(aAddr,
false);
60 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Unable to add CellRangeAddress (count)", cnt + 2,
63 uno::Sequence<table::CellRangeAddress> aAfterAddAddr = xSCRC->getRangeAddresses();
64 cnt = xSCRC->getCount();
65 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Unable to add CellRangeAddresses (entry: first)", aAddr[0],
66 aAfterAddAddr[cnt - 2]);
67 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Unable to add CellRangeAddresses (entry: second)", aAddr[1],
68 aAfterAddAddr[cnt - 1]);
70 xSCRC->removeRangeAddresses(aAddr);
71 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Unable to remove CellRangeAddresses (count)", cnt - 2,
74 const uno::Sequence<table::CellRangeAddress> aAfterRemoveAddr = xSCRC->getRangeAddresses();
75 for (
auto const& addr : aAfterRemoveAddr)
77 CPPUNIT_ASSERT_MESSAGE(
"Unable to remove CellRangeAddresses (entry: first)",
79 CPPUNIT_ASSERT_MESSAGE(
"Unable to remove CellRangeAddresses (entry: second)",
86 uno::Sequence<table::CellRangeAddress> aAddr(2);
87 auto pAddr = aAddr.getArray();
88 for (
unsigned int i = 0;
i < 2;
i++)
91 pAddr[
i].StartColumn =
i;
92 pAddr[
i].StartRow =
i;
93 pAddr[
i].EndColumn =
i + 3;
94 pAddr[
i].EndRow =
i + 3;
virtual css::uno::Reference< css::uno::XInterface > init()=0
void testAddRemoveRangeAddress()
void testAddRemoveRangeAddresses()
static css::uno::Sequence< com::sun::star::table::CellRangeAddress > createCellRangeAddresses()