1cdf0e10cSrcweir<?xml version="1.0" encoding="UTF-8"?> 2cdf0e10cSrcweir<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> 3cdf0e10cSrcweir<script:module xmlns:script="http://openoffice.org/2000/script" script:name="awt_XNumericField" script:language="StarBasic"> 4cdf0e10cSrcweir 5cdf0e10cSrcweir 6cdf0e10cSrcweir'************************************************************************* 7cdf0e10cSrcweir' 8*3e6afcd2SAndrew Rist' Licensed to the Apache Software Foundation (ASF) under one 9*3e6afcd2SAndrew Rist' or more contributor license agreements. See the NOTICE file 10*3e6afcd2SAndrew Rist' distributed with this work for additional information 11*3e6afcd2SAndrew Rist' regarding copyright ownership. The ASF licenses this file 12*3e6afcd2SAndrew Rist' to you under the Apache License, Version 2.0 (the 13*3e6afcd2SAndrew Rist' "License"); you may not use this file except in compliance 14*3e6afcd2SAndrew Rist' with the License. You may obtain a copy of the License at 15*3e6afcd2SAndrew Rist' 16*3e6afcd2SAndrew Rist' http://www.apache.org/licenses/LICENSE-2.0 17*3e6afcd2SAndrew Rist' 18*3e6afcd2SAndrew Rist' Unless required by applicable law or agreed to in writing, 19*3e6afcd2SAndrew Rist' software distributed under the License is distributed on an 20*3e6afcd2SAndrew Rist' "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 21*3e6afcd2SAndrew Rist' KIND, either express or implied. See the License for the 22*3e6afcd2SAndrew Rist' specific language governing permissions and limitations 23*3e6afcd2SAndrew Rist' under the License. 24cdf0e10cSrcweir' 25cdf0e10cSrcweir'************************************************************************* 26cdf0e10cSrcweir 27cdf0e10cSrcweir 28cdf0e10cSrcweir 29*3e6afcd2SAndrew Rist 30*3e6afcd2SAndrew Rist 31cdf0e10cSrcweir' Be sure that all variables are dimensioned: 32cdf0e10cSrcweiroption explicit 33cdf0e10cSrcweir 34cdf0e10cSrcweir 35cdf0e10cSrcweir 36cdf0e10cSrcweirSub RunTest() 37cdf0e10cSrcweir 38cdf0e10cSrcweir'************************************************************************* 39cdf0e10cSrcweir' INTERFACE: 40cdf0e10cSrcweir' com.sun.star.awt.XNumericField 41cdf0e10cSrcweir'************************************************************************* 42cdf0e10cSrcweirOn Error Goto ErrHndl 43cdf0e10cSrcweir Dim bOK As Boolean 44cdf0e10cSrcweir Dim oldVal, newVal As Variant 45cdf0e10cSrcweir 46cdf0e10cSrcweir Test.StartMethod("getValue()") 47cdf0e10cSrcweir Test.StartMethod("setValue()") 48cdf0e10cSrcweir bOK = true 49cdf0e10cSrcweir oldVal = oObj.getValue() 50cdf0e10cSrcweir Out.Log("value before: "+oldVal) 51cdf0e10cSrcweir oObj.setValue(oldVal+20) 52cdf0e10cSrcweir newVal = oObj.getValue() 53cdf0e10cSrcweir Out.Log("value after: "+newVal) 54cdf0e10cSrcweir bOK = bOK AND (oldVal <> newVal) 55cdf0e10cSrcweir Test.MethodTested("setValue()", bOK) 56cdf0e10cSrcweir Test.MethodTested("getValue()", bOK) 57cdf0e10cSrcweir 58cdf0e10cSrcweir Test.StartMethod("getMin()") 59cdf0e10cSrcweir Test.StartMethod("setMin()") 60cdf0e10cSrcweir bOK = true 61cdf0e10cSrcweir oldVal = oObj.getMin() 62cdf0e10cSrcweir Out.Log("value before: "+oldVal) 63cdf0e10cSrcweir oObj.setMin(oldVal+20) 64cdf0e10cSrcweir newVal = oObj.getMin() 65cdf0e10cSrcweir Out.Log("value after: "+newVal) 66cdf0e10cSrcweir bOK = bOK AND (oldVal <> newVal) 67cdf0e10cSrcweir Test.MethodTested("setMin()", bOK) 68cdf0e10cSrcweir Test.MethodTested("getMin()", bOK) 69cdf0e10cSrcweir 70cdf0e10cSrcweir Test.StartMethod("getMax()") 71cdf0e10cSrcweir Test.StartMethod("setMax()") 72cdf0e10cSrcweir bOK = true 73cdf0e10cSrcweir oldVal = oObj.getMax() 74cdf0e10cSrcweir Out.Log("value before: "+oldVal) 75cdf0e10cSrcweir oObj.setMax(oldVal+20) 76cdf0e10cSrcweir newVal = oObj.getMax() 77cdf0e10cSrcweir Out.Log("value after: "+newVal) 78cdf0e10cSrcweir bOK = bOK AND (oldVal <> newVal) 79cdf0e10cSrcweir Test.MethodTested("setMax()", bOK) 80cdf0e10cSrcweir Test.MethodTested("getMax()", bOK) 81cdf0e10cSrcweir 82cdf0e10cSrcweir Test.StartMethod("getFirst()") 83cdf0e10cSrcweir Test.StartMethod("setFirst()") 84cdf0e10cSrcweir bOK = true 85cdf0e10cSrcweir oldVal = oObj.getFirst() 86cdf0e10cSrcweir Out.Log("value before: "+oldVal) 87cdf0e10cSrcweir oObj.setFirst(oldVal+20) 88cdf0e10cSrcweir newVal = oObj.getFirst() 89cdf0e10cSrcweir Out.Log("value after: "+newVal) 90cdf0e10cSrcweir bOK = bOK AND (oldVal <> newVal) 91cdf0e10cSrcweir Test.MethodTested("setFirst()", bOK) 92cdf0e10cSrcweir Test.MethodTested("getFirst()", bOK) 93cdf0e10cSrcweir 94cdf0e10cSrcweir Test.StartMethod("getLast()") 95cdf0e10cSrcweir Test.StartMethod("setLast()") 96cdf0e10cSrcweir bOK = true 97cdf0e10cSrcweir oldVal = oObj.getLast() 98cdf0e10cSrcweir Out.Log("value before: "+oldVal) 99cdf0e10cSrcweir oObj.setLast(oldVal+20) 100cdf0e10cSrcweir newVal = oObj.getLast() 101cdf0e10cSrcweir Out.Log("value after: "+newVal) 102cdf0e10cSrcweir bOK = bOK AND (oldVal <> newVal) 103cdf0e10cSrcweir Test.MethodTested("setLast()", bOK) 104cdf0e10cSrcweir Test.MethodTested("getLast()", bOK) 105cdf0e10cSrcweir 106cdf0e10cSrcweir Test.StartMethod("getSpinSize()") 107cdf0e10cSrcweir Test.StartMethod("setSpinSize()") 108cdf0e10cSrcweir bOK = true 109cdf0e10cSrcweir oldVal = oObj.getSpinSize() 110cdf0e10cSrcweir Out.Log("value before: "+oldVal) 111cdf0e10cSrcweir oObj.setSpinSize(oldVal+20) 112cdf0e10cSrcweir newVal = oObj.getSpinSize() 113cdf0e10cSrcweir Out.Log("value after: "+newVal) 114cdf0e10cSrcweir bOK = bOK AND (oldVal <> newVal) 115cdf0e10cSrcweir Test.MethodTested("setSpinSize()", bOK) 116cdf0e10cSrcweir Test.MethodTested("getSpinSize()", bOK) 117cdf0e10cSrcweir 118cdf0e10cSrcweir Test.StartMethod("getDecimalDigits()") 119cdf0e10cSrcweir Test.StartMethod("setDecimalDigits()") 120cdf0e10cSrcweir bOK = true 121cdf0e10cSrcweir oldVal = oObj.getDecimalDigits() 122cdf0e10cSrcweir Out.Log("value before: "+oldVal) 123cdf0e10cSrcweir oObj.setDecimalDigits(oldVal+20) 124cdf0e10cSrcweir newVal = oObj.getDecimalDigits() 125cdf0e10cSrcweir Out.Log("value after: "+newVal) 126cdf0e10cSrcweir bOK = bOK AND (oldVal <> newVal) 127cdf0e10cSrcweir Test.MethodTested("setDecimalDigits()", bOK) 128cdf0e10cSrcweir Test.MethodTested("getDecimalDigits()", bOK) 129cdf0e10cSrcweir 130cdf0e10cSrcweir Test.StartMethod("isStrictFormat()") 131cdf0e10cSrcweir Test.StartMethod("setStrictFormat()") 132cdf0e10cSrcweir bOK = true 133cdf0e10cSrcweir oldVal = oObj.isStrictFormat() 134cdf0e10cSrcweir Out.Log("value before: "+oldVal) 135cdf0e10cSrcweir if (oldVal) then 136cdf0e10cSrcweir oObj.setStrictFormat(false) 137cdf0e10cSrcweir else 138cdf0e10cSrcweir oObj.setStrictFormat(true) 139cdf0e10cSrcweir endif 140cdf0e10cSrcweir newVal = oObj.isStrictFormat() 141cdf0e10cSrcweir Out.Log("value after: "+newVal) 142cdf0e10cSrcweir bOK = bOK AND (oldVal <> newVal) 143cdf0e10cSrcweir Test.MethodTested("setStrictFormat()", bOK) 144cdf0e10cSrcweir Test.MethodTested("isStrictFormat()", bOK) 145cdf0e10cSrcweir 146cdf0e10cSrcweirExit Sub 147cdf0e10cSrcweirErrHndl: 148cdf0e10cSrcweir Test.Exception() 149cdf0e10cSrcweir bOK = false 150cdf0e10cSrcweir resume next 151cdf0e10cSrcweirEnd Sub 152cdf0e10cSrcweir</script:module> 153