1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 package ifc.sheet;
29 
30 import lib.MultiMethodTest;
31 
32 import com.sun.star.sheet.GeneralFunction;
33 import com.sun.star.sheet.SubTotalColumn;
34 import com.sun.star.sheet.XSubTotalField;
35 
36 /**
37 * Testing <code>com.sun.star.sheet.XSubTotalField</code>
38 * interface methods :
39 * <ul>
40 *  <li><code> getGroupColumn()</code></li>
41 *  <li><code> setGroupColumn()</code></li>
42 *  <li><code> getSubTotalColumns()</code></li>
43 *  <li><code> setSubTotalColumns()</code></li>
44 * </ul> <p>
45 * @see com.sun.star.sheet.XSubTotalField
46 */
47 public class _XSubTotalField extends MultiMethodTest {
48 
49     public XSubTotalField oObj = null;
50     public int GroupColumn = 0;
51     public SubTotalColumn[] STColumns = null;
52 
53     /**
54     * Test calls the method, stores and checks returned value. <p>
55     * Has <b> OK </b> status if returned value isn't equal to zero. <p>
56     */
57     public void _getGroupColumn() {
58         GroupColumn = oObj.getGroupColumn();
59         tRes.tested("getGroupColumn()", GroupColumn != 0);
60     } // end of getGroupColumn
61 
62     /**
63     * Test calls the method, stores and checks returned value. <p>
64     * Has <b> OK </b> status if returned value isn't null. <p>
65     */
66     public void _getSubTotalColumns() {
67         STColumns = oObj.getSubTotalColumns();
68         tRes.tested("getSubTotalColumns()", STColumns != null);
69     } // end of getSubTotalColumns
70 
71     /**
72     * Test sets new value of the column by which entries are grouped,
73     * gets the current value and compares
74     * returned value with value that was stored by method
75     * <code>getGroupColumn()</code>. <p>
76     * Has <b> OK </b> status if values aren't equal. <p>
77     * The following method tests are to be completed successfully before :
78     * <ul>
79     *  <li> <code> getGroupColumn() </code> : to have the current column by
80     *  which entries are grouped </li>
81     * </ul>
82     */
83     public void _setGroupColumn() {
84         requiredMethod("getGroupColumn()");
85         oObj.setGroupColumn(2);
86         tRes.tested("setGroupColumn()", GroupColumn != oObj.getGroupColumn());
87     } // end of getGroupColumn
88 
89     /**
90     * Test sets new value using method, gets the current value and compares
91     * returned value with value that was stored by method
92     * <code>getSubTotalColumns()</code>. <p>
93     * Has <b> OK </b> status if values aren't equal. <p>
94     * The following method tests are to be completed successfully before :
95     * <ul>
96     *  <li> <code> getSubTotalColumns() </code> : to have the current value</li>
97     * </ul>
98     */
99     public void _setSubTotalColumns() {
100         requiredMethod("getSubTotalColumns()");
101         SubTotalColumn[] columns = new SubTotalColumn[2];
102         SubTotalColumn column = new SubTotalColumn();
103         column.Column=2;
104         column.Function=GeneralFunction.AVERAGE;
105         columns[0]=column;
106         columns[1]=STColumns[0];
107         oObj.setSubTotalColumns(columns);
108         tRes.tested(
109             "setSubTotalColumns()",
110             !STColumns.equals(oObj.getSubTotalColumns()) );
111     } // end of getSubTotalColumns
112 
113 }  // finish class _XSubTotalField
114 
115 
116