merge the formfield patch from ooo-build
[ooovba.git] / qadevOOo / tests / java / ifc / chart / _ChartAxis.java
blob8a6c600e79ed4d38cd6647f95485bb743a36afba
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: _ChartAxis.java,v $
10 * $Revision: 1.4 $
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.chart;
33 import lib.MultiPropertyTest;
34 import lib.StatusException;
35 import util.ValueChanger;
37 /**
38 * Testing <code>com.sun.star.chart.ChartAxis</code>
39 * service properties:
40 * <ul>
41 * <li><code> ArrangeOrder</code></li>
42 * <li><code> AutoMax</code></li>
43 * <li><code> AutoMin</code></li>
44 * <li><code> AutoOrigin</code></li>
45 * <li><code> AutoStepHelp</code></li>
46 * <li><code> AutoStepMain</code></li>
47 * <li><code> DisplayLabels</code></li>
48 * <li><code> GapWidth</code></li>
49 * <li><code> HelpMarks</code></li>
50 * <li><code> Logarithmic</code></li>
51 * <li><code> Marks</code></li>
52 * <li><code> Max</code></li>
53 * <li><code> Min</code></li>
54 * <li><code> NumberFormat</code></li>
55 * <li><code> Origin</code></li>
56 * <li><code> Overlap</code></li>
57 * <li><code> StepHelp</code></li>
58 * <li><code> StepMain</code></li>
59 * <li><code> TextBreak</code></li>
60 * <li><code> TextRotation</code></li>
61 * <li><code> TextCanOverlap</code></li>
62 * </ul> <p>
63 * @see com.sun.star.chart.ChartAxis
65 public class _ChartAxis extends MultiPropertyTest {
67 /**
68 * Tests property 'Max'.
69 * Property 'AutoOrigin' sets to true and property 'AutoMax'
70 * sets to false before test.
72 public void _Max() {
73 try {
74 //if AutoOrigin isn't true then this property works only when
75 //current Origin is less then new value of Max
76 oObj.setPropertyValue("AutoOrigin", new Boolean(true));
77 oObj.setPropertyValue("AutoMax",new Boolean(false));
78 } catch(com.sun.star.lang.WrappedTargetException e) {
79 log.println("Couldn't set property value");
80 e.printStackTrace(log);
81 throw new StatusException("Couldn't set property value", e);
82 } catch(com.sun.star.lang.IllegalArgumentException e) {
83 log.println("Couldn't set property value");
84 e.printStackTrace(log);
85 throw new StatusException("Couldn't set property value", e);
86 } catch(com.sun.star.beans.PropertyVetoException e) {
87 log.println("Couldn't set property value");
88 e.printStackTrace(log);
89 throw new StatusException("Couldn't set property value", e);
90 } catch(com.sun.star.beans.UnknownPropertyException e) {
91 log.println("Couldn't set property value");
92 e.printStackTrace(log);
93 throw new StatusException("Couldn't set property value", e);
96 testProperty("Max");
99 /**
100 * Tests property 'Min'.
101 * Property 'AutoOrigin' sets to true and property 'AutoMin'
102 * sets to false before test.
104 public void _Min() {
105 try {
106 //if AutoOrigin isn't true then this property works only when
107 //current Origin is greater then new value of Min
108 oObj.setPropertyValue("AutoOrigin", new Boolean(true));
109 oObj.setPropertyValue("AutoMin", new Boolean(false));
110 } catch(com.sun.star.lang.WrappedTargetException e) {
111 log.println("Couldn't set property value");
112 e.printStackTrace(log);
113 throw new StatusException("Couldn't set property value", e);
114 } catch(com.sun.star.lang.IllegalArgumentException e) {
115 log.println("Couldn't set property value");
116 e.printStackTrace(log);
117 throw new StatusException("Couldn't set property value", e);
118 } catch(com.sun.star.beans.PropertyVetoException e) {
119 log.println("Couldn't set property value");
120 e.printStackTrace(log);
121 throw new StatusException("Couldn't set property value", e);
122 } catch(com.sun.star.beans.UnknownPropertyException e) {
123 log.println("Couldn't set property value");
124 e.printStackTrace(log);
125 throw new StatusException("Couldn't set property value", e);
128 testProperty("Min");
132 * Tests property 'Origin'.
133 * Property 'Logarithmic' sets to false before test.
135 public void _Origin() {
136 try {
137 oObj.setPropertyValue("Logarithmic",new Boolean(false));
138 } catch(com.sun.star.lang.WrappedTargetException e) {
139 log.println("Couldn't set property value");
140 e.printStackTrace(log);
141 throw new StatusException("Couldn't set property value", e);
142 } catch(com.sun.star.lang.IllegalArgumentException e) {
143 log.println("Couldn't set property value");
144 e.printStackTrace(log);
145 throw new StatusException("Couldn't set property value", e);
146 } catch(com.sun.star.beans.PropertyVetoException e) {
147 log.println("Couldn't set property value");
148 e.printStackTrace(log);
149 throw new StatusException("Couldn't set property value", e);
150 } catch(com.sun.star.beans.UnknownPropertyException e) {
151 log.println("Couldn't set property value");
152 e.printStackTrace(log);
153 throw new StatusException("Couldn't set property value", e);
156 testProperty("Origin");
159 protected PropertyTester StepMainTester = new PropertyTester() {
160 protected Object getNewValue(String propName, Object oldValue)
161 throws java.lang.IllegalArgumentException {
162 Double ValueToSet = (Double) ValueChanger.changePValue(oldValue);
163 double stm = ValueToSet.doubleValue();
164 stm = stm / 5;
165 return new Double(stm);
170 * Tests property 'StepMain'.
171 * Property 'Logarithmic' and 'AutoStepMain' sets
172 * to false before test.
174 public void _StepMain() {
175 try {
176 oObj.setPropertyValue("AutoStepMain", new Boolean(false));
177 oObj.setPropertyValue("Logarithmic",new Boolean(false));
178 } catch(com.sun.star.lang.WrappedTargetException e) {
179 log.println("Couldn't set property value");
180 e.printStackTrace(log);
181 throw new StatusException("Couldn't set property value", e);
182 } catch(com.sun.star.lang.IllegalArgumentException e) {
183 log.println("Couldn't set property value");
184 e.printStackTrace(log);
185 throw new StatusException("Couldn't set property value", e);
186 } catch(com.sun.star.beans.PropertyVetoException e) {
187 log.println("Couldn't set property value");
188 e.printStackTrace(log);
189 throw new StatusException("Couldn't set property value", e);
190 } catch(com.sun.star.beans.UnknownPropertyException e) {
191 log.println("Couldn't set property value");
192 e.printStackTrace(log);
193 throw new StatusException("Couldn't set property value", e);
196 testProperty("StepMain", StepMainTester);
198 } // finish class _ChartAxis