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="accessibility_XAccessibleValue" 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
36
37Sub RunTest()
38
39'*************************************************************************
40' INTERFACE:
41' com.sun.star.accessibility.XAccessibleValue
42'*************************************************************************
43On Error Goto ErrHndl
44    Dim bOK As Boolean
45
46    Test.StartMethod("getMinimumValue()")
47    Dim minVal As Variant
48    bOK = true
49    minVal = oObj.getMinimumValue()
50    Out.Log("Minimum value is "+minVal)
51    Test.MethodTested("getMinimumValue()",bOK)
52
53    Test.StartMethod("getMaximumValue()")
54    Dim maxVal As Variant
55    bOK = true
56    maxVal = oObj.getMaximumValue()
57    Out.Log("Maximum value is "+maxVal)
58    Test.MethodTested("getMaximumValue()",bOK)
59
60    Test.StartMethod("getCurrentValue()")
61    Dim curVal As Variant
62    bOK = true
63    curVal = oObj.getCurrentValue()
64    bOK = bOK AND (curVal &gt;= minVal) AND (curVal &lt;= maxVal)
65    Test.MethodTested("getCurrentValue()",bOK)
66
67
68    Test.StartMethod("setCurrentValue()")
69    Dim newVal As Variant, resVal As Variant
70    bOK = true
71    newVal = curVal + 1
72    if (newVal &gt; maxVal) then newVal = newVal - 2
73
74    Out.Log("Setting new value: "+newVal)
75    bOK = bOK AND oObj.setCurrentValue(newVal)
76    resVal = oObj.getCurrentValue()
77    Out.Log("Result: "+resVal)
78    bOK = bOK AND (Abs(newVal - resVal) &lt; 0.00001)
79
80    Out.Log("Setting new value: "+minVal)
81    bOK = bOK AND oObj.setCurrentValue(minVal)
82    resVal = oObj.getCurrentValue()
83    Out.Log("Result: "+resVal)
84    bOK = bOK AND (Abs(minVal - resVal) &lt; 0.00001)
85
86    Out.Log("Setting new value: "+maxVal)
87    bOK = bOK AND oObj.setCurrentValue(maxVal)
88    resVal = oObj.getCurrentValue()
89    Out.Log("Result: "+resVal)
90    bOK = bOK AND (Abs(maxVal - resVal) &lt; 0.00001)
91
92    newVal = minVal - 1
93    Out.Log("Setting new value: "+newVal)
94    bOK = bOK AND oObj.setCurrentValue(newVal)
95    resVal = oObj.getCurrentValue()
96    Out.Log("Result: "+resVal)
97    bOK = bOK AND (Abs(minVal - resVal) &lt; 0.00001)
98
99    newVal = maxVal + 1
100    Out.Log("Setting new value: "+newVal)
101    bOK = bOK AND oObj.setCurrentValue(newVal)
102    resVal = oObj.getCurrentValue()
103    Out.Log("Result: "+resVal)
104    bOK = bOK AND (Abs(maxVal - resVal) &lt; 0.00001)
105
106    Test.MethodTested("setCurrentValue()",bOK)
107
108Exit Sub
109ErrHndl:
110    Test.Exception()
111    bOK = false
112    resume next
113End Sub
114</script:module>
115