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' Be sure that all variables are dimensioned:
37option explicit
38
39
40
41Sub RunTest()
42
43'*************************************************************************
44' INTERFACE:
45' com.sun.star.awt.XNumericField
46'*************************************************************************
47On Error Goto ErrHndl
48    Dim bOK As Boolean
49    Dim oldVal, newVal As Variant
50
51    Test.StartMethod("getValue()")
52    Test.StartMethod("setValue()")
53    bOK = true
54    oldVal = oObj.getValue()
55    Out.Log("value before: "+oldVal)
56    oObj.setValue(oldVal+20)
57    newVal = oObj.getValue()
58    Out.Log("value after: "+newVal)
59    bOK = bOK AND (oldVal &lt;&gt; newVal)
60    Test.MethodTested("setValue()", bOK)
61    Test.MethodTested("getValue()", bOK)
62
63    Test.StartMethod("getMin()")
64    Test.StartMethod("setMin()")
65    bOK = true
66    oldVal = oObj.getMin()
67    Out.Log("value before: "+oldVal)
68    oObj.setMin(oldVal+20)
69    newVal = oObj.getMin()
70    Out.Log("value after: "+newVal)
71    bOK = bOK AND (oldVal &lt;&gt; newVal)
72    Test.MethodTested("setMin()", bOK)
73    Test.MethodTested("getMin()", bOK)
74
75    Test.StartMethod("getMax()")
76    Test.StartMethod("setMax()")
77    bOK = true
78    oldVal = oObj.getMax()
79    Out.Log("value before: "+oldVal)
80    oObj.setMax(oldVal+20)
81    newVal = oObj.getMax()
82    Out.Log("value after: "+newVal)
83    bOK = bOK AND (oldVal &lt;&gt; newVal)
84    Test.MethodTested("setMax()", bOK)
85    Test.MethodTested("getMax()", bOK)
86
87    Test.StartMethod("getFirst()")
88    Test.StartMethod("setFirst()")
89    bOK = true
90    oldVal = oObj.getFirst()
91    Out.Log("value before: "+oldVal)
92    oObj.setFirst(oldVal+20)
93    newVal = oObj.getFirst()
94    Out.Log("value after: "+newVal)
95    bOK = bOK AND (oldVal &lt;&gt; newVal)
96    Test.MethodTested("setFirst()", bOK)
97    Test.MethodTested("getFirst()", bOK)
98
99    Test.StartMethod("getLast()")
100    Test.StartMethod("setLast()")
101    bOK = true
102    oldVal = oObj.getLast()
103    Out.Log("value before: "+oldVal)
104    oObj.setLast(oldVal+20)
105    newVal = oObj.getLast()
106    Out.Log("value after: "+newVal)
107    bOK = bOK AND (oldVal &lt;&gt; newVal)
108    Test.MethodTested("setLast()", bOK)
109    Test.MethodTested("getLast()", bOK)
110
111    Test.StartMethod("getSpinSize()")
112    Test.StartMethod("setSpinSize()")
113    bOK = true
114    oldVal = oObj.getSpinSize()
115    Out.Log("value before: "+oldVal)
116    oObj.setSpinSize(oldVal+20)
117    newVal = oObj.getSpinSize()
118    Out.Log("value after: "+newVal)
119    bOK = bOK AND (oldVal &lt;&gt; newVal)
120    Test.MethodTested("setSpinSize()", bOK)
121    Test.MethodTested("getSpinSize()", bOK)
122
123    Test.StartMethod("getDecimalDigits()")
124    Test.StartMethod("setDecimalDigits()")
125    bOK = true
126    oldVal = oObj.getDecimalDigits()
127    Out.Log("value before: "+oldVal)
128    oObj.setDecimalDigits(oldVal+20)
129    newVal = oObj.getDecimalDigits()
130    Out.Log("value after: "+newVal)
131    bOK = bOK AND (oldVal &lt;&gt; newVal)
132    Test.MethodTested("setDecimalDigits()", bOK)
133    Test.MethodTested("getDecimalDigits()", bOK)
134
135    Test.StartMethod("isStrictFormat()")
136    Test.StartMethod("setStrictFormat()")
137    bOK = true
138    oldVal = oObj.isStrictFormat()
139    Out.Log("value before: "+oldVal)
140    if (oldVal) then
141        oObj.setStrictFormat(false)
142    else
143        oObj.setStrictFormat(true)
144    endif
145    newVal = oObj.isStrictFormat()
146    Out.Log("value after: "+newVal)
147    bOK = bOK AND (oldVal &lt;&gt; newVal)
148    Test.MethodTested("setStrictFormat()", bOK)
149    Test.MethodTested("isStrictFormat()", bOK)
150
151Exit Sub
152ErrHndl:
153    Test.Exception()
154    bOK = false
155    resume next
156End Sub
157</script:module>
158