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_XSpinField" 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.awt.XSpinField 42'************************************************************************* 43On Error Goto ErrHndl 44 45 Test.StartMethod("addSpinListener()") 46 Dim oListener As Object 47 oListener = createUnoListener("SL_", "com.sun.star.awt.XSpinListener") 48 initListener() 49 oObj.addSpinListener(oListener) 50 Test.MethodTested("addSpinListener()", True) 51 52 Test.StartMethod("up()") 53 oObj.up() 54 wait(1000) 55 Test.MethodTested("up()", bUpCalled) 56 57 Test.StartMethod("down()") 58 oObj.down() 59 wait(1000) 60 Test.MethodTested("down()", bDownCalled) 61 62 Test.StartMethod("first()") 63 oObj.first() 64 wait(1000) 65 Test.MethodTested("first()", bFirstCalled) 66 67 Test.StartMethod("last()") 68 oObj.last() 69 wait(1000) 70 Test.MethodTested("last()", bLastCalled) 71 72 Test.StartMethod("removeSpinListener()") 73 oObj.removeSpinListener(oListener) 74 initListener() 75 oObj.up() 76 wait(1000) 77 Test.MethodTested("removeSpinListener()", Not bUpCalled) 78 79 Test.StartMethod("enableRepeat()") 80 oObj.enableRepeat(true) 81 oObj.enableRepeat(false) 82 Test.MethodTested("enableRepeat()", True) 83Exit Sub 84ErrHndl: 85 Test.Exception() 86 bOK = false 87 resume next 88End Sub 89 90Dim bUpCalled As Boolean 91Dim bDownCalled As Boolean 92Dim bFirstCalled As Boolean 93Dim bLastCalled As Boolean 94 95Sub initListener() 96 bUpCalled = false 97 bDownCalled = false 98 bFirstCalled = false 99 bLastCalled = false 100End Sub 101 102Sub SL_up() 103 Out.log("Listener up called") 104 bUpCalled = true 105End Sub 106 107Sub SL_down() 108 Out.log("Listener down called") 109 bDownCalled = true 110End Sub 111 112Sub SL_first() 113 Out.log("Listener first called") 114 bFirstCalled = true 115End Sub 116 117Sub SL_last() 118 Out.log("Listener last called") 119 bLastCalled = true 120End Sub 121</script:module> 122