summaryrefslogtreecommitdiff
path: root/testautomation/chart2/required/includes/ch2_datadialogue.inc
blob: 85bb63a200f94798e289d2b3d1aa72d590ae6724 (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
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
'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 : oliver.craemer@sun.com
'*
'* short description : Resource-test for the Chart Data Dialogue.
'*
'*******************************************************************
'*
' #1 tChartDataDialogueButtons
' #1 tChartDataDialogueFieldsUndo
'*
'\*******************************************************************

testcase tChartDataDialogueButtons
    '/// Create new impress document
    printlog "Create new impress document"   
    call hNewDocument
        Kontext "DocumentImpress"
        '/// Insert a new Chart-object, via the Menu: 'Insert - Chart'.
        Printlog "   Insert a new Chart-object, via the Menu: 'Insert - Chart'."
        InsertChart
        WaitSlot()
        '/// Press 'TAB' once to select the object
        printlog "   Press 'TAB' once to select the object."
        DocumentImpress.TypeKeys "<TAB>"
        '/// Click the button 'RETURN' / 'ENTER' to enter the Chart-Data-dialogue
        printlog "   Click the button 'Return', to enter the Chart-Data-dialogue."
        DocumentImpress.TypeKeys "<RETURN>"
        Kontext "DocumentChart"
        '/// Open context menu
        printlog "Open context menu" 
        DocumentChart.OpenContextMenu
        '/// Select the third entry
        printlog "Select the third entry"
        hMenuSelectNr (6)
        sleep (1)
        Kontext "Diagramdata"
        call DialogTest ( Diagramdata )
        '/// Check if the diagram data dialogue came up
        printlog "Check if the diagram data dialogue came up"
        if Diagramdata.Exists then 
            printlog "   Diagramdata came up just as expected."
        else
            warnlog "   Diagramdata didnt come up as expected."
            call hCloseDocument
            goto endsub
        end if
        '/// Check if the 'Insert Row'-button is enabled.
        printlog "Check if the 'Insert Row'-button is enabled."
        if InsertRow.isEnabled then 
            printlog "   InsertRow was correctly enabled."
        else
            warnlog "   InsertRow wasnt enabled, but should have been."
        end if
        '/// Check if the 'Swap Columns'-button is disabled.
        printlog "Check if the 'Swap Columns'-button is disabled."
        if SwapColumns.isEnabled then 
            warnlog "   SwapColumns was enabled, but should have been disabled."
        else
            printlog "   SwapColumns was correctly disabled."
        end if
        '/// Check if the 'Swap Rows'-button is enabled.
        printlog "Check if the 'Swap Rows'-button is enabled."
        if SwapRows.isEnabled then 
            printlog "   SwapRows was correctly enabled."
        else
            warnlog "   SwapRows wasnt enabled, but should have been."
        end if
        '/// Check if the 'Delete Row'-button is enabled.
        printlog "Check if the 'Delete Row'-button is enabled."
        if DeleteRow.isEnabled then 
            printlog "   DeleteRow was correctly enabled."
        else
            warnlog "   DeleteRow wasnt enabled, but should have been."
        end if
        '/// Check if the 'Delete Column'-button is enabled.
        printlog "Check if the 'Delete Column'-button is enabled."
        if DeleteColumn.isEnabled then 
            warnlog "   DeleteColumn was enabled, but should have been disabled."
        else
            printlog "   DeleteColumn was correctly disabled."
        end if
        '/// Press 'TAB' to enter the Data-fields, followed by 'SHIFT TAB' end up in the first field.
        printlog "Press 'TAB' to enter the Data-fields, followed by 'SHIFT TAB' end up in the first field."
        Kontext "Diagramdata"
        Diagramdata.TypeKeys "<TAB>", true
        Diagramdata.TypeKeys "<SHIFT TAB>", true
        '/// Set the text in the marked field to '111'. Then move to the next field by pressing 'TAB'.
        printlog "   Set the text in the marked field to '111'. Then move to the next field by pressing 'TAB'."
        Tables.TypeKeys "111", true
        Diagramdata.TypeKeys "<TAB>", true
        '/// Set the text in the marked field to '222'. Then move to the next field by pressing 'TAB'.
        printlog "   Set the text in the marked field to '222'. Then move to the next field by pressing 'TAB'."
        Tables.TypeKeys "222", true
        Diagramdata.TypeKeys "<TAB>", true
        '/// Set the text in the marked field to '333'. Then move to the next field by pressing 'TAB'. ///'
        printlog "   Set the text in the marked field to '333'. Then move back to the first field by pressing 'SHIFT TAB' twice."
        Tables.TypeKeys "333", true
        'Do one more TAB, then three DOWNs, and check that the SwapColumn and SwapRow Icons are disabled.
        Tables.TypeKeys "<TAB>", true
        Tables.TypeKeys "<DOWN>", 3, true
        if SwapColumns.isEnabled then 
            warnlog "   SwapColumns was enabled, but should have been disabled."
        else
            printlog "   SwapColumns was correctly disabled."
        end if
        if SwapRows.isEnabled then 
            warnlog "   SwapRows should have been disabled, but was enabled."
        else
            printlog "   SwapRows was correctly disabled."
        end if
        '/// Return to the upper left corner.
        printlog "Return to the upper left corner."
        Tables.TypeKeys "<SHIFT TAB>", 3, true
        Tables.TypeKeys "<UP>", 3, true
        '/// Click the button 'Insert Row'.
        printlog "   Click the button 'Insert Row'."
        InsertRow.Click
        '/// Click the second button of the six in the upper left corner: Insert Column 
        printlog "   Click the button 'Insert Column'."
        InsertColumn.Click
        '/// Check if a new Column got inserted. And if it's unnamed.
        Tables.TypeKeys "<TAB>", true
        Tables.TypeKeys "<MOD1 C>", true
        if GetClipboard <> "" then 
            warnlog "   Inserting a new column in the DataTable didn't seem to work."
        endif
        Diagramdata.TypeKeys "<TAB>", 5, true
        if DataSeriesLabel.GetText <> "" then 
            warnlog "   Error when inserting a new Column: the Label for the Column doesn't appear to be clear. Was:" +DataSeriesLabel.GetText
        endif
        Tables.TypeKeys "<TAB>", true
        '/// Click the third button of the six in the upper left corner: 'Delete Row'.  ///'
        printlog "   Click the button 'Delete Row'."
        DeleteRow.Click
        Tables.TypeKeys "<SHIFT TAB>", true
        Tables.TypeKeys "<MOD1 C>", true
        if GetClipboard <> "" then
            warnlog "   Inserting a new column in the DataTable didn't seem to work."
        endif
        '/// Press 'TAB' three times to enter the column we wish to delete. ///'
        printlog "   Press 'TAB' three times to enter the column we wish to delete."
        Tables.TypeKeys "<TAB>", 3, true
        '/// Click the button 'Delete Column'.
        printlog "   Click the button 'Delete Column'."
        DeleteColumn.Click
        '/// Check if the Column got deleted.
        printlog "   Check if the Column got deleted."
        Tables.TypeKeys "<TAB>", 2, true
        Tables.TypeKeys "<MOD1 C>", true
        if GetClipboard <> "" then 
            warnlog "   Error when deleting a Column."
        end if
        Tables.TypeKeys "<SHIFT TAB>", 3, true
        Tables.TypeKeys "<MOD1 C>", true
        if GetClipboard = "2,4" OR GetClipboard = "2.4" then 
            printlog "   DeleteColumn worked as expected."                                
        else
            warnlog "   Error when deleting a Column."
        end if
        '/// Click the button 'Swap Columns'.
        printlog "   Click the button 'Swap Columns'."
        SwapColumns.Click
        Tables.TypeKeys "<SHIFT TAB>", true
        Tables.TypeKeys "<MOD1 C>", true
        if GetClipboard = "8,8" OR GetClipboard = "8.8" then 
            printlog "   SwapColumns worked as expected."
        else
            warnlog "   Error when Swapping a Column."
        end if
        '/// Click the button 'Swap Rows'.
        printlog "   Click the button 'Swap Rows'."
        SwapRows.Click
        '/// Check the result
        Tables.TypeKeys "<SHIFT TAB>", 4, true
        Tables.TypeKeys "<MOD1 C>", true
        if GetClipboard = "1,5" OR GetClipboard = "1.5" then 
            printlog "   SwapRows worked as expected."
        else
            warnlog "   Error when Swapping a Row."
        end if
        '/// Close the dialogue
        printlog "   Close the dialogue."
        Diagramdata.Close
        '/// End of test. Close the document.
        printlog "   End of test. Closing the document."
    Call hCloseDocument
endcase
'
'---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
'
testcase tChartDataDialogueFieldsUndo
    printlog "   tChartDataDialogueFieldsUndo starts"   
    Call hNewDocument
        Kontext "DocumentImpress"
        '/// Insert a new Chart-object, via the Menu: 'Insert - Chart'.
        printlog "   Insert a new Chart-object, via the Menu: 'Insert - Chart'."
        InsertChart
        WaitSlot()
        '/// Press 'TAB' once to select the object
        printlog "   Press 'TAB' once to select the object."
        DocumentImpress.TypeKeys "<TAB>"
        '/// Click the button 'RETURN' / 'ENTER' to enter the Chart-Data-dialogue
        printlog "   Click the button 'Return', to enter the Chart-Data-dialogue."
        DocumentImpress.TypeKeys "<RETURN>"
        Kontext "DocumentChart"
        '/// Open context menu
        printlog "Open context menu"
        DocumentChart.OpenContextMenu
        '/// Select third entry
        printlog "Select third entry"
        hMenuSelectNr (6)
        sleep (1)
        Kontext "Diagramdata"
        call DialogTest ( Diagramdata )
        '/// Check if the dialogue came up.
        printlog "Check if the dialogue came up."
        if Diagramdata.Exists then 
            printlog "   Diagramdata came up just as expected."
        else
            warnlog "   Diagramdata didnt come up as expected. Please contact the test-administrator."
            call hCloseDocument
            goto endsub
        end if
        '/// Type the word 'Great' in the Label-textfield (for the Column).
        printlog "   Typing the word 'Great' in the Label-textfield (for the Column), and checking that it remained changed after leaving the field."
        DataSeriesLabel.SetText "Great"
        '/// Press 'TAB', followed by 'SHIFT TAB'. To jump from and back to the field. (and deselect and select it again).
        printlog "   Press 'TAB', followed by 'SHIFT TAB'. To jump from and back to the field. (and deselect and select it again)"
        Diagramdata.TypeKeys "<TAB>"
        Diagramdata.TypeKeys "<SHIFT TAB>"
        '/// Compare the written text with what the field now contains.
        printlog "   Compare the written text with what the field now contains."
        if DataSeriesLabel.GetText <> "Great" then 
            warnlog "   The field 'DataSeriesLabel' didn't get set. Should be 'Great', but was '" + DataSeriesLabel.GetText + "'."
        endif                                    
        '/// Inside the Tables: Press the 'TAB'-key seven times.
        printlog "   Inside the Tables: Press the 'TAB'-key seven times."
        Tables.TypeKeys "<TAB>", 7
        '/// Inside the Tables: Check if you can type the numbers '774433', followed by 'TAB', and '774411'.
        printlog "   Inside the Tables: Check if you can type the numbers '774433', followed by 'TAB', and '774411'."
        try
            Tables.TypeKeys "774433", true
            Tables.TypeKeys "<TAB>", true
            Tables.TypeKeys "774411", true
            Tables.TypeKeys "<SHIFT TAB>", true
            Tables.TypeKeys "<MOD1 C>", true
            if GetClipboard <> "774433" then 
                warnlog "   Writing the value '774433' in the DataTable didn't seem to work."
            endif
            Tables.TypeKeys "<TAB>", true
            Tables.TypeKeys "<MOD1 C>", true
            if GetClipboard <> "774411" then 
                warnlog "   Writing the value '774411' in the DataTable didn't seem to work."
            endif
        catch
            warnlog "   Either we're not at the right position, or the Table-fields doesn't become editable onto selection."
        endcatch
        '/// Close the dialogue
        printlog "   Close the dialogue."
        Diagramdata.Close
        '/// Try if we can Undo the changes with 'Edit - Undo'.
        printlog "Try if we can Undo the changes with 'Edit - Undo'."
        Kontext "DocumentImpress"
        DatabaseUndo
        '/// And then we enter the dialogue again, to check if the values has returned to what they were before we changed them.
        printlog "And then we enter the dialogue again, to check if the values has returned to what they were before we changed them."
        '/// One press on 'TAB' to select the object ///'
        printlog "   Click the button 'TAB', to select the object."
        DocumentImpress.TypeKeys "<TAB>"
        '/// Followed by one press on "RETURN" / "ENTER" to enter the Chart-Data-dialogue  ///'
        printlog "   Click the button 'Return', to enter the Chart-Data-dialogue."
        DocumentImpress.TypeKeys "<RETURN>"
        Kontext "DocumentChart"
        '/// Open context menu
        printlog "Open context menu"        
        DocumentChart.OpenContextMenu
        '/// Select third entry
        printlog "Select third entry"
        hMenuSelectNr (6)        
        sleep (1)
        Kontext "Diagramdata"
        '/// Inside the Tables: Press the 'TAB'-key 14 times.
        printlog "   Inside the Tables: Press the 'TAB'-key 14 times."
        Tables.TypeKeys "<TAB>", 14
        '/// Inside the Tables: Check if the values has returned to what they were before changing them.
        printlog "   Inside the Tables: Check if the values has returned to what they were before changing them."
        Tables.TypeKeys "<MOD1 C>", true
        if GetClipboard <> "774433" then
            if GetClipboard = "9,02" OR GetClipboard = "9.02" then
                printlog "   Edit-Undo worked fine."
            else
                warnlog "   Edit-Undo didn't seem to work on the values in the Dialogue."
            end if
        else
            warnlog "   Edit-Undo didn't work on the values in the Dialogue."
        end if
        '/// Check if the Label we earlier named 'Great', now has changed back.
        printlog "   Check if the Label we earlier named 'Great', now has changed back."
        if DataSeriesLabel.GetText = "Great" then 
            warnlog "   The field 'DataSeriesLabel' didn't change back."
        endif
        '/// Close the dialogue
        printlog "   Close the dialogue."
        Diagramdata.Close
        '/// End of test. Close the document.
        printlog "   End of test. Closing the document."
    Call hCloseDocument
endcase