Branch libreoffice-5-0-4
[LibreOffice.git] / qadevOOo / tests / java / ifc / sheet / _XConsolidationDescriptor.java
blobed82b68b21c84bdcd57a40482ffb0eeb06421ff1
1 /*
2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 package ifc.sheet;
21 import lib.MultiMethodTest;
22 import util.ValueComparer;
24 import com.sun.star.sheet.GeneralFunction;
25 import com.sun.star.sheet.XConsolidationDescriptor;
26 import com.sun.star.table.CellAddress;
27 import com.sun.star.table.CellRangeAddress;
29 /**
30 * Testing <code>com.sun.star.sheet.XConsolidationDescriptor</code>
31 * interface methods :
32 * <ul>
33 * <li><code> getFunction()</code></li>
34 * <li><code> setFunction()</code></li>
35 * <li><code> getSources()</code></li>
36 * <li><code> setSources()</code></li>
37 * <li><code> getStartOutputPosition()</code></li>
38 * <li><code> setStartOutputPosition()</code></li>
39 * <li><code> getUseColumnHeaders()</code></li>
40 * <li><code> setUseColumnHeaders()</code></li>
41 * <li><code> getUseRowHeaders()</code></li>
42 * <li><code> setUseRowHeaders()</code></li>
43 * <li><code> getInsertLinks()</code></li>
44 * <li><code> setInsertLinks()</code></li>
45 * </ul> <p>
46 * @see com.sun.star.sheet.XConsolidationDescriptor
48 public class _XConsolidationDescriptor extends MultiMethodTest {
50 public XConsolidationDescriptor oObj = null;
51 public GeneralFunction aFunction = null;
52 public boolean insertLinks = false;
53 public boolean useColumnHeaders = false;
54 public boolean useRowHeaders = false;
55 public CellRangeAddress[] CRaddr = null;
56 public CellAddress addr = null;
58 /**
59 * Test calls the method, stores and checks returned value. <p>
60 * Has <b> OK </b> status if returned value isn't null. <p>
62 public void _getFunction() {
63 aFunction = oObj.getFunction();
64 tRes.tested("getFunction()", aFunction != null );
67 /**
68 * Test calls the method and stores returned value. <p>
69 * Has <b> OK </b> status if the method successfully returns. <p>
71 public void _getInsertLinks() {
72 insertLinks = oObj.getInsertLinks();
73 tRes.tested("getInsertLinks()", true);
76 /**
77 * Test calls the method and stores returned value. <p>
78 * Has <b> OK </b> status if the method successfully returns. <p>
80 public void _getSources() {
81 CRaddr = oObj.getSources();
82 tRes.tested("getSources()", true);
85 /**
86 * Test calls the method and stores returned value. <p>
87 * Has <b> OK </b> status if the method successfully returns. <p>
89 public void _getStartOutputPosition() {
90 addr = oObj.getStartOutputPosition();
91 tRes.tested("getStartOutputPosition()", true);
94 /**
95 * Test calls the method and stores returned value. <p>
96 * Has <b> OK </b> status if the method successfully returns. <p>
98 public void _getUseColumnHeaders() {
99 useColumnHeaders = oObj.getUseColumnHeaders();
100 tRes.tested("getUseColumnHeaders()", true);
104 * Test calls the method and stores returned value. <p>
105 * Has <b> OK </b> status if the method successfully returns. <p>
107 public void _getUseRowHeaders() {
108 useRowHeaders = oObj.getUseRowHeaders();
109 tRes.tested("getUseRowHeaders()", true);
113 * Test sets the new current function, gets current function
114 * and compare function gotten by method <code>getFunction()</code> with
115 * function that was set. <p>
116 * Has <b> OK </b> status if the functions aren't equal. <p>
117 * The following method tests are to be completed successfully before :
118 * <ul>
119 * <li> <code> getFunction() </code> : to have current value of
120 * the function by which the ranges are consolidated </li>
121 * </ul>
123 public void _setFunction() {
124 requiredMethod("getFunction()");
125 GeneralFunction aFunction2 = null;
126 if (aFunction.equals(GeneralFunction.SUM)) {
127 aFunction2 = GeneralFunction.COUNT;
129 else {
130 aFunction2 = GeneralFunction.SUM;
132 oObj.setFunction(aFunction2);
133 aFunction2 = oObj.getFunction();
134 tRes.tested("setFunction()", !aFunction.equals(aFunction2));
138 * Test sets property to value that negative to the current value
139 * and compares returned value with value that was set. <p>
140 * Has <b> OK </b> status if returned value isn't equal to value that was
141 * stored by method <code>getInsertLinks()</code>. <p>
142 * The following method tests are to be completed successfully before :
143 * <ul>
144 * <li> <code> getInsertLinks() </code> : to have current value of
145 * this property </li>
146 * </ul>
148 public void _setInsertLinks() {
149 requiredMethod("getInsertLinks()");
150 oObj.setInsertLinks( !insertLinks );
151 boolean insertLinks2 = oObj.getInsertLinks();
152 tRes.tested("setInsertLinks()", insertLinks != insertLinks2);
156 * Test sets new cell ranges and compares cell ranges gotten by method
157 * <code>getSources()</code> with the cell range that was set. <p>
158 * Has <b> OK </b> status if returned value isn't equal to value that was
159 * stored by method <code>getSources()</code>. <p>
160 * The following method tests are to be completed successfully before :
161 * <ul>
162 * <li> <code> getSources() </code> : to have the cell ranges which
163 * are consolidated </li>
164 * </ul>
166 public void _setSources() {
167 requiredMethod("getSources()");
168 oObj.setSources(newCRaddr());
169 CellRangeAddress[] CRaddr2 = oObj.getSources();
170 tRes.tested("setSources()",!ValueComparer.equalValue(CRaddr, CRaddr2));
174 * Test sets new cell address for start output position and compares
175 * cell address gotten by method <code>getStartOutputPosition()</code>
176 * with the cell address that was set. <p>
177 * Has <b> OK </b> status if returned value isn't equal to value that was
178 * stored by method <code>getStartOutputPosition()</code>. <p>
179 * The following method tests are to be completed successfully before :
180 * <ul>
181 * <li> <code> getStartOutputPosition() </code> : to have the cell address
182 * of start output position </li>
183 * </ul>
185 public void _setStartOutputPosition() {
186 requiredMethod("getStartOutputPosition()");
187 CellAddress addr2 = new CellAddress();
188 addr2.Column = addr.Column + 1;
189 addr2.Row = addr.Row + 1;
190 oObj.setStartOutputPosition(addr2);
191 tRes.tested("setStartOutputPosition()",
192 !ValueComparer.equalValue(addr, addr2));
196 * Test sets property to value that negative to the current value
197 * and compares returned value with value that was set. <p>
198 * Has <b> OK </b> status if returned value isn't equal to value that was
199 * stored by method <code>getUseColumnHeaders()</code>. <p>
200 * The following method tests are to be completed successfully before :
201 * <ul>
202 * <li> <code> getUseColumnHeaders() </code> : to have current value of
203 * this property </li>
204 * </ul>
206 public void _setUseColumnHeaders() {
207 requiredMethod("getUseColumnHeaders()");
208 oObj.setUseColumnHeaders( !useColumnHeaders );
209 boolean uCH = oObj.getUseColumnHeaders();
210 tRes.tested("setUseColumnHeaders()", useColumnHeaders != uCH);
214 * Test sets property to value that negative to the current value
215 * and compares returned value with value that was set. <p>
216 * Has <b> OK </b> status if returned value isn't equal to value that was
217 * stored by method <code>getUseRowHeaders()</code>. <p>
218 * The following method tests are to be completed successfully before :
219 * <ul>
220 * <li> <code> getUseRowHeaders() </code> : to have current value of
221 * this property </li>
222 * </ul>
224 public void _setUseRowHeaders() {
225 requiredMethod("getUseRowHeaders()");
226 oObj.setUseRowHeaders(!useRowHeaders);
227 boolean uRH = oObj.getUseRowHeaders();
228 tRes.tested("setUseRowHeaders()", useRowHeaders != uRH );
232 * Constructs new cell range addresses using old cell range addresses.
233 * @return new cell range addresses
235 public CellRangeAddress[] newCRaddr() {
237 CellRangeAddress[] back = new CellRangeAddress[1];
239 CellRangeAddress cra1 = new CellRangeAddress();
240 cra1.EndColumn=5;
241 cra1.EndRow=5;
242 cra1.Sheet=(short)0;
243 cra1.StartColumn=1;
244 cra1.StartRow=1;
245 back[0]=cra1;
247 return back;
251 } // finish class _XConsolidationDescriptor