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: Table.inc,v $
13 '* last change: $Author: obo $ $Date: 2008-07-22 12:35:10 $
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 : marc.neumann@sun.com
36 '* short description : test the Main Table Application Window
38 '************************************************************************
57 '\***********************************************************************************
60 printlog "------------------ Table.inc ---------------------"
62 printlog "-------------------- main menu -------------------------"
65 printlog "--------------------- toolbar --------------------------"
83 '-------------------------------------------------------------------------
87 printlog "open a new table"
90 '/// click on the search button
91 printlog "click on the search button"
95 '/// check if the search dialog appear
96 printlog "check if the search dialog appear"
97 Kontext "RecordSearch"
98 if RecordSearch.Exists(3) then
99 '/// close the search dialog
100 printlog "close the search dialog"
104 warnlog "The search dialog doesn't appear"
108 '/// close the table and the database
109 printlog "close the table and the database"
114 '-------------------------------------------------------------------------
115 testcase tSortAscending
117 '/// open a new table
118 printlog "open a new table"
121 '/// click on the search button
122 printlog "click on the search button"
127 '/// close the table and the database
128 printlog "close the table and the database"
133 '-------------------------------------------------------------------------
134 testcase tSortDescending
136 '/// open a new table
137 printlog "open a new table"
140 '/// click on the search button
141 printlog "click on the search button"
146 '/// close the table and the database
147 printlog "close the table and the database"
152 '-------------------------------------------------------------------------
155 '/// open a new table
156 printlog "open a new table"
159 '/// click on the auto filter button
160 printlog "click on the auto filter button"
165 '/// close the table and the database
166 printlog "close the table and the database"
171 '-------------------------------------------------------------------------
172 testcase tDefaultFilter
174 '/// open a new table
175 printlog "open a new table"
178 '/// click on the DefaultFilter button
179 printlog "click on the DefaultFilter button"
183 '/// check if the default filter dialog appear
184 printlog "check if the default filter dialog appear"
185 Kontext "FilterDialog"
186 if FilterDialog.Exists(2) then
189 warnlog "The filter dialog doesn't appear"
192 '/// close the table and the database
193 printlog "close the table and the database"
198 '-------------------------------------------------------------------------
201 '/// open a new table
202 printlog "open a new table"
205 '/// click on the sort order button
206 printlog "click on the sort order button"
210 '/// check if the sort order dialog appear
211 printlog "check if the sort order dialog appear"
213 if SortOrder.Exists(2) then
216 warnlog "The sort order dialog doesn't appear"
219 '/// close the table and the database
220 printlog "close the table and the database"
225 '-------------------------------------------------------------------------
226 testcase tRemoveFilter
228 '/// open a new table
229 printlog "open a new table"
232 '/// click on the remove filter button
233 printlog "click on the remove filter button"
237 if RemoveFilter.isenabled then
240 warnlog "The remove filter icon isn't activ"
242 '/// close the table and the database
243 printlog "close the table and the database"
248 '-------------------------------------------------------------------------
249 testcase tApplyFilter
251 '/// open a new table
252 printlog "open a new table"
255 '/// click on the applay filter button
256 printlog "click on the apply filter button"
260 if ApplyFilter.isenabled then
263 warnlog "The apply filter icon isn't activ"
265 '/// close the table and the database
266 printlog "close the table and the database"
271 '-------------------------------------------------------------------------
274 '/// open a new table
275 printlog "open a new table"
278 '/// click on the applay filter button
279 printlog "click on the apply filter button"
283 '/// close the table and the database
284 printlog "close the table and the database"
289 '-------------------------------------------------------------------------
292 '/// open a new table
293 printlog "open a new table"
296 '/// click on the applay filter button
297 printlog "click on the apply filter button"
301 '/// close the table and the database
302 printlog "close the table and the database"
307 '-------------------------------------------------------------------------
310 '/// open a new table
311 printlog "open a new table"
315 printlog "change a record"
317 TableView.TypeKeys "hello" , true
319 '/// check if the save button is active
320 '/// but do not click on it
321 printlog "check if the save button is active"
322 printlog "but do not click on it"
324 if not RecSave.isEnabled then
325 warnlog "the save button is not enabled."
332 '-------------------------------------------------------------------------
336 printlog "open a table"
340 '/// click on the cut button
341 printlog "click on the cut button"
346 '/// check if the text is in the clipboard
347 printlog "check if the text is in the clipboard"
348 if getClipboard <> "GUR00" then
349 warnlog "The Cut button doesn't work"
352 '/// check if the cut icon is disabled
354 if Cut.isEnabled then
355 warnlog "The CUT icon is enabled, but I have nothing selected"
359 '/// close the table and the database
360 printlog "close the table and the database"
365 '-------------------------------------------------------------------------
369 printlog "open a table"
373 '/// click on the copy button
374 printlog "click on the copy button"
379 '/// check if the text is in the clipboard
380 printlog "check if the text is in the clipboard"
381 if getClipboard <> "GUR00" then
382 warnlog "The Cut button doesn't work"
385 '/// close the table and the database
386 printlog "close the table and the database"
392 '-------------------------------------------------------------------------
396 printlog "opene new table"
399 '/// set a string to the clipboard
400 printlog "set a string to the clipboard"
403 '/// press the cursor left key
404 printlog "press the cursor left key"
406 TableView.TypeKeys "<LEFT>" , true
408 '/// paste the text from the clipbaord
409 printlog "paste the text from the clipbaord"
413 '/// check if the text is pasted to the fieldname
414 printlog "check if the text is pasted to the fieldname"
416 TableView.TypeKeys "<HOME>" , true
418 TableView.TypeKeys "<SHIFT END>" , true
420 '/// click the copy icon
421 printlog "click the copy icon"
425 if getClipboard <> "wordGUR00" then
426 warnlog "the paste button doesn't work"
428 '/// close the table design and the database
429 printlog "close the table design and the database"
434 '-------------------------------------------------------------------------
438 printlog "open a table"
441 '/// set a string to the clipboard
442 printlog "set a string to the clipboard"
445 '/// press the cursor left key
446 printlog "press the cursor left key"
448 TableView.TypeKeys "<LEFT>" , true
450 '/// paste the text from the clipbaord
451 printlog "paste the text from the clipbaord"
455 '/// check if the text is pasted to the fieldname
456 printlog "check if the text is pasted to the fieldname"
458 TableView.TypeKeys "<HOME>" , true
460 TableView.TypeKeys "<SHIFT END>" , true
462 '/// click the copy icon
463 printlog "click the copy icon"
467 if getClipboard <> "wordGUR00" then
468 warnlog "the paste button doesn't work"
472 '/// click the undo icon
473 printlog "click the undo icon"
478 '/// click the copy icon
482 if getClipboard <> "GUR00" then
483 warnlog "the undo button doesn't work"
486 '/// close the table design and the database
487 printlog "close the table design and the database"
492 '-------------------------------------------------------------------------
493 '-------------------------------------------------------------------------
494 testcase tMainMenuBar
496 dim iCount as integer ' the numbers of the items in the menu.
503 '/// check if there are between 8 and 12 items in the file menu.
504 printlog "check if there are between 8 and 12 items in the file menu."
505 '/// + there different count related to the file pick list.
506 printlog "+ there different count related to the file pick list."
507 hMenuSelectNr(1) ' the file menu
508 iCount = getMenuItemCount()
509 if ( lcase( gPlatform ) = "osx" ) then
510 if ( iCount <> 7 ) then
511 warnlog( "File menu: 8 items expected, found " & iCount )
514 if (iCount <> 8 ) then
515 warnlog "There should between 8 and 12 items in the file menu but there are " + iCount + " items."
519 '/// check if there are 12 items in the FILE/NEW menu.
520 printlog "check if there are 12 items in the FILE/NEW menu."
521 printlog "check the FILE/NEW"
522 hMenuSelectNr(1) ' FILE/NEW menu
523 iCount = hMenuItemGetCount()
524 if (iCount <> 12) then
525 warnlog "There should 12 items in the FILE/NEW menu but there are " + iCount + " items."
527 call hMenuClose() ' close the FILE menu
529 '/// check the FILE/AUTOPILOTS
530 printlog "check the FILE/AUTOPILOTS"
532 hMenuSelectNr(1) ' the file menu
533 hMenuSelectNr(3) ' the autopilots menu
534 iCount = hMenuItemGetCount()
535 if (iCount <> 8) then
536 warnlog "There should 8 items in the FILE/AUTOPILOTS menu but there are " + iCount + " items."
540 '/// check if there are 8 items in the edit menu.
541 printlog "check if there are 8 items in the edit menu."
544 iCount = hMenuItemGetCount()
545 if (iCount <> 8) then
546 warnlog "There should 8 items in the edit menu but there are " + iCount + " items."
550 '/// check if there are 2 items in the view menu.
551 printlog "check if there are 2 items in the view menu."
554 iCount = hMenuItemGetCount()
555 if (iCount <> 2) then
556 warnlog "There should 2 items in the view menu but there are " + iCount + " items."
560 '/// check if there are 4 items in the tools menu.
561 printlog "check if there are 4 items in the tools menu."
564 iCount = hMenuItemGetCount()
565 if ( lcase( gPlatform ) = "osx" ) then
566 if ( iCount <> 3 ) then
567 warnlog( "Tools menu: 3 items expected, found " & iCount )
570 if (iCount <> 4) then
571 warnlog "There should 4 items in the tools menu but there are " + iCount + " items."
576 '/// check if there are 4 items in the TOOLS/MACRO menu.
577 printlog "check if there are 4 items in the TOOLS/MACRO menu."
581 iCount = hMenuItemGetCount()
582 if (iCount <> 4) then
583 warnlog "There should 4 items in the TOOLS/MACRO menu but there are " + iCount + " items."
592 '-------------------------------------------------------------------------
593 '-------------------------------------------------------------------------
594 '-------------------------------------------------------------------------
595 function getMenuItemCount as Integer
596 'use this function becasue this doesn't count the pick list
597 Dim i, j, Ende, nID as Integer
600 for i=1 to MenuGetItemCount
601 if NOT MenuIsSeperator ( i ) then
603 s = Mid(MenuGetItemText( MenuGetItemID(i)),3,1)
605 'printlog "MenuGetItemText( MenuGetItemID(i)) = " + MenuGetItemText( MenuGetItemID(i))
613 '-------------------------------------------------------------------------
617 hFileOpen( gOfficePath & "user/database/biblio.odb" )
621 Insight.MouseDown(50,50)
622 Insight.MouseUp(50,50)
628 Kontext "ContainerView"