merge the formfield patch from ooo-build
[ooovba.git] / qadevOOo / tests / java / ifc / text / _NumberingLevel.java
blob2cf2a28e972963208394ba9b48800091902c85bb
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: _NumberingLevel.java,v $
10 * $Revision: 1.3 $
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.text;
33 import com.sun.star.beans.PropertyValue;
34 import java.util.Enumeration;
35 import java.util.Hashtable;
36 import lib.StatusException;
37 import lib.TestParameters;
38 import share.LogWriter;
41 /**
42 * Testing <code>com.sun.star.text.NumberingLevel</code><p>
43 * This service is currently konwn as property value of
44 * com.sun.star.text.ParagraphProperties.NumberingRules
45 * This test checks only for completnes of implemented properties.
46 * service properties :
47 * <ul>
48 * <li><code> Adjust</code></li>
49 * <li><code> ParentNumbering</code></li>
50 * <li><code> Prefix</code></li>
51 * <li><code> Suffix</code></li>
52 * <li><code> CharStyleName</code></li>
53 * <li><code> BulletId</code></li>
54 * <li><code> BulletChar</code></li>
55 * <li><code> BulletFontName</code></li>
56 * <li><code> BulletFont</code></li>
57 * <li><code> GraphicURL</code></li>
58 * <li><code> GraphicBitmap</code></li>
59 * <li><code> GraphicSize</code></li>
60 * <li><code> VertOrient</code></li>
61 * <li><code> StartWith</code></li>
62 * <li><code> LeftMargin</code></li>
63 * <li><code> SymbolTextDistance</code></li>
64 * <li><code> FirstLineOffset</code></li>
65 * <li><code> NumberingType</code></li>
66 * <li><code> HeadingStyleName</code></li>
67 * <li><code> BulletColor</code></li>
68 * <li><code> BulletRelSize</code></li>
69 * </ul> <p>
71 * @see com.sun.star.text.NumberingLevel
72 * @see com.sun.star.test.ParagraphProperties
73 * @see ifc.text._ParagraphProperties
75 public class _NumberingLevel {
77 private static TestParameters tParam = null;
78 private static Hashtable NumberingLevel = new Hashtable();
79 private static PropertyValue[] PropertyArray = null;
80 private static LogWriter log = null;
83 /**
84 * returns an instance of _NumberingLevel
85 * @param log the log writer
86 * @param tParam the test parameters
87 * @param propertyValues a PropertyValue[] which should contain all properties of com.sun.star.text.NumberingLevel
89 public _NumberingLevel(LogWriter log, TestParameters tParam, PropertyValue[] propertyValues){
91 this.tParam = tParam;
92 this.PropertyArray = propertyValues;
94 this.log = log;
96 //key = PropertyName, value = Ooptional
97 NumberingLevel.put("Adjust", new Boolean(false));
98 NumberingLevel.put("ParentNumbering", new Boolean(true));
99 NumberingLevel.put("Prefix", new Boolean(false));
100 NumberingLevel.put("Suffix", new Boolean(false));
101 NumberingLevel.put("CharStyleName", new Boolean(true));
102 NumberingLevel.put("BulletId", new Boolean(true));
103 NumberingLevel.put("BulletChar", new Boolean(false));
104 NumberingLevel.put("BulletFontName", new Boolean(false));
105 NumberingLevel.put("BulletFont", new Boolean(true));
106 NumberingLevel.put("GraphicURL", new Boolean(false));
107 NumberingLevel.put("GraphicBitmap", new Boolean(true));
108 NumberingLevel.put("GraphicSize", new Boolean(true));
109 NumberingLevel.put("VertOrient", new Boolean(true));
110 NumberingLevel.put("StartWith", new Boolean(true));
111 NumberingLevel.put("LeftMargin", new Boolean(false));
112 NumberingLevel.put("SymbolTextDistance", new Boolean(true));
113 NumberingLevel.put("FirstLineOffset", new Boolean(false));
114 NumberingLevel.put("NumberingType", new Boolean(false));
115 NumberingLevel.put("HeadingStyleName", new Boolean(false));
116 NumberingLevel.put("BulletColor", new Boolean(true));
117 NumberingLevel.put("BulletRelSize", new Boolean(true));
122 * This methods checks the PropertyValue for completnes. If one or more properties
123 * are missing the return value is FALSE, else TRUE
124 * @return returns TRUE if PropertyValue[] is complete, else FALSE
126 public boolean testPropertieArray(){
128 boolean status = true;
129 try{
131 // iterate over the given property array and remove it from the must list
132 for (int i = 0; i < PropertyArray.length; i++){
133 String propertyName=PropertyArray[i].Name;
135 if ( NumberingLevel.containsKey(propertyName) ) {
136 NumberingLevel.remove(propertyName);
137 } else {
138 status = false;
139 if ( status ) {
140 log.println("FAILED: com.sun.star.text.NumberingLevel -> " +
141 "found not described property:");
144 status = false;
145 log.println("-> '" + propertyName + "'");
150 // get rest of properties and check if they are optional
151 if (! NumberingLevel.isEmpty()){
152 for (Enumeration e = NumberingLevel.keys() ; e.hasMoreElements() ;) {
153 String property = (String) e.nextElement();
155 // if some elements are not optional -> failed
156 if ( ! ((Boolean)NumberingLevel.get(property)).booleanValue() ){
158 if ( status ) {
159 log.println("FAILED: com.sun.star.text.NumberingLevel -> " +
160 "could not find not optional property:");
163 status = false;
164 log.println("-> '" + property + "'");
169 }catch( Exception e ){
170 throw new StatusException("ERROR: could not test all properties of com.sun.star.text.NumberingLevel",e);
173 return status;
177 } // finish class _NumberingLevel