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 : gregor.hartmann@oracle.com
30 '* short description : Basic form-controls
32 '\******************************************************************************
34 private const ICONTROLCOUNT = 22
36 testcase tAllControlsOnDialog( cMajor as string )
38 printlog( "Insert all available controls into a BASIC dialog and verify that changed settings persist a save/load cycle" )
40 'qaerrorlog( "#i105685# - Test disabled" )
43 dim iApplication as Integer ' numeric expression for gApplication
44 dim cApplication as string ' Name of the current application
46 ' number of controls and the name of the current control
47 dim iCurrentControl as integer
48 dim sCurrentControl as string
50 ' the workfile and the filter (Tested for 569, 645, 680)
53 const CMODULE = "tacod" ' abbreviation for tAllControlsOnDialog
54 const BUTTON_TIMEOUT = -1
55 const UPPER_BOUNDARY = 1 ' 1 = only writer, increase to add Calc, Impress, Draw...
57 ' Currently set to test writer only. Increase upper boundary to add applications
58 ' Up to 4 should be useful
59 for iApplication = 1 to UPPER_BOUNDARY
61 cApplication = hNumericDoctype( iApplication )
62 printlog( "Document type: " & cApplication )
64 sFile = convertpath( hGetWorkPath() & "basic" & hGetSuffix( cMajor ) )
65 printlog( "Using file: " & sFile )
67 printlog( "Delete the file, if it exists" )
70 printlog( "Open a second document" )
73 printlog( "Create a new module for the new document, new dialog, open macro controls" )
74 if ( not hInitFormControls( CMODULE ) ) then
75 printlog( "Aborting due to previous errors" )
80 printlog( "Insert all controls into the dialog" )
81 for iCurrentControl = 1 to ICONTROLCOUNT
83 sCurrentControl = hDrawControlOnDialog( iCurrentControl )
84 hUseAsyncSlot( "ContextProperties" )
85 kontext "ControlPropertiesTabControl"
86 if ( ControlPropertiesTabControl.exists( 1 ) ) then
87 hPBSetControlName( sCurrentControl )
88 hUseAsyncSlot( "ContextProperties" )
90 warnlog( "Property browser not open" )
96 printlog( "close the BASIC-IDE" )
100 printlog( "Test case 1: Verify that settings survive a close and reopen of the BASIC IDE" )
104 if ( hSelectNodeByName( MakroAus , CMODULE ) ) then
105 printlog( "The node was found. Good." )
107 qaerrorlog( "Searching node by name failed. Using fallback" )
108 hSelectTheLastnode( MakroAus )
111 printlog( "Edit the module" )
112 if ( hClickButton( Bearbeiten ) = BUTTON_TIMEOUT ) then
113 warnlog( "Edit-Button is not enabled, the test cannot continue" )
115 hCloseDialog( Makro, "cancel" )
121 printlog( "Find the dialog we created before" )
122 if ( hFindFirstDialog() ) then
123 printlog( "First dialog found. Good." )
125 warnlog( "#i115117 - Could not access dialog, accelerator not working? (Test interrupted)" )
131 printlog( "Select every control, open its properties and verify its name, close properties" )
132 for iCurrentControl = 1 to ICONTROLCOUNT
134 sCurrentControl = hGetControlName( iCurrentControl )
135 if ( hSelectControl( iCurrentControl ) ) then
136 kontext "ControlPropertiesTabControl"
137 if ( ControlPropertiesTabControl.exists( 5 ) ) then
139 hPBGetControlName( sCurrentControl )
140 hUseAsyncSlot( "ContextProperties" )
141 kontext "ControlPropertiesTabControl" : ControlPropertiesTabControl.notExists( 3 )
143 warnlog( "Property browser not open for " & sCurrentControl )
146 warnlog( "Failed to select control: " & sCurrentControl )
151 printlog( "Close the BASIC-IDE" )
154 if ( getDocumentCount <> 1 ) then warnlog( "Number of open documents is incorrect, expected one only" )
156 printlog( "Save the document" )
157 Call hFileSaveAsKill( sFile )
159 printlog( "Close the document" )
163 printlog( "Test case 2: Verify that all items keep their names after close and reload of the document" )
165 printlog( "Open the file again" )
168 printlog( "Open the basic-IDE from this document, open controls, activate 'Select-mode' and open the properties" )
172 if ( hSelectNodeByName( MakroAus , CMODULE ) ) then
173 printlog( "The node was found. Good." )
175 qaerrorlog( "Searching node by name failed. Using fallback" )
176 hSelectTheLastnode( MakroAus )
179 printlog( "Edit the module" )
180 if ( hClickButton( Bearbeiten ) = BUTTON_TIMEOUT ) then
181 warnlog( "Edit-Button is not enabled, the test cannot continue" )
183 hCloseDialog( Makro, "cancel" )
189 printlog( "Find the dialog we created before" )
190 if ( hFindFirstDialog() ) then
191 printlog( "First dialog found. Good." )
193 warnlog( "Could not access dialog, aborting test" )
199 printlog( "Select every control, open its properties and verify its name, close properties" )
200 for iCurrentControl = 1 to ICONTROLCOUNT
202 sCurrentControl = hGetControlName( iCurrentControl )
203 if ( hSelectControl( iCurrentControl ) ) then
204 kontext "ControlPropertiesTabControl"
205 if ( ControlPropertiesTabControl.exists( 5 ) ) then
207 hPBGetControlName( sCurrentControl )
208 hUseAsyncSlot( "ContextProperties" )
209 kontext "ControlPropertiesTabControl" : ControlPropertiesTabControl.notExists( 3 )
211 warnlog( "Property browser not open for " & sCurrentControl )
214 warnlog( "Failed to select control: " & sCurrentControl )
219 printlog( "Cleanup: Close the BASIC-IDE" )
222 printlog( "Cleanup: Close the document" )
225 printlog( "Cleanup: Delete the file we created" )