2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 package ifc
.inspection
;
21 import com
.sun
.star
.inspection
.PropertyCategoryDescriptor
;
22 import com
.sun
.star
.inspection
.XObjectInspectorModel
;
23 import lib
.MultiMethodTest
;
28 * Testing <code>com.sun.star.inspection.XObjectInspectorModel</code>
31 * <li><code> describeCategories()</code></li>
32 * <li><code> getHandlerFactories()</code></li>
33 * <li><code> getPropertyOrderIndex()</code></li>
35 * Test is <b> NOT </b> multithread compliant. <p>
38 public class _XObjectInspectorModel
extends MultiMethodTest
{
43 public XObjectInspectorModel oObj
= null;
46 * calls the method <CODE>getHandlerFactories()</CODE>
47 * Has <b>OK</b> status if returned value is not null.
49 public void _HandlerFactories() {
51 Object
[] HandlerFactories
= oObj
.getHandlerFactories();
53 tRes
.tested("HandlerFactories()", HandlerFactories
!= null) ;
57 * Call the method <CODE>getPropertyOrderIndex()</CODE> with an invalid property name.
58 * Has <CODE>OK</CODE> status if the returned index is "0".
60 public void _getPropertyOrderIndex() {
63 boolean result
= true;
65 log
.println("try to get index of Invalid property name 'InvalidPropertyName' ...");
66 index
= oObj
.getPropertyOrderIndex("InvalidPropertyName");
67 log
.println("index is: " + index
);
68 result
= (index
== 0);
70 tRes
.tested("getPropertyOrderIndex()", result
) ;
74 * Call the method <CODE>describeCategories()</CODE>
75 * Has <b>OK</b> status if returned value is not null.
77 public void _describeCategories() {
79 PropertyCategoryDescriptor
[] categories
= oObj
.describeCategories();
81 tRes
.tested("describeCategories()", categories
!= null) ;
85 * Call the method <CODE>getHasHelpSection()</CODE>
86 * Has <b>OK</b> status if method returned </CODE>true</CODE>
88 public void _HasHelpSection() {
90 boolean hasHelpSection
= oObj
.getHasHelpSection();
92 tRes
.tested("HasHelpSection()", hasHelpSection
) ;
96 * Call the method <CODE>getMinHelpTextLines()</CODE>
97 * Has <b>OK</b> status if returned value equals to object relation 'minHelpTextLines'
99 public void _MinHelpTextLines() {
101 Integer minHelpTextLines
= (Integer
) tEnv
.getObjRelation("minHelpTextLines");
103 int getMinHelpTextLines
= oObj
.getMinHelpTextLines();
105 boolean result
= (minHelpTextLines
.intValue() == getMinHelpTextLines
);
108 log
.println("FAILED: value:" + minHelpTextLines
+ " gotten value:" + getMinHelpTextLines
);
110 tRes
.tested("MinHelpTextLines()", result
) ;
114 * Call the method <CODE>getMaxHelpTextLines())</CODE>
115 * Has <b>OK</b> status if returned value equals to object relation 'maxHelpTextLines'
117 public void _MaxHelpTextLines() {
119 Integer maxHelpTextLines
= (Integer
) tEnv
.getObjRelation("maxHelpTextLines");
121 int getMaxHelpTextLines
= oObj
.getMaxHelpTextLines();
123 boolean result
= (maxHelpTextLines
.intValue() == getMaxHelpTextLines
);
126 log
.println("FAILED: expected value:" + maxHelpTextLines
+ " gotten value:" + getMaxHelpTextLines
);
128 tRes
.tested("MaxHelpTextLines()", result
);
131 public void _IsReadOnly() {
132 boolean readOnly
= oObj
.getIsReadOnly();
134 oObj
.setIsReadOnly(!readOnly
);
136 boolean result
= (readOnly
!= oObj
.getIsReadOnly());
138 log
.println("FAILED: could not change 'IsReadOnly' to value '" + !readOnly
+ "'");
141 oObj
.setIsReadOnly(readOnly
);
143 result
&= (readOnly
== oObj
.getIsReadOnly());
145 log
.println("FAILED: could not change back 'IsReadOnly' to value '" + !readOnly
+ "'");
148 tRes
.tested("IsReadOnly()", result
);