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' 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' Be sure that all variables are dimensioned:
37option explicit
38
39'*************************************************************************
40' This Interface/Service test depends on the following GLOBAL variables,
41' which must be specified in the object creation:
42
43'Global oModel As Object
44'Global oContext As Object
45'Global oWinpeer As Object
46'Global oToolkit As Object
47
48'*************************************************************************
49
50
51
52
53
54Sub RunTest()
55
56'*************************************************************************
57' INTERFACE:
58' com.sun.star.awt.XControl
59'*************************************************************************
60On Error Goto ErrHndl
61    Dim bOK As Boolean
62
63    If isNull(oContext) then
64       Out.Log("'oContext' as global variable required!")
65    End If
66    If isNull(oWinpeer) then
67       Out.Log("'oWinper' as global variable required!")
68    End If
69    If isNull(oToolkit) then
70       Out.Log("'oToolkit' as global variable required!")
71    End If
72
73    Test.StartMethod("setContext()")
74    bOK = true
75    oObj.setContext(oContext)
76    Test.MethodTested("setContext()", bOK)
77
78    Test.StartMethod("getContext()")
79    bOK = hasUnoInterfaces(oObj.getContext(), "com.sun.star.uno.XInterface")
80    Test.MethodTested("getContext()", bOK)
81
82    Test.StartMethod("createPeer()")
83    bOK = true
84    oObj.createPeer(oToolkit, oWinpeer)
85    Test.MethodTested("createPeer()", bOK)
86
87    Test.StartMethod("getPeer()")
88    bOK = hasUnoInterfaces(oObj.getPeer(),"com.sun.star.awt.XWindowPeer")
89    Test.MethodTested("getPeer()", bOK)
90
91    Test.StartMethod("setModel()")
92    bOK = true
93    oObj.setModel(oModel)
94    Test.StartMethod("getModel()")
95    bOK = bOK AND hasUnoInterfaces(oObj.getModel(), "com.sun.star.awt.XControlModel")
96    Test.MethodTested("setModel()", bOK)
97    Test.MethodTested("getModel()", bOK)
98
99    Test.StartMethod("getView()")
100    bOK = hasUnoInterfaces(oObj.getView(), "com.sun.star.awt.XView")
101    Test.MethodTested("getView()", bOK)
102
103    Test.StartMethod("setDesignMode()")
104    bOK = true
105    oObj.setDesignMode(true)
106    Test.StartMethod("isDesignMode()")
107    bOk = bOk AND oObj.isDesignMode()
108    oObj.setDesignMode(false)
109    bOk = bOk AND NOT oObj.isDesignMode()
110    Test.MethodTested("setDesignMode()", bOK)
111    Test.MethodTested("isDesignMode()", bOK)
112
113    Test.StartMethod("isTransparent()")
114    bOk = VarType(oObj.isTransparent()) = 11
115    Test.MethodTested("isTransparent()", bOK)
116
117Exit Sub
118ErrHndl:
119    Test.Exception()
120    bOK = false
121    resume next
122End Sub
123</script:module>
124