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.text;
25 
26 import lib.MultiMethodTest;
27 
28 import com.sun.star.text.TextColumn;
29 import com.sun.star.text.XTextColumns;
30 
31 /**
32  * Testing <code>com.sun.star.text.XTextColumns</code>
33  * interface methods :
34  * <ul>
35  *  <li><code> getReferenceValue()</code></li>
36  *  <li><code> getColumnCount()</code></li>
37  *  <li><code> setColumnCount()</code></li>
38  *  <li><code> getColumns()</code></li>
39  *  <li><code> setColumns()</code></li>
40  * </ul> <p>
41  * Test is <b> NOT </b> multithread compilant. <p>
42  * @see com.sun.star.text.XTextColumns
43  */
44 public class _XTextColumns extends MultiMethodTest {
45 
46     public XTextColumns oObj = null;
47 
48     /**
49      * Test calls the method. <p>
50      * Has <b> OK </b> status if the method returns
51      * positive value.
52      */
_getColumnCount()53     public void _getColumnCount(){
54 
55         short howmuch = oObj.getColumnCount();
56         tRes.tested("getColumnCount()",howmuch >=0);
57     }
58 
59     /**
60      * Test calls the method. <p>
61      * Has <b> OK </b> status if the method returns not
62      * <code>null</code> value.
63      */
_getColumns()64     public void _getColumns(){
65         TextColumn[] cols = oObj.getColumns();
66         tRes.tested("getColumns()",cols != null);
67     }
68 
69     /**
70      * Test calls the method. <p>
71      * Has <b> OK </b> status if the method returns
72      * positive value.
73      */
_getReferenceValue()74     public void _getReferenceValue(){
75 
76         int ref = oObj.getReferenceValue();
77         tRes.tested("getReferenceValue()",ref >0);
78     }
79 
80     /**
81      * Sets the column count property to some value
82      * then checks it by <code>getColumnCount</code> method. <p>
83      *
84      * Has <b>OK</b> status if set and get values are equal.
85      */
_setColumnCount()86     public void _setColumnCount(){
87 
88         oObj.setColumnCount((short) 3);
89         short howmuch = oObj.getColumnCount();
90         tRes.tested("setColumnCount()",howmuch == 3);
91     }
92 
93     /**
94      * Sets columns to some array
95      * then checks it by <code>getColumns</code> method. <p>
96      *
97      * Has <b>OK</b> status if set and get arays are equal.
98      */
_setColumns()99     public void _setColumns(){
100 
101         TextColumn newCol = new TextColumn(5,1,1);
102         TextColumn[] cols = {newCol};
103         oObj.setColumns(cols);
104         TextColumn[] gCols = oObj.getColumns();
105         tRes.tested("setColumns()",util.ValueComparer.equalValue(cols, gCols));
106     }
107 
108 }  // finish class _XTextColumns
109 
110 
111