1 # This is a collection of BASIC macros that can cause Syntax errors, Exceptions,
4 # ---------------------------------------------------------------------------- #
13 # ---------------------------------------------------------------------------- #
16 '# MessageBoxes - Macro that opens all flavors of messageboxes
17 function TestMessageBoxes()
26 msgbox( "16" , 2 + 16 )
27 msgbox( "32" , 2 + 32 )
28 msgbox( "48" , 2 + 48 )
29 msgbox( "64" , 2 + 64 )
30 msgbox( "128" , 2 + 128 )
31 msgbox( "256" , 2 + 256 )
32 msgbox( "512" , 2 + 512 )
36 # ---------------------------------------------------------------------------- #
39 '# TTMacro1: This is a short testscript for automated testing!
46 # ---------------------------------------------------------------------------- #
49 '# TTMacro2: Macro that only contains a comment on the first line
51 # ---------------------------------------------------------------------------- #
54 '# TTMacro3: Bring up a messagebox
61 # ---------------------------------------------------------------------------- #
64 ' This is a macro to test the BASIC library export
67 msgbox( "tBasicExport" )
71 # ---------------------------------------------------------------------------- #
74 ' No runtime exception
80 F = "file://" & curdir & "/test.txt"
81 Open F for random as #17
88 # ---------------------------------------------------------------------------- #
91 '# This is a macro required for verification of issue 77436
94 o= createUnoService("TestNamesComp")
95 msgbox o.dbg_supportedInterfaces
98 ctx = getDefaultContext
99 factory = ctx.getValueByName("org.openoffice.test.Names")
100 msgbox o.dbg_supportedInterfaces
104 # ---------------------------------------------------------------------------- #
117 # ---------------------------------------------------------------------------- #
121 MsgBox Format(1250, "Currency")
122 MsgBox Format(1250, "Yes/No")
123 MsgBox Format(1250, "True/False")
124 MsgBox Format(1250, "On/Off")
127 # ---------------------------------------------------------------------------- #
130 ' Should display three messageboxes: -10,1,-10
132 aTestFunction (-10) ' will compile
133 aTestFunction 1,-10 ' will compile
134 aTestFunction -10 ' should now compile and run, too
137 function aTestFunction( param1 as variant )
138 msgbox "param1 = " & param1
141 # ---------------------------------------------------------------------------- #
144 ' This should trigger an exception
147 BasicLibraries.LoadLibrary( "ThisLibDoesNotExist" )
150 # ---------------------------------------------------------------------------- #
153 ' Two messageboxes that should display "false"
156 Dim oError1 as new com.sun.star.sdbc.SQLException
157 print isnull( oError1 )
158 Dim oError2 as Object
159 oError2 = CreateUnoStruct( "com.sun.star.sdbc.SQLException" )
160 print isnull( oError2 )
163 # ---------------------------------------------------------------------------- #
166 ' There should be no "Paramtheses do not match" warning
168 Public Const cMAX = 256
172 Dim mRangeArray(0, 0) as String
177 ReDim mRangeArray(CInt(cMAX), n) as String
182 # ---------------------------------------------------------------------------- #
189 mTmp() = Test(False) '<-- generates an 'unexpected ')' compiler error
190 MsgBox mTmp(0) & " " & mTmp(1)
194 Function Test(ByVal bFlag As Boolean) As Variant
196 Dim mRanges(100) As String
198 If (bFlag = True) Then
199 Test = "return a String"
201 mRanges(0) = "Return an"
208 # ---------------------------------------------------------------------------- #
211 ' Date should contain the year 1900 and the value should be 2
215 v = DateSerial(0,1,1)
216 Msgbox ("Date : " & v)
217 MsgBox ("Value : " & CDbl(v))
220 # ---------------------------------------------------------------------------- #
223 option vbasupport 1
\r
229 msgbox( "not equal" )
\r
234 # ---------------------------------------------------------------------------- #
237 Private Declare Function FooFunction Lib "foo" ( nVal )
\r
238 Public Declare Function FooFunction2 Lib "foo" ( nVal )
\r
241 msgbox( "i103697" )
\r
244 # ---------------------------------------------------------------------------- #
259 if ( mt.b = 3.14 ) then