blob: 7f2c5bf6904d1d4237b15c7fe34722260147ef1a [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="awt_XControlContainer" script:language="StarBasic">
'*************************************************************************
'
' Licensed to the Apache Software Foundation (ASF) under one
' or more contributor license agreements. See the NOTICE file
' distributed with this work for additional information
' regarding copyright ownership. The ASF licenses this file
' to you under the Apache License, Version 2.0 (the
' "License"); you may not use this file except in compliance
' with the License. You may obtain a copy of the License at
'
' http://www.apache.org/licenses/LICENSE-2.0
'
' Unless required by applicable law or agreed to in writing,
' software distributed under the License is distributed on an
' "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
' KIND, either express or implied. See the License for the
' specific language governing permissions and limitations
' under the License.
'
'*************************************************************************
'*************************************************************************
' This Interface/Service test depends on the following GLOBAL variables,
' which must be specified in the object creation:
'Global oXControl1 as Object
'Global oXControl2 as Object
'*************************************************************************
Sub RunTest()
'*************************************************************************
' INTERFACE:
' com.sun.star.awt.XControlContainer
'*************************************************************************
On Error Goto ErrHndl
Dim bOK As Boolean
If isNull(oXControl1) then
Out.Log("'oXControl1' as global variable required!")
End If
If isNull(oXControl2) then
Out.Log("'oXControl2' as global variable required!")
End If
Dim vGetControls As Variant
Dim oGetControl As Object
Test.StartMethod("setStatusText()")
bOK = true
oObj.setStatusText("testing XControlContainer::setStatusText(String)")
Test.MethodTested("setStatusText()", bOK)
Test.StartMethod("addControl()")
bOK = true
oObj.addControl("Control1", oXControl1)
oObj.addControl("Control2", oXControl2)
Test.StartMethod("getControls()")
vGetControls = oObj.getControls()
Dim nControls As Integer
nControls = uBound(vGetControls)
bOK = bOK AND (nControls &gt;= 1)
Test.MethodTested("addControl()", bOK)
Test.MethodTested("getControls()", bOK)
Test.StartMethod("getControl()")
oGetControl = oObj.getControl("Control1")
bOK = bOK AND NOT isNull(oGetControl)
Test.MethodTested("getControl()", bOK)
Test.StartMethod("removeControl()")
bOK = true
oObj.removeControl(oXControl2)
Test.StartMethod("getControls()")
vGetControls = oObj.getControls()
bOK = bOK AND ((nControls - ubound(vGetControls)) = 1)
Test.MethodTested("removeControl()", bOK)
Exit Sub
ErrHndl:
Test.Exception()
bOK = false
resume next
End Sub
</script:module>