merge the formfield patch from ooo-build
[ooovba.git] / qadevOOo / tests / java / ifc / table / _TableColumn.java
blobb6ac50384595705cdcb286f499c6282f3e6fcb22
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: _TableColumn.java,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 package ifc.table;
33 import lib.MultiPropertyTest;
34 import util.ValueComparer;
36 import com.sun.star.table.XCellRange;
37 import com.sun.star.uno.UnoRuntime;
38 import com.sun.star.uno.XInterface;
40 /**
41 * Testing <code>com.sun.star.table.TableColumn</code>
42 * service properties :
43 * <ul>
44 * <li><code> Width</code></li>
45 * <li><code> OptimalWidth</code></li>
46 * <li><code> IsVisible</code></li>
47 * <li><code> IsStartOfNewPage</code></li>
48 * </ul> <p>
49 * Properties testing is automated by <code>lib.MultiPropertyTest</code>.
50 * @see com.sun.star.table.TableColumn
52 public class _TableColumn extends MultiPropertyTest {
54 public void _OptimalWidth() {
55 boolean res = false;
56 try {
57 XInterface tObject = tEnv.getTestObject();
58 XCellRange aRange = (XCellRange)
59 UnoRuntime.queryInterface(XCellRange.class, tObject);
60 aRange.getCellByPosition(0,0).setFormula("Thats a pretty long text");
61 Object width_before = oObj.getPropertyValue("Width");
62 log.println("Before setting to optimal width: "+width_before);
63 oObj.setPropertyValue("OptimalWidth", new Boolean(true));
64 Object width_after = oObj.getPropertyValue("Width");
65 log.println("After setting to optimal width: "+width_after);
66 res = ! ValueComparer.equalValue(width_before,width_after);
67 } catch (Exception e) {
68 res = false;
69 e.printStackTrace(log);
72 tRes.tested("OptimalWidth",res );
75 } //finish class _TableColumn