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 import util.ValueComparer;
28 
29 import com.sun.star.sheet.XLabelRange;
30 import com.sun.star.table.CellRangeAddress;
31 
32 /**
33 * Testing <code>com.sun.star.sheet.XLabelRange</code>
34 * interface methods :
35 * <ul>
36 *  <li><code> getLabelArea()</code></li>
37 *  <li><code> setLabelArea()</code></li>
38 *  <li><code> getDataArea()</code></li>
39 *  <li><code> setDataArea()</code></li>
40 * </ul> <p>
41 * @see com.sun.star.sheet.XLabelRange
42 */
43 public class _XLabelRange extends MultiMethodTest {
44 
45     public XLabelRange oObj = null;
46     public CellRangeAddress setDAddress = null;
47     public CellRangeAddress setLAddress = null;
48 
49     /**
50     * Test creates and stores <code>CellRangeAddress</code>, calls the method.
51     * <p>Has <b> OK </b> status if the method successfully returns. <p>
52     * @see com.sun.star.table.CellRangeAddress
53     */
_setDataArea()54     public void _setDataArea() {
55         int nr = Thread.activeCount();
56         setDAddress = new CellRangeAddress((short)1, nr, 1, nr, 8);
57         oObj.setDataArea(setDAddress);
58         tRes.tested("setDataArea()", true);
59     }
60 
61     /**
62     * Test creates and stores <code>CellRangeAddress</code>, calls the method.
63     * <p>Has <b> OK </b> status if the method successfully returns. <p>
64     * @see com.sun.star.table.CellRangeAddress
65     */
_setLabelArea()66     public void _setLabelArea() {
67         int nr = Thread.activeCount();
68         setLAddress = new CellRangeAddress((short)1, nr, 0, nr, 0);
69         oObj.setLabelArea(setLAddress);
70         tRes.tested("setLabelArea()", true);
71     }
72 
73     /**
74     * Test calls the method and compares returned value with value that was set.
75     * <p>Has <b> OK </b> status if values are equal. <p>
76     * The following method tests are to be completed successfully before :
77     * <ul>
78     *  <li> <code> setDataArea() </code> : to have address of the cell range for
79     *  which the labels are valid</li>
80     * </ul>
81     */
_getDataArea()82     public void _getDataArea() {
83         requiredMethod("setDataArea()");
84         CellRangeAddress gA = oObj.getDataArea();
85         tRes.tested("getDataArea()", ValueComparer.equalValue(gA, setDAddress));
86     }
87 
88     /**
89     * Test calls the method and compares returned value with value set before.
90     * <p>Has <b> OK </b> status if if values are equal. <p>
91     * The following method tests are to be completed successfully before :
92     * <ul>
93     *  <li> <code> setLabelArea() </code>: to have the cell range that contains
94     *  the labels</li>
95     * </ul>
96     */
_getLabelArea()97     public void _getLabelArea() {
98         requiredMethod("setLabelArea()");
99         CellRangeAddress gA1 = oObj.getLabelArea();
100         tRes.tested("getLabelArea()",
101             ValueComparer.equalValue(gA1, setLAddress));
102     }
103 }  // finish class _XLabelRange
104 
105 
106