12#include <com/sun/star/sheet/XCellRangeData.hpp>
13#include <com/sun/star/uno/Any.hxx>
14#include <com/sun/star/uno/Reference.hxx>
15#include <com/sun/star/uno/RuntimeException.hpp>
16#include <com/sun/star/uno/Sequence.hxx>
18#include <cppunit/TestAssert.h>
21using namespace css::uno;
27void setValues(uno::Sequence< uno::Sequence < Any > >& rColRow,
double nOffset)
29 auto pColRow = rColRow.getArray();
30 for (sal_Int32 i = 0;
i < 4; ++
i)
32 pColRow[
i].realloc(4);
33 auto pCol = pColRow[
i].getArray();
34 for (sal_Int32 j = 0; j < 4; ++j)
37 double nValue =
i + j + nOffset;
47 uno::Reference< sheet::XCellRangeData > xCellRangeData(
getXCellRangeData(), UNO_QUERY_THROW);
49 uno::Sequence< uno::Sequence < Any > > aColRow(4);
50 setValues(aColRow, 1);
51 xCellRangeData->setDataArray(aColRow);
53 for ( sal_Int32
i = 0;
i < aColRow.getLength(); ++
i)
55 for ( sal_Int32 j = 0; j < aColRow[
i].getLength(); ++j)
57 const Any& aAny = aColRow[
i][j];
59 CPPUNIT_ASSERT( aAny >>=
nValue);
60 CPPUNIT_ASSERT_DOUBLES_EQUAL(
static_cast<double>(
i+j+1),
nValue, 0.000001);
65 setValues(aColRow, 0);
66 xCellRangeData->setDataArray(aColRow);
71 uno::Reference< sheet::XCellRangeData > xCellRangeData(
getXCellRangeData(), UNO_QUERY_THROW);
72 uno::Sequence< uno::Sequence < Any > > aColRow = xCellRangeData->getDataArray();
73 CPPUNIT_ASSERT(aColRow.hasElements());
78 uno::Reference< sheet::XCellRangeData > xCellRangeData(
getXCellRangeData(), UNO_QUERY_THROW);
79 CPPUNIT_ASSERT_THROW_MESSAGE(
"No RuntimeException thrown", xCellRangeData->getDataArray(),
80 css::uno::RuntimeException);
85 uno::Reference< sheet::XCellRangeData > xCellRangeData(
getXCellRangeData(), UNO_QUERY_THROW);
87 uno::Sequence< uno::Sequence < Any > > aColRow;
89 setValues(aColRow, 1);
90 CPPUNIT_ASSERT_THROW_MESSAGE(
"No RuntimeException thrown", xCellRangeData->setDataArray(aColRow),
91 css::uno::RuntimeException);
void testSetDataArrayOnTableSheet()
void testGetDataArrayOnTableSheet()
virtual css::uno::Reference< css::uno::XInterface > getXCellRangeData()=0