Branch libreoffice-5-0-4
[LibreOffice.git] / qadevOOo / tests / java / ifc / chart / _ChartAxis.java
blobf63413ebe7cb682c4af5fa9a78813f053c9c13d6
1 /*
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 .
19 package ifc.chart;
21 import lib.MultiPropertyTest;
22 import lib.StatusException;
23 import util.ValueChanger;
25 /**
26 * Testing <code>com.sun.star.chart.ChartAxis</code>
27 * service properties:
28 * <ul>
29 * <li><code> ArrangeOrder</code></li>
30 * <li><code> AutoMax</code></li>
31 * <li><code> AutoMin</code></li>
32 * <li><code> AutoOrigin</code></li>
33 * <li><code> AutoStepHelp</code></li>
34 * <li><code> AutoStepMain</code></li>
35 * <li><code> DisplayLabels</code></li>
36 * <li><code> GapWidth</code></li>
37 * <li><code> HelpMarks</code></li>
38 * <li><code> Logarithmic</code></li>
39 * <li><code> Marks</code></li>
40 * <li><code> Max</code></li>
41 * <li><code> Min</code></li>
42 * <li><code> NumberFormat</code></li>
43 * <li><code> Origin</code></li>
44 * <li><code> Overlap</code></li>
45 * <li><code> StepHelp</code></li>
46 * <li><code> StepMain</code></li>
47 * <li><code> TextBreak</code></li>
48 * <li><code> TextRotation</code></li>
49 * <li><code> TextCanOverlap</code></li>
50 * </ul> <p>
51 * @see com.sun.star.chart.ChartAxis
53 public class _ChartAxis extends MultiPropertyTest {
55 /**
56 * Tests property 'Max'.
57 * Property 'AutoOrigin' sets to true and property 'AutoMax'
58 * sets to false before test.
60 public void _Max() {
61 try {
62 //if AutoOrigin isn't true then this property works only when
63 //current Origin is less then new value of Max
64 oObj.setPropertyValue("AutoOrigin", Boolean.TRUE);
65 oObj.setPropertyValue("AutoMax",Boolean.FALSE);
66 } catch(com.sun.star.lang.WrappedTargetException e) {
67 log.println("Couldn't set property value");
68 e.printStackTrace(log);
69 throw new StatusException("Couldn't set property value", e);
70 } catch(com.sun.star.lang.IllegalArgumentException e) {
71 log.println("Couldn't set property value");
72 e.printStackTrace(log);
73 throw new StatusException("Couldn't set property value", e);
74 } catch(com.sun.star.beans.PropertyVetoException e) {
75 log.println("Couldn't set property value");
76 e.printStackTrace(log);
77 throw new StatusException("Couldn't set property value", e);
78 } catch(com.sun.star.beans.UnknownPropertyException e) {
79 log.println("Couldn't set property value");
80 e.printStackTrace(log);
81 throw new StatusException("Couldn't set property value", e);
84 testProperty("Max");
87 /**
88 * Tests property 'Min'.
89 * Property 'AutoOrigin' sets to true and property 'AutoMin'
90 * sets to false before test.
92 public void _Min() {
93 try {
94 //if AutoOrigin isn't true then this property works only when
95 //current Origin is greater then new value of Min
96 oObj.setPropertyValue("AutoOrigin", Boolean.TRUE);
97 oObj.setPropertyValue("AutoMin", Boolean.FALSE);
98 } catch(com.sun.star.lang.WrappedTargetException e) {
99 log.println("Couldn't set property value");
100 e.printStackTrace(log);
101 throw new StatusException("Couldn't set property value", e);
102 } catch(com.sun.star.lang.IllegalArgumentException e) {
103 log.println("Couldn't set property value");
104 e.printStackTrace(log);
105 throw new StatusException("Couldn't set property value", e);
106 } catch(com.sun.star.beans.PropertyVetoException e) {
107 log.println("Couldn't set property value");
108 e.printStackTrace(log);
109 throw new StatusException("Couldn't set property value", e);
110 } catch(com.sun.star.beans.UnknownPropertyException e) {
111 log.println("Couldn't set property value");
112 e.printStackTrace(log);
113 throw new StatusException("Couldn't set property value", e);
116 testProperty("Min");
120 * Tests property 'Origin'.
121 * Property 'Logarithmic' sets to false before test.
123 public void _Origin() {
124 try {
125 oObj.setPropertyValue("Logarithmic",Boolean.FALSE);
126 } catch(com.sun.star.lang.WrappedTargetException e) {
127 log.println("Couldn't set property value");
128 e.printStackTrace(log);
129 throw new StatusException("Couldn't set property value", e);
130 } catch(com.sun.star.lang.IllegalArgumentException e) {
131 log.println("Couldn't set property value");
132 e.printStackTrace(log);
133 throw new StatusException("Couldn't set property value", e);
134 } catch(com.sun.star.beans.PropertyVetoException e) {
135 log.println("Couldn't set property value");
136 e.printStackTrace(log);
137 throw new StatusException("Couldn't set property value", e);
138 } catch(com.sun.star.beans.UnknownPropertyException e) {
139 log.println("Couldn't set property value");
140 e.printStackTrace(log);
141 throw new StatusException("Couldn't set property value", e);
144 testProperty("Origin");
147 protected PropertyTester StepMainTester = new PropertyTester() {
148 @Override
149 protected Object getNewValue(String propName, Object oldValue)
150 throws java.lang.IllegalArgumentException {
151 Double ValueToSet = (Double) ValueChanger.changePValue(oldValue);
152 double stm = ValueToSet.doubleValue();
153 stm = stm / 5;
154 return new Double(stm);
159 * Tests property 'StepMain'.
160 * Property 'Logarithmic' and 'AutoStepMain' sets
161 * to false before test.
163 public void _StepMain() {
164 try {
165 oObj.setPropertyValue("AutoStepMain", Boolean.FALSE);
166 oObj.setPropertyValue("Logarithmic",Boolean.FALSE);
167 } catch(com.sun.star.lang.WrappedTargetException e) {
168 log.println("Couldn't set property value");
169 e.printStackTrace(log);
170 throw new StatusException("Couldn't set property value", e);
171 } catch(com.sun.star.lang.IllegalArgumentException e) {
172 log.println("Couldn't set property value");
173 e.printStackTrace(log);
174 throw new StatusException("Couldn't set property value", e);
175 } catch(com.sun.star.beans.PropertyVetoException 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.beans.UnknownPropertyException e) {
180 log.println("Couldn't set property value");
181 e.printStackTrace(log);
182 throw new StatusException("Couldn't set property value", e);
185 testProperty("StepMain", StepMainTester);
187 } // finish class _ChartAxis