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_UnoControlNumericFieldModel" 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
32
33Sub RunTest()
34
35'*************************************************************************
36' SERVICE:
37' com.sun.star.awt.UnoControlNumericFieldModel
38'*************************************************************************
39On Error Goto ErrHndl
40    Dim bOK As Boolean
41    Dim newVal, oldVal As Long
42
43    PropertyTester.TestProperty("BackgroundColor")
44
45    PropertyTester.TestProperty("Border")
46
47    PropertyTester.TestProperty("DecimalAccuracy")
48
49    PropertyTester.TestProperty("Enabled")
50
51    PropertyTester.TestProperty("FontDescriptor")
52
53    PropertyTester.TestProperty("ShowThousandsSeparator")
54
55    PropertyTester.TestProperty("Printable")
56
57    PropertyTester.TestProperty("ReadOnly")
58
59    PropertyTester.TestProperty("Spin")
60
61    PropertyTester.TestProperty("StrictFormat")
62
63    PropertyTester.TestProperty("Tabstop")
64
65    PropertyTester.TestProperty("TextColor")
66
67    Test.StartMethod("Value")
68    bOK = true
69    oldVal = oObj.Value
70    Out.Log("value before: "+oldVal)
71    if (oldVal &lt;&gt; 999) then
72        oObj.Value = 999
73    else
74        oObj.Value = 1000
75    endif
76    newVal = oObj.Value
77    Out.Log("value after: "+newVal)
78    bOK = bOK AND (newVal &lt;&gt; oldVal)
79    Test.MethodTested("Value",bOK)
80
81    Test.StartMethod("ValueMax")
82    bOK = true
83    oldVal = oObj.ValueMax
84    Out.Log("value before: "+oldVal)
85    if (oldVal &lt;&gt; 10000) then
86        oObj.ValueMax = 10000
87    else
88        oObj.ValueMax = 10001
89    endif
90    newVal = oObj.ValueMax
91    Out.Log("value after: "+newVal)
92    bOK = bOK AND (newVal &lt;&gt; oldVal)
93    Test.MethodTested("ValueMax",bOK)
94
95    Test.StartMethod("ValueMin")
96    bOK = true
97    oldVal = oObj.ValueMin
98    Out.Log("value before: "+oldVal)
99    if (oldVal &lt;&gt; -10000) then
100        oObj.ValueMin = -10000
101    else
102        oObj.ValueMin = -10001
103    endif
104    newVal = oObj.ValueMin
105    Out.Log("value after: "+newVal)
106    bOK = bOK AND (newVal &lt;&gt; oldVal)
107    Test.MethodTested("ValueMin",bOK)
108
109    PropertyTester.TestProperty("ValueStep")
110
111    PropertyTester.TestProperty("HelpText")
112
113    PropertyTester.TestProperty("HelpURL")
114
115    PropertyTester.TestProperty("FontEmphasisMark")
116
117    PropertyTester.TestProperty("FontRelief")
118
119    PropertyTester.TestProperty("TextLineColor")
120
121Exit Sub
122ErrHndl:
123    Test.Exception()
124    bOK = false
125    resume next
126End Sub
127</script:module>
128