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 .
21 import java
.util
.HashMap
;
22 import java
.util
.Iterator
;
24 import lib
.StatusException
;
25 import lib
.TestParameters
;
26 import share
.LogWriter
;
28 import com
.sun
.star
.beans
.PropertyValue
;
32 * Testing <code>com.sun.star.text.NumberingLevel</code><p>
33 * This service is currently known as property value of
34 * com.sun.star.text.ParagraphProperties.NumberingRules
35 * This test checks only for completnes of implemented properties.
36 * service properties :
38 * <li><code> Adjust</code></li>
39 * <li><code> ParentNumbering</code></li>
40 * <li><code> Prefix</code></li>
41 * <li><code> Suffix</code></li>
42 * <li><code> CharStyleName</code></li>
43 * <li><code> BulletId</code></li>
44 * <li><code> BulletChar</code></li>
45 * <li><code> BulletFontName</code></li>
46 * <li><code> BulletFont</code></li>
47 * <li><code> GraphicURL</code></li>
48 * <li><code> GraphicBitmap</code></li>
49 * <li><code> GraphicSize</code></li>
50 * <li><code> VertOrient</code></li>
51 * <li><code> StartWith</code></li>
52 * <li><code> LeftMargin</code></li>
53 * <li><code> SymbolTextDistance</code></li>
54 * <li><code> FirstLineOffset</code></li>
55 * <li><code> NumberingType</code></li>
56 * <li><code> HeadingStyleName</code></li>
57 * <li><code> BulletColor</code></li>
58 * <li><code> BulletRelSize</code></li>
61 * @see com.sun.star.text.NumberingLevel
62 * @see com.sun.star.test.ParagraphProperties
63 * @see ifc.style._ParagraphProperties
65 public class _NumberingLevel
{
67 private HashMap
<String
, Boolean
> NumberingLevel
= new HashMap
<String
,Boolean
>();
68 private PropertyValue
[] PropertyArray
= null;
69 private LogWriter log
= null;
73 * returns an instance of _NumberingLevel
74 * @param log the log writer
75 * @param tParam the test parameters
76 * @param propertyValues a PropertyValue[] which should contain all properties of com.sun.star.text.NumberingLevel
78 public _NumberingLevel(LogWriter log
, TestParameters tParam
, PropertyValue
[] propertyValues
){
80 this.PropertyArray
= propertyValues
;
84 //key = PropertyName, value = Ooptional
85 NumberingLevel
.put("Adjust", Boolean
.FALSE
);
86 NumberingLevel
.put("ParentNumbering", Boolean
.TRUE
);
87 NumberingLevel
.put("Prefix", Boolean
.FALSE
);
88 NumberingLevel
.put("Suffix", Boolean
.FALSE
);
89 NumberingLevel
.put("CharStyleName", Boolean
.TRUE
);
90 NumberingLevel
.put("BulletId", Boolean
.TRUE
);
91 NumberingLevel
.put("BulletChar", Boolean
.FALSE
);
92 NumberingLevel
.put("BulletFontName", Boolean
.FALSE
);
93 NumberingLevel
.put("BulletFont", Boolean
.TRUE
);
94 NumberingLevel
.put("GraphicURL", Boolean
.FALSE
);
95 NumberingLevel
.put("GraphicBitmap", Boolean
.TRUE
);
96 NumberingLevel
.put("GraphicSize", Boolean
.TRUE
);
97 NumberingLevel
.put("VertOrient", Boolean
.TRUE
);
98 NumberingLevel
.put("StartWith", Boolean
.TRUE
);
99 NumberingLevel
.put("LeftMargin", Boolean
.FALSE
);
100 NumberingLevel
.put("SymbolTextDistance", Boolean
.TRUE
);
101 NumberingLevel
.put("FirstLineOffset", Boolean
.FALSE
);
102 NumberingLevel
.put("NumberingType", Boolean
.FALSE
);
103 NumberingLevel
.put("HeadingStyleName", Boolean
.FALSE
);
104 NumberingLevel
.put("BulletColor", Boolean
.TRUE
);
105 NumberingLevel
.put("BulletRelSize", Boolean
.TRUE
);
110 * This methods checks the PropertyValue for completnes. If one or more properties
111 * are missing the return value is FALSE, else TRUE
112 * @return returns TRUE if PropertyValue[] is complete, else FALSE
114 public boolean testPropertieArray(){
116 boolean status
= true;
119 // iterate over the given property array and remove it from the must list
120 for (int i
= 0; i
< PropertyArray
.length
; i
++){
121 String propertyName
=PropertyArray
[i
].Name
;
123 if ( NumberingLevel
.containsKey(propertyName
) ) {
124 NumberingLevel
.remove(propertyName
);
128 log
.println("FAILED: com.sun.star.text.NumberingLevel -> " +
129 "found not described property:");
133 log
.println("-> '" + propertyName
+ "'");
138 // get rest of properties and check if they are optional
139 if (! NumberingLevel
.isEmpty()){
140 for (Iterator
<String
> e
= NumberingLevel
.keySet().iterator() ; e
.hasNext() ;) {
141 String property
= e
.next();
143 // if some elements are not optional -> failed
144 if ( ! NumberingLevel
.get(property
).booleanValue() ){
147 log
.println("FAILED: com.sun.star.text.NumberingLevel -> " +
148 "could not find not optional property:");
152 log
.println("-> '" + property
+ "'");
157 }catch( Exception e
){
158 throw new StatusException("ERROR: could not test all properties of com.sun.star.text.NumberingLevel",e
);
165 } // finish class _NumberingLevel