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