1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
30 import lib
.MultiPropertyTest
;
32 import com
.sun
.star
.text
.XTextColumns
;
33 import com
.sun
.star
.uno
.AnyConverter
;
34 import com
.sun
.star
.uno
.Type
;
37 * Testing <code>com.sun.star.text.TextSection</code>
38 * service properties :
40 * <li><code> Condition</code></li>
41 * <li><code> IsVisible</code></li>
42 * <li><code> IsProtected</code></li>
43 * <li><code> FileLink</code></li>
44 * <li><code> LinkRegion</code></li>
45 * <li><code> DDECommandType</code></li>
46 * <li><code> DDECommandFile</code></li>
47 * <li><code> DDECommandElement</code></li>
48 * <li><code> BackGraphicURL</code></li>
49 * <li><code> BackGraphicFilter</code></li>
50 * <li><code> BackGraphicLocation</code></li>
51 * <li><code> FootnoteIsCollectAtTextEnd</code></li>
52 * <li><code> FootnoteIsRestartNumbering</code></li>
53 * <li><code> FootnoteRestartNumberingAt</code></li>
54 * <li><code> FootnoteIsOwnNumbering</code></li>
55 * <li><code> FootnoteNumberingType</code></li>
56 * <li><code> FootnoteNumberingPrefix</code></li>
57 * <li><code> FootnoteNumberingSuffix</code></li>
58 * <li><code> EndnoteIsCollectAtTextEnd</code></li>
59 * <li><code> EndnoteIsRestartNumbering</code></li>
60 * <li><code> EndnoteRestartNumberingAt</code></li>
61 * <li><code> EndnoteIsOwnNumbering</code></li>
62 * <li><code> EndnoteNumberingType</code></li>
63 * <li><code> EndnoteNumberingPrefix</code></li>
64 * <li><code> EndnoteNumberingSuffix</code></li>
65 * <li><code> IsAutomaticUpdate</code></li>
67 * The following predefined files needed to complete the test:
69 * <li> <code>crazy-blue.jpg, space-metal.jpg</code> : are used for
70 * setting 'BackGraphicURL' property. </li>
72 * Properties testing is automated by <code>lib.MultiPropertyTest</code>.
73 * @see com.sun.star.text.TextSection
75 public class _TextSection
extends MultiPropertyTest
{
78 * Only image file URL can be used as a value.
80 public void _BackGraphicURL() {
81 log
.println("Testing with custom Property tester") ;
82 testProperty("BackGraphicURL",
83 util
.utils
.getFullTestURL("crazy-blue.jpg"),
84 util
.utils
.getFullTestURL("space-metal.jpg")) ;
88 * This property can be void, so if old value is <code> null </code>
89 * new value must be specified.
91 public void _FootnoteNumberingType() {
92 log
.println("Testing with custom Property tester") ;
93 testProperty("FootnoteNumberingType",
94 new Short(com
.sun
.star
.text
.FootnoteNumbering
.PER_DOCUMENT
),
95 new Short(com
.sun
.star
.text
.FootnoteNumbering
.PER_PAGE
)) ;
100 * Custom property tester for property <code>TextColumns</code>
102 protected PropertyTester TextColumnsTester
= new PropertyTester() {
104 protected Object
getNewValue(String propName
, Object oldValue
) {
105 XTextColumns TC
= null;
108 TC
= (XTextColumns
) tEnv
.getObjRelation("TC");
110 val2set
+= ((XTextColumns
) AnyConverter
.toObject(
111 new Type(XTextColumns
.class),oldValue
)).getColumnCount();
112 } catch (com
.sun
.star
.lang
.IllegalArgumentException iae
) {
113 log
.println("Couldn't change Column count");
115 TC
.setColumnCount(val2set
);
120 protected boolean compare(Object obj1
, Object obj2
) {
124 val1
= ((XTextColumns
) AnyConverter
.toObject(
125 new Type(XTextColumns
.class),obj1
)).getColumnCount();
126 val2
= ((XTextColumns
) AnyConverter
.toObject(
127 new Type(XTextColumns
.class),obj2
)).getColumnCount();
128 } catch (com
.sun
.star
.lang
.IllegalArgumentException iae
) {
129 log
.println("comparing values failed");
134 protected String
toString(Object obj
) {
135 return "XTextColumns: ColumnCount = "+
136 ((XTextColumns
) obj
).getColumnCount();
141 public void _TextColumns() {
142 log
.println("Testing with custom Property tester");
143 testProperty("TextColumns", TextColumnsTester
);
147 } //finish class _TextContent