1*ef39d40dSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*ef39d40dSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*ef39d40dSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*ef39d40dSAndrew Rist * distributed with this work for additional information 6*ef39d40dSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*ef39d40dSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*ef39d40dSAndrew Rist * "License"); you may not use this file except in compliance 9*ef39d40dSAndrew Rist * with the License. You may obtain a copy of the License at 10*ef39d40dSAndrew Rist * 11*ef39d40dSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*ef39d40dSAndrew Rist * 13*ef39d40dSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*ef39d40dSAndrew Rist * software distributed under the License is distributed on an 15*ef39d40dSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*ef39d40dSAndrew Rist * KIND, either express or implied. See the License for the 17*ef39d40dSAndrew Rist * specific language governing permissions and limitations 18*ef39d40dSAndrew Rist * under the License. 19*ef39d40dSAndrew Rist * 20*ef39d40dSAndrew Rist *************************************************************/ 21*ef39d40dSAndrew Rist 22*ef39d40dSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir package ifc.chart; 25cdf0e10cSrcweir 26cdf0e10cSrcweir import lib.MultiPropertyTest; 27cdf0e10cSrcweir import lib.StatusException; 28cdf0e10cSrcweir import util.ValueChanger; 29cdf0e10cSrcweir 30cdf0e10cSrcweir /** 31cdf0e10cSrcweir * Testing <code>com.sun.star.chart.ChartAxis</code> 32cdf0e10cSrcweir * service properties: 33cdf0e10cSrcweir * <ul> 34cdf0e10cSrcweir * <li><code> ArrangeOrder</code></li> 35cdf0e10cSrcweir * <li><code> AutoMax</code></li> 36cdf0e10cSrcweir * <li><code> AutoMin</code></li> 37cdf0e10cSrcweir * <li><code> AutoOrigin</code></li> 38cdf0e10cSrcweir * <li><code> AutoStepHelp</code></li> 39cdf0e10cSrcweir * <li><code> AutoStepMain</code></li> 40cdf0e10cSrcweir * <li><code> DisplayLabels</code></li> 41cdf0e10cSrcweir * <li><code> GapWidth</code></li> 42cdf0e10cSrcweir * <li><code> HelpMarks</code></li> 43cdf0e10cSrcweir * <li><code> Logarithmic</code></li> 44cdf0e10cSrcweir * <li><code> Marks</code></li> 45cdf0e10cSrcweir * <li><code> Max</code></li> 46cdf0e10cSrcweir * <li><code> Min</code></li> 47cdf0e10cSrcweir * <li><code> NumberFormat</code></li> 48cdf0e10cSrcweir * <li><code> Origin</code></li> 49cdf0e10cSrcweir * <li><code> Overlap</code></li> 50cdf0e10cSrcweir * <li><code> StepHelp</code></li> 51cdf0e10cSrcweir * <li><code> StepMain</code></li> 52cdf0e10cSrcweir * <li><code> TextBreak</code></li> 53cdf0e10cSrcweir * <li><code> TextRotation</code></li> 54cdf0e10cSrcweir * <li><code> TextCanOverlap</code></li> 55cdf0e10cSrcweir * </ul> <p> 56cdf0e10cSrcweir * @see com.sun.star.chart.ChartAxis 57cdf0e10cSrcweir */ 58cdf0e10cSrcweir public class _ChartAxis extends MultiPropertyTest { 59cdf0e10cSrcweir 60cdf0e10cSrcweir /** 61cdf0e10cSrcweir * Tests property 'Max'. 62cdf0e10cSrcweir * Property 'AutoOrigin' sets to true and property 'AutoMax' 63cdf0e10cSrcweir * sets to false before test. 64cdf0e10cSrcweir */ _Max()65cdf0e10cSrcweir public void _Max() { 66cdf0e10cSrcweir try { 67cdf0e10cSrcweir //if AutoOrigin isn't true then this property works only when 68cdf0e10cSrcweir //current Origin is less then new value of Max 69cdf0e10cSrcweir oObj.setPropertyValue("AutoOrigin", new Boolean(true)); 70cdf0e10cSrcweir oObj.setPropertyValue("AutoMax",new Boolean(false)); 71cdf0e10cSrcweir } catch(com.sun.star.lang.WrappedTargetException e) { 72cdf0e10cSrcweir log.println("Couldn't set property value"); 73cdf0e10cSrcweir e.printStackTrace(log); 74cdf0e10cSrcweir throw new StatusException("Couldn't set property value", e); 75cdf0e10cSrcweir } catch(com.sun.star.lang.IllegalArgumentException e) { 76cdf0e10cSrcweir log.println("Couldn't set property value"); 77cdf0e10cSrcweir e.printStackTrace(log); 78cdf0e10cSrcweir throw new StatusException("Couldn't set property value", e); 79cdf0e10cSrcweir } catch(com.sun.star.beans.PropertyVetoException e) { 80cdf0e10cSrcweir log.println("Couldn't set property value"); 81cdf0e10cSrcweir e.printStackTrace(log); 82cdf0e10cSrcweir throw new StatusException("Couldn't set property value", e); 83cdf0e10cSrcweir } catch(com.sun.star.beans.UnknownPropertyException e) { 84cdf0e10cSrcweir log.println("Couldn't set property value"); 85cdf0e10cSrcweir e.printStackTrace(log); 86cdf0e10cSrcweir throw new StatusException("Couldn't set property value", e); 87cdf0e10cSrcweir } 88cdf0e10cSrcweir 89cdf0e10cSrcweir testProperty("Max"); 90cdf0e10cSrcweir } 91cdf0e10cSrcweir 92cdf0e10cSrcweir /** 93cdf0e10cSrcweir * Tests property 'Min'. 94cdf0e10cSrcweir * Property 'AutoOrigin' sets to true and property 'AutoMin' 95cdf0e10cSrcweir * sets to false before test. 96cdf0e10cSrcweir */ _Min()97cdf0e10cSrcweir public void _Min() { 98cdf0e10cSrcweir try { 99cdf0e10cSrcweir //if AutoOrigin isn't true then this property works only when 100cdf0e10cSrcweir //current Origin is greater then new value of Min 101cdf0e10cSrcweir oObj.setPropertyValue("AutoOrigin", new Boolean(true)); 102cdf0e10cSrcweir oObj.setPropertyValue("AutoMin", new Boolean(false)); 103cdf0e10cSrcweir } catch(com.sun.star.lang.WrappedTargetException e) { 104cdf0e10cSrcweir log.println("Couldn't set property value"); 105cdf0e10cSrcweir e.printStackTrace(log); 106cdf0e10cSrcweir throw new StatusException("Couldn't set property value", e); 107cdf0e10cSrcweir } catch(com.sun.star.lang.IllegalArgumentException e) { 108cdf0e10cSrcweir log.println("Couldn't set property value"); 109cdf0e10cSrcweir e.printStackTrace(log); 110cdf0e10cSrcweir throw new StatusException("Couldn't set property value", e); 111cdf0e10cSrcweir } catch(com.sun.star.beans.PropertyVetoException e) { 112cdf0e10cSrcweir log.println("Couldn't set property value"); 113cdf0e10cSrcweir e.printStackTrace(log); 114cdf0e10cSrcweir throw new StatusException("Couldn't set property value", e); 115cdf0e10cSrcweir } catch(com.sun.star.beans.UnknownPropertyException e) { 116cdf0e10cSrcweir log.println("Couldn't set property value"); 117cdf0e10cSrcweir e.printStackTrace(log); 118cdf0e10cSrcweir throw new StatusException("Couldn't set property value", e); 119cdf0e10cSrcweir } 120cdf0e10cSrcweir 121cdf0e10cSrcweir testProperty("Min"); 122cdf0e10cSrcweir } 123cdf0e10cSrcweir 124cdf0e10cSrcweir /** 125cdf0e10cSrcweir * Tests property 'Origin'. 126cdf0e10cSrcweir * Property 'Logarithmic' sets to false before test. 127cdf0e10cSrcweir */ _Origin()128cdf0e10cSrcweir public void _Origin() { 129cdf0e10cSrcweir try { 130cdf0e10cSrcweir oObj.setPropertyValue("Logarithmic",new Boolean(false)); 131cdf0e10cSrcweir } catch(com.sun.star.lang.WrappedTargetException e) { 132cdf0e10cSrcweir log.println("Couldn't set property value"); 133cdf0e10cSrcweir e.printStackTrace(log); 134cdf0e10cSrcweir throw new StatusException("Couldn't set property value", e); 135cdf0e10cSrcweir } catch(com.sun.star.lang.IllegalArgumentException e) { 136cdf0e10cSrcweir log.println("Couldn't set property value"); 137cdf0e10cSrcweir e.printStackTrace(log); 138cdf0e10cSrcweir throw new StatusException("Couldn't set property value", e); 139cdf0e10cSrcweir } catch(com.sun.star.beans.PropertyVetoException e) { 140cdf0e10cSrcweir log.println("Couldn't set property value"); 141cdf0e10cSrcweir e.printStackTrace(log); 142cdf0e10cSrcweir throw new StatusException("Couldn't set property value", e); 143cdf0e10cSrcweir } catch(com.sun.star.beans.UnknownPropertyException e) { 144cdf0e10cSrcweir log.println("Couldn't set property value"); 145cdf0e10cSrcweir e.printStackTrace(log); 146cdf0e10cSrcweir throw new StatusException("Couldn't set property value", e); 147cdf0e10cSrcweir } 148cdf0e10cSrcweir 149cdf0e10cSrcweir testProperty("Origin"); 150cdf0e10cSrcweir } 151cdf0e10cSrcweir 152cdf0e10cSrcweir protected PropertyTester StepMainTester = new PropertyTester() { 153cdf0e10cSrcweir protected Object getNewValue(String propName, Object oldValue) 154cdf0e10cSrcweir throws java.lang.IllegalArgumentException { 155cdf0e10cSrcweir Double ValueToSet = (Double) ValueChanger.changePValue(oldValue); 156cdf0e10cSrcweir double stm = ValueToSet.doubleValue(); 157cdf0e10cSrcweir stm = stm / 5; 158cdf0e10cSrcweir return new Double(stm); 159cdf0e10cSrcweir } 160cdf0e10cSrcweir }; 161cdf0e10cSrcweir 162cdf0e10cSrcweir /** 163cdf0e10cSrcweir * Tests property 'StepMain'. 164cdf0e10cSrcweir * Property 'Logarithmic' and 'AutoStepMain' sets 165cdf0e10cSrcweir * to false before test. 166cdf0e10cSrcweir */ _StepMain()167cdf0e10cSrcweir public void _StepMain() { 168cdf0e10cSrcweir try { 169cdf0e10cSrcweir oObj.setPropertyValue("AutoStepMain", new Boolean(false)); 170cdf0e10cSrcweir oObj.setPropertyValue("Logarithmic",new Boolean(false)); 171cdf0e10cSrcweir } catch(com.sun.star.lang.WrappedTargetException e) { 172cdf0e10cSrcweir log.println("Couldn't set property value"); 173cdf0e10cSrcweir e.printStackTrace(log); 174cdf0e10cSrcweir throw new StatusException("Couldn't set property value", e); 175cdf0e10cSrcweir } catch(com.sun.star.lang.IllegalArgumentException e) { 176cdf0e10cSrcweir log.println("Couldn't set property value"); 177cdf0e10cSrcweir e.printStackTrace(log); 178cdf0e10cSrcweir throw new StatusException("Couldn't set property value", e); 179cdf0e10cSrcweir } catch(com.sun.star.beans.PropertyVetoException e) { 180cdf0e10cSrcweir log.println("Couldn't set property value"); 181cdf0e10cSrcweir e.printStackTrace(log); 182cdf0e10cSrcweir throw new StatusException("Couldn't set property value", e); 183cdf0e10cSrcweir } catch(com.sun.star.beans.UnknownPropertyException e) { 184cdf0e10cSrcweir log.println("Couldn't set property value"); 185cdf0e10cSrcweir e.printStackTrace(log); 186cdf0e10cSrcweir throw new StatusException("Couldn't set property value", e); 187cdf0e10cSrcweir } 188cdf0e10cSrcweir 189cdf0e10cSrcweir testProperty("StepMain", StepMainTester); 190cdf0e10cSrcweir } 191cdf0e10cSrcweir } // finish class _ChartAxis 192cdf0e10cSrcweir 193