merge the formfield patch from ooo-build
[ooovba.git] / qadevOOo / tests / basic / ifc / awt / XCheckBox / awt_XCheckBox.xba
blob6aab15f6f3febcd819ac7d6bbfadc336790944be
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_XCheckBox" script:language="StarBasic">
6 '*************************************************************************
8 ' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9 '
10 ' Copyright 2008 by Sun Microsystems, Inc.
12 ' OpenOffice.org - a multi-platform office productivity suite
14 ' $RCSfile: awt_XCheckBox.xba,v $
16 ' $Revision: 1.3 $
18 ' This file is part of OpenOffice.org.
20 ' OpenOffice.org is free software: you can redistribute it and/or modify
21 ' it under the terms of the GNU Lesser General Public License version 3
22 ' only, as published by the Free Software Foundation.
24 ' OpenOffice.org is distributed in the hope that it will be useful,
25 ' but WITHOUT ANY WARRANTY; without even the implied warranty of
26 ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 ' GNU Lesser General Public License version 3 for more details
28 ' (a copy is included in the LICENSE file that accompanied this code).
30 ' You should have received a copy of the GNU Lesser General Public License
31 ' version 3 along with OpenOffice.org. If not, see
32 ' <http://www.openoffice.org/license.html>
33 ' for a copy of the LGPLv3 License.
35 '*************************************************************************
36 '*************************************************************************
40 ' Be sure that all variables are dimensioned:
41 option explicit
44 Dim bIL_itemStateChanged As Boolean
47 Sub RunTest()
49 '*************************************************************************
50 ' INTERFACE:
51 ' com.sun.star.awt.XCheckBox
52 '*************************************************************************
53 On Error Goto ErrHndl
54 Dim bOK As Boolean
55 Dim oListener As Object
57 bIL_itemStateChanged = False
58 out.log("create listener for item events")
59 oListener = createUnoListener("IL_", "com.sun.star.awt.XItemListener")
61 Test.StartMethod("addItemListener()")
62 oObj.addItemListener(oListener)
63 out.log("Can be checked only interactively !!!")
64 bOK = True
65 Test.MethodTested("addItemListener()", bOK)
67 Test.StartMethod("removeItemListener()")
68 oObj.removeItemListener(oListener)
69 bOK = True
70 Test.MethodTested("removeItemListener()", bOK)
72 Test.StartMethod("getState()")
73 Test.StartMethod("setState()")
74 Dim state, newState As Integer
75 state = oObj.getState()
76 Out.Log("current state of check-box: " + state)
77 newState = 0
78 If state = 0 Then
79 newState = 1
80 EndIf
81 Out.Log("set new state: " + newState)
82 oObj.setState(newState)
83 bOK = (newState = oObj.getState())
84 Test.MethodTested("getState()", bOK)
85 Test.MethodTested("setState()", bOK)
87 Test.StartMethod("setLabel()")
88 oObj.setLabel("XCheckBox test")
89 bOK = true
90 Test.MethodTested("setLabel()", bOK)
92 Test.StartMethod("enableTriState()")
93 oObj.enableTriState(True)
94 bOK = true
95 Test.MethodTested("enableTriState()", bOK)
97 Exit Sub
98 ErrHndl:
99 Test.Exception()
100 bOK = false
101 resume next
102 End Sub
104 Sub IL_disposing
105 End Sub
107 Sub IL_itemStateChanged
108 Out.Log("CallBack for ItemListener itemStateChanged was called.")
109 bIL_itemStateChanged = true
110 End Sub
111 </script:module>