1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 package ifc.awt; 29 30 31 import lib.MultiMethodTest; 32 33 import com.sun.star.awt.XNumericField; 34 35 /** 36 * Testing <code>com.sun.star.awt.XNumericField</code> 37 * interface methods : 38 * <ul> 39 * <li><code> setValue()</code></li> 40 * <li><code> getValue()</code></li> 41 * <li><code> setMin()</code></li> 42 * <li><code> getMin()</code></li> 43 * <li><code> setMax()</code></li> 44 * <li><code> getMax()</code></li> 45 * <li><code> setFirst()</code></li> 46 * <li><code> getFirst()</code></li> 47 * <li><code> setLast()</code></li> 48 * <li><code> getLast()</code></li> 49 * <li><code> setSpinSize()</code></li> 50 * <li><code> getSpinSize()</code></li> 51 * <li><code> setDecimalDigits()</code></li> 52 * <li><code> getDecimalDigits()</code></li> 53 * <li><code> setStrictFormat()</code></li> 54 * <li><code> isStrictFormat()</code></li> 55 * </ul> <p> 56 * Test is <b> NOT </b> multithread compilant. <p> 57 * @see com.sun.star.awt.XNumericField 58 */ 59 public class _XNumericField extends MultiMethodTest { 60 61 public XNumericField oObj = null; 62 private double val = 0 ; 63 private double min = 0 ; 64 private double max = 0 ; 65 private double first = 0 ; 66 private double last = 0 ; 67 private double spin = 0 ; 68 private short digits = 0 ; 69 private boolean strict = true ; 70 71 /** 72 * Sets value changed and then compares it to get value. <p> 73 * Has <b>OK</b> status if set and get values are equal. 74 * The following method tests are to be completed successfully before : 75 * <ul> 76 * <li> <code> getValue </code> </li> 77 * </ul> 78 */ 79 public void _setValue() { 80 requiredMethod("getValue()"); 81 82 oObj.setValue(val + 1.1) ; 83 84 tRes.tested("setValue()", oObj.getValue() == val + 1.1) ; 85 } 86 87 /** 88 * Just calls the method and stores value returned. <p> 89 * Has <b>OK</b> status if no runtime exceptions occured. 90 */ 91 public void _getValue() { 92 val = oObj.getValue() ; 93 94 tRes.tested("getValue()", true) ; 95 } 96 97 /** 98 * Sets minimal value changed and then compares it to get value. <p> 99 * Has <b>OK</b> status if set and get values are equal. 100 * The following method tests are to be completed successfully before : 101 * <ul> 102 * <li> <code> getMin </code> </li> 103 * </ul> 104 */ 105 public void _setMin() { 106 requiredMethod("getMin()") ; 107 108 oObj.setMin(min + 1.1) ; 109 110 tRes.tested("setMin()", oObj.getMin() == min + 1.1) ; 111 } 112 113 /** 114 * Just calls the method and stores value returned. <p> 115 * Has <b>OK</b> status if no runtime exceptions occured. 116 */ 117 public void _getMin() { 118 119 boolean result = true ; 120 min = oObj.getMin() ; 121 122 tRes.tested("getMin()", result) ; 123 } 124 125 /** 126 * Sets maximal value changed and then compares it to get value. <p> 127 * Has <b>OK</b> status if set and get values are equal. 128 * The following method tests are to be completed successfully before : 129 * <ul> 130 * <li> <code> getMax </code> </li> 131 * </ul> 132 */ 133 public void _setMax() { 134 requiredMethod("getMax()") ; 135 136 boolean result = true ; 137 oObj.setMax(max + 1.1) ; 138 result = oObj.getMax() == max + 1.1 ; 139 140 tRes.tested("setMax()", result) ; 141 } 142 143 /** 144 * Just calls the method and stores value returned. <p> 145 * Has <b>OK</b> status if no runtime exceptions occured. 146 */ 147 public void _getMax() { 148 149 boolean result = true ; 150 max = oObj.getMax() ; 151 152 tRes.tested("getMax()", result) ; 153 } 154 155 /** 156 * Sets value changed and then compares it to get value. <p> 157 * Has <b>OK</b> status if set and get values are equal. 158 * The following method tests are to be completed successfully before : 159 * <ul> 160 * <li> <code> getFirst </code> </li> 161 * </ul> 162 */ 163 public void _setFirst() { 164 requiredMethod("getFirst()") ; 165 166 boolean result = true ; 167 oObj.setFirst(first + 1.1) ; 168 double ret = oObj.getFirst() ; 169 result = ret == first + 1.1 ; 170 171 tRes.tested("setFirst()", result) ; 172 } 173 174 /** 175 * Just calls the method and stores value returned. <p> 176 * Has <b>OK</b> status if no runtime exceptions occured. 177 */ 178 public void _getFirst() { 179 180 boolean result = true ; 181 first = oObj.getFirst() ; 182 183 tRes.tested("getFirst()", result) ; 184 } 185 186 /** 187 * Sets value changed and then compares it to get value. <p> 188 * Has <b>OK</b> status if set and get values are equal. 189 * The following method tests are to be completed successfully before : 190 * <ul> 191 * <li> <code> getLast </code> </li> 192 * </ul> 193 */ 194 public void _setLast() { 195 requiredMethod("getLast()") ; 196 197 boolean result = true ; 198 oObj.setLast(last + 1.1) ; 199 double ret = oObj.getLast() ; 200 201 result = ret == last + 1.1 ; 202 203 tRes.tested("setLast()", result) ; 204 } 205 206 /** 207 * Just calls the method and stores value returned. <p> 208 * Has <b>OK</b> status if no runtime exceptions occured. 209 */ 210 public void _getLast() { 211 212 boolean result = true ; 213 last = oObj.getLast() ; 214 215 tRes.tested("getLast()", result) ; 216 } 217 218 /** 219 * Sets value changed and then compares it to get value. <p> 220 * Has <b>OK</b> status if set and get values are equal. 221 * The following method tests are to be completed successfully before : 222 * <ul> 223 * <li> <code> getSpinSize </code> </li> 224 * </ul> 225 */ 226 public void _setSpinSize() { 227 requiredMethod("getSpinSize()") ; 228 229 boolean result = true ; 230 oObj.setSpinSize(spin + 1.1) ; 231 result = oObj.getSpinSize() == spin + 1.1 ; 232 233 tRes.tested("setSpinSize()", result) ; 234 } 235 236 /** 237 * Just calls the method and stores value returned. <p> 238 * Has <b>OK</b> status if no runtime exceptions occured. 239 */ 240 public void _getSpinSize() { 241 242 boolean result = true ; 243 spin = oObj.getSpinSize() ; 244 245 tRes.tested("getSpinSize()", result) ; 246 } 247 248 /** 249 * Sets value changed and then compares it to get value. <p> 250 * Has <b>OK</b> status if set and get values are equal. 251 * The following method tests are to be completed successfully before : 252 * <ul> 253 * <li> <code> getDecimalDigits </code> </li> 254 * </ul> 255 */ 256 public void _setDecimalDigits() { 257 requiredMethod("getDecimalDigits()") ; 258 259 boolean result = true ; 260 oObj.setDecimalDigits((short)(digits + 1)) ; 261 262 short res = oObj.getDecimalDigits() ; 263 result = res == ((short)digits + 1) ; 264 265 tRes.tested("setDecimalDigits()", result) ; 266 } 267 268 /** 269 * Just calls the method and stores value returned. <p> 270 * Has <b>OK</b> status if no runtime exceptions occured. 271 */ 272 public void _getDecimalDigits() { 273 274 boolean result = true ; 275 digits = oObj.getDecimalDigits() ; 276 277 tRes.tested("getDecimalDigits()", result) ; 278 } 279 280 /** 281 * Sets value changed and then compares it to get value. <p> 282 * Has <b>OK</b> status if set and get values are equal. 283 * The following method tests are to be completed successfully before : 284 * <ul> 285 * <li> <code> isStrictFormat </code> </li> 286 * </ul> 287 */ 288 public void _setStrictFormat() { 289 requiredMethod("isStrictFormat()") ; 290 291 boolean result = true ; 292 oObj.setStrictFormat(!strict) ; 293 result = oObj.isStrictFormat() == !strict ; 294 295 tRes.tested("setStrictFormat()", result) ; 296 } 297 298 /** 299 * Just calls the method and stores value returned. <p> 300 * Has <b>OK</b> status if no runtime exceptions occured. 301 */ 302 public void _isStrictFormat() { 303 304 boolean result = true ; 305 strict = oObj.isStrictFormat() ; 306 307 tRes.tested("isStrictFormat()", result) ; 308 } 309 } 310 311 312