1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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/xarealink.hxx>
11 #include <test/cppunitasserthelper.hxx>
13 #include <com/sun/star/sheet/XAreaLink.hpp>
14 #include <com/sun/star/table/CellRangeAddress.hpp>
15 #include <com/sun/star/uno/Reference.hxx>
17 #include <cppunit/TestAssert.h>
19 using namespace com::sun::star
;
20 using namespace com::sun::star::uno
;
24 void XAreaLink::testSetDestArea()
26 uno::Reference
< sheet::XAreaLink
> xAreaLink(init(), UNO_QUERY_THROW
);
28 xAreaLink
->setDestArea(table::CellRangeAddress(1,3,4,5,8));
29 // After setting the destination area, the link is refreshed and the area
30 // is adjusted to the size of the source data.
31 // Only test the 'Sheet', 'StartCol', and 'StartRow'
32 table::CellRangeAddress aDestArea
= xAreaLink
->getDestArea();
33 CPPUNIT_ASSERT_EQUAL_MESSAGE("Couldn't set new DestArea (Sheet)", sal_Int16(1), aDestArea
.Sheet
);
34 CPPUNIT_ASSERT_EQUAL_MESSAGE("Couldn't set new DestArea (StartCol)", sal_Int32(3), aDestArea
.StartColumn
);
35 CPPUNIT_ASSERT_EQUAL_MESSAGE("Couldn't set new DestArea (StartRow)", sal_Int32(4), aDestArea
.StartRow
);
38 void XAreaLink::testSetSourceArea()
40 uno::Reference
< sheet::XAreaLink
> xAreaLink(init(), UNO_QUERY_THROW
);
42 xAreaLink
->setSourceArea("Sheet1.A1:B1");
43 CPPUNIT_ASSERT_EQUAL_MESSAGE("Couldn't set new source area",
44 OUString("Sheet1.A1:B1"), xAreaLink
->getSourceArea());
47 void XAreaLink::testGetDestArea()
49 uno::Reference
< sheet::XAreaLink
> xAreaLink(init(), UNO_QUERY_THROW
);
51 CPPUNIT_ASSERT_EQUAL_MESSAGE("Couldn't get dest area",
52 table::CellRangeAddress(1,2,3,3,6), xAreaLink
->getDestArea());
55 void XAreaLink::testGetSourceArea()
57 uno::Reference
< sheet::XAreaLink
> xAreaLink(init(), UNO_QUERY_THROW
);
59 CPPUNIT_ASSERT_EQUAL_MESSAGE("Couldn't get source area",
60 OUString("a2:b5"), xAreaLink
->getSourceArea());
65 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */