1*cdf0e10cSrcweirREM  *****  BASIC  *****
2*cdf0e10cSrcweir
3*cdf0e10cSrcweir
4*cdf0e10cSrcweirOPTION EXPLICIT
5*cdf0e10cSrcweirOPTION COMPATIBLE
6*cdf0e10cSrcweir
7*cdf0e10cSrcweirSub Main
8*cdf0e10cSrcweirCOMPATIBILITYMODE(true)
9*cdf0e10cSrcweir
10*cdf0e10cSrcweirIf runtest = -1 Then
11*cdf0e10cSrcweir  MsgBox "Test Failed!!!"
12*cdf0e10cSrcweirElse
13*cdf0e10cSrcweir  MsgBox "Test Succeeded"
14*cdf0e10cSrcweirEnd If
15*cdf0e10cSrcweir
16*cdf0e10cSrcweirEnd Sub
17*cdf0e10cSrcweir
18*cdf0e10cSrcweirFunction runtest() As Integer
19*cdf0e10cSrcweirDim inBool As Boolean, inBool2 As Boolean, outBool As Boolean
20*cdf0e10cSrcweirDim inByte As Integer, inByte2 As Integer
21*cdf0e10cSrcweirDim inShort As Integer, inShort2 As Integer
22*cdf0e10cSrcweirDim inLong As Long, inLong2 As Long, inLong3 As Long, inLong4 As Long
23*cdf0e10cSrcweirDim inString As String, inString2 As String
24*cdf0e10cSrcweirDim inFloat As Single, inFloat2 As Single
25*cdf0e10cSrcweirDim inDouble As Double, inDouble2 As Double
26*cdf0e10cSrcweirDim inVariant, inVariant2
27*cdf0e10cSrcweirDim inAr, inAr2
28*cdf0e10cSrcweirDim inDate As Date,inDate2 As Date, outDate As Date
29*cdf0e10cSrcweirDim inCurrency As Currency, inCurrency2 As Currency, outCurrency As Currency
30*cdf0e10cSrcweirDim inSCode As New com.sun.star.bridge.oleautomation.SCode
31*cdf0e10cSrcweirDim inSCode2 As New com.sun.star.bridge.oleautomation.SCode
32*cdf0e10cSrcweirDim inDecimal As Variant, inDecimal2 As Variant, outDecimal As Variant
33*cdf0e10cSrcweirDim inrefDecimal As Variant, outrefDecimal As Variant
34*cdf0e10cSrcweirDim outSCode As New com.sun.star.bridge.oleautomation.SCode
35*cdf0e10cSrcweirDim outByte As Integer
36*cdf0e10cSrcweirDim outShort As Integer
37*cdf0e10cSrcweirDim outLong, outLong2 As Long
38*cdf0e10cSrcweirDim outString As String
39*cdf0e10cSrcweirDim outFloat As Single
40*cdf0e10cSrcweirDim outDouble As Double
41*cdf0e10cSrcweirDim outVariant
42*cdf0e10cSrcweir'bug #109936 causes an errOr when outObject is used As out param
43*cdf0e10cSrcweirDim inObject As Object, inObject2 As Object, outObject As Object
44*cdf0e10cSrcweirDim objNOTHING As Object
45*cdf0e10cSrcweirDim inUnknown As Object, inUnknown2 As Object, outUnknown As Object
46*cdf0e10cSrcweir
47*cdf0e10cSrcweirDim inArray, outArray, outArray2
48*cdf0e10cSrcweirDim len1, len2
49*cdf0e10cSrcweirDim arString(1) As String
50*cdf0e10cSrcweirarString(0)= "String one"
51*cdf0e10cSrcweirarString(1)= "String two"
52*cdf0e10cSrcweir
53*cdf0e10cSrcweirDim factory As Object
54*cdf0e10cSrcweirfactory= createUnoService("com.sun.star.bridge.OleObjectFactory")
55*cdf0e10cSrcweirDim obj As Object
56*cdf0e10cSrcweirobj= factory.createInstance("AxTestComponents.Basic")
57*cdf0e10cSrcweir
58*cdf0e10cSrcweirDim objFoo As Object
59*cdf0e10cSrcweirobjFoo = factory.createInstance("AxTestComponents.Foo")
60*cdf0e10cSrcweir
61*cdf0e10cSrcweir
62*cdf0e10cSrcweir'in parameter -------------------------------------------------------------------
63*cdf0e10cSrcweirinBool = true
64*cdf0e10cSrcweirinByte = 10
65*cdf0e10cSrcweirinShort = 11
66*cdf0e10cSrcweirinLong = 111
67*cdf0e10cSrcweirinString = "Hello World"
68*cdf0e10cSrcweirinFloat = 3.14
69*cdf0e10cSrcweirinDouble = 3.145
70*cdf0e10cSrcweirinVariant = "bla"
71*cdf0e10cSrcweirinDate = NOW()
72*cdf0e10cSrcweirinCurrency = 12345.6789
73*cdf0e10cSrcweirinSCode.Value = &h80020004
74*cdf0e10cSrcweirinDecimal = CDec("-9223372036854775808") 'lowest int64
75*cdf0e10cSrcweir
76*cdf0e10cSrcweirobj.inBool(inBool)
77*cdf0e10cSrcweirobj.inByte(inByte)
78*cdf0e10cSrcweirobj.inShort(inShort)
79*cdf0e10cSrcweirobj.inLong(inLong)
80*cdf0e10cSrcweirobj.inString(inString)
81*cdf0e10cSrcweirobj.inFloat(inFloat)
82*cdf0e10cSrcweirobj.inDouble(inDouble)
83*cdf0e10cSrcweirobj.inVariant(inVariant)
84*cdf0e10cSrcweir'obj.prpString= "a string property"
85*cdf0e10cSrcweirobj.inObject(obj)
86*cdf0e10cSrcweirobj.inArray(arString())
87*cdf0e10cSrcweirobj.inDate(inDate)
88*cdf0e10cSrcweirobj.inCurrency(inCurrency)
89*cdf0e10cSrcweirobj.inSCode(inSCode)
90*cdf0e10cSrcweirobj.inUnknown(objFoo)
91*cdf0e10cSrcweirobj.inDecimal(inDecimal)
92*cdf0e10cSrcweir
93*cdf0e10cSrcweir'out parameter -------------------------------------------------------------------------
94*cdf0e10cSrcweiroutBool = false
95*cdf0e10cSrcweirobj.outBool(outBool)
96*cdf0e10cSrcweiroutByte = 0
97*cdf0e10cSrcweirobj.outByte(outByte)
98*cdf0e10cSrcweiroutShort = 0
99*cdf0e10cSrcweirobj.outShort(outShort)
100*cdf0e10cSrcweiroutLong = 0
101*cdf0e10cSrcweirobj.outLong(outLong)
102*cdf0e10cSrcweiroutFloat = 0
103*cdf0e10cSrcweirobj.outFloat(outFloat)
104*cdf0e10cSrcweiroutDouble = 0
105*cdf0e10cSrcweirobj.outDouble(outDouble)
106*cdf0e10cSrcweiroutString = ""
107*cdf0e10cSrcweirobj.outString(outString)
108*cdf0e10cSrcweiroutVariant = 0
109*cdf0e10cSrcweirobj.outVariant(outVariant)
110*cdf0e10cSrcweiroutObject  = NOTHING
111*cdf0e10cSrcweirobj.outObject(outObject)
112*cdf0e10cSrcweiroutArray = 0
113*cdf0e10cSrcweirobj.outArray(outArray)
114*cdf0e10cSrcweirobj.outDate(outDate)
115*cdf0e10cSrcweirobj.outCurrency(outCurrency)
116*cdf0e10cSrcweirobj.outSCode(outSCode)
117*cdf0e10cSrcweirobj.outUnknown(outUnknown)
118*cdf0e10cSrcweirobj.outDecimal(outDecimal)
119*cdf0e10cSrcweir
120*cdf0e10cSrcweir
121*cdf0e10cSrcweirIf inBool <> outBool Or inByte <> outByte Or inShort <> outShort Or inLong <> outLong Or _
122*cdf0e10cSrcweir   inFloat <> outFloat Or inDouble <> outDouble Or inString <> outString Or _
123*cdf0e10cSrcweir   inVariant <> outVariant Or NOT equalUnoObjects(obj, outObject) Or NOT _
124*cdf0e10cSrcweir   equalArrays(arString(), outArray()) Or inDate <> outDate Or inCurrency <> outCurrency Or _
125*cdf0e10cSrcweir   inSCode.Value <> outSCode.Value Or Not equalUnoObjects(objFoo, outUnknown) Or _
126*cdf0e10cSrcweir   inDecimal <> outDecimal Then
127*cdf0e10cSrcweir   runtest = -1
128*cdf0e10cSrcweir   exit Function
129*cdf0e10cSrcweirEnd If
130*cdf0e10cSrcweir
131*cdf0e10cSrcweir
132*cdf0e10cSrcweir'in-out parameter -------------------------------------------------------------
133*cdf0e10cSrcweir'implementation of inout methods returns the previously set value in out param
134*cdf0e10cSrcweirinBool = true
135*cdf0e10cSrcweirinBool2 = inBool
136*cdf0e10cSrcweirobj.inoutBool(inBool2)
137*cdf0e10cSrcweiroutBool = false
138*cdf0e10cSrcweirobj.inoutBool(outBool)
139*cdf0e10cSrcweirinByte = 10
140*cdf0e10cSrcweirinByte2 = inByte
141*cdf0e10cSrcweirobj.inoutByte(inByte2)
142*cdf0e10cSrcweiroutByte = 0
143*cdf0e10cSrcweirobj.inoutByte(outByte)
144*cdf0e10cSrcweirinShort =  10
145*cdf0e10cSrcweirinShort2 = inShort
146*cdf0e10cSrcweirobj.inShort(inShort2)
147*cdf0e10cSrcweiroutShort = 0
148*cdf0e10cSrcweirobj.inoutShort(outShort)
149*cdf0e10cSrcweirinLong = 10
150*cdf0e10cSrcweirinLong2 = inLong
151*cdf0e10cSrcweirobj.inoutLong(inLong2)
152*cdf0e10cSrcweiroutLong = 0
153*cdf0e10cSrcweirobj.inoutLong(outLong)
154*cdf0e10cSrcweirinFloat = 3.14
155*cdf0e10cSrcweirinFloat2 = inFloat
156*cdf0e10cSrcweirobj.inoutFloat(inFloat2)
157*cdf0e10cSrcweiroutFloat = 0
158*cdf0e10cSrcweirobj.inoutFloat(outFloat)
159*cdf0e10cSrcweirinDouble= 3.14
160*cdf0e10cSrcweirinDouble2 = inDouble
161*cdf0e10cSrcweirobj.inoutDouble(inDouble2)
162*cdf0e10cSrcweiroutDouble = 0
163*cdf0e10cSrcweirobj.inoutDouble(outDouble)
164*cdf0e10cSrcweirinString = "in"
165*cdf0e10cSrcweirinString2 = inString
166*cdf0e10cSrcweirobj.inoutString(inString2)
167*cdf0e10cSrcweiroutString = ""
168*cdf0e10cSrcweirobj.inoutString(outString)
169*cdf0e10cSrcweirinVariant = "in"
170*cdf0e10cSrcweirinVariant2 = inVariant
171*cdf0e10cSrcweirobj.inoutVariant(inVariant2)
172*cdf0e10cSrcweiroutVariant = 0
173*cdf0e10cSrcweirobj.inoutVariant(outVariant)
174*cdf0e10cSrcweirinObject = factory.createInstance("AxTestComponents.Basic")
175*cdf0e10cSrcweirinObject2 = inObject
176*cdf0e10cSrcweirobj.inoutObject(inObject2)
177*cdf0e10cSrcweiroutObject = NOTHING
178*cdf0e10cSrcweirobj.inoutObject(outObject)
179*cdf0e10cSrcweirinAr = arString()
180*cdf0e10cSrcweirinAr2 = inAr
181*cdf0e10cSrcweirobj.inoutArray(inAr2)
182*cdf0e10cSrcweiroutArray = 0
183*cdf0e10cSrcweirobj.outArray(outArray())
184*cdf0e10cSrcweirinDate = NOW()
185*cdf0e10cSrcweirinDate2 = inDate
186*cdf0e10cSrcweirobj.inoutDate(inDate2)
187*cdf0e10cSrcweiroutDate = 0
188*cdf0e10cSrcweirobj.inoutDate(outDate)
189*cdf0e10cSrcweirinCurrency = 1234.5678
190*cdf0e10cSrcweirinCurrency2 = inCurrency
191*cdf0e10cSrcweirobj.inoutCurrency(inCurrency2)
192*cdf0e10cSrcweiroutCurrency = 0
193*cdf0e10cSrcweirobj.inoutCurrency(outCurrency)
194*cdf0e10cSrcweirinSCode.Value = &h80020004
195*cdf0e10cSrcweirinSCode2 = inSCode
196*cdf0e10cSrcweirobj.inoutSCode(inSCode2)
197*cdf0e10cSrcweiroutSCode.Value = 0
198*cdf0e10cSrcweirobj.inoutSCode(outSCode)
199*cdf0e10cSrcweirinUnknown = objFoo
200*cdf0e10cSrcweirinUnknown2 = inUnknown
201*cdf0e10cSrcweirobj.inoutUnknown(inUnknown2)
202*cdf0e10cSrcweiroutUnknown = Nothing
203*cdf0e10cSrcweirobj.inoutUnknown(outUnknown)
204*cdf0e10cSrcweirinDecimal = CDec("18446744073709551615") 'highest positiv value of unsigne int64
205*cdf0e10cSrcweirinDecimal2 = inDecimal
206*cdf0e10cSrcweirobj.inoutDecimal(inDecimal2)
207*cdf0e10cSrcweiroutDecimal = 0
208*cdf0e10cSrcweirobj.inoutDecimal(outDecimal)
209*cdf0e10cSrcweir
210*cdf0e10cSrcweirIf inBool <> outBool Or inByte <> outByte Or inShort <> outShort Or inLong <> outLong Or _
211*cdf0e10cSrcweir   inFloat <> outFloat Or inDouble <> outDouble Or inString <> outString Or _
212*cdf0e10cSrcweir   inVariant <> outVariant Or NOT equalUnoObjects(inObject, outObject) Or _
213*cdf0e10cSrcweir   NOT equalArrays(inAr, outArray) Or inDate <> outDate Or inCurrency <> outCurrency Or _
214*cdf0e10cSrcweir   inSCode.Value <> outSCode.Value  Or Not equalUnoObjects(inUnknown, outUnknown) Or _
215*cdf0e10cSrcweir   inDecimal <> outDecimal Then
216*cdf0e10cSrcweir  runtest = -1
217*cdf0e10cSrcweir  Exit Function
218*cdf0e10cSrcweirEnd If
219*cdf0e10cSrcweir
220*cdf0e10cSrcweir'properties -------------------------------------------------------------------------
221*cdf0e10cSrcweirinBool = false
222*cdf0e10cSrcweiroutBool = true
223*cdf0e10cSrcweirobj.prpBool = inBool
224*cdf0e10cSrcweiroutBool = obj.prpBool
225*cdf0e10cSrcweirinByte = 11
226*cdf0e10cSrcweiroutByte = 0
227*cdf0e10cSrcweirobj.prpByte = inByte
228*cdf0e10cSrcweiroutByte= obj.prpByte
229*cdf0e10cSrcweirinShort = 127
230*cdf0e10cSrcweiroutShort = 0
231*cdf0e10cSrcweirobj.prpShort= inShort
232*cdf0e10cSrcweiroutShort= obj.prpShort
233*cdf0e10cSrcweirinLong = 1000
234*cdf0e10cSrcweiroutLong = 0
235*cdf0e10cSrcweirobj.prpLong = inLong
236*cdf0e10cSrcweiroutLong= obj.prpLong
237*cdf0e10cSrcweirinFloat = 3.14
238*cdf0e10cSrcweiroutFloat = 0
239*cdf0e10cSrcweirobj.prpFloat = inFloat
240*cdf0e10cSrcweiroutFloat= obj.prpFloat
241*cdf0e10cSrcweirinDouble = 3.123
242*cdf0e10cSrcweiroutDouble = 0
243*cdf0e10cSrcweirobj.prpDouble = inDouble
244*cdf0e10cSrcweiroutDouble= obj.prpDouble
245*cdf0e10cSrcweirinString = "bla"
246*cdf0e10cSrcweiroutString = ""
247*cdf0e10cSrcweirobj.prpString = inString
248*cdf0e10cSrcweiroutString = obj.prpString
249*cdf0e10cSrcweirinObject = obj
250*cdf0e10cSrcweiroutObject = objNOTHING
251*cdf0e10cSrcweirobj.prpObject = inObject
252*cdf0e10cSrcweiroutObject = obj.prpObject
253*cdf0e10cSrcweirinVariant = "bla"
254*cdf0e10cSrcweiroutVariant = 0
255*cdf0e10cSrcweirobj.prpVariant = inVariant
256*cdf0e10cSrcweiroutVariant= obj.prpVariant
257*cdf0e10cSrcweirinArray = arString()
258*cdf0e10cSrcweiroutArray = 0
259*cdf0e10cSrcweirobj.prpArray = inArray()
260*cdf0e10cSrcweiroutArray= obj.prpArray
261*cdf0e10cSrcweirinDate = NOW()
262*cdf0e10cSrcweiroutDate = 0
263*cdf0e10cSrcweirobj.prpDate = inDate
264*cdf0e10cSrcweiroutDate = obj.prpDate
265*cdf0e10cSrcweirinCurrency = 1234.5678
266*cdf0e10cSrcweiroutCurrency = 0
267*cdf0e10cSrcweirobj.prpCurrency = inCurrency
268*cdf0e10cSrcweiroutCurrency = obj.prpCurrency
269*cdf0e10cSrcweirinSCode.Value = &h80020004
270*cdf0e10cSrcweiroutSCode.Value = 0
271*cdf0e10cSrcweirobj.prpSCode = inSCode
272*cdf0e10cSrcweiroutSCode = obj.prpSCode
273*cdf0e10cSrcweirinUnknown = objFoo
274*cdf0e10cSrcweiroutUnknown= Nothing
275*cdf0e10cSrcweirobj.prpUnknown = inUnknown
276*cdf0e10cSrcweiroutUnknown = obj.prpUnknown
277*cdf0e10cSrcweirinDecimal = CDec("18446744073709551615")' highest unsigned int64
278*cdf0e10cSrcweiroutDecimal = 0
279*cdf0e10cSrcweirobj.prpDecimal = inDecimal
280*cdf0e10cSrcweiroutDecimal = obj.prpDecimal
281*cdf0e10cSrcweir
282*cdf0e10cSrcweirIf inBool <> outBool Or inByte <> outByte Or inShort <> outShort Or inLong <> outLong Or _
283*cdf0e10cSrcweir   inFloat <> outFloat Or inDouble <> outDouble Or inString <> outString Or _
284*cdf0e10cSrcweir   inVariant <> outVariant Or NOT equalUnoObjects(inObject, outObject) Or _
285*cdf0e10cSrcweir   NOT equalArrays(inArray, outArray) Or inDate <> outDate Or inCurrency <> outCurrency Or _
286*cdf0e10cSrcweir   inSCode.Value <> outSCode.Value Or Not equalUnoObjects(inUnknown, outUnknown) Or _
287*cdf0e10cSrcweir   inDecimal <> outDecimal Then
288*cdf0e10cSrcweir  runtest = -1
289*cdf0e10cSrcweir  Exit Function
290*cdf0e10cSrcweirEnd If
291*cdf0e10cSrcweir
292*cdf0e10cSrcweir' ref parameter ------------------------------------------------------------------------
293*cdf0e10cSrcweirobj.inLong(0)
294*cdf0e10cSrcweirinLong = 123
295*cdf0e10cSrcweiroutLong = 0
296*cdf0e10cSrcweirobj.inLong(0)
297*cdf0e10cSrcweirobj.inrefLong(inLong)
298*cdf0e10cSrcweirobj.outLong(outLong)
299*cdf0e10cSrcweirinVariant = "bla"
300*cdf0e10cSrcweiroutVariant = 0
301*cdf0e10cSrcweirobj.inVariant(0)
302*cdf0e10cSrcweirobj.inrefVariant(inVariant)
303*cdf0e10cSrcweirobj.outVariant(outVariant)
304*cdf0e10cSrcweirIf inLong <> outLong Or inVariant <> outVariant Then
305*cdf0e10cSrcweir  runtest = -1
306*cdf0e10cSrcweir  Exit Function
307*cdf0e10cSrcweirEnd If
308*cdf0e10cSrcweir
309*cdf0e10cSrcweiroutLong = 0
310*cdf0e10cSrcweirobj.prprefLong = inLong
311*cdf0e10cSrcweiroutLong = obj.prprefLong
312*cdf0e10cSrcweiroutVariant = 0
313*cdf0e10cSrcweirobj.prprefVariant = inVariant
314*cdf0e10cSrcweiroutVariant = obj.prprefVariant
315*cdf0e10cSrcweirIf inLong <> outLong Or  inVariant <> outVariant Then
316*cdf0e10cSrcweir  runtest = -1
317*cdf0e10cSrcweir  Exit Function
318*cdf0e10cSrcweirEnd If
319*cdf0e10cSrcweir
320*cdf0e10cSrcweir
321*cdf0e10cSrcweir'vararg --------------------------------------------------------------------------------
322*cdf0e10cSrcweirinLong=1
323*cdf0e10cSrcweirinLong2 = 2
324*cdf0e10cSrcweirinLong3 = 3
325*cdf0e10cSrcweirobj.varargfunc1(inLong)
326*cdf0e10cSrcweiroutArray = 0
327*cdf0e10cSrcweiroutLong = 0
328*cdf0e10cSrcweirobj.varargfunc2(outLong, outArray)
329*cdf0e10cSrcweirIf inLong <> outLong Then
330*cdf0e10cSrcweir  runtest = -1
331*cdf0e10cSrcweir  Exit Function
332*cdf0e10cSrcweirEnd If
333*cdf0e10cSrcweirlen1 = UBound(outArray)  - LBound(outArray) +1
334*cdf0e10cSrcweirIf len1 <> 0 Then
335*cdf0e10cSrcweir  runtest = -1
336*cdf0e10cSrcweir  Exit Function
337*cdf0e10cSrcweirEnd If
338*cdf0e10cSrcweiroutArray = 0
339*cdf0e10cSrcweirobj.varargfunc1(inLong, inLong2, inLong3)
340*cdf0e10cSrcweirobj.varargfunc2(outLong, outArray)
341*cdf0e10cSrcweirlen1 = UBound(outArray) - LBound(outArray) +1
342*cdf0e10cSrcweirIf len1 <> 2 Or outArray(0) <> inLong2 Or outArray(1) <> inLong3 Then
343*cdf0e10cSrcweir  runtest = -1
344*cdf0e10cSrcweir  Exit Function
345*cdf0e10cSrcweirEnd If
346*cdf0e10cSrcweir
347*cdf0e10cSrcweir
348*cdf0e10cSrcweir'defaultvalue ---------------------------------------------------------------------------
349*cdf0e10cSrcweirinLong = 0
350*cdf0e10cSrcweirinFloat = 0
351*cdf0e10cSrcweirinVariant = 0
352*cdf0e10cSrcweirinVariant2 = 0
353*cdf0e10cSrcweir'defaults are: 1, 2, 4
354*cdf0e10cSrcweir'The third parameter is a VARIANT with a default value of 4. COM gives it the type BSTR
355*cdf0e10cSrcweirobj.defaultvalue1()
356*cdf0e10cSrcweirobj.defaultvalue2(inLong, inFloat, inVariant)
357*cdf0e10cSrcweirIf inLong <> 1 Or inFloat <> 2 Or inVariant <> "4" Then
358*cdf0e10cSrcweir  runtest = -1
359*cdf0e10cSrcweir  Exit Function
360*cdf0e10cSrcweirEnd If
361*cdf0e10cSrcweirinLong = 10
362*cdf0e10cSrcweirinFloat = 11
363*cdf0e10cSrcweirinLong2 = inLong
364*cdf0e10cSrcweirinFloat2 = inFloat
365*cdf0e10cSrcweirinVariant = 0
366*cdf0e10cSrcweirinVariant = 0
367*cdf0e10cSrcweirobj.defaultvalue1(inLong, inFloat)
368*cdf0e10cSrcweirobj.defaultvalue2(inLong, inFloat, inVariant)
369*cdf0e10cSrcweirIf inLong <> inLong2 Or inFloat <> inFloat2 Or inVariant <> "4" Then
370*cdf0e10cSrcweir  runtest = -1
371*cdf0e10cSrcweir  Exit Function
372*cdf0e10cSrcweirEnd If
373*cdf0e10cSrcweir
374*cdf0e10cSrcweir'optional parameters ----------------------------------------------------------------
375*cdf0e10cSrcweirinLong = 100
376*cdf0e10cSrcweiroutLong = 0
377*cdf0e10cSrcweirobj.optional1(inLong)
378*cdf0e10cSrcweirobj.optional2(outLong)
379*cdf0e10cSrcweirIf inLong <> outLong Then
380*cdf0e10cSrcweir runtest = -1
381*cdf0e10cSrcweir Exit Function
382*cdf0e10cSrcweirEnd If
383*cdf0e10cSrcweir
384*cdf0e10cSrcweirinLong2 = 101
385*cdf0e10cSrcweiroutLong2 = 0
386*cdf0e10cSrcweirobj.optional1(inLong, inLong2)
387*cdf0e10cSrcweirobj.optional2(outLong, outLong2)
388*cdf0e10cSrcweirIf inLong <> outLong AND inLong2 <> outLong2 Then
389*cdf0e10cSrcweir runtest = -1
390*cdf0e10cSrcweir Exit Function
391*cdf0e10cSrcweirEnd If
392*cdf0e10cSrcweir
393*cdf0e10cSrcweirinLong2 = 101
394*cdf0e10cSrcweiroutLong2 = 0
395*cdf0e10cSrcweirobj.optional1(inLong, inLong2)
396*cdf0e10cSrcweirobj.optional1(inLong)
397*cdf0e10cSrcweirobj.optional2(outLong, outLong2)
398*cdf0e10cSrcweirIf inLong <> outLong AND inLong2 <> outLong2 Then
399*cdf0e10cSrcweir runtest = -1
400*cdf0e10cSrcweir Exit Function
401*cdf0e10cSrcweirEnd If
402*cdf0e10cSrcweir
403*cdf0e10cSrcweirinLong = 10
404*cdf0e10cSrcweirinLong2 = 100
405*cdf0e10cSrcweiroutLong = 5
406*cdf0e10cSrcweiroutLong2 = 6
407*cdf0e10cSrcweirobj.optional3()
408*cdf0e10cSrcweirobj.optional3(inLong, inLong2)
409*cdf0e10cSrcweirobj.optional4(outLong, outLong2) 'outLong = 10, outLong2 = 100
410*cdf0e10cSrcweirIf inLong <> outLong AND inLong2 <> outLong2 Then
411*cdf0e10cSrcweir runtest = -1
412*cdf0e10cSrcweir Exit Function
413*cdf0e10cSrcweirEnd If
414*cdf0e10cSrcweirinLong = 10
415*cdf0e10cSrcweirinLong2 = 100
416*cdf0e10cSrcweirinLong3 = inLong
417*cdf0e10cSrcweirinLong4 = inLong2
418*cdf0e10cSrcweirobj.optional4(inLong, inLong)
419*cdf0e10cSrcweiroutLong = 0
420*cdf0e10cSrcweiroutLong2 = 0
421*cdf0e10cSrcweirobj.optional5(outLong, outLong2)
422*cdf0e10cSrcweirIf inLong3 <> outLong AND inLong4 <> outLong2 Then
423*cdf0e10cSrcweir  runtest = -1
424*cdf0e10cSrcweir  Exit Function
425*cdf0e10cSrcweirEnd If
426*cdf0e10cSrcweir
427*cdf0e10cSrcweirinLong = 10
428*cdf0e10cSrcweiroutLong = 5
429*cdf0e10cSrcweirobj.optional3(inLong)
430*cdf0e10cSrcweirobj.optional4(outLong)
431*cdf0e10cSrcweirIf inLong <> outLong Then
432*cdf0e10cSrcweir runtest = -1
433*cdf0e10cSrcweir Exit Function
434*cdf0e10cSrcweirEnd If
435*cdf0e10cSrcweirinLong = 10
436*cdf0e10cSrcweirinLong2 = inLong
437*cdf0e10cSrcweiroutLong = 0
438*cdf0e10cSrcweirobj.optional4(inLong)
439*cdf0e10cSrcweirobj.optional5(outLong)
440*cdf0e10cSrcweirIf inLong2 <> outLong Then
441*cdf0e10cSrcweir  runtest = -1
442*cdf0e10cSrcweir  Exit Function
443*cdf0e10cSrcweirEnd If
444*cdf0e10cSrcweir
445*cdf0e10cSrcweir'named arguments-------------------------------------------------------------------------
446*cdf0e10cSrcweir'all args As named args, different order
447*cdf0e10cSrcweirobj.optional6(0, 0, 0, 0)
448*cdf0e10cSrcweirinLong = 1
449*cdf0e10cSrcweirinLong2 = 2
450*cdf0e10cSrcweirinLong3 = 3
451*cdf0e10cSrcweirinLong4 = 4
452*cdf0e10cSrcweirobj.optional6(val4:= inLong4, val3:=inLong3, val2:=inLong2, val1:= inLong)
453*cdf0e10cSrcweirDim outLong3 As Long
454*cdf0e10cSrcweirDim outLong4 As Long
455*cdf0e10cSrcweiroutLong = 0
456*cdf0e10cSrcweiroutLong2 = 0
457*cdf0e10cSrcweiroutLong3 = 0
458*cdf0e10cSrcweiroutLong4 = 0
459*cdf0e10cSrcweirobj.optional7(outLong, outLong2, outLong3, outLong4)
460*cdf0e10cSrcweirIf inLong <> outLong Or inLong2 <> outLong2 _
461*cdf0e10cSrcweir	Or inLong3 <> outLong3 Or inLong4 <> outLong4 Then
462*cdf0e10cSrcweir	runtest = -1
463*cdf0e10cSrcweir	Exit Function
464*cdf0e10cSrcweirEnd If
465*cdf0e10cSrcweir
466*cdf0e10cSrcweir'mixed positional and named args with omitted args
467*cdf0e10cSrcweirDim scode_paramNotFound As New com.sun.star.bridge.oleautomation.SCode
468*cdf0e10cSrcweirscode_paramNotFound.Value = &h80020004
469*cdf0e10cSrcweir
470*cdf0e10cSrcweirobj.optional6(0, 0, 0, 0)
471*cdf0e10cSrcweir'val1 and val3 will be DISP_E_PARAMNOTFOUND
472*cdf0e10cSrcweirobj.optional6(, inLong2, val4:=inLong4)
473*cdf0e10cSrcweirDim outSCode1, outSCode2
474*cdf0e10cSrcweirobj.optional7(outSCode, outLong2, outSCode2, outLong4)
475*cdf0e10cSrcweirIf outSCode.Value <> scode_paramNotFound.Value Or inLong2 <> outLong2 _
476*cdf0e10cSrcweir	Or outSCode2.Value <> scode_paramNotFound.Value Or inLong4 <> outLong4 Then
477*cdf0e10cSrcweir	runtest = -1
478*cdf0e10cSrcweir	Exit Function
479*cdf0e10cSrcweirEnd If
480*cdf0e10cSrcweir
481*cdf0e10cSrcweir'mixed positional and named args with ommitted args as out -args
482*cdf0e10cSrcweirinLong = 1
483*cdf0e10cSrcweirinLong2 = 2
484*cdf0e10cSrcweirinLong3 = 3
485*cdf0e10cSrcweirinLong4 = 4
486*cdf0e10cSrcweirobj.optional6(inLong, inLong2, inLong3, inLong4)
487*cdf0e10cSrcweiroutLong2 = 0
488*cdf0e10cSrcweiroutLong3 = 0
489*cdf0e10cSrcweirobj.optional7(,outLong2, val3:= outLong3)
490*cdf0e10cSrcweirIf inLong2 <> outLong2 Or inLong3 <> outLong3 Then
491*cdf0e10cSrcweir	runtest = -1
492*cdf0e10cSrcweir	Exit Function
493*cdf0e10cSrcweirEnd If
494*cdf0e10cSrcweir
495*cdf0e10cSrcweir'test properties with additional arguments ------------------------------------
496*cdf0e10cSrcweirinLong = 10
497*cdf0e10cSrcweirinLong2 = 20
498*cdf0e10cSrcweirinLong3 = 30
499*cdf0e10cSrcweiroutLong = 0
500*cdf0e10cSrcweiroutLong2 = 0
501*cdf0e10cSrcweiroutLong3 = 0
502*cdf0e10cSrcweirobj.prpMultiArg1(0,0) = 0
503*cdf0e10cSrcweir'obj.prpMultiArg1 = 0
504*cdf0e10cSrcweirobj.prpMultiArg1(inLong,inLong2) = inLong3
505*cdf0e10cSrcweiroutLong3 = obj.prpMultiArg1(outLong, outLong2)
506*cdf0e10cSrcweirIf outLong <> 10 Or outLong2 <> 02 Or outLong3 <> 30 Then
507*cdf0e10cSrcweir	runtest = -1
508*cdf0e10cSrcweir	Exit Function
509*cdf0e10cSrcweirEnd If
510*cdf0e10cSrcweir
511*cdf0e10cSrcweiroutLong = 0
512*cdf0e10cSrcweiroutLong2 = 0
513*cdf0e10cSrcweirobj.prpMultiArg1(0,0) = 0
514*cdf0e10cSrcweirobj.prpMultiArg1(1) = 3
515*cdf0e10cSrcweiroutLong2 = obj.prpMultiArg1(outLong)
516*cdf0e10cSrcweirIf outLong <> 1 Or outLong2 <> 3 Then
517*cdf0e10cSrcweir	runtest = -1
518*cdf0e10cSrcweir	Exit Function
519*cdf0e10cSrcweirEnd If
520*cdf0e10cSrcweir
521*cdf0e10cSrcweiroutLong = 0
522*cdf0e10cSrcweiroutLong2 = 0
523*cdf0e10cSrcweirobj.prpMultiArg1(0,0) = 0
524*cdf0e10cSrcweirobj.prpMultiArg1(val2:= 1) = 3
525*cdf0e10cSrcweiroutLong2 = obj.prpMultiArg1(val2:=outLong)
526*cdf0e10cSrcweirIf outLong <> 1 Or outLong2 <> 3 Then
527*cdf0e10cSrcweir	runtest = -1
528*cdf0e10cSrcweir	Exit Function
529*cdf0e10cSrcweirEnd If
530*cdf0e10cSrcweir
531*cdf0e10cSrcweiroutLong = -1
532*cdf0e10cSrcweiroutLong2 = -1
533*cdf0e10cSrcweirobj.prpMultiArg2(0) = 0
534*cdf0e10cSrcweiroutLong = obj.prpMultiArg2GetValues(outLong, outLong2)
535*cdf0e10cSrcweirIf outLong <> 0 Or outLong2 <> 0 Then
536*cdf0e10cSrcweir	runtest = -1
537*cdf0e10cSrcweir	Exit Function
538*cdf0e10cSrcweirEnd If
539*cdf0e10cSrcweir
540*cdf0e10cSrcweir
541*cdf0e10cSrcweiroutLong = 0
542*cdf0e10cSrcweiroutLong2 = 0
543*cdf0e10cSrcweirobj.prpMultiArg2(1) = 2
544*cdf0e10cSrcweirobj.prpMultiArg2GetValues(outLong, outLong2)
545*cdf0e10cSrcweirIf outLong <> 1 Or outLong2 <> 2 Then
546*cdf0e10cSrcweir	runtest = -1
547*cdf0e10cSrcweir	Exit Function
548*cdf0e10cSrcweirEnd If
549*cdf0e10cSrcweir
550*cdf0e10cSrcweir
551*cdf0e10cSrcweir
552*cdf0e10cSrcweir' other tests ------------------------------------------------------------------
553*cdf0e10cSrcweirobj.inObject(NOTHING)
554*cdf0e10cSrcweiroutObject = NOTHING
555*cdf0e10cSrcweir'bridge should return an XInterface any with null pointer
556*cdf0e10cSrcweir'A basic errOr should occur if this is not the case
557*cdf0e10cSrcweirobj.outObject(outObject)
558*cdf0e10cSrcweir
559*cdf0e10cSrcweirIf Not IsNull(outObject) Then
560*cdf0e10cSrcweir	runtest = -1
561*cdf0e10cSrcweir	Exit Function
562*cdf0e10cSrcweirEnd If
563*cdf0e10cSrcweir'Decimal passed by reference
564*cdf0e10cSrcweirinrefDecimal = CDec("9223372036854775807") 'highest positiv value of int64
565*cdf0e10cSrcweirobj.inrefDecimal(inrefDecimal)
566*cdf0e10cSrcweiroutrefDecimal = 0
567*cdf0e10cSrcweirobj.outDecimal(outrefDecimal)
568*cdf0e10cSrcweirIf inrefDecimal <> outrefDecimal Then
569*cdf0e10cSrcweir	runtest = -1
570*cdf0e10cSrcweir	Exit Function
571*cdf0e10cSrcweirEnd If
572*cdf0e10cSrcweir
573*cdf0e10cSrcweir' Test Automation object with dual interfaces ------------------------------------
574*cdf0e10cSrcweirdim dispatcher as object
575*cdf0e10cSrcweirdim oExplorer as object
576*cdf0e10cSrcweirdispatcher = createUnoService("com.sun.star.bridge.OleObjectFactory")
577*cdf0e10cSrcweiroExplorer = dispatcher.createInstance("InternetExplorer.Application")
578*cdf0e10cSrcweirIf Not IsNull(oExplorer) Then
579*cdf0e10cSrcweir	oExplorer.visible = true
580*cdf0e10cSrcweir	oExplorer.Navigate2("http://www.openoffice.org")
581*cdf0e10cSrcweirElse
582*cdf0e10cSrcweir	MsgBox("Could not perform test with Internet Explorer!")
583*cdf0e10cSrcweirEnd If
584*cdf0e10cSrcweir
585*cdf0e10cSrcweir
586*cdf0e10cSrcweirEnd Function
587*cdf0e10cSrcweir
588*cdf0e10cSrcweir'One dimensional arrays with simple types.
589*cdf0e10cSrcweir'lower bound must be 0
590*cdf0e10cSrcweirFunction equalArrays(ar1, ar2)
591*cdf0e10cSrcweirDim len1
592*cdf0e10cSrcweirDim len2
593*cdf0e10cSrcweirlen1 = UBound(ar1) - LBound(ar1) + 1
594*cdf0e10cSrcweirlen2 = UBound(ar2) - LBound(ar2) + 1
595*cdf0e10cSrcweirIf len1 <> len2 Then
596*cdf0e10cSrcweir  equalArrays = false
597*cdf0e10cSrcweir  Exit Function
598*cdf0e10cSrcweirEnd If
599*cdf0e10cSrcweirDim counter
600*cdf0e10cSrcweirFOr counter = 0 To len1 - 1
601*cdf0e10cSrcweir  If ar1(counter) <> ar2(counter) Then
602*cdf0e10cSrcweir    equalArrays = false
603*cdf0e10cSrcweir    Exit Function
604*cdf0e10cSrcweir  End If
605*cdf0e10cSrcweirNext
606*cdf0e10cSrcweirequalArrays = true
607*cdf0e10cSrcweirEnd Function
608*cdf0e10cSrcweir
609*cdf0e10cSrcweir
610