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