1<?xml version="1.0" encoding="UTF-8"?> 2<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> 3<script:module xmlns:script="http://openoffice.org/2000/script" script:name="awt_XControlContainer" script:language="StarBasic"> 4 5 6'************************************************************************* 7' 8' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 9' 10' Copyright 2000, 2010 Oracle and/or its affiliates. 11' 12' OpenOffice.org - a multi-platform office productivity suite 13' 14' This file is part of OpenOffice.org. 15' 16' OpenOffice.org is free software: you can redistribute it and/or modify 17' it under the terms of the GNU Lesser General Public License version 3 18' only, as published by the Free Software Foundation. 19' 20' OpenOffice.org is distributed in the hope that it will be useful, 21' but WITHOUT ANY WARRANTY; without even the implied warranty of 22' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23' GNU Lesser General Public License version 3 for more details 24' (a copy is included in the LICENSE file that accompanied this code). 25' 26' You should have received a copy of the GNU Lesser General Public License 27' version 3 along with OpenOffice.org. If not, see 28' <http://www.openoffice.org/license.html> 29' for a copy of the LGPLv3 License. 30' 31'************************************************************************* 32'************************************************************************* 33 34 35 36'************************************************************************* 37' This Interface/Service test depends on the following GLOBAL variables, 38' which must be specified in the object creation: 39 40'Global oXControl1 as Object 41'Global oXControl2 as Object 42 43'************************************************************************* 44 45 46 47 48 49Sub RunTest() 50 51'************************************************************************* 52' INTERFACE: 53' com.sun.star.awt.XControlContainer 54'************************************************************************* 55On Error Goto ErrHndl 56 Dim bOK As Boolean 57 58 If isNull(oXControl1) then 59 Out.Log("'oXControl1' as global variable required!") 60 End If 61 If isNull(oXControl2) then 62 Out.Log("'oXControl2' as global variable required!") 63 End If 64 65 Dim vGetControls As Variant 66 Dim oGetControl As Object 67 68 Test.StartMethod("setStatusText()") 69 bOK = true 70 oObj.setStatusText("testing XControlContainer::setStatusText(String)") 71 Test.MethodTested("setStatusText()", bOK) 72 73 Test.StartMethod("addControl()") 74 bOK = true 75 oObj.addControl("Control1", oXControl1) 76 oObj.addControl("Control2", oXControl2) 77 Test.StartMethod("getControls()") 78 vGetControls = oObj.getControls() 79Dim nControls As Integer 80 nControls = uBound(vGetControls) 81 bOK = bOK AND (nControls >= 1) 82 Test.MethodTested("addControl()", bOK) 83 Test.MethodTested("getControls()", bOK) 84 85 Test.StartMethod("getControl()") 86 oGetControl = oObj.getControl("Control1") 87 bOK = bOK AND NOT isNull(oGetControl) 88 Test.MethodTested("getControl()", bOK) 89 90 Test.StartMethod("removeControl()") 91 bOK = true 92 oObj.removeControl(oXControl2) 93 Test.StartMethod("getControls()") 94 vGetControls = oObj.getControls() 95 bOK = bOK AND ((nControls - ubound(vGetControls)) = 1) 96 Test.MethodTested("removeControl()", bOK) 97 98Exit Sub 99ErrHndl: 100 Test.Exception() 101 bOK = false 102 resume next 103End Sub 104</script:module> 105