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