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.XViewPane;
29 import com.sun.star.table.CellRangeAddress;
30 
31 /**
32 * Testing <code>com.sun.star.sheet.XViewPane</code>
33 * interface methods :
34 * <ul>
35 *  <li><code> getFirstVisibleColumn()</code></li>
36 *  <li><code> setFirstVisibleColumn()</code></li>
37 *  <li><code> getFirstVisibleRow()</code></li>
38 *  <li><code> setFirstVisibleRow()</code></li>
39 *  <li><code> getVisibleRange()</code></li>
40 * </ul> <p>
41 * @see com.sun.star.sheet.XViewPane
42 */
43 public class _XViewPane extends MultiMethodTest {
44 
45     public XViewPane oObj = null;
46     int row = 3;
47     int col = 5;
48 
49     /**
50     * Test calls the method and checks returned value. <p>
51     * Has <b> OK </b> status if returned value is equal to value that was set
52     * by method <code>setFirstVisibleColumn()</code>. <p>
53     * The following method tests are to be completed successfully before :
54     * <ul>
55     *  <li> <code> setFirstVisibleColumn() </code> : to set specific value
56     *  of the first column that is visible in the pane </li>
57     * </ul>
58     */
_getFirstVisibleColumn()59     public void _getFirstVisibleColumn() {
60         requiredMethod("setFirstVisibleColumn()");
61         boolean result = col == oObj.getFirstVisibleColumn();
62         tRes.tested("getFirstVisibleColumn()", result);
63     }
64 
65     /**
66     * Test calls the method and checks returned value. <p>
67     * Has <b> OK </b> status if returned value is equal to value that was set
68     * by method <code>setFirstVisibleRow()</code>. <p>
69     * The following method tests are to be completed successfully before :
70     * <ul>
71     *  <li> <code> setFirstVisibleRow() </code> : to set specific value of
72     *  the first row that is visible in the pane </li>
73     * </ul>
74     */
_getFirstVisibleRow()75     public void _getFirstVisibleRow() {
76         requiredMethod("setFirstVisibleRow()");
77         boolean result = row == oObj.getFirstVisibleRow();
78         tRes.tested("getFirstVisibleRow()", result);
79     }
80 
81     /**
82     * Test just calls the method. <p>
83     * Has <b> OK </b> status if the method successfully returns. <p>
84     */
_setFirstVisibleColumn()85     public void _setFirstVisibleColumn() {
86         oObj.setFirstVisibleColumn(col);
87         tRes.tested("setFirstVisibleColumn()", true);
88     }
89 
90     /**
91     * Test just calls the method. <p>
92     * Has <b> OK </b> status if the method successfully returns. <p>
93     */
_setFirstVisibleRow()94     public void _setFirstVisibleRow() {
95         oObj.setFirstVisibleRow(row);
96         tRes.tested("setFirstVisibleRow()", true);
97     }
98 
99     /**
100     * Test calls the method, checks returned value and adds object relation
101     * 'DATAAREA' to test environment. <p>
102     * Has <b> OK </b> status if returned value isn't null and if start row and
103     * start column are equal to values that was set by methods
104     * <code>setFirstVisibleRow</code> and <code>setFirstVisibleColumn</code>.<p>
105     * The following method tests are to be completed successfully before :
106     * <ul>
107     *  <li> <code> setFirstVisibleRow() </code> : to set specific value of
108     *  the first row that is visible in the pane </li>
109     *  <li> <code> setFirstVisibleColumn() </code> : to set specific value of
110     *  the first column that is visible in the pane </li>
111     * </ul>
112     */
_getVisibleRange()113     public void _getVisibleRange() {
114         requiredMethod("setFirstVisibleRow()");
115         requiredMethod("setFirstVisibleColumn()");
116 
117         CellRangeAddress RA = oObj.getVisibleRange();
118         boolean result = RA != null;
119         if (result) {
120             result &= RA.Sheet == 0;
121             result &= RA.StartRow == row;
122             result &= RA.StartColumn == col;
123             tEnv.addObjRelation("DATAAREA", RA);
124         }
125 
126         tRes.tested("getVisibleRange()", result);
127     }
128 }
129 
130