Version 3.6.0.4, tag libreoffice-3.6.0.4
[LibreOffice.git] / qadevOOo / tests / java / ifc / inspection / _XObjectInspectorModel.java
blobe03cb51a1c5f27e4c1132c684a05f85ca9c52599
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 ************************************************************************/
28 package ifc.inspection;
30 import com.sun.star.inspection.PropertyCategoryDescriptor;
31 import com.sun.star.inspection.XObjectInspectorModel;
32 import lib.MultiMethodTest;
36 /**
37 * Testing <code>com.sun.star.inspection.XObjectInspectorModel</code>
38 * interface methods :
39 * <ul>
40 * <li><code> describeCategories()</code></li>
41 * <li><code> getHandlerFactories()</code></li>
42 * <li><code> getPropertyOrderIndex()</code></li>
43 * </ul> <p>
44 * Test is <b> NOT </b> multithread compilant. <p>
47 public class _XObjectInspectorModel extends MultiMethodTest {
49 /**
50 * the test object
52 public XObjectInspectorModel oObj = null;
54 /**
55 * calls the method <CODE>getHandlerFactories()</CODE>
56 * Has <b>OK</b> status if returned value is not null.
58 public void _HandlerFactories() {
60 Object[] HandlerFactories = oObj.getHandlerFactories();
62 tRes.tested("HandlerFactories()", HandlerFactories != null) ;
65 /**
66 * Call the method <CODE>getPropertyOrderIndex()</CODE> with an invalid propety name.
67 * Has <CODE>OK</CODE> status if the returned index is "0".
69 public void _getPropertyOrderIndex() {
71 int index = 0;
72 boolean result = true;
74 log.println("try to get index of INvalid property name 'InvalidPropertyName' ...");
75 index = oObj.getPropertyOrderIndex("InvalidPropertyName");
76 log.println("index is: " + index);
77 result = (index == 0);
79 tRes.tested("getPropertyOrderIndex()", result) ;
82 /**
83 * Call the method <CODE>describeCategories()</CODE>
84 * Has <b>OK</b> status if returned value is not null.
86 public void _describeCategories() {
88 PropertyCategoryDescriptor[] categories = oObj.describeCategories();
90 tRes.tested("describeCategories()", categories != null) ;
93 /**
94 * Call the method <CODE>getHasHelpSection()</CODE>
95 * Has <b>OK</b> status if method returned </CODE>true</CODE>
97 public void _HasHelpSection() {
99 boolean hasHelpSection = oObj.getHasHelpSection();
101 tRes.tested("HasHelpSection()", hasHelpSection) ;
105 * Call the method <CODE>getMinHelpTextLines()</CODE>
106 * Has <b>OK</b> status if returned value equals to object relation 'minHelpTextLines'
108 public void _MinHelpTextLines() {
110 Integer minHelpTextLines = (Integer) tEnv.getObjRelation("minHelpTextLines");
112 int getMinHelpTextLines = oObj.getMinHelpTextLines();
114 boolean result = (minHelpTextLines.intValue() == getMinHelpTextLines);
116 if (!result)
117 log.println("FAILED: value:" + minHelpTextLines + " getted value:" + getMinHelpTextLines);
119 tRes.tested("MinHelpTextLines()", result) ;
123 * Call the method <CODE>getMaxHelpTextLines())</CODE>
124 * Has <b>OK</b> status if returned value equals to object relation 'maxHelpTextLines'
126 public void _MaxHelpTextLines() {
128 Integer maxHelpTextLines = (Integer) tEnv.getObjRelation("maxHelpTextLines");
130 int getMaxHelpTextLines = oObj.getMaxHelpTextLines();
132 boolean result = (maxHelpTextLines.intValue() == getMaxHelpTextLines);
134 if (!result)
135 log.println("FAILED: expected value:" + maxHelpTextLines + " getted value:" + getMaxHelpTextLines);
137 tRes.tested("MaxHelpTextLines()", result);
140 public void _IsReadOnly() {
141 boolean readOnly = oObj.getIsReadOnly();
143 oObj.setIsReadOnly(!readOnly);
145 boolean result = (readOnly != oObj.getIsReadOnly());
146 if (!result){
147 log.println("FAILED: could not change 'IsReadOnly' to value '" + !readOnly + "'");
150 oObj.setIsReadOnly(readOnly);
152 result &= (readOnly == oObj.getIsReadOnly());
153 if (!result){
154 log.println("FAILED: could not change back 'IsReadOnly' to value '" + !readOnly + "'");
157 tRes.tested("IsReadOnly()", result);