1 'encoding UTF-8 Do not remove or change this line!
2 '**************************************************************************
3 ' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 ' Copyright 2000, 2010 Oracle and/or its affiliates.
7 ' OpenOffice.org - a multi-platform office productivity suite
9 ' This file is part of OpenOffice.org.
11 ' OpenOffice.org is free software: you can redistribute it and/or modify
12 ' it under the terms of the GNU Lesser General Public License version 3
13 ' only, as published by the Free Software Foundation.
15 ' OpenOffice.org is distributed in the hope that it will be useful,
16 ' but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ' GNU Lesser General Public License version 3 for more details
19 ' (a copy is included in the LICENSE file that accompanied this code).
21 ' You should have received a copy of the GNU Lesser General Public License
22 ' version 3 along with OpenOffice.org. If not, see
23 ' <http://www.openoffice.org/license.html>
24 ' for a copy of the LGPLv3 License.
26 '/************************************************************************
28 '* owner : thorsten.bosbach@oracle.com
30 '* short description : Function test of Basic IDE Assign Componenet
32 '\************************************************************************
35 testcase tAssignComponent
36 dim j,b,i,a,x,y as integer
39 dim sDialogName as string
41 ' make sure we start from backingwindow
44 printlog "closing: " + j
47 ' make sure we only have one document window
51 ToolsMacrosOrganizeDialogs
53 if TabDialogs.exists(5) then
54 ModuleList.typeKeys("<home>")
55 sTemp = ModuleList.getSelText
57 while (NOT newDialog.isEnabled) AND (sTemp <> sTemp2)
58 ModuleList.typeKeys("<down>")
60 sTemp = ModuleList.getSelText
62 if sTemp = sTemp2 then
63 warnlog "Couldn't find a way to enable the 'New...' button - aborting"
66 printlog ModuleList.getSelText
69 if NeuerDialog.exists(5) then
70 ' save dialog name, for deleting it later
71 sDialogName = Dialogname.getText
75 if TabDialogs.exists(5) then
76 printlog ModuleList.getSelText
79 if DialogWindow.exists(5) then ' you can't use exists on BasicIDE; check for a control
80 DialogWindow.TypeKeys("tab")
81 DialogWindow.TypeKeys("tab",true)
85 qaErrorLog "#i70901# .typeKeys doesn't work in DialogWindow"
86 ' works better, but also not always
87 DialogWindow.mouseDown( 10 , 10 )
88 DialogWindow.mouseMove( 90 , 90 )
89 DialogWindow.mouseUp( 90 , 90 )
93 qaErrorLog "Even Workaround doesn't work! - exiting"
97 kontext "ControlPropertiesDialog"
98 'printlog TabEventsControl.exists(5)
99 if NOT ControlPropertiesDialog.exists(5) then
100 qaErrorLog "#i70901# can't use exists on tabpage parent"
102 'printlog TabGeneralControl.exists(5)
104 ' if ControlPropertiesDialog.exists(5) then
105 kontext "TabGeneralControl"
106 if TabGeneralControl.exists(5) then
107 kontext "ControlPropertiesTabControl"
108 ControlPropertiesTabcontrol.setPage (TabEventsControl)
109 Kontext "TabEventsControl"
110 if TabEventsControl.exists(5) then
112 Kontext "AssignMacro"
113 if AssignMacro.exists(5) then
115 Kontext "AssingComponent"
116 if AssingComponent.exists(5) then
117 DialogTest(AssingComponent)
118 ComponentMethodName.setText ("vnd.sun.star.script:Library1.Module1.TestDialogComponent?language=Basic&location=document")
120 Kontext "AssignMacro"
121 if AssignMacro.exists(5) then
122 ' doesn't work, because featureset is not implemted on component EditListBox... expected for xmas 2006
123 'printlog eventListBox.getItemText
125 Kontext "TabEventsControl"
126 printlog evtKeyTyped.getText
127 Kontext "ControlPropertiesDialog"
131 warnlog "couldn't open dialog 'Assign Component'"
134 warnlog "couldn't open dialog 'Assign Macro'"
137 warnlog "couldn't switch to tab page 'Events''"
140 warnlog "couldn't open flyer 'Properties: Dialog'"
143 warnlog "couldn't open Basic IDE Dialog editor"
146 warnlog "couldn't open dialog 'New Dialog'"
149 warnlog "couldn't open dialog 'New Dialog'"
152 warnlog "couldn't open dialog 'OOo Basic Macro Organizer'"
156 ToolsMacrosOrganizeDialogs
158 if TabDialogs.exists(5) then
159 ModuleList.typeKeys("<home>")
160 sTemp = ModuleList.getSelText
162 while (sTemp <> sDialogName) AND (sTemp <> sTemp2)
163 ModuleList.typeKeys("<down>")
165 sTemp = ModuleList.getSelText
167 if sTemp = sTemp2 then
168 warnlog "Couldn't find the created dialog - aborting"
171 printlog ModuleList.getSelText
174 if active.exists(5) then
175 printlog active.getText
178 warnlog "couldn't delete dialog '"+sDialogName+"'"
183 warnlog "couldn't open dialog 'OOo Basic Macro Organizer'"
187 ' oSimpleComponent = CreateUnoService( "my_module.MyService1" )
188 ' oActiveFrame = StarDesktop.getActiveFrame()
189 ' oSimpleComponent.createDialog("vnd.sun.star.script:Standard.Dialog1?location=application", oActiveFrame )
195 testcase tAssignComponentFunction
199 sPath = gTesttoolPath & "framework\optional\input/eventbinding/"
200 dim sExtension as string
201 sExtension = "DialogComponent.oxt"
203 sExtensionCLI("list","")
204 'sExtensionCLI("add","DialogComponent.oxt",convertPath(gTestToolPath + "framework\optional\input/eventbinding/") )
205 hExtensionAddGUI( sPath & sExtension, "" )
206 hFileOpen(convertPath(gTestToolPath + "framework\optional\input/eventbinding/DialogComponent.odt"))
207 kontext "SecurityWarning"
208 if SecurityWarning.exists(5) then
212 Kontext "ScriptSelector"
213 if ScriptSelector.exists(10) then
214 x = LibraryTreeList.getItemCount
215 'There have to show up 3 libraries, else the document isn't loaded
217 printlog "Try again..."
218 ScriptSelector.cancel
221 Kontext "ScriptSelector"
222 x = LibraryTreeList.getItemCount
224 'Look for library 'DialogComponent' and 'DIALOGCOMPONENT'
226 sTemp = LibraryTreeList.getItemText(i)
227 'printlog "("+i+"/"+x+"): '" + sTemp + "'"
228 if (instr(stemp,"DialogComponent.odt") OR instr(stemp,"DIALOGCOMPONENT.ODT")) then
230 printlog "Found library ("+i+"/"+x+"): '" + sTemp + "'"
234 'Select the library and unfold it
235 LibraryTreeList.select(a)
236 LibraryTreeList.typeKeys("+")
237 'Go to 'Standard' and unfold
238 LibraryTreeList.typeKeys("<down>")
239 LibraryTreeList.typeKeys("+")
241 LibraryTreeList.typeKeys("<down>")
243 'Select macro name 'TestDialogComponent'
244 x = ScriptList.getItemCount
246 sTemp = ScriptList.getItemText(i)
247 'printlog "("+i+"/"+x+"): '" + sTemp + "'"
248 if "TestDialogComponent" = sTemp then
250 printlog "Found macro ("+i+"/"+x+"): '" + sTemp + "'"
256 'Start the macro by pressing the button 'run'
257 qaErrorLog ("#i68892# The test can't go on, because no help ids are useable in BASIC right now.")
258 ScriptSelector.cancel
260 ' sleep... at least 60 seconds
263 warnlog "Macro not found: 'TestDialogComponent'"
266 warnlog "Library not found: 'DialogComponent' or 'DIALOGCOMPONENT'"
269 warnlog "'Run macro dialog' didn't came up"
271 'printlog resetapplication
273 ' vnd.sun.star.UNO:doit1
274 ' vnd.sun.star.UNO:doit2
275 ' vnd.sun.star.UNO:doit3
276 ' vnd.sun.star.UNO:handleEventWithArguments
277 ' vnd.sun.star.UNO:handleEvent
278 ' vnd.sun.star.UNO:copyText
280 sExtensionCLI("remove","DialogComponent.oxt" )
281 'hExtension RemoveGUI( sExtension )