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