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