| <?xml version="1.0" encoding="UTF-8"?> |
| <!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> |
| <script:module xmlns:script="http://openoffice.org/2000/script" script:name="accessibility_XAccessibleValue" script:language="StarBasic"> |
| |
| |
| '************************************************************************* |
| ' |
| ' Licensed to the Apache Software Foundation (ASF) under one |
| ' or more contributor license agreements. See the NOTICE file |
| ' distributed with this work for additional information |
| ' regarding copyright ownership. The ASF licenses this file |
| ' to you under the Apache License, Version 2.0 (the |
| ' "License"); you may not use this file except in compliance |
| ' with the License. You may obtain a copy of the License at |
| ' |
| ' http://www.apache.org/licenses/LICENSE-2.0 |
| ' |
| ' Unless required by applicable law or agreed to in writing, |
| ' software distributed under the License is distributed on an |
| ' "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| ' KIND, either express or implied. See the License for the |
| ' specific language governing permissions and limitations |
| ' under the License. |
| ' |
| '************************************************************************* |
| |
| |
| |
| |
| |
| ' Be sure that all variables are dimensioned: |
| option explicit |
| |
| |
| |
| |
| Sub RunTest() |
| |
| '************************************************************************* |
| ' INTERFACE: |
| ' com.sun.star.accessibility.XAccessibleValue |
| '************************************************************************* |
| On Error Goto ErrHndl |
| Dim bOK As Boolean |
| |
| Test.StartMethod("getMinimumValue()") |
| Dim minVal As Variant |
| bOK = true |
| minVal = oObj.getMinimumValue() |
| Out.Log("Minimum value is "+minVal) |
| Test.MethodTested("getMinimumValue()",bOK) |
| |
| Test.StartMethod("getMaximumValue()") |
| Dim maxVal As Variant |
| bOK = true |
| maxVal = oObj.getMaximumValue() |
| Out.Log("Maximum value is "+maxVal) |
| Test.MethodTested("getMaximumValue()",bOK) |
| |
| Test.StartMethod("getCurrentValue()") |
| Dim curVal As Variant |
| bOK = true |
| curVal = oObj.getCurrentValue() |
| bOK = bOK AND (curVal >= minVal) AND (curVal <= maxVal) |
| Test.MethodTested("getCurrentValue()",bOK) |
| |
| |
| Test.StartMethod("setCurrentValue()") |
| Dim newVal As Variant, resVal As Variant |
| bOK = true |
| newVal = curVal + 1 |
| if (newVal > maxVal) then newVal = newVal - 2 |
| |
| Out.Log("Setting new value: "+newVal) |
| bOK = bOK AND oObj.setCurrentValue(newVal) |
| resVal = oObj.getCurrentValue() |
| Out.Log("Result: "+resVal) |
| bOK = bOK AND (Abs(newVal - resVal) < 0.00001) |
| |
| Out.Log("Setting new value: "+minVal) |
| bOK = bOK AND oObj.setCurrentValue(minVal) |
| resVal = oObj.getCurrentValue() |
| Out.Log("Result: "+resVal) |
| bOK = bOK AND (Abs(minVal - resVal) < 0.00001) |
| |
| Out.Log("Setting new value: "+maxVal) |
| bOK = bOK AND oObj.setCurrentValue(maxVal) |
| resVal = oObj.getCurrentValue() |
| Out.Log("Result: "+resVal) |
| bOK = bOK AND (Abs(maxVal - resVal) < 0.00001) |
| |
| newVal = minVal - 1 |
| Out.Log("Setting new value: "+newVal) |
| bOK = bOK AND oObj.setCurrentValue(newVal) |
| resVal = oObj.getCurrentValue() |
| Out.Log("Result: "+resVal) |
| bOK = bOK AND (Abs(minVal - resVal) < 0.00001) |
| |
| newVal = maxVal + 1 |
| Out.Log("Setting new value: "+newVal) |
| bOK = bOK AND oObj.setCurrentValue(newVal) |
| resVal = oObj.getCurrentValue() |
| Out.Log("Result: "+resVal) |
| bOK = bOK AND (Abs(maxVal - resVal) < 0.00001) |
| |
| Test.MethodTested("setCurrentValue()",bOK) |
| |
| Exit Sub |
| ErrHndl: |
| Test.Exception() |
| bOK = false |
| resume next |
| End Sub |
| </script:module> |