1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 package ifc.chart; 25 26 import lib.MultiPropertyTest; 27 28 /** 29 * Testing <code>com.sun.star.chart.ChartAxisXSupplier</code> 30 * service properties : 31 * <ul> 32 * <li><code> HasXAxis</code></li> 33 * <li><code> HasXAxisDescription</code></li> 34 * <li><code> HasXAxisGrid</code></li> 35 * <li><code> HasXAxisHelpGrid</code></li> 36 * <li><code> HasXAxisTitle</code></li> 37 * </ul> <p> 38 * @see com.sun.star.chart.ChartAxisXSupplier 39 */ 40 public class _ChartAxisXSupplier extends MultiPropertyTest { _HasXAxis()41 public void _HasXAxis() { 42 try { 43 log.println("Property HasXAxis"); 44 boolean res = ((Boolean)oObj.getPropertyValue( 45 "HasXAxis")).booleanValue(); 46 if (!res) 47 oObj.setPropertyValue("HasXAxis", Boolean.TRUE); 48 // test connected property HasXAxisDescription 49 if (!((Boolean)oObj.getPropertyValue( 50 "HasXAxisDescription")).booleanValue()) 51 oObj.setPropertyValue("HasXAxisDescription", Boolean.TRUE); 52 53 oObj.setPropertyValue("HasXAxis", Boolean.FALSE); 54 boolean setVal = ((Boolean)oObj.getPropertyValue( 55 "HasXAxis")).booleanValue(); 56 log.println("Start value: " + setVal); 57 // description should also be false now 58 setVal |= ((Boolean)oObj.getPropertyValue( 59 "HasXAxisDescription")).booleanValue(); 60 log.println("Connected value axis description: " + setVal); 61 62 oObj.setPropertyValue("HasXAxis", Boolean.TRUE); 63 setVal |= !((Boolean)oObj.getPropertyValue( 64 "HasXAxis")).booleanValue(); 65 log.println("Changed value: " + !setVal); 66 67 // description should be true again 68 setVal |= !((Boolean)oObj.getPropertyValue( 69 "HasXAxisDescription")).booleanValue(); 70 log.println("Changed connected value axis description: " + !setVal); 71 72 tRes.tested("HasXAxis", !setVal); 73 // leave axis untouched 74 oObj.setPropertyValue("HasXAxis", new Boolean(res)); 75 } 76 catch (com.sun.star.lang.WrappedTargetException e) { 77 log.println(e.getMessage()); 78 e.printStackTrace(log); 79 tRes.tested("HasXAxis", false); 80 } 81 catch (com.sun.star.lang.IllegalArgumentException e) { 82 log.println(e.getMessage()); 83 e.printStackTrace(log); 84 tRes.tested("HasXAxis", false); 85 } 86 catch (com.sun.star.beans.UnknownPropertyException e) { 87 log.println(e.getMessage()); 88 e.printStackTrace(log); 89 tRes.tested("HasXAxis", false); 90 } 91 catch (com.sun.star.beans.PropertyVetoException e) { 92 log.println(e.getMessage()); 93 e.printStackTrace(log); 94 tRes.tested("HasXAxis", false); 95 } 96 } 97 _HasXAxisDescription()98 public void _HasXAxisDescription() { 99 requiredMethod("HasXAxis"); 100 try { 101 log.println("Property HasXAxisDescription"); 102 if (!((Boolean)oObj.getPropertyValue("HasXAxis")).booleanValue()) 103 oObj.setPropertyValue("HasXAxis", Boolean.TRUE); 104 105 boolean res = ((Boolean)oObj.getPropertyValue( 106 "HasXAxisDescription")).booleanValue(); 107 log.println("Start value: " + res); 108 109 oObj.setPropertyValue("HasXAxisDescription", new Boolean(!res)); 110 boolean setValue = ((Boolean)oObj.getPropertyValue( 111 "HasXAxisDescription")).booleanValue(); 112 log.println("Changed value: " + setValue); 113 tRes.tested("HasXAxisDescription", res != setValue); 114 } 115 catch (com.sun.star.lang.WrappedTargetException e) { 116 log.println(e.getMessage()); 117 e.printStackTrace(log); 118 tRes.tested("HasXAxisDescription", false); 119 } 120 catch (com.sun.star.lang.IllegalArgumentException e) { 121 log.println(e.getMessage()); 122 e.printStackTrace(log); 123 tRes.tested("HasXAxisDescription", false); 124 } 125 catch (com.sun.star.beans.UnknownPropertyException e) { 126 log.println(e.getMessage()); 127 e.printStackTrace(log); 128 tRes.tested("HasXAxisDescription", false); 129 } 130 catch (com.sun.star.beans.PropertyVetoException e) { 131 log.println(e.getMessage()); 132 e.printStackTrace(log); 133 tRes.tested("HasXAxisDescription", false); 134 } 135 } 136 } // EOF ChartAxisXSupplier 137 138