LibreOffice Module test (master) 1
xarealink.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 */
9
12
13#include <com/sun/star/sheet/XAreaLink.hpp>
14#include <com/sun/star/table/CellRangeAddress.hpp>
15#include <com/sun/star/uno/Reference.hxx>
16
17#include <cppunit/TestAssert.h>
18
19using namespace com::sun::star;
20using namespace com::sun::star::uno;
21
22namespace apitest {
23
25{
26 uno::Reference< sheet::XAreaLink > xAreaLink(init(), UNO_QUERY_THROW);
27
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);
36}
37
39{
40 uno::Reference< sheet::XAreaLink > xAreaLink(init(), UNO_QUERY_THROW);
41
42 xAreaLink->setSourceArea("Sheet1.A1:B1");
43 CPPUNIT_ASSERT_EQUAL_MESSAGE("Couldn't set new source area",
44 OUString("Sheet1.A1:B1"), xAreaLink->getSourceArea());
45}
46
48{
49 uno::Reference< sheet::XAreaLink > xAreaLink(init(), UNO_QUERY_THROW);
50
51 CPPUNIT_ASSERT_EQUAL_MESSAGE("Couldn't get dest area",
52 table::CellRangeAddress(1,2,3,3,6), xAreaLink->getDestArea());
53}
54
56{
57 uno::Reference< sheet::XAreaLink > xAreaLink(init(), UNO_QUERY_THROW);
58
59 CPPUNIT_ASSERT_EQUAL_MESSAGE("Couldn't get source area",
60 OUString("a2:b5"), xAreaLink->getSourceArea());
61}
62
63}
64
65/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */