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