1 'encoding UTF-8 Do not remove or change this line!
2 '**************************************************************************
3 ' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 ' Copyright 2000, 2010 Oracle and/or its affiliates.
7 ' OpenOffice.org - a multi-platform office productivity suite
9 ' This file is part of OpenOffice.org.
11 ' OpenOffice.org is free software: you can redistribute it and/or modify
12 ' it under the terms of the GNU Lesser General Public License version 3
13 ' only, as published by the Free Software Foundation.
15 ' OpenOffice.org is distributed in the hope that it will be useful,
16 ' but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ' GNU Lesser General Public License version 3 for more details
19 ' (a copy is included in the LICENSE file that accompanied this code).
21 ' You should have received a copy of the GNU Lesser General Public License
22 ' version 3 along with OpenOffice.org. If not, see
23 ' <http://www.openoffice.org/license.html>
24 ' for a copy of the LGPLv3 License.
26 '/******************************************************************************
28 '* owner : gregor.hartmann@oracle.com
30 '* short description : Regression tests for especially annoying BASIC issues
32 '\******************************************************************************
34 function hIDERunMacro()
37 if ( MacroBar.exists() ) then
40 warnlog( "MacroBar not accessible" )
45 '*******************************************************************************
47 function hTestActive( cString as string , iMethod as integer , bExact as boolean ) as integer
50 ' -1 = Exact match expected, fuzzy match found
52 ' -3 = content of messagebox not relevant
53 ' -4 = Messagebox not displayed / Macro not executed
54 ' 1 - 4 = Number of buttons on the dialog
56 ' internal states, if state = 0 we return the buttoncount instead
57 const STATE_SUCCESS = 0
58 const STATE_FUZZY_MATCH = -1
59 const STATE_NO_MATCH = -2
60 const STATE_IGNORE_MSGBOX = -3
61 const STATE_MACRO_EXECUTION_FAILED = -4
63 const CFN = "hTestActive()::"
65 dim cMsg as string ' The string printed in the message box
66 dim rc as integer ' Returncode for error handling and returnvalue
67 dim buttons as integer ' Number of buttons on the message box
70 if ( Active.exists( 2 ) ) then
72 cMsg = Active.getText()
74 if ( cString <> "" ) then
75 if ( instr( active.getText(), cString ) ) then
76 if ( active.getText() = cString ) then
80 warnlog( CFN & "Message is no exact match: " & cMsg )
81 rc = STATE_FUZZY_MATCH
87 warnlog( CFN & "Messagebox has wrong content: " & cMsg )
91 rc = STATE_IGNORE_MSGBOX
94 buttons = Active.getButtonCount()
95 select case( iMethod )
97 case 2 : Active.Cancel()
102 warnlog( CFN & "Messagebox is missing" )
103 rc = STATE_MACRO_EXECUTION_FAILED
106 if ( rc = STATE_SUCCESS ) then hTestActive() = buttons
110 '*******************************************************************************
118 const CLOSE_METHOD_OK = 1
119 const CLOSE_METHOD_CANCEL = 2
120 const CLOSE_METHOD_NO = 4
122 const REQUIRES_EXACT_MATCH = TRUE
123 const REQUIRES_FUZZY_MATCH = FALSE
125 gApplication = "WRITER"
127 hInitBasicIDE( "TestIssues" )
130 printlog( " ---------- i41695 ------------ " )
131 hInsertMacroFromFile( "i41695" )
133 hTestActive( "i41695-1", CLOSE_METHOD_OK , REQUIRES_EXACT_MATCH )
134 hTestActive( "i41695-2", CLOSE_METHOD_OK , REQUIRES_EXACT_MATCH )
137 printlog( " ---------- i83978 ------------ " )
138 hInsertMacroFromFile( "i83978" )
140 hTestActive( "NoSuchElementException", CLOSE_METHOD_OK , REQUIRES_FUZZY_MATCH )
143 printlog( " ---------- i82830 ------------ " )
144 hInsertMacroFromFile( "i82830" )
146 hTestActive( "12D687" , CLOSE_METHOD_OK , REQUIRES_EXACT_MATCH )
147 hTestActive( "4553207", CLOSE_METHOD_OK , REQUIRES_EXACT_MATCH )
149 if ( gISOLang = "en-US" ) then
151 printlog( " ---------- i81674 ------------ " )
152 hInsertMacroFromFile( "i81674" )
154 hTestActive( "250" , CLOSE_METHOD_OK , REQUIRES_FUZZY_MATCH )
155 hTestActive( "Yes" , CLOSE_METHOD_OK , REQUIRES_EXACT_MATCH )
156 hTestActive( "True", CLOSE_METHOD_OK , REQUIRES_EXACT_MATCH )
157 hTestActive( "On" , CLOSE_METHOD_OK , REQUIRES_EXACT_MATCH )
161 printlog( " ---------- i80532 ------------ " )
162 hInsertMacroFromFile( "i80532" )
164 hTestActive( "-10", CLOSE_METHOD_OK , REQUIRES_FUZZY_MATCH )
165 hTestActive( "1" , CLOSE_METHOD_OK , REQUIRES_FUZZY_MATCH )
166 hTestActive( "-10", CLOSE_METHOD_OK , REQUIRES_FUZZY_MATCH )
169 printlog( " ---------- i84040 ------------ " )
170 hInsertMacroFromFile( "i84040" )
172 hTestActive( "False", CLOSE_METHOD_OK , REQUIRES_EXACT_MATCH )
173 hTestActive( "False", CLOSE_METHOD_OK , REQUIRES_EXACT_MATCH )
176 printlog( " ---------- i86265 ------------ " )
177 hInsertMacroFromFile( "i86265" )
179 hTestActive( "i86265-1", CLOSE_METHOD_OK , REQUIRES_EXACT_MATCH )
180 hTestActive( "i86265-2", CLOSE_METHOD_OK , REQUIRES_EXACT_MATCH )
183 printlog( " ---------- i92329 ------------ " )
184 hInsertMacroFromFile( "i92329" )
186 hTestActive( "Return an Array" , CLOSE_METHOD_OK )
189 printlog( " ---------- i97038 ------------ " )
190 hInsertMacroFromFile( "i97038" )
192 hTestActive( "1900" , CLOSE_METHOD_OK , REQUIRES_FUZZY_MATCH )
193 hTestActive( "2" , CLOSE_METHOD_OK , REQUIRES_FUZZY_MATCH )
196 printlog( " ---------- i103691 ------------ " )
197 hInsertMacroFromFile( "i103691" )
199 hTestActive( "Equal" , CLOSE_METHOD_OK , REQUIRES_FUZZY_MATCH )
202 printlog( " ---------- i103697 ------------ " )
203 hInsertMacroFromFile( "i103697" )
205 hTestActive( "i103697" , CLOSE_METHOD_OK , REQUIRES_FUZZY_MATCH )
208 printlog( " ---------- i103990 ------------ " )
209 hInsertMacroFromFile( "i103990" )
211 hTestActive( "42" , CLOSE_METHOD_OK , REQUIRES_FUZZY_MATCH )
212 hTestActive( "43" , CLOSE_METHOD_OK , REQUIRES_FUZZY_MATCH )
213 hTestActive( "Pi" , CLOSE_METHOD_OK , REQUIRES_FUZZY_MATCH )
216 printlog( " ---------- i107070 ------------ " )
217 hInsertMacroFromFile( "i107070" )
219 hTestActive( "Dbg_Methods" , CLOSE_METHOD_OK , REQUIRES_FUZZY_MATCH )
220 hTestActive( "Dbg_Methods" , CLOSE_METHOD_OK , REQUIRES_FUZZY_MATCH )
221 hTestActive( "." , CLOSE_METHOD_OK , REQUIRES_FUZZY_MATCH )
224 printlog( " ---------- i106744 ------------ " )
225 hInsertMacroFromFile( "i106744-1" )
227 hTestActive( "NOT EMPTY" , CLOSE_METHOD_OK , REQUIRES_EXACT_MATCH )
230 printlog( " ---------- i106744 ------------ " )
231 hInsertMacroFromFile( "i106744-2" )
233 hTestActive( "NOT EMPTY" , CLOSE_METHOD_OK , REQUIRES_EXACT_MATCH )
236 printlog( " ---------- MessageBoxes ------------ " )
237 hInsertMacroFromFile( "MessageBoxes" )
240 if ( hTestActive( "0x" , CLOSE_METHOD_OK , REQUIRES_EXACT_MATCH ) <> RESTYPE_1 ) then warnlog( "Wrong resource type" )
241 if ( hTestActive( "1x" , CLOSE_METHOD_OK , REQUIRES_EXACT_MATCH ) <> RESTYPE_2 ) then warnlog( "Wrong resource type" )
242 if ( hTestActive( "2x" , CLOSE_METHOD_CANCEL , REQUIRES_EXACT_MATCH ) <> RESTYPE_3 ) then warnlog( "Wrong resource type" )
243 if ( hTestActive( "3x" , CLOSE_METHOD_CANCEL , REQUIRES_EXACT_MATCH ) <> RESTYPE_3 ) then warnlog( "Wrong resource type" )
244 if ( hTestActive( "4x" , CLOSE_METHOD_NO , REQUIRES_EXACT_MATCH ) <> RESTYPE_2 ) then warnlog( "Wrong resource type" )
245 if ( hTestActive( "5x" , CLOSE_METHOD_CANCEL , REQUIRES_EXACT_MATCH ) <> RESTYPE_2 ) then warnlog( "Wrong resource type" )
246 if ( hTestActive( "16" , CLOSE_METHOD_CANCEL , REQUIRES_EXACT_MATCH ) <> RESTYPE_3 ) then warnlog( "Wrong resource type" )
247 if ( hTestActive( "32" , CLOSE_METHOD_CANCEL , REQUIRES_EXACT_MATCH ) <> RESTYPE_3 ) then warnlog( "Wrong resource type" )
248 if ( hTestActive( "48" , CLOSE_METHOD_CANCEL , REQUIRES_EXACT_MATCH ) <> RESTYPE_3 ) then warnlog( "Wrong resource type" )
249 if ( hTestActive( "64" , CLOSE_METHOD_OK , REQUIRES_EXACT_MATCH ) <> RESTYPE_1 ) then warnlog( "Wrong resource type" )
250 if ( hTestActive( "128", CLOSE_METHOD_CANCEL , REQUIRES_EXACT_MATCH ) <> RESTYPE_3 ) then warnlog( "Wrong resource type" )
251 if ( hTestActive( "256", CLOSE_METHOD_CANCEL , REQUIRES_EXACT_MATCH ) <> RESTYPE_3 ) then warnlog( "Wrong resource type" )
252 if ( hTestActive( "512", CLOSE_METHOD_CANCEL , REQUIRES_EXACT_MATCH ) <> RESTYPE_3 ) then warnlog( "Wrong resource type" )