summaryrefslogtreecommitdiff
path: root/testautomation/framework/optional/includes/basic_formcontrols.inc
blob: cc9d33cf924409b6d42d8428975926ae2ff569c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
'encoding UTF-8  Do not remove or change this line!
'**************************************************************************
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 * 
 * Copyright 2000, 2010 Oracle and/or its affiliates.
 *
 * OpenOffice.org - a multi-platform office productivity suite
 *
 * This file is part of OpenOffice.org.
 *
 * OpenOffice.org is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3
 * only, as published by the Free Software Foundation.
 *
 * OpenOffice.org is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License version 3 for more details
 * (a copy is included in the LICENSE file that accompanied this code).
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with OpenOffice.org.  If not, see
 * <http://www.openoffice.org/license.html>
 * for a copy of the LGPLv3 License.
 *
'/************************************************************************
'*
'* owner : joerg.skottke@sun.com
'*
'* short description : Basic form-controls
'*
'\******************************************************************************

testcase tAllControlsOnDialog( cMajor as string )

    printlog( "Insert all available controls into a BASIC dialog and verify that changed settings persist a save/load cycle" )
    
    qaerrorlog( "#i105685# - Test disabled" )
    goto endsub

    dim iApplication as Integer ' numeric expression for gApplication
    dim cApplication as string  ' Name of the current application
    
    dim lsControlNames( 30 ) as string  ' list containing the names of the controls

    ' number of controls and the name of the current control
    dim iCurrentControl as integer
    dim sCurrentControl as string

    ' the workfile and the filter (Tested for 569, 645, 680)
    dim sFile as string

    ' errorstatus: if false, something went wrong and the test cancels
    ' trying to recover somehow
    dim bOpen as boolean
    dim brc as boolean 
    dim irc as integer
    
    const CMODULE = "tacod" ' abbreviation for tAllControlsOnDialog

    printlog( "Perform the test for one application only: WRITER" )
    for iApplication = 1 to 1
    
        printlog( "Set document type" )
        cApplication = hNumericDoctype( iApplication )

        printlog( "Build the filename" )
        sFile = hGetWorkPath() & "basic" & hGetSuffix( cMajor )
        sFile = ConvertPath( sFile )
        printlog( "Using file: " & sFile )
        
        printlog( "Delete the file, if it exists" )
        hDeleteFile( sFile )
                
        printlog( "Open a second document" )
        printlog( "" )
        printlog( cApplication )
        brc = hCreateDocument()
        if ( not brc ) then
            warnlog( "Failed to create a new document, aborting" )
            goto endsub
        endif

        printlog( "Create a new module for the new document" )
        printlog( "Create a new dialog in BasicIDE" )
        printlog( "Open the macro controls float" )
        bOpen = hInitFormControls( CMODULE )
        if ( not bOpen ) then
            printlog( "Aborting due to previous errors" )
            call hCloseDocument()
            goto endsub
        endif

        printlog( "Insert all controls into the dialog" )
        for iCurrentControl = 1 to ICONTROLCOUNT

            sCurrentControl = hDrawControlOnDialog( iCurrentControl )
            listappend( lsControlNames() , sCurrentControl )
            hOpenPropertyBrowser()
            hPBSetControlName( sCurrentControl )
            hClosePropertyBrowser()

        next iCurrentControl
        

        Kontext "BASICIDE"
        printlog( "close the BASIC-IDE" )
        hCloseBasicIde()
        
        
        printlog( "" )
        printlog( "Test case 1: Verify that settings survive a close and reopen of the BASIC IDE" )
        
        ToolsMacro_uno
        kontext "Makro"
        irc = hSelectNodeByName( MakroAus , CMODULE )
        if ( irc = 0 ) then
            qaerrorlog( "Searching node by name failed. Using fallback" )
            hSelectTheLastnode( MakroAus )
        else
            printlog( "The node was found. Good." )
        endif
        
        brc = hIsMacroEditButtonEnabled()
        if ( not brc ) then
            warnlog( "Edit-Button is not enabled, the test cannot continue" )
            kontext "Makro"
            Makro.cancel()
            brc = hDestroyDocument()
            goto endsub
        endif
            
        printlog( "Click 'Edit' to edit the module" )
        printlog( "Edit the module" )
        Bearbeiten.Click()
        if ( WaitSlot <> WSFinished ) then
            warnlog( "Slot not finished after 1 second" )
        endif

        kontext "BasicIDE"
        printlog( "Find the dialog we created before" )
        ' try to find our dialog again by stepping through the tabbar
        bOpen = hFindFirstDialog()
        if ( not bOpen ) then
            warnlog( "Could access dialog, aborting test" )
            hCloseBasicIde()
            brc = hDestroyDocument()
            goto endsub
        endif

        printlog( "Open the macro controls float" )
        ' if the dialog is open, open the macro controls toolbar as well,
        ' we need access to the "properties" button
        bOpen = hShowMacroControls()
        if ( not bOpen ) then
            warnlog( "Could not open macro controls, aborting" )
            hCloseBasicIde()
            brc = hDestroyDocument()
            goto endsub
        endif
        
        printlog( "Select every control, open its properties and verify its name, close properties" )
        for iCurrentControl = 1 to ICONTROLCOUNT

            if ( instr( gtSysName, "Solaris" ) > 0 ) then
                qaerrorlog( "Skipping frame control on Solaris" )
            else
                hSelectControl( iCurrentControl )
                hOpenPropertyBrowser()
                sCurrentControl = lsControlNames( iCurrentControl )
                hPBGetControlName( sCurrentControl )
                hClosePropertyBrowser()
            endif
            
        next iCurrentControl
        
        ' we need to delete the list-content otherwise we run into index-problems
        ListAllDelete( lsControlNames() )
       
        printlog( "Cleanup: Close the BASIC-IDE" )
        printlog( "Close the BASIC IDE" )
        hCloseBasicIde()        
        
        if ( getDocumentCount <> 1 ) then
            warnlog( "Number of open documents is incorrect, expected one only" )
        endif 

        printlog "Save the document"
        printlog( "save the document" )
        Call hFileSaveAsKill( sFile )

        printlog "Close it"
        printlog( "close the document" )
        brc = hDestroyDocument()

        printlog( "" ) 
        printlog( "Test case 2: Verify that all items keep their names after close and reload of the document" )
        
        printlog( "Open the file again" )
        printlog( "Open the document" )
        hFileOpen( sFile )

        printlog "Open tools/macro and select the last module for the current document"
        printlog( "open the basic-IDE of this document, open controls, activate 'Select-mode' and open the properties" )
        ToolsMacro_uno
        kontext "Makro"
        irc = hSelectNodeByName( MakroAus , CMODULE )
        if ( irc = 0 ) then
            qaerrorlog( "Searching node by name failed. Using fallback" )
            hSelectTheLastnode( MakroAus )
        else
            printlog( "The node was found. Good." )
        endif
        
        brc = hIsMacroEditButtonEnabled()
        if ( not brc ) then
            warnlog( "Edit-Button is not enabled, the test cannot continue" )
            kontext "Makro"
            Makro.cancel()
            brc = hDestroyDocument()
            goto endsub
        endif
            
        printlog( "Click 'Edit' to edit the module" )
        printlog( "Edit the module" )
        Bearbeiten.Click()
        if ( WaitSlot <> WSFinished ) then
            warnlog( "Slot not finished after 1 second" )
        endif

        kontext "BasicIDE"
        printlog( "Find the dialog we created before" )
        ' try to find our dialog again by stepping through the tabbar
        bOpen = hFindFirstDialog()
        if ( not bOpen ) then
            warnlog( "Could access dialog, aborting test" )
            hCloseBasicIde()
            brc = hDestroyDocument()
            goto endsub
        endif

        printlog( "Open the macro controls float" )
        ' if the dialog is open, open the macro controls toolbar as well,
        ' we need access to the "properties" button
        bOpen = hShowMacroControls()
        if ( not bOpen ) then
            warnlog( "Could not open macro controls, aborting" )
            hCloseBasicIde()
            brc = hDestroyDocument()
            goto endsub
        endif
        
        printlog( "Select every control, open its properties and verify its name, close properties" )
        for iCurrentControl = 1 to ICONTROLCOUNT

            if ( instr( gtSysName, "Solaris" ) > 0 ) then
                qaerrorlog( "Skipping frame control on Solaris" )
            else
                hSelectControl( iCurrentControl )
                hOpenPropertyBrowser()
                sCurrentControl = lsControlNames( iCurrentControl )
                hPBGetControlName( sCurrentControl )
                hClosePropertyBrowser()
            endif
            
        next iCurrentControl
        
        ' we need to delete the list-content otherwise we run into index-problems
        ListAllDelete( lsControlNames() )
       
        printlog( "Cleanup: Close the BASIC-IDE" )
        printlog( "Close the BASIC IDE" )
        hCloseBasicIde()
        
        printlog( "Cleanup: Close the document" )
        printlog( "Close the document" )
        brc = hDestroyDocument()
        
        printlog( "Cleanup: Delete the file we created" )
        hDeleteFile( sFile )
        
        printlog( "Repeat this for every application" )
        
    next iApplication

endcase