bump product version to 7.2.5.1
[LibreOffice.git] / test / source / sheet / xconsolidationdescriptor.cxx
blob455533c2369548dca08e1301904a9e117178170c
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.
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 */
10 #include <test/sheet/xconsolidationdescriptor.hxx>
11 #include <test/cppunitasserthelper.hxx>
13 #include <com/sun/star/sheet/GeneralFunction.hpp>
14 #include <com/sun/star/sheet/XConsolidationDescriptor.hpp>
15 #include <com/sun/star/table/CellAddress.hpp>
16 #include <com/sun/star/table/CellRangeAddress.hpp>
17 #include <com/sun/star/uno/Reference.hxx>
18 #include <com/sun/star/uno/Sequence.hxx>
20 #include <cppunit/TestAssert.h>
22 using namespace css;
23 using namespace css::uno;
25 namespace apitest
27 void XConsolidationDescriptor::testGetFunction()
29 uno::Reference<sheet::XConsolidationDescriptor> xConsolidationDescriptor(init(),
30 UNO_QUERY_THROW);
32 CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get function", sheet::GeneralFunction_SUM,
33 xConsolidationDescriptor->getFunction());
36 void XConsolidationDescriptor::testSetFunction()
38 uno::Reference<sheet::XConsolidationDescriptor> xConsolidationDescriptor(init(),
39 UNO_QUERY_THROW);
41 xConsolidationDescriptor->setFunction(sheet::GeneralFunction_COUNT);
42 CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set function", sheet::GeneralFunction_COUNT,
43 xConsolidationDescriptor->getFunction());
46 void XConsolidationDescriptor::testGetSources()
48 uno::Reference<sheet::XConsolidationDescriptor> xConsolidationDescriptor(init(),
49 UNO_QUERY_THROW);
51 uno::Sequence<table::CellRangeAddress> aSources = xConsolidationDescriptor->getSources();
52 CPPUNIT_ASSERT_MESSAGE("Unable to get sources", !aSources.hasElements());
55 void XConsolidationDescriptor::testSetSources()
57 uno::Reference<sheet::XConsolidationDescriptor> xConsolidationDescriptor(init(),
58 UNO_QUERY_THROW);
60 uno::Sequence<table::CellRangeAddress> aSources(1);
61 aSources[0] = table::CellRangeAddress(0, 1, 1, 5, 5);
62 xConsolidationDescriptor->setSources(aSources);
63 CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set sources", table::CellRangeAddress(0, 1, 1, 5, 5),
64 xConsolidationDescriptor->getSources()[0]);
67 void XConsolidationDescriptor::testGetStartOutputPosition()
69 uno::Reference<sheet::XConsolidationDescriptor> xConsolidationDescriptor(init(),
70 UNO_QUERY_THROW);
72 CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get start output position", table::CellAddress(0, 0, 0),
73 xConsolidationDescriptor->getStartOutputPosition());
76 void XConsolidationDescriptor::testSetStartOutputPosition()
78 uno::Reference<sheet::XConsolidationDescriptor> xConsolidationDescriptor(init(),
79 UNO_QUERY_THROW);
81 xConsolidationDescriptor->setStartOutputPosition(table::CellAddress(0, 1, 2));
82 CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set start output position", table::CellAddress(0, 1, 2),
83 xConsolidationDescriptor->getStartOutputPosition());
86 void XConsolidationDescriptor::testGetUseColumnHeaders()
88 uno::Reference<sheet::XConsolidationDescriptor> xConsolidationDescriptor(init(),
89 UNO_QUERY_THROW);
91 CPPUNIT_ASSERT_MESSAGE("Unable to get use column headers",
92 !xConsolidationDescriptor->getUseColumnHeaders());
95 void XConsolidationDescriptor::testSetUseColumnHeaders()
97 uno::Reference<sheet::XConsolidationDescriptor> xConsolidationDescriptor(init(),
98 UNO_QUERY_THROW);
100 xConsolidationDescriptor->setUseColumnHeaders(true);
101 CPPUNIT_ASSERT_MESSAGE("Unable to set use column headers",
102 xConsolidationDescriptor->getUseColumnHeaders());
105 void XConsolidationDescriptor::testGetUseRowHeaders()
107 uno::Reference<sheet::XConsolidationDescriptor> xConsolidationDescriptor(init(),
108 UNO_QUERY_THROW);
110 CPPUNIT_ASSERT_MESSAGE("Unable to get use row headers",
111 !xConsolidationDescriptor->getUseRowHeaders());
114 void XConsolidationDescriptor::testSetUseRowHeaders()
116 uno::Reference<sheet::XConsolidationDescriptor> xConsolidationDescriptor(init(),
117 UNO_QUERY_THROW);
119 xConsolidationDescriptor->setUseRowHeaders(true);
120 CPPUNIT_ASSERT_MESSAGE("Unable to set use row headers",
121 xConsolidationDescriptor->getUseRowHeaders());
124 void XConsolidationDescriptor::testGetInsertLinks()
126 uno::Reference<sheet::XConsolidationDescriptor> xConsolidationDescriptor(init(),
127 UNO_QUERY_THROW);
129 CPPUNIT_ASSERT_MESSAGE("Unable to get use insert links",
130 !xConsolidationDescriptor->getInsertLinks());
133 void XConsolidationDescriptor::testSetInsertLinks()
135 uno::Reference<sheet::XConsolidationDescriptor> xConsolidationDescriptor(init(),
136 UNO_QUERY_THROW);
138 xConsolidationDescriptor->setInsertLinks(true);
139 CPPUNIT_ASSERT_MESSAGE("Unable to set use insert links",
140 xConsolidationDescriptor->getInsertLinks());
144 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */