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
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
|
'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 : marc.neumann@sun.com
'*
'* short description : test the Main Table Application Window
'*
'************************************************************************
'*
' #1 tMainMenuBar
' #1 tSearch
' #1 tSortAscending
' #1 tSortDescending
' #1 tAutoFilter
' #1 tDefaultFilter
' #1 tSortOrder
' #1 tRemoveFilter
' #1 tApplyFilter
' #1 tRefresh
' #1 tEdit
' #1 tCut
' #1 tCopy
' #1 tPaste
' #1 tUndo
' #1 tSave
'*
'\***********************************************************************************
sub Table
printlog "------------------ Table.inc ---------------------"
printlog "-------------------- main menu -------------------------"
call tMainMenuBar
printlog "--------------------- toolbar --------------------------"
call tSearch
call tSortAscending
call tSortDescending
call tAutoFilter
call tDefaultFilter
call tSortOrder
call tRemoveFilter
call tApplyFilter
call tRefresh
call tEdit
call tCut
call tCopy
call tPaste
call tUndo
call tSave
end sub
'-------------------------------------------------------------------------
testcase tSearch
'/// open a new table
printlog "open a new table"
initTable
sleep(1)
'/// click on the search button
printlog "click on the search button"
Kontext "Toolbar"
RecSearch.Click
sleep(1)
'/// check if the search dialog appear
printlog "check if the search dialog appear"
Kontext "RecordSearch"
if RecordSearch.Exists(3) then
'/// close the search dialog
printlog "close the search dialog"
CloseBtn.click
sleep(2)
else
warnlog "The search dialog doesn't appear"
end if
'/// close the table and the database
printlog "close the table and the database"
call fCloseTableView
call fCloseDatabase
endcase
'-------------------------------------------------------------------------
testcase tSortAscending
'/// open a new table
printlog "open a new table"
initTable
sleep(1)
'/// click on the search button
printlog "click on the search button"
Kontext "Toolbar"
SortAscending.Click
sleep(1)
'/// close the table and the database
printlog "close the table and the database"
call fCloseTableView
call fCloseDatabase
endcase
'-------------------------------------------------------------------------
testcase tSortDescending
'/// open a new table
printlog "open a new table"
initTable
sleep(1)
'/// click on the search button
printlog "click on the search button"
Kontext "Toolbar"
SortDescending.Click
sleep(1)
'/// close the table and the database
printlog "close the table and the database"
call fCloseTableView
call fCloseDatabase
endcase
'-------------------------------------------------------------------------
testcase tAutoFilter
'/// open a new table
printlog "open a new table"
initTable
sleep(1)
'/// click on the auto filter button
printlog "click on the auto filter button"
Kontext "Toolbar"
DBAutoFilter.Click
sleep(1)
'/// close the table and the database
printlog "close the table and the database"
call fCloseTableView
call fCloseDatabase
endcase
'-------------------------------------------------------------------------
testcase tDefaultFilter
'/// open a new table
printlog "open a new table"
initTable
sleep(1)
'/// click on the DefaultFilter button
printlog "click on the DefaultFilter button"
Kontext "Toolbar"
DefaultFilter.Click
sleep(1)
'/// check if the default filter dialog appear
printlog "check if the default filter dialog appear"
Kontext "FilterDialog"
if FilterDialog.Exists(2) then
FilterDialog.Cancel
else
warnlog "The filter dialog doesn't appear"
end if
'/// close the table and the database
printlog "close the table and the database"
call fCloseTableView
call fCloseDatabase
endcase
'-------------------------------------------------------------------------
testcase tSortOrder
'/// open a new table
printlog "open a new table"
initTable
sleep(1)
'/// click on the sort order button
printlog "click on the sort order button"
Kontext "Toolbar"
SortOrder.Click
sleep(1)
'/// check if the sort order dialog appear
printlog "check if the sort order dialog appear"
Kontext "SortOrder"
if SortOrder.Exists(2) then
SortOrder.Cancel
else
warnlog "The sort order dialog doesn't appear"
end if
'/// close the table and the database
printlog "close the table and the database"
call fCloseTableView
call fCloseDatabase
endcase
'-------------------------------------------------------------------------
testcase tRemoveFilter
'/// open a new table
printlog "open a new table"
initTable
sleep(1)
'/// click on the remove filter button
printlog "click on the remove filter button"
Kontext "Toolbar"
DBAutoFilter.Click
sleep(1)
if RemoveFilter.isenabled then
RemoveFilter.Click
else
warnlog "The remove filter icon isn't activ"
end if
'/// close the table and the database
printlog "close the table and the database"
call fCloseTableView
call fCloseDatabase
endcase
'-------------------------------------------------------------------------
testcase tApplyFilter
'/// open a new table
printlog "open a new table"
initTable
sleep(1)
'/// click on the applay filter button
printlog "click on the apply filter button"
Kontext "Toolbar"
DBAutoFilter.Click
sleep(1)
if ApplyFilter.isenabled then
ApplyFilter.Click
else
warnlog "The apply filter icon isn't activ"
end if
'/// close the table and the database
printlog "close the table and the database"
call fCloseTableView
call fCloseDatabase
endcase
'-------------------------------------------------------------------------
testcase tRefresh
'/// open a new table
printlog "open a new table"
initTable
sleep(1)
'/// click on the applay filter button
printlog "click on the apply filter button"
Kontext "Toolbar"
Refresh.Click
sleep(1)
'/// close the table and the database
printlog "close the table and the database"
call fCloseTableView
call fCloseDatabase
endcase
'-------------------------------------------------------------------------
testcase tEdit
'/// open a new table
printlog "open a new table"
initTable
sleep(1)
'/// click on the applay filter button
printlog "click on the apply filter button"
Kontext "Toolbar"
DBEditDoc.Click
sleep(1)
'/// close the table and the database
printlog "close the table and the database"
call fCloseTableView
call fCloseDatabase
endcase
'-------------------------------------------------------------------------
testcase tSave
'/// open a new table
printlog "open a new table"
initTable
sleep(1)
'/// change a record
printlog "change a record"
Kontext "TableView"
TableView.TypeKeys "hello" , true
sleep(1)
'/// check if the save button is active
'/// but do not click on it
printlog "check if the save button is active"
printlog "but do not click on it"
Kontext "Toolbar"
if not RecSave.isEnabled then
warnlog "the save button is not enabled."
endif
sleep(1)
call fCloseTableView
call fCloseDatabase
endcase
'-------------------------------------------------------------------------
testcase tCut
'/// open a table
printlog "open a table"
initTable
sleep(1)
'/// click on the cut button
printlog "click on the cut button"
Kontext "Toolbar"
Cut.Click
sleep(1)
'/// check if the text is in the clipboard
printlog "check if the text is in the clipboard"
if getClipboard <> "GUR00" then
warnlog "The Cut button doesn't work"
end if
'/// check if the cut icon is disabled
Kontext "Toolbar"
if Cut.isEnabled then
warnlog "The CUT icon is enabled, but I have nothing selected"
endif
sleep(1)
'/// close the table and the database
printlog "close the table and the database"
call fCloseTableView
call fCloseDatabase
endcase
'-------------------------------------------------------------------------
testcase tCopy
'/// open a table
printlog "open a table"
initTable
sleep(1)
'/// click on the copy button
printlog "click on the copy button"
Kontext "Toolbar"
Copy.Click
sleep(1)
'/// check if the text is in the clipboard
printlog "check if the text is in the clipboard"
if getClipboard <> "GUR00" then
warnlog "The Cut button doesn't work"
end if
'/// close the table and the database
printlog "close the table and the database"
call fCloseTableView
call fCloseDatabase
endcase
'-------------------------------------------------------------------------
testcase tPaste
'/// opene new table
printlog "opene new table"
initTable
'/// set a string to the clipboard
printlog "set a string to the clipboard"
setClipboard "word"
'/// press the cursor left key
printlog "press the cursor left key"
Kontext "TableView"
TableView.TypeKeys "<LEFT>" , true
sleep(1)
'/// paste the text from the clipbaord
printlog "paste the text from the clipbaord"
Kontext "Toolbar"
Paste.Click
sleep(1)
'/// check if the text is pasted to the fieldname
printlog "check if the text is pasted to the fieldname"
Kontext "TableView"
TableView.TypeKeys "<HOME>" , true
sleep(1)
TableView.TypeKeys "<SHIFT END>" , true
sleep(1)
'/// click the copy icon
printlog "click the copy icon"
Kontext "Toolbar"
Copy.Click
sleep(1)
if getClipboard <> "wordGUR00" then
warnlog "the paste button doesn't work"
end if
'/// close the table design and the database
printlog "close the table design and the database"
call fCloseTableView
call fCloseDatabase
endcase
'-------------------------------------------------------------------------
testcase tUndo
'/// open a table
printlog "open a table"
initTable
'/// set a string to the clipboard
printlog "set a string to the clipboard"
setClipboard "word"
'/// press the cursor left key
printlog "press the cursor left key"
Kontext "TableView"
TableView.TypeKeys "<LEFT>" , true
sleep(1)
'/// paste the text from the clipbaord
printlog "paste the text from the clipbaord"
Kontext "Toolbar"
Paste.Click
sleep(1)
'/// check if the text is pasted to the fieldname
printlog "check if the text is pasted to the fieldname"
Kontext "TableView"
TableView.TypeKeys "<HOME>" , true
sleep(1)
TableView.TypeKeys "<SHIFT END>" , true
sleep(1)
'/// click the copy icon
printlog "click the copy icon"
Kontext "Toolbar"
Copy.Click
sleep(1)
if getClipboard <> "wordGUR00" then
warnlog "the paste button doesn't work"
end if
'/// click the undo icon
printlog "click the undo icon"
Kontext "Toolbar"
RecUndo.Click
sleep(1)
'/// click the copy icon
Kontext "Toolbar"
Copy.Click
sleep(1)
if getClipboard <> "GUR00" then
warnlog "the undo button doesn't work"
end if
'/// close the table design and the database
printlog "close the table design and the database"
call fCloseTableView
call fCloseDatabase
endcase
'-------------------------------------------------------------------------
'-------------------------------------------------------------------------
testcase tMainMenuBar
dim iCount as integer ' the numbers of the items in the menu.
call initTable
Kontext "TableView"
TableView.UseMenu
'/// check if there are between 8 and 12 items in the file menu.
printlog "check if there are between 8 and 12 items in the file menu."
'/// + there different count related to the file pick list.
printlog "+ there different count related to the file pick list."
hMenuSelectNr(1) ' the file menu
iCount = getMenuItemCount()
if ( lcase( gPlatform ) = "osx" ) then
if ( iCount <> 7 ) then
warnlog( "File menu: 8 items expected, found " & iCount )
endif
else
if (iCount <> 8 ) then
warnlog "There should between 8 and 12 items in the file menu but there are " + iCount + " items."
end if
endif
'/// check if there are 12 items in the FILE/NEW menu.
printlog "check if there are 12 items in the FILE/NEW menu."
printlog "check the FILE/NEW"
hMenuSelectNr(1) ' FILE/NEW menu
iCount = hMenuItemGetCount()
if (iCount <> 12) then
warnlog "There should 12 items in the FILE/NEW menu but there are " + iCount + " items."
end if
call hMenuClose() ' close the FILE menu
'/// check the FILE/AUTOPILOTS
printlog "check the FILE/AUTOPILOTS"
TableView.UseMenu
hMenuSelectNr(1) ' the file menu
hMenuSelectNr(3) ' the autopilots menu
iCount = hMenuItemGetCount()
if (iCount <> 8) then
warnlog "There should 8 items in the FILE/AUTOPILOTS menu but there are " + iCount + " items."
endif
call hMenuClose()
'/// check if there are 8 items in the edit menu.
printlog "check if there are 8 items in the edit menu."
TableView.UseMenu
hMenuSelectNr(2)
iCount = hMenuItemGetCount()
if (iCount <> 8) then
warnlog "There should 8 items in the edit menu but there are " + iCount + " items."
end if
call hMenuClose()
'/// check if there are 2 items in the view menu.
printlog "check if there are 2 items in the view menu."
TableView.UseMenu
hMenuSelectNr(3)
iCount = hMenuItemGetCount()
if (iCount <> 2) then
warnlog "There should 2 items in the view menu but there are " + iCount + " items."
end if
call hMenuClose()
'/// check if there are 4 items in the tools menu.
printlog "check if there are 4 items in the tools menu."
TableView.UseMenu
hMenuSelectNr(5)
iCount = hMenuItemGetCount()
if ( lcase( gPlatform ) = "osx" ) then
if ( iCount <> 3 ) then
warnlog( "Tools menu: 3 items expected, found " & iCount )
endif
else
if (iCount <> 4) then
warnlog "There should 4 items in the tools menu but there are " + iCount + " items."
end if
endif
call hMenuClose()
'/// check if there are 4 items in the TOOLS/MACRO menu.
printlog "check if there are 4 items in the TOOLS/MACRO menu."
TableView.UseMenu
hMenuSelectNr(5)
hMenuSelectNr(1)
iCount = hMenuItemGetCount()
if (iCount <> 4) then
warnlog "There should 4 items in the TOOLS/MACRO menu but there are " + iCount + " items."
end if
call hMenuClose()
call fCloseTableView
call fCloseDatabase
endcase
'-------------------------------------------------------------------------
'-------------------------------------------------------------------------
'-------------------------------------------------------------------------
function getMenuItemCount as Integer
'use this function becasue this doesn't count the pick list
Dim i as Integer
Dim j as Integer
Dim Ende as Integer
Dim nID as Integer
Sleep 2
j=0
for i=1 to MenuGetItemCount
if NOT MenuIsSeperator ( i ) then
dim s as String
s = Mid(MenuGetItemText( MenuGetItemID(i)),3,1)
'printlog "s = " + s
'printlog "MenuGetItemText( MenuGetItemID(i)) = " + MenuGetItemText( MenuGetItemID(i))
if s <> ":" then
j=j+1
endif
endif
next i
getMenuItemCount = j
end function
'-------------------------------------------------------------------------
sub initTable
hFileOpen( gOfficePath & "user/database/biblio.odb" )
Kontext "DATABASE"
Database.MouseDown(50,50)
Database.MouseUp(50,50)
sleep(1)
ViewTables
Kontext "ContainerView"
TableTree.select 1
OpenTable
sleep(2)
end sub
|