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