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