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 ************************************************************************/
30 import lib
.MultiPropertyTest
;
31 import lib
.StatusException
;
32 import util
.ValueChanger
;
35 * Testing <code>com.sun.star.chart.ChartAxis</code>
38 * <li><code> ArrangeOrder</code></li>
39 * <li><code> AutoMax</code></li>
40 * <li><code> AutoMin</code></li>
41 * <li><code> AutoOrigin</code></li>
42 * <li><code> AutoStepHelp</code></li>
43 * <li><code> AutoStepMain</code></li>
44 * <li><code> DisplayLabels</code></li>
45 * <li><code> GapWidth</code></li>
46 * <li><code> HelpMarks</code></li>
47 * <li><code> Logarithmic</code></li>
48 * <li><code> Marks</code></li>
49 * <li><code> Max</code></li>
50 * <li><code> Min</code></li>
51 * <li><code> NumberFormat</code></li>
52 * <li><code> Origin</code></li>
53 * <li><code> Overlap</code></li>
54 * <li><code> StepHelp</code></li>
55 * <li><code> StepMain</code></li>
56 * <li><code> TextBreak</code></li>
57 * <li><code> TextRotation</code></li>
58 * <li><code> TextCanOverlap</code></li>
60 * @see com.sun.star.chart.ChartAxis
62 public class _ChartAxis
extends MultiPropertyTest
{
65 * Tests property 'Max'.
66 * Property 'AutoOrigin' sets to true and property 'AutoMax'
67 * sets to false before test.
71 //if AutoOrigin isn't true then this property works only when
72 //current Origin is less then new value of Max
73 oObj
.setPropertyValue("AutoOrigin", new Boolean(true));
74 oObj
.setPropertyValue("AutoMax",new Boolean(false));
75 } catch(com
.sun
.star
.lang
.WrappedTargetException e
) {
76 log
.println("Couldn't set property value");
77 e
.printStackTrace(log
);
78 throw new StatusException("Couldn't set property value", e
);
79 } catch(com
.sun
.star
.lang
.IllegalArgumentException e
) {
80 log
.println("Couldn't set property value");
81 e
.printStackTrace(log
);
82 throw new StatusException("Couldn't set property value", e
);
83 } catch(com
.sun
.star
.beans
.PropertyVetoException e
) {
84 log
.println("Couldn't set property value");
85 e
.printStackTrace(log
);
86 throw new StatusException("Couldn't set property value", e
);
87 } catch(com
.sun
.star
.beans
.UnknownPropertyException e
) {
88 log
.println("Couldn't set property value");
89 e
.printStackTrace(log
);
90 throw new StatusException("Couldn't set property value", e
);
97 * Tests property 'Min'.
98 * Property 'AutoOrigin' sets to true and property 'AutoMin'
99 * sets to false before test.
103 //if AutoOrigin isn't true then this property works only when
104 //current Origin is greater then new value of Min
105 oObj
.setPropertyValue("AutoOrigin", new Boolean(true));
106 oObj
.setPropertyValue("AutoMin", new Boolean(false));
107 } catch(com
.sun
.star
.lang
.WrappedTargetException e
) {
108 log
.println("Couldn't set property value");
109 e
.printStackTrace(log
);
110 throw new StatusException("Couldn't set property value", e
);
111 } catch(com
.sun
.star
.lang
.IllegalArgumentException e
) {
112 log
.println("Couldn't set property value");
113 e
.printStackTrace(log
);
114 throw new StatusException("Couldn't set property value", e
);
115 } catch(com
.sun
.star
.beans
.PropertyVetoException e
) {
116 log
.println("Couldn't set property value");
117 e
.printStackTrace(log
);
118 throw new StatusException("Couldn't set property value", e
);
119 } catch(com
.sun
.star
.beans
.UnknownPropertyException e
) {
120 log
.println("Couldn't set property value");
121 e
.printStackTrace(log
);
122 throw new StatusException("Couldn't set property value", e
);
129 * Tests property 'Origin'.
130 * Property 'Logarithmic' sets to false before test.
132 public void _Origin() {
134 oObj
.setPropertyValue("Logarithmic",new Boolean(false));
135 } catch(com
.sun
.star
.lang
.WrappedTargetException e
) {
136 log
.println("Couldn't set property value");
137 e
.printStackTrace(log
);
138 throw new StatusException("Couldn't set property value", e
);
139 } catch(com
.sun
.star
.lang
.IllegalArgumentException e
) {
140 log
.println("Couldn't set property value");
141 e
.printStackTrace(log
);
142 throw new StatusException("Couldn't set property value", e
);
143 } catch(com
.sun
.star
.beans
.PropertyVetoException e
) {
144 log
.println("Couldn't set property value");
145 e
.printStackTrace(log
);
146 throw new StatusException("Couldn't set property value", e
);
147 } catch(com
.sun
.star
.beans
.UnknownPropertyException e
) {
148 log
.println("Couldn't set property value");
149 e
.printStackTrace(log
);
150 throw new StatusException("Couldn't set property value", e
);
153 testProperty("Origin");
156 protected PropertyTester StepMainTester
= new PropertyTester() {
157 protected Object
getNewValue(String propName
, Object oldValue
)
158 throws java
.lang
.IllegalArgumentException
{
159 Double ValueToSet
= (Double
) ValueChanger
.changePValue(oldValue
);
160 double stm
= ValueToSet
.doubleValue();
162 return new Double(stm
);
167 * Tests property 'StepMain'.
168 * Property 'Logarithmic' and 'AutoStepMain' sets
169 * to false before test.
171 public void _StepMain() {
173 oObj
.setPropertyValue("AutoStepMain", new Boolean(false));
174 oObj
.setPropertyValue("Logarithmic",new Boolean(false));
175 } catch(com
.sun
.star
.lang
.WrappedTargetException e
) {
176 log
.println("Couldn't set property value");
177 e
.printStackTrace(log
);
178 throw new StatusException("Couldn't set property value", e
);
179 } catch(com
.sun
.star
.lang
.IllegalArgumentException e
) {
180 log
.println("Couldn't set property value");
181 e
.printStackTrace(log
);
182 throw new StatusException("Couldn't set property value", e
);
183 } catch(com
.sun
.star
.beans
.PropertyVetoException e
) {
184 log
.println("Couldn't set property value");
185 e
.printStackTrace(log
);
186 throw new StatusException("Couldn't set property value", e
);
187 } catch(com
.sun
.star
.beans
.UnknownPropertyException e
) {
188 log
.println("Couldn't set property value");
189 e
.printStackTrace(log
);
190 throw new StatusException("Couldn't set property value", e
);
193 testProperty("StepMain", StepMainTester
);
195 } // finish class _ChartAxis