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.awt; 25 26 import lib.MultiMethodTest; 27 28 import com.sun.star.awt.XCurrencyField; 29 30 /** 31 * Testing <code>com.sun.star.awt.XCurrencyField</code> 32 * interface methods : 33 * <ul> 34 * <li><code> setValue()</code></li> 35 * <li><code> getValue()</code></li> 36 * <li><code> setMin()</code></li> 37 * <li><code> getMin()</code></li> 38 * <li><code> setMax()</code></li> 39 * <li><code> getMax()</code></li> 40 * <li><code> setFirst()</code></li> 41 * <li><code> getFirst()</code></li> 42 * <li><code> setLast()</code></li> 43 * <li><code> getLast()</code></li> 44 * <li><code> setSpinSize()</code></li> 45 * <li><code> getSpinSize()</code></li> 46 * <li><code> setDecimalDigits()</code></li> 47 * <li><code> getDecimalDigits()</code></li> 48 * <li><code> setStrictFormat()</code></li> 49 * <li><code> isStrictFormat()</code></li> 50 * </ul> <p> 51 * Test is <b> NOT </b> multithread compilant. <p> 52 * @see com.sun.star.awt.XCurrencyField 53 */ 54 public class _XCurrencyField extends MultiMethodTest { 55 56 public XCurrencyField oObj = null; 57 private double val = 0; 58 private double min = 0; 59 private double max = 0; 60 private double first = 0; 61 private double last = 0; 62 private double spin = 0; 63 private short digits = 0; 64 private boolean strict = true; 65 66 /** 67 * Sets value changed and then compares it to get value. <p> 68 * Has <b>OK</b> status if set and get values are equal. 69 * The following method tests are to be completed successfully before : 70 * <ul> 71 * <li> <code> getValue </code> </li> 72 * </ul> 73 */ _setValue()74 public void _setValue() { 75 requiredMethod("getValue()"); 76 77 oObj.setValue(val + 1.1); 78 79 tRes.tested("setValue()", oObj.getValue() == val + 1.1); 80 } 81 82 /** 83 * Just calls the method and stores value returned. <p> 84 * Has <b>OK</b> status if no runtime exceptions occured. 85 */ _getValue()86 public void _getValue() { 87 val = oObj.getValue(); 88 89 tRes.tested("getValue()", true); 90 } 91 92 /** 93 * Sets minimal value changed and then compares it to get value. <p> 94 * Has <b>OK</b> status if set and get values are equal. 95 * The following method tests are to be completed successfully before : 96 * <ul> 97 * <li> <code> getMin </code> </li> 98 * </ul> 99 */ _setMin()100 public void _setMin() { 101 requiredMethod("getMin()"); 102 103 oObj.setMin(min + 1.1); 104 105 tRes.tested("setMin()", oObj.getMin() == min + 1.1); 106 } 107 108 /** 109 * Just calls the method and stores value returned. <p> 110 * Has <b>OK</b> status if no runtime exceptions occured. 111 */ _getMin()112 public void _getMin() { 113 114 boolean result = true; 115 min = oObj.getMin(); 116 117 tRes.tested("getMin()", result); 118 } 119 120 /** 121 * Sets maximal value changed and then compares it to get value. <p> 122 * Has <b>OK</b> status if set and get values are equal. 123 * The following method tests are to be completed successfully before : 124 * <ul> 125 * <li> <code> getMax </code> </li> 126 * </ul> 127 */ _setMax()128 public void _setMax() { 129 requiredMethod("getMax()"); 130 131 boolean result = true; 132 oObj.setMax(max + 1.1); 133 result = oObj.getMax() == max + 1.1; 134 135 tRes.tested("setMax()", result); 136 } 137 138 /** 139 * Just calls the method and stores value returned. <p> 140 * Has <b>OK</b> status if no runtime exceptions occured. 141 */ _getMax()142 public void _getMax() { 143 144 boolean result = true; 145 max = oObj.getMax(); 146 147 tRes.tested("getMax()", result); 148 } 149 150 /** 151 * Sets value changed and then compares it to get value. <p> 152 * Has <b>OK</b> status if set and get values are equal. 153 * The following method tests are to be completed successfully before : 154 * <ul> 155 * <li> <code> getFirst </code> </li> 156 * </ul> 157 */ _setFirst()158 public void _setFirst() { 159 requiredMethod("getFirst()"); 160 161 boolean result = true; 162 oObj.setFirst(first + 1.1); 163 double ret = oObj.getFirst(); 164 result = ret == first + 1.1; 165 166 tRes.tested("setFirst()", result); 167 } 168 169 /** 170 * Just calls the method and stores value returned. <p> 171 * Has <b>OK</b> status if no runtime exceptions occured. 172 */ _getFirst()173 public void _getFirst() { 174 175 boolean result = true; 176 first = oObj.getFirst(); 177 178 tRes.tested("getFirst()", result); 179 } 180 181 /** 182 * Sets value changed and then compares it to get value. <p> 183 * Has <b>OK</b> status if set and get values are equal. 184 * The following method tests are to be completed successfully before : 185 * <ul> 186 * <li> <code> getLast </code> </li> 187 * </ul> 188 */ _setLast()189 public void _setLast() { 190 requiredMethod("getLast()"); 191 192 boolean result = true; 193 oObj.setLast(last + 1.1); 194 double ret = oObj.getLast(); 195 196 result = ret == last + 1.1; 197 198 tRes.tested("setLast()", result); 199 } 200 201 /** 202 * Just calls the method and stores value returned. <p> 203 * Has <b>OK</b> status if no runtime exceptions occured. 204 */ _getLast()205 public void _getLast() { 206 207 boolean result = true; 208 last = oObj.getLast(); 209 210 tRes.tested("getLast()", result); 211 } 212 213 /** 214 * Sets value changed and then compares it to get value. <p> 215 * Has <b>OK</b> status if set and get values are equal. 216 * The following method tests are to be completed successfully before : 217 * <ul> 218 * <li> <code> getSpinSize </code> </li> 219 * </ul> 220 */ _setSpinSize()221 public void _setSpinSize() { 222 requiredMethod("getSpinSize()"); 223 224 boolean result = true; 225 oObj.setSpinSize(spin + 1.1); 226 result = oObj.getSpinSize() == spin + 1.1; 227 228 tRes.tested("setSpinSize()", result); 229 } 230 231 /** 232 * Just calls the method and stores value returned. <p> 233 * Has <b>OK</b> status if no runtime exceptions occured. 234 */ _getSpinSize()235 public void _getSpinSize() { 236 237 boolean result = true; 238 spin = oObj.getSpinSize(); 239 240 tRes.tested("getSpinSize()", result); 241 } 242 243 /** 244 * Sets value changed and then compares it to get value. <p> 245 * Has <b>OK</b> status if set and get values are equal. 246 * The following method tests are to be completed successfully before : 247 * <ul> 248 * <li> <code> getDecimalDigits </code> </li> 249 * </ul> 250 */ _setDecimalDigits()251 public void _setDecimalDigits() { 252 requiredMethod("getDecimalDigits()"); 253 254 boolean result = true; 255 oObj.setDecimalDigits((short) (digits + 1)); 256 257 short res = oObj.getDecimalDigits(); 258 result = res == ((short) digits + 1); 259 260 tRes.tested("setDecimalDigits()", result); 261 } 262 263 /** 264 * Just calls the method and stores value returned. <p> 265 * Has <b>OK</b> status if no runtime exceptions occured. 266 */ _getDecimalDigits()267 public void _getDecimalDigits() { 268 269 boolean result = true; 270 digits = oObj.getDecimalDigits(); 271 272 tRes.tested("getDecimalDigits()", result); 273 } 274 275 /** 276 * Sets value changed and then compares it to get value. <p> 277 * Has <b>OK</b> status if set and get values are equal. 278 * The following method tests are to be completed successfully before : 279 * <ul> 280 * <li> <code> isStrictFormat </code> </li> 281 * </ul> 282 */ _setStrictFormat()283 public void _setStrictFormat() { 284 requiredMethod("isStrictFormat()"); 285 286 boolean result = true; 287 oObj.setStrictFormat(!strict); 288 result = oObj.isStrictFormat() == !strict; 289 290 tRes.tested("setStrictFormat()", result); 291 } 292 293 /** 294 * Just calls the method and stores value returned. <p> 295 * Has <b>OK</b> status if no runtime exceptions occured. 296 */ _isStrictFormat()297 public void _isStrictFormat() { 298 299 boolean result = true; 300 strict = oObj.isStrictFormat(); 301 302 tRes.tested("isStrictFormat()", result); 303 } 304 } 305