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