1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 #include <test/sheet/xcellrangedata.hxx>
11 #include <com/sun/star/sheet/XCellRangeData.hpp>
13 #include "cppunit/extensions/HelperMacros.h"
16 using namespace css::uno
;
22 void setValues(uno::Sequence
< uno::Sequence
< Any
> >& rColRow
, double nOffset
)
24 for (sal_Int32 i
= 0; i
< 4; ++i
)
26 rColRow
[i
].realloc(4);
27 for (sal_Int32 j
= 0; j
< 4; ++j
)
29 Any
& aAny
= rColRow
[i
][j
];
30 double nValue
= i
+ j
+ nOffset
;
38 void XCellRangeData::testSetDataArray()
40 uno::Reference
< sheet::XCellRangeData
> xCellRangeData( getXCellRangeData(), UNO_QUERY_THROW
);
42 uno::Sequence
< uno::Sequence
< Any
> > aColRow
;
44 setValues(aColRow
, 1);
45 xCellRangeData
->setDataArray(aColRow
);
46 // need to check here for correct values
49 setValues(aColRow
, 0);
50 xCellRangeData
->setDataArray(aColRow
);
53 void XCellRangeData::testGetDataArray()
55 uno::Reference
< sheet::XCellRangeData
> xCellRangeData( getXCellRangeData(), UNO_QUERY_THROW
);
56 uno::Sequence
< uno::Sequence
< Any
> > aColRow
= xCellRangeData
->getDataArray();
57 for ( sal_Int32 i
= 0; i
< aColRow
.getLength(); ++i
)
59 for ( sal_Int32 j
= 0; j
< aColRow
[i
].getLength(); ++j
)
61 Any
& aAny
= aColRow
[i
][j
];
63 CPPUNIT_ASSERT( aAny
>>= nValue
);
64 CPPUNIT_ASSERT_DOUBLES_EQUAL(static_cast<double>(i
+j
), nValue
, 0.000001);
71 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */