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