1*ef39d40dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*ef39d40dSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*ef39d40dSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*ef39d40dSAndrew Rist  * distributed with this work for additional information
6*ef39d40dSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*ef39d40dSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*ef39d40dSAndrew Rist  * "License"); you may not use this file except in compliance
9*ef39d40dSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*ef39d40dSAndrew Rist  *
11*ef39d40dSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*ef39d40dSAndrew Rist  *
13*ef39d40dSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*ef39d40dSAndrew Rist  * software distributed under the License is distributed on an
15*ef39d40dSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*ef39d40dSAndrew Rist  * KIND, either express or implied.  See the License for the
17*ef39d40dSAndrew Rist  * specific language governing permissions and limitations
18*ef39d40dSAndrew Rist  * under the License.
19*ef39d40dSAndrew Rist  *
20*ef39d40dSAndrew Rist  *************************************************************/
21*ef39d40dSAndrew Rist 
22*ef39d40dSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir package ifc.sheet;
25cdf0e10cSrcweir 
26cdf0e10cSrcweir import lib.MultiMethodTest;
27cdf0e10cSrcweir 
28cdf0e10cSrcweir import com.sun.star.sheet.GeneralFunction;
29cdf0e10cSrcweir import com.sun.star.sheet.SubTotalColumn;
30cdf0e10cSrcweir import com.sun.star.sheet.XSubTotalField;
31cdf0e10cSrcweir 
32cdf0e10cSrcweir /**
33cdf0e10cSrcweir * Testing <code>com.sun.star.sheet.XSubTotalField</code>
34cdf0e10cSrcweir * interface methods :
35cdf0e10cSrcweir * <ul>
36cdf0e10cSrcweir *  <li><code> getGroupColumn()</code></li>
37cdf0e10cSrcweir *  <li><code> setGroupColumn()</code></li>
38cdf0e10cSrcweir *  <li><code> getSubTotalColumns()</code></li>
39cdf0e10cSrcweir *  <li><code> setSubTotalColumns()</code></li>
40cdf0e10cSrcweir * </ul> <p>
41cdf0e10cSrcweir * @see com.sun.star.sheet.XSubTotalField
42cdf0e10cSrcweir */
43cdf0e10cSrcweir public class _XSubTotalField extends MultiMethodTest {
44cdf0e10cSrcweir 
45cdf0e10cSrcweir     public XSubTotalField oObj = null;
46cdf0e10cSrcweir     public int GroupColumn = 0;
47cdf0e10cSrcweir     public SubTotalColumn[] STColumns = null;
48cdf0e10cSrcweir 
49cdf0e10cSrcweir     /**
50cdf0e10cSrcweir     * Test calls the method, stores and checks returned value. <p>
51cdf0e10cSrcweir     * Has <b> OK </b> status if returned value isn't equal to zero. <p>
52cdf0e10cSrcweir     */
_getGroupColumn()53cdf0e10cSrcweir     public void _getGroupColumn() {
54cdf0e10cSrcweir         GroupColumn = oObj.getGroupColumn();
55cdf0e10cSrcweir         tRes.tested("getGroupColumn()", GroupColumn != 0);
56cdf0e10cSrcweir     } // end of getGroupColumn
57cdf0e10cSrcweir 
58cdf0e10cSrcweir     /**
59cdf0e10cSrcweir     * Test calls the method, stores and checks returned value. <p>
60cdf0e10cSrcweir     * Has <b> OK </b> status if returned value isn't null. <p>
61cdf0e10cSrcweir     */
_getSubTotalColumns()62cdf0e10cSrcweir     public void _getSubTotalColumns() {
63cdf0e10cSrcweir         STColumns = oObj.getSubTotalColumns();
64cdf0e10cSrcweir         tRes.tested("getSubTotalColumns()", STColumns != null);
65cdf0e10cSrcweir     } // end of getSubTotalColumns
66cdf0e10cSrcweir 
67cdf0e10cSrcweir     /**
68cdf0e10cSrcweir     * Test sets new value of the column by which entries are grouped,
69cdf0e10cSrcweir     * gets the current value and compares
70cdf0e10cSrcweir     * returned value with value that was stored by method
71cdf0e10cSrcweir     * <code>getGroupColumn()</code>. <p>
72cdf0e10cSrcweir     * Has <b> OK </b> status if values aren't equal. <p>
73cdf0e10cSrcweir     * The following method tests are to be completed successfully before :
74cdf0e10cSrcweir     * <ul>
75cdf0e10cSrcweir     *  <li> <code> getGroupColumn() </code> : to have the current column by
76cdf0e10cSrcweir     *  which entries are grouped </li>
77cdf0e10cSrcweir     * </ul>
78cdf0e10cSrcweir     */
_setGroupColumn()79cdf0e10cSrcweir     public void _setGroupColumn() {
80cdf0e10cSrcweir         requiredMethod("getGroupColumn()");
81cdf0e10cSrcweir         oObj.setGroupColumn(2);
82cdf0e10cSrcweir         tRes.tested("setGroupColumn()", GroupColumn != oObj.getGroupColumn());
83cdf0e10cSrcweir     } // end of getGroupColumn
84cdf0e10cSrcweir 
85cdf0e10cSrcweir     /**
86cdf0e10cSrcweir     * Test sets new value using method, gets the current value and compares
87cdf0e10cSrcweir     * returned value with value that was stored by method
88cdf0e10cSrcweir     * <code>getSubTotalColumns()</code>. <p>
89cdf0e10cSrcweir     * Has <b> OK </b> status if values aren't equal. <p>
90cdf0e10cSrcweir     * The following method tests are to be completed successfully before :
91cdf0e10cSrcweir     * <ul>
92cdf0e10cSrcweir     *  <li> <code> getSubTotalColumns() </code> : to have the current value</li>
93cdf0e10cSrcweir     * </ul>
94cdf0e10cSrcweir     */
_setSubTotalColumns()95cdf0e10cSrcweir     public void _setSubTotalColumns() {
96cdf0e10cSrcweir         requiredMethod("getSubTotalColumns()");
97cdf0e10cSrcweir         SubTotalColumn[] columns = new SubTotalColumn[2];
98cdf0e10cSrcweir         SubTotalColumn column = new SubTotalColumn();
99cdf0e10cSrcweir         column.Column=2;
100cdf0e10cSrcweir         column.Function=GeneralFunction.AVERAGE;
101cdf0e10cSrcweir         columns[0]=column;
102cdf0e10cSrcweir         columns[1]=STColumns[0];
103cdf0e10cSrcweir         oObj.setSubTotalColumns(columns);
104cdf0e10cSrcweir         tRes.tested(
105cdf0e10cSrcweir             "setSubTotalColumns()",
106cdf0e10cSrcweir             !STColumns.equals(oObj.getSubTotalColumns()) );
107cdf0e10cSrcweir     } // end of getSubTotalColumns
108cdf0e10cSrcweir 
109cdf0e10cSrcweir }  // finish class _XSubTotalField
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 
112