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_XControl" script:language="StarBasic"> 4 5 6'************************************************************************* 7' 8' Licensed to the Apache Software Foundation (ASF) under one 9' or more contributor license agreements. See the NOTICE file 10' distributed with this work for additional information 11' regarding copyright ownership. The ASF licenses this file 12' to you under the Apache License, Version 2.0 (the 13' "License"); you may not use this file except in compliance 14' with the License. You may obtain a copy of the License at 15' 16' http://www.apache.org/licenses/LICENSE-2.0 17' 18' Unless required by applicable law or agreed to in writing, 19' software distributed under the License is distributed on an 20' "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 21' KIND, either express or implied. See the License for the 22' specific language governing permissions and limitations 23' under the License. 24' 25'************************************************************************* 26 27 28 29 30 31' Be sure that all variables are dimensioned: 32option explicit 33 34'************************************************************************* 35' This Interface/Service test depends on the following GLOBAL variables, 36' which must be specified in the object creation: 37 38'Global oModel As Object 39'Global oContext As Object 40'Global oWinpeer As Object 41'Global oToolkit As Object 42 43'************************************************************************* 44 45 46 47 48 49Sub RunTest() 50 51'************************************************************************* 52' INTERFACE: 53' com.sun.star.awt.XControl 54'************************************************************************* 55On Error Goto ErrHndl 56 Dim bOK As Boolean 57 58 If isNull(oContext) then 59 Out.Log("'oContext' as global variable required!") 60 End If 61 If isNull(oWinpeer) then 62 Out.Log("'oWinper' as global variable required!") 63 End If 64 If isNull(oToolkit) then 65 Out.Log("'oToolkit' as global variable required!") 66 End If 67 68 Test.StartMethod("setContext()") 69 bOK = true 70 oObj.setContext(oContext) 71 Test.MethodTested("setContext()", bOK) 72 73 Test.StartMethod("getContext()") 74 bOK = hasUnoInterfaces(oObj.getContext(), "com.sun.star.uno.XInterface") 75 Test.MethodTested("getContext()", bOK) 76 77 Test.StartMethod("createPeer()") 78 bOK = true 79 oObj.createPeer(oToolkit, oWinpeer) 80 Test.MethodTested("createPeer()", bOK) 81 82 Test.StartMethod("getPeer()") 83 bOK = hasUnoInterfaces(oObj.getPeer(),"com.sun.star.awt.XWindowPeer") 84 Test.MethodTested("getPeer()", bOK) 85 86 Test.StartMethod("setModel()") 87 bOK = true 88 oObj.setModel(oModel) 89 Test.StartMethod("getModel()") 90 bOK = bOK AND hasUnoInterfaces(oObj.getModel(), "com.sun.star.awt.XControlModel") 91 Test.MethodTested("setModel()", bOK) 92 Test.MethodTested("getModel()", bOK) 93 94 Test.StartMethod("getView()") 95 bOK = hasUnoInterfaces(oObj.getView(), "com.sun.star.awt.XView") 96 Test.MethodTested("getView()", bOK) 97 98 Test.StartMethod("setDesignMode()") 99 bOK = true 100 oObj.setDesignMode(true) 101 Test.StartMethod("isDesignMode()") 102 bOk = bOk AND oObj.isDesignMode() 103 oObj.setDesignMode(false) 104 bOk = bOk AND NOT oObj.isDesignMode() 105 Test.MethodTested("setDesignMode()", bOK) 106 Test.MethodTested("isDesignMode()", bOK) 107 108 Test.StartMethod("isTransparent()") 109 bOk = VarType(oObj.isTransparent()) = 11 110 Test.MethodTested("isTransparent()", bOK) 111 112Exit Sub 113ErrHndl: 114 Test.Exception() 115 bOK = false 116 resume next 117End Sub 118</script:module> 119