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 2008 by Sun Microsystems, Inc.
7 '* OpenOffice.org - a multi-platform office productivity suite
9 '* $RCSfile: basic_issues.inc,v $
13 '* last change: $Author: jsi $ $Date: 2008-06-16 12:18:13 $
15 '* This file is part of OpenOffice.org.
17 '* OpenOffice.org is free software: you can redistribute it and/or modify
18 '* it under the terms of the GNU Lesser General Public License version 3
19 '* only, as published by the Free Software Foundation.
21 '* OpenOffice.org is distributed in the hope that it will be useful,
22 '* but WITHOUT ANY WARRANTY; without even the implied warranty of
23 '* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 '* GNU Lesser General Public License version 3 for more details
25 '* (a copy is included in the LICENSE file that accompanied this code).
27 '* You should have received a copy of the GNU Lesser General Public License
28 '* version 3 along with OpenOffice.org. If not, see
29 '* <http://www.openoffice.org/license.html>
30 '* for a copy of the LGPLv3 License.
32 '/******************************************************************************
34 '* owner : Joerg.Skottke@Sun.Com
36 '* short description : Regression tests for especially annoying BASIC issues
38 '\******************************************************************************
40 function hIDERunMacro()
43 if ( MacroBar.exists() ) then
46 warnlog( "MacroBar not accessible" )
51 '*******************************************************************************
53 function hTestActive( cString as string , iMethod as integer , bExact as boolean ) as integer
56 ' -1 = Exact match expected, fuzzy match found
58 ' -3 = content of messagebox not relevant
59 ' -4 = Messagebox not displayed / Macro not executed
60 ' 1 - 4 = Number of buttons on the dialog
62 const CFN = "hTestActive()::"
64 dim cMsg as string ' The string printed in the message box
65 dim rc as integer ' Returncode for error handling and returnvalue
66 dim buttons as integer ' Number of buttons on the message box
69 if ( Active.exists( 2 ) ) then
71 cMsg = Active.getText()
73 if ( cString <> "" ) then
74 if ( instr( active.getText(), cString ) <> 0 ) then
75 if ( active.getText() = cString ) then
76 'printlog( CFN & "Correct message found (exact match): " & cMsg )
80 warnlog( CFN & "Message is no exact match: " & cMsg )
83 'printlog( CFN & "Correct message found (fuzzy match): " & cMsg )
88 warnlog( CFN & "Messagebox has wrong content: " & cMsg )
92 'printlog( CFN & "Messagebox: " & cMsg )
96 buttons = Active.getButtonCount()
97 'printlog( CFN & "Number of buttons: " & buttons )
98 select case( iMethod )
100 case 2 : Active.Cancel()
101 case 3 : Acitve.Yes()
105 warnlog( CFN & "Messagebox is missing" )
108 if ( rc = 0 ) then hTestActive() = buttons
112 '*******************************************************************************
116 gApplication = "WRITER"
118 hInitBasicIDE( "TestIssues" )
121 printlog( " ---------- i41695 ------------ " )
122 hInsertMacroFromFile( "i41695" )
124 hTestActive( "i41695-1", 1 , TRUE )
125 hTestActive( "i41695-2", 1 , TRUE )
128 printlog( " ---------- i83978 ------------ " )
129 hInsertMacroFromFile( "i83978" )
131 hTestActive( "com.sun.star.container.NoSuchElementException", 1 , FALSE )
134 printlog( " ---------- i82830 ------------ " )
135 hInsertMacroFromFile( "i82830" )
137 hTestActive( "12D687" , 1 , TRUE )
138 hTestActive( "4553207", 1 , TRUE )
140 if ( gISOLang = "en-US" ) then
142 printlog( " ---------- i81674 ------------ " )
143 hInsertMacroFromFile( "i81674" )
145 hTestActive( "250" , 1 , FALSE )
146 hTestActive( "Yes" , 1 , TRUE )
147 hTestActive( "True", 1 , TRUE )
148 hTestActive( "On" , 1 , TRUE )
152 printlog( " ---------- i80532 ------------ " )
153 hInsertMacroFromFile( "i80532" )
155 hTestActive( "-10", 1 , FALSE )
156 hTestActive( "1" , 1 , FALSE )
157 hTestActive( "-10", 1 , FALSE )
160 printlog( " ---------- i84040 ------------ " )
161 hInsertMacroFromFile( "i84040" )
163 hTestActive( "False", 1 , TRUE )
164 hTestActive( "False", 1 , TRUE )
167 printlog( " ---------- i86265 ------------ " )
168 hInsertMacroFromFile( "i86265" )
170 hTestActive( "i86265-1", 1 , TRUE )
171 hTestActive( "i86265-2", 1 , TRUE )
174 printlog( " ---------- i92329 ------------ " )
175 hInsertMacroFromFile( "i92329" )
177 hTestActive( "Return an Array" , 1 )
180 printlog( " ---------- i97038 ------------ " )
181 hInsertMacroFromFile( "i97038" )
183 hTestActive( "1900" , 1 , FALSE )
184 hTestActive( "2" , 1 , FALSE )
187 printlog( " ---------- i103691 ------------ " )
188 hInsertMacroFromFile( "i103691" )
190 hTestActive( "Equal" , 1 , FALSE )
193 printlog( " ---------- i103697 ------------ " )
194 hInsertMacroFromFile( "i103697" )
196 hTestActive( "i103697" , 1 , FALSE )
199 printlog( " ---------- i103990 ------------ " )
200 hInsertMacroFromFile( "i103990" )
202 hTestActive( "42" , 1 , FALSE )
203 hTestActive( "43" , 1 , FALSE )
204 hTestActive( "Pi" , 1 , FALSE )
208 printlog( " ---------- MessageBoxes ------------ " )
209 hInsertMacroFromFile( "MessageBoxes" )
211 if ( hTestActive( "0x" , 1 , TRUE ) > 1 ) then warnlog( "Wrong resource type" )
212 if ( hTestActive( "1x" , 1 , TRUE ) > 2 ) then warnlog( "Wrong resource type" )
213 if ( hTestActive( "2x" , 2 , TRUE ) > 3 ) then warnlog( "Wrong resource type" )
214 if ( hTestActive( "3x" , 2 , TRUE ) > 3 ) then warnlog( "Wrong resource type" )
215 if ( hTestActive( "4x" , 4 , TRUE ) > 2 ) then warnlog( "Wrong resource type" )
216 if ( hTestActive( "5x" , 2 , TRUE ) > 2 ) then warnlog( "Wrong resource type" )
217 if ( hTestActive( "16" , 2 , TRUE ) > 3 ) then warnlog( "Wrong resource type" )
218 if ( hTestActive( "32" , 2 , TRUE ) > 3 ) then warnlog( "Wrong resource type" )
219 if ( hTestActive( "48" , 2 , TRUE ) > 3 ) then warnlog( "Wrong resource type" )
220 if ( hTestActive( "64" , 1 , TRUE ) > 1 ) then warnlog( "Wrong resource type" )
221 if ( hTestActive( "128", 2 , TRUE ) > 3 ) then warnlog( "Wrong resource type" )
222 if ( hTestActive( "256", 2 , TRUE ) > 3 ) then warnlog( "Wrong resource type" )
223 if ( hTestActive( "512", 2 , TRUE ) > 3 ) then warnlog( "Wrong resource type" )