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 2008 by Sun Microsystems, Inc.
7 '* OpenOffice.org - a multi-platform office productivity suite
9 '* $RCSfile: basic_formcontrols.inc,v $
13 '* last change: $Author: jsi $ $Date: 2008-06-16 12:18:13 $
15 '* This file is part of OpenOffice.org.
17 '* OpenOffice.org is free software: you can redistribute it and/or modify
18 '* it under the terms of the GNU Lesser General Public License version 3
19 '* only, as published by the Free Software Foundation.
21 '* OpenOffice.org is distributed in the hope that it will be useful,
22 '* but WITHOUT ANY WARRANTY; without even the implied warranty of
23 '* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 '* GNU Lesser General Public License version 3 for more details
25 '* (a copy is included in the LICENSE file that accompanied this code).
27 '* You should have received a copy of the GNU Lesser General Public License
28 '* version 3 along with OpenOffice.org. If not, see
29 '* <http://www.openoffice.org/license.html>
30 '* for a copy of the LGPLv3 License.
32 '/************************************************************************
34 '* owner : joerg.skottke@sun.com
36 '* short description : Basic form-controls
38 '\******************************************************************************
40 testcase tAllControlsOnDialog( cMajor as string )
42 printlog( "Insert all available controls into a BASIC dialog and verify that changed settings persist a save/load cycle" )
44 dim iApplication as Integer ' numeric expression for gApplication
45 dim cApplication as string ' Name of the current application
47 dim lsControlNames( 30 ) as string ' list containing the names of the controls
49 ' number of controls and the name of the current control
50 dim iCurrentControl as integer
51 dim sCurrentControl as string
53 ' the workfile and the filter (Tested for 569, 645, 680)
56 ' errorstatus: if false, something went wrong and the test cancels
57 ' trying to recover somehow
62 const CMODULE = "tacod" ' abbreviation for tAllControlsOnDialog
64 printlog( "Perform the test for one application only: WRITER" )
65 for iApplication = 1 to 1
67 printlog( "Set document type" )
68 cApplication = hNumericDoctype( iApplication )
70 printlog( "Build the filename" )
71 sFile = hGetWorkPath() & "basic" & hGetSuffix( cMajor )
72 sFile = ConvertPath( sFile )
73 printlog( "Using file: " & sFile )
75 printlog( "Delete the file, if it exists" )
78 printlog( "Open a second document" )
80 printlog( cApplication )
81 brc = hCreateDocument()
83 warnlog( "Failed to create a new document, aborting" )
87 printlog( "Create a new module for the new document" )
88 printlog( "Create a new dialog in BasicIDE" )
89 printlog( "Open the macro controls float" )
90 bOpen = hInitFormControls( CMODULE )
92 printlog( "Aborting due to previous errors" )
97 printlog( "Insert all controls into the dialog" )
98 for iCurrentControl = 1 to ICONTROLCOUNT
100 sCurrentControl = hDrawControlOnDialog( iCurrentControl )
101 listappend( lsControlNames() , sCurrentControl )
102 hOpenPropertyBrowser()
103 hPBSetControlName( sCurrentControl )
104 hClosePropertyBrowser()
110 printlog( "close the BASIC-IDE" )
115 printlog( "Test case 1: Verify that settings survive a close and reopen of the BASIC IDE" )
119 irc = hSelectNodeByName( MakroAus , CMODULE )
121 qaerrorlog( "Searching node by name failed. Using fallback" )
122 hSelectTheLastnode( MakroAus )
124 printlog( "The node was found. Good." )
127 brc = hIsMacroEditButtonEnabled()
129 warnlog( "Edit-Button is not enabled, the test cannot continue" )
132 brc = hDestroyDocument()
136 printlog( "Click 'Edit' to edit the module" )
137 printlog( "Edit the module" )
139 if ( WaitSlot <> WSFinished ) then
140 warnlog( "Slot not finished after 1 second" )
144 printlog( "Find the dialog we created before" )
145 ' try to find our dialog again by stepping through the tabbar
146 bOpen = hFindFirstDialog()
147 if ( not bOpen ) then
148 warnlog( "Could access dialog, aborting test" )
150 brc = hDestroyDocument()
154 printlog( "Open the macro controls float" )
155 ' if the dialog is open, open the macro controls toolbar as well,
156 ' we need access to the "properties" button
157 bOpen = hShowMacroControls()
158 if ( not bOpen ) then
159 warnlog( "Could not open macro controls, aborting" )
161 brc = hDestroyDocument()
165 printlog( "Select every control, open its properties and verify its name, close properties" )
166 for iCurrentControl = 1 to ICONTROLCOUNT
168 if ( instr( gtSysName, "Solaris" ) > 0 ) then
169 qaerrorlog( "Skipping frame control on Solaris" )
171 hSelectControl( iCurrentControl )
172 hOpenPropertyBrowser()
173 sCurrentControl = lsControlNames( iCurrentControl )
174 hPBGetControlName( sCurrentControl )
175 hClosePropertyBrowser()
180 ' we need to delete the list-content otherwise we run into index-problems
181 ListAllDelete( lsControlNames() )
183 printlog( "Cleanup: Close the BASIC-IDE" )
184 printlog( "Close the BASIC IDE" )
187 if ( getDocumentCount <> 1 ) then
188 warnlog( "Number of open documents is incorrect, expected one only" )
191 printlog "Save the document"
192 printlog( "save the document" )
193 Call hFileSaveAsKill( sFile )
196 printlog( "close the document" )
197 brc = hDestroyDocument()
200 printlog( "Test case 2: Verify that all items keep their names after close and reload of the document" )
202 printlog( "Open the file again" )
203 printlog( "Open the document" )
206 printlog "Open tools/macro and select the last module for the current document"
207 printlog( "open the basic-IDE of this document, open controls, activate 'Select-mode' and open the properties" )
210 irc = hSelectNodeByName( MakroAus , CMODULE )
212 qaerrorlog( "Searching node by name failed. Using fallback" )
213 hSelectTheLastnode( MakroAus )
215 printlog( "The node was found. Good." )
218 brc = hIsMacroEditButtonEnabled()
220 warnlog( "Edit-Button is not enabled, the test cannot continue" )
223 brc = hDestroyDocument()
227 printlog( "Click 'Edit' to edit the module" )
228 printlog( "Edit the module" )
230 if ( WaitSlot <> WSFinished ) then
231 warnlog( "Slot not finished after 1 second" )
235 printlog( "Find the dialog we created before" )
236 ' try to find our dialog again by stepping through the tabbar
237 bOpen = hFindFirstDialog()
238 if ( not bOpen ) then
239 warnlog( "Could access dialog, aborting test" )
241 brc = hDestroyDocument()
245 printlog( "Open the macro controls float" )
246 ' if the dialog is open, open the macro controls toolbar as well,
247 ' we need access to the "properties" button
248 bOpen = hShowMacroControls()
249 if ( not bOpen ) then
250 warnlog( "Could not open macro controls, aborting" )
252 brc = hDestroyDocument()
256 printlog( "Select every control, open its properties and verify its name, close properties" )
257 for iCurrentControl = 1 to ICONTROLCOUNT
259 if ( instr( gtSysName, "Solaris" ) > 0 ) then
260 qaerrorlog( "Skipping frame control on Solaris" )
262 hSelectControl( iCurrentControl )
263 hOpenPropertyBrowser()
264 sCurrentControl = lsControlNames( iCurrentControl )
265 hPBGetControlName( sCurrentControl )
266 hClosePropertyBrowser()
271 ' we need to delete the list-content otherwise we run into index-problems
272 ListAllDelete( lsControlNames() )
274 printlog( "Cleanup: Close the BASIC-IDE" )
275 printlog( "Close the BASIC IDE" )
278 printlog( "Cleanup: Close the document" )
279 printlog( "Close the document" )
280 brc = hDestroyDocument()
282 printlog( "Cleanup: Delete the file we created" )
285 printlog( "Repeat this for every application" )