1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: _XObjectInspectorModel.java,v $
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
.inspection
;
33 import com
.sun
.star
.inspection
.PropertyCategoryDescriptor
;
34 import com
.sun
.star
.inspection
.XObjectInspectorModel
;
35 import lib
.MultiMethodTest
;
40 * Testing <code>com.sun.star.inspection.XObjectInspectorModel</code>
43 * <li><code> describeCategories()</code></li>
44 * <li><code> getHandlerFactories()</code></li>
45 * <li><code> getPropertyOrderIndex()</code></li>
47 * Test is <b> NOT </b> multithread compilant. <p>
50 public class _XObjectInspectorModel
extends MultiMethodTest
{
55 public XObjectInspectorModel oObj
= null;
58 * calls the method <CODE>getHandlerFactories()</CODE>
59 * Has <b>OK</b> status if returned value is not null.
61 public void _HandlerFactories() {
63 Object
[] HandlerFactories
= oObj
.getHandlerFactories();
65 tRes
.tested("HandlerFactories()", HandlerFactories
!= null) ;
69 * Call the method <CODE>getPropertyOrderIndex()</CODE> with an invalid propety name.
70 * Has <CODE>OK</CODE> status if the returned index is "0".
72 public void _getPropertyOrderIndex() {
75 boolean result
= true;
77 log
.println("try to get index of INvalid property name 'InvalidPropertyName' ...");
78 index
= oObj
.getPropertyOrderIndex("InvalidPropertyName");
79 log
.println("index is: " + index
);
80 result
= (index
== 0);
82 tRes
.tested("getPropertyOrderIndex()", result
) ;
86 * Call the method <CODE>describeCategories()</CODE>
87 * Has <b>OK</b> status if returned value is not null.
89 public void _describeCategories() {
91 PropertyCategoryDescriptor
[] categories
= oObj
.describeCategories();
93 tRes
.tested("describeCategories()", categories
!= null) ;
97 * Call the method <CODE>getHasHelpSection()</CODE>
98 * Has <b>OK</b> status if method returned </CODE>true</CODE>
100 public void _HasHelpSection() {
102 boolean hasHelpSection
= oObj
.getHasHelpSection();
104 tRes
.tested("HasHelpSection()", hasHelpSection
) ;
108 * Call the method <CODE>getMinHelpTextLines()</CODE>
109 * Has <b>OK</b> status if returned value equals to object relation 'minHelpTextLines'
111 public void _MinHelpTextLines() {
113 Integer minHelpTextLines
= (Integer
) tEnv
.getObjRelation("minHelpTextLines");
115 int getMinHelpTextLines
= oObj
.getMinHelpTextLines();
117 boolean result
= (minHelpTextLines
.intValue() == getMinHelpTextLines
);
120 log
.println("FAILED: value:" + minHelpTextLines
+ " getted value:" + getMinHelpTextLines
);
122 tRes
.tested("MinHelpTextLines()", result
) ;
126 * Call the method <CODE>getMaxHelpTextLines())</CODE>
127 * Has <b>OK</b> status if returned value equals to object relation 'maxHelpTextLines'
129 public void _MaxHelpTextLines() {
131 Integer maxHelpTextLines
= (Integer
) tEnv
.getObjRelation("maxHelpTextLines");
133 int getMaxHelpTextLines
= oObj
.getMaxHelpTextLines();
135 boolean result
= (maxHelpTextLines
.intValue() == getMaxHelpTextLines
);
138 log
.println("FAILED: expected value:" + maxHelpTextLines
+ " getted value:" + getMaxHelpTextLines
);
140 tRes
.tested("MaxHelpTextLines()", result
);
143 public void _IsReadOnly() {
144 boolean readOnly
= oObj
.getIsReadOnly();
146 oObj
.setIsReadOnly(!readOnly
);
148 boolean result
= (readOnly
!= oObj
.getIsReadOnly());
150 log
.println("FAILED: could not change 'IsReadOnly' to value '" + !readOnly
+ "'");
153 oObj
.setIsReadOnly(readOnly
);
155 result
&= (readOnly
== oObj
.getIsReadOnly());
157 log
.println("FAILED: could not change back 'IsReadOnly' to value '" + !readOnly
+ "'");
160 tRes
.tested("IsReadOnly()", result
);