1<?xml version="1.0" encoding="UTF-8"?> 2<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> 3<script:module xmlns:script="http://openoffice.org/2000/script" script:name="awt_XNumericField" script:language="StarBasic"> 4 5 6'************************************************************************* 7' 8' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 9' 10' Copyright 2000, 2010 Oracle and/or its affiliates. 11' 12' OpenOffice.org - a multi-platform office productivity suite 13' 14' This file is part of OpenOffice.org. 15' 16' OpenOffice.org is free software: you can redistribute it and/or modify 17' it under the terms of the GNU Lesser General Public License version 3 18' only, as published by the Free Software Foundation. 19' 20' OpenOffice.org is distributed in the hope that it will be useful, 21' but WITHOUT ANY WARRANTY; without even the implied warranty of 22' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23' GNU Lesser General Public License version 3 for more details 24' (a copy is included in the LICENSE file that accompanied this code). 25' 26' You should have received a copy of the GNU Lesser General Public License 27' version 3 along with OpenOffice.org. If not, see 28' <http://www.openoffice.org/license.html> 29' for a copy of the LGPLv3 License. 30' 31'************************************************************************* 32***** 33'************************************************************************* 34 35 36 37' Be sure that all variables are dimensioned: 38option explicit 39 40 41 42Sub RunTest() 43 44'************************************************************************* 45' INTERFACE: 46' com.sun.star.awt.XNumericField 47'************************************************************************* 48On Error Goto ErrHndl 49 Dim bOK As Boolean 50 Dim oldVal, newVal As Variant 51 52 Test.StartMethod("getValue()") 53 Test.StartMethod("setValue()") 54 bOK = true 55 oldVal = oObj.getValue() 56 Out.Log("value before: "+oldVal) 57 oObj.setValue(oldVal+20) 58 newVal = oObj.getValue() 59 Out.Log("value after: "+newVal) 60 bOK = bOK AND (oldVal <> newVal) 61 Test.MethodTested("setValue()", bOK) 62 Test.MethodTested("getValue()", bOK) 63 64 Test.StartMethod("getMin()") 65 Test.StartMethod("setMin()") 66 bOK = true 67 oldVal = oObj.getMin() 68 Out.Log("value before: "+oldVal) 69 oObj.setMin(oldVal+20) 70 newVal = oObj.getMin() 71 Out.Log("value after: "+newVal) 72 bOK = bOK AND (oldVal <> newVal) 73 Test.MethodTested("setMin()", bOK) 74 Test.MethodTested("getMin()", bOK) 75 76 Test.StartMethod("getMax()") 77 Test.StartMethod("setMax()") 78 bOK = true 79 oldVal = oObj.getMax() 80 Out.Log("value before: "+oldVal) 81 oObj.setMax(oldVal+20) 82 newVal = oObj.getMax() 83 Out.Log("value after: "+newVal) 84 bOK = bOK AND (oldVal <> newVal) 85 Test.MethodTested("setMax()", bOK) 86 Test.MethodTested("getMax()", bOK) 87 88 Test.StartMethod("getFirst()") 89 Test.StartMethod("setFirst()") 90 bOK = true 91 oldVal = oObj.getFirst() 92 Out.Log("value before: "+oldVal) 93 oObj.setFirst(oldVal+20) 94 newVal = oObj.getFirst() 95 Out.Log("value after: "+newVal) 96 bOK = bOK AND (oldVal <> newVal) 97 Test.MethodTested("setFirst()", bOK) 98 Test.MethodTested("getFirst()", bOK) 99 100 Test.StartMethod("getLast()") 101 Test.StartMethod("setLast()") 102 bOK = true 103 oldVal = oObj.getLast() 104 Out.Log("value before: "+oldVal) 105 oObj.setLast(oldVal+20) 106 newVal = oObj.getLast() 107 Out.Log("value after: "+newVal) 108 bOK = bOK AND (oldVal <> newVal) 109 Test.MethodTested("setLast()", bOK) 110 Test.MethodTested("getLast()", bOK) 111 112 Test.StartMethod("getSpinSize()") 113 Test.StartMethod("setSpinSize()") 114 bOK = true 115 oldVal = oObj.getSpinSize() 116 Out.Log("value before: "+oldVal) 117 oObj.setSpinSize(oldVal+20) 118 newVal = oObj.getSpinSize() 119 Out.Log("value after: "+newVal) 120 bOK = bOK AND (oldVal <> newVal) 121 Test.MethodTested("setSpinSize()", bOK) 122 Test.MethodTested("getSpinSize()", bOK) 123 124 Test.StartMethod("getDecimalDigits()") 125 Test.StartMethod("setDecimalDigits()") 126 bOK = true 127 oldVal = oObj.getDecimalDigits() 128 Out.Log("value before: "+oldVal) 129 oObj.setDecimalDigits(oldVal+20) 130 newVal = oObj.getDecimalDigits() 131 Out.Log("value after: "+newVal) 132 bOK = bOK AND (oldVal <> newVal) 133 Test.MethodTested("setDecimalDigits()", bOK) 134 Test.MethodTested("getDecimalDigits()", bOK) 135 136 Test.StartMethod("isStrictFormat()") 137 Test.StartMethod("setStrictFormat()") 138 bOK = true 139 oldVal = oObj.isStrictFormat() 140 Out.Log("value before: "+oldVal) 141 if (oldVal) then 142 oObj.setStrictFormat(false) 143 else 144 oObj.setStrictFormat(true) 145 endif 146 newVal = oObj.isStrictFormat() 147 Out.Log("value after: "+newVal) 148 bOK = bOK AND (oldVal <> newVal) 149 Test.MethodTested("setStrictFormat()", bOK) 150 Test.MethodTested("isStrictFormat()", bOK) 151 152Exit Sub 153ErrHndl: 154 Test.Exception() 155 bOK = false 156 resume next 157End Sub 158</script:module> 159