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.table;
25 
26 import lib.MultiPropertyTest;
27 import util.ValueComparer;
28 
29 import com.sun.star.table.XCellRange;
30 import com.sun.star.uno.UnoRuntime;
31 import com.sun.star.uno.XInterface;
32 
33 /**
34 * Testing <code>com.sun.star.table.TableColumn</code>
35 * service properties :
36 * <ul>
37 *  <li><code> Width</code></li>
38 *  <li><code> OptimalWidth</code></li>
39 *  <li><code> IsVisible</code></li>
40 *  <li><code> IsStartOfNewPage</code></li>
41 * </ul> <p>
42 * Properties testing is automated by <code>lib.MultiPropertyTest</code>.
43 * @see com.sun.star.table.TableColumn
44 */
45 public class _TableColumn extends MultiPropertyTest {
46 
_OptimalWidth()47     public void _OptimalWidth() {
48         boolean res = false;
49         try {
50             XInterface tObject = tEnv.getTestObject();
51             XCellRange aRange = (XCellRange)
52                     UnoRuntime.queryInterface(XCellRange.class, tObject);
53             aRange.getCellByPosition(0,0).setFormula("Thats a pretty long text");
54             Object width_before = oObj.getPropertyValue("Width");
55             log.println("Before setting to optimal width: "+width_before);
56             oObj.setPropertyValue("OptimalWidth", new Boolean(true));
57             Object width_after = oObj.getPropertyValue("Width");
58             log.println("After setting to optimal width: "+width_after);
59             res = ! ValueComparer.equalValue(width_before,width_after);
60         } catch (Exception e) {
61            res = false;
62            e.printStackTrace(log);
63         }
64 
65         tRes.tested("OptimalWidth",res );
66     }
67 
68 } //finish class _TableColumn
69 
70 
71