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 warnlog "#102712# AutoFilter does not work"
158 '/// open a new table
159 printlog "open a new table"
162 '/// click on the auto filter button
163 printlog "click on the auto filter button"
168 '/// close the table and the database
169 printlog "close the table and the database"
174 '-------------------------------------------------------------------------
175 testcase tDefaultFilter
177 '/// open a new table
178 printlog "open a new table"
181 '/// click on the DefaultFilter button
182 printlog "click on the DefaultFilter button"
186 '/// check if the default filter dialog appear
187 printlog "check if the default filter dialog appear"
188 Kontext "FilterDialog"
189 if FilterDialog.Exists(2) then
192 warnlog "The filter dialog doesn't appear"
195 '/// close the table and the database
196 printlog "close the table and the database"
201 '-------------------------------------------------------------------------
204 '/// open a new table
205 printlog "open a new table"
208 '/// click on the sort order button
209 printlog "click on the sort order button"
213 '/// check if the sort order dialog appear
214 printlog "check if the sort order dialog appear"
216 if SortOrder.Exists(2) then
219 warnlog "The sort order dialog doesn't appear"
222 '/// close the table and the database
223 printlog "close the table and the database"
228 '-------------------------------------------------------------------------
229 testcase tRemoveFilter
231 warnlog "#102712# AutoFilter does not work"
234 '/// open a new table
235 printlog "open a new table"
238 '/// click on the remove filter button
239 printlog "click on the remove filter button"
243 if RemoveFilter.isenabled then
246 warnlog "The remove filter icon isn't activ"
248 '/// close the table and the database
249 printlog "close the table and the database"
254 '-------------------------------------------------------------------------
255 testcase tApplyFilter
257 warnlog "#102712# AutoFilter does not work"
260 '/// open a new table
261 printlog "open a new table"
264 '/// click on the applay filter button
265 printlog "click on the apply filter button"
269 if ApplyFilter.isenabled then
272 warnlog "The apply filter icon isn't activ"
274 '/// close the table and the database
275 printlog "close the table and the database"
280 '-------------------------------------------------------------------------
283 '/// open a new table
284 printlog "open a new table"
287 '/// click on the applay filter button
288 printlog "click on the apply filter button"
292 '/// close the table and the database
293 printlog "close the table and the database"
298 '-------------------------------------------------------------------------
301 '/// open a new table
302 printlog "open a new table"
305 '/// click on the applay filter button
306 printlog "click on the apply filter button"
310 '/// close the table and the database
311 printlog "close the table and the database"
316 '-------------------------------------------------------------------------
319 '/// open a new table
320 printlog "open a new table"
324 printlog "change a record"
326 TableView.TypeKeys "hello" , true
328 '/// check if the save button is active
329 '/// but do not click on it
330 printlog "check if the save button is active"
331 printlog "but do not click on it"
333 if not RecSave.isEnabled then
334 warnlog "the save button is not enabled."
341 '-------------------------------------------------------------------------
345 printlog "open a table"
349 '/// click on the cut button
350 printlog "click on the cut button"
355 '/// check if the text is in the clipboard
356 printlog "check if the text is in the clipboard"
357 if getClipboard <> "GUR00" then
358 warnlog "The Cut button doesn't work"
361 '/// check if the cut icon is disabled
363 if Cut.isEnabled then
364 warnlog "The CUT icon is enabled, but I have nothing selected"
368 '/// close the table and the database
369 printlog "close the table and the database"
374 '-------------------------------------------------------------------------
378 printlog "open a table"
382 '/// click on the copy button
383 printlog "click on the copy button"
388 '/// check if the text is in the clipboard
389 printlog "check if the text is in the clipboard"
390 if getClipboard <> "GUR00" then
391 warnlog "The Cut button doesn't work"
394 '/// close the table and the database
395 printlog "close the table and the database"
401 '-------------------------------------------------------------------------
405 printlog "opene new table"
408 '/// set a string to the clipboard
409 printlog "set a string to the clipboard"
412 '/// press the cursor left key
413 printlog "press the cursor left key"
415 TableView.TypeKeys "<LEFT>" , true
417 '/// paste the text from the clipbaord
418 printlog "paste the text from the clipbaord"
422 '/// check if the text is pasted to the fieldname
423 printlog "check if the text is pasted to the fieldname"
425 TableView.TypeKeys "<HOME>" , true
427 TableView.TypeKeys "<SHIFT END>" , true
429 '/// click the copy icon
430 printlog "click the copy icon"
434 if getClipboard <> "wordGUR00" then
435 warnlog "the paste button doesn't work"
437 '/// close the table design and the database
438 printlog "close the table design and the database"
443 '-------------------------------------------------------------------------
447 printlog "open a table"
450 '/// set a string to the clipboard
451 printlog "set a string to the clipboard"
454 '/// press the cursor left key
455 printlog "press the cursor left key"
457 TableView.TypeKeys "<LEFT>" , true
459 '/// paste the text from the clipbaord
460 printlog "paste the text from the clipbaord"
464 '/// check if the text is pasted to the fieldname
465 printlog "check if the text is pasted to the fieldname"
467 TableView.TypeKeys "<HOME>" , true
469 TableView.TypeKeys "<SHIFT END>" , true
471 '/// click the copy icon
472 printlog "click the copy icon"
476 if getClipboard <> "wordGUR00" then
477 warnlog "the paste button doesn't work"
481 '/// click the undo icon
482 printlog "click the undo icon"
487 '/// click the copy icon
491 if getClipboard <> "GUR00" then
492 warnlog "the undo button doesn't work"
495 '/// close the table design and the database
496 printlog "close the table design and the database"
501 '-------------------------------------------------------------------------
502 '-------------------------------------------------------------------------
503 testcase tMainMenuBar
505 dim iCount as integer ' the numbers of the items in the menu.
512 '/// check if there are between 8 and 12 items in the file menu.
513 printlog "check if there are between 8 and 12 items in the file menu."
514 '/// + there different count related to the file pick list.
515 printlog "+ there different count related to the file pick list."
516 hMenuSelectNr(1) ' the file menu
517 iCount = getMenuItemCount()
518 if ( lcase( gPlatform ) = "osx" ) then
519 if ( iCount <> 7 ) then
520 warnlog( "File menu: 8 items expected, found " & iCount )
523 if (iCount <> 8 ) then
524 warnlog "There should between 8 and 12 items in the file menu but there are " + iCount + " items."
528 '/// check if there are 12 items in the FILE/NEW menu.
529 printlog "check if there are 12 items in the FILE/NEW menu."
530 printlog "check the FILE/NEW"
531 hMenuSelectNr(1) ' FILE/NEW menu
532 iCount = hMenuItemGetCount()
533 if (iCount <> 12) then
534 warnlog "There should 12 items in the FILE/NEW menu but there are " + iCount + " items."
536 call hMenuClose() ' close the FILE menu
538 '/// check the FILE/AUTOPILOTS
539 printlog "check the FILE/AUTOPILOTS"
541 hMenuSelectNr(1) ' the file menu
542 hMenuSelectNr(3) ' the autopilots menu
543 iCount = hMenuItemGetCount()
544 if (iCount <> 8) then
545 warnlog "There should 8 items in the FILE/AUTOPILOTS menu but there are " + iCount + " items."
549 '/// check if there are 8 items in the edit menu.
550 printlog "check if there are 8 items in the edit menu."
553 iCount = hMenuItemGetCount()
554 if (iCount <> 8) then
555 warnlog "There should 8 items in the edit menu but there are " + iCount + " items."
559 '/// check if there are 2 items in the view menu.
560 printlog "check if there are 2 items in the view menu."
563 iCount = hMenuItemGetCount()
564 if (iCount <> 2) then
565 warnlog "There should 2 items in the view menu but there are " + iCount + " items."
569 '/// check if there are 4 items in the tools menu.
570 printlog "check if there are 4 items in the tools menu."
573 iCount = hMenuItemGetCount()
574 if ( lcase( gPlatform ) = "osx" ) then
575 if ( iCount <> 3 ) then
576 warnlog( "Tools menu: 3 items expected, found " & iCount )
579 if (iCount <> 4) then
580 warnlog "There should 4 items in the tools menu but there are " + iCount + " items."
585 '/// check if there are 4 items in the TOOLS/MACRO menu.
586 printlog "check if there are 4 items in the TOOLS/MACRO menu."
590 iCount = hMenuItemGetCount()
591 if (iCount <> 4) then
592 warnlog "There should 4 items in the TOOLS/MACRO menu but there are " + iCount + " items."
601 '-------------------------------------------------------------------------
602 '-------------------------------------------------------------------------
603 '-------------------------------------------------------------------------
604 function getMenuItemCount as Integer
605 'use this function becasue this doesn't count the pick list
606 Dim i, j, Ende, nID as Integer
609 for i=1 to MenuGetItemCount
610 if NOT MenuIsSeperator ( i ) then
612 s = Mid(MenuGetItemText( MenuGetItemID(i)),3,1)
614 'printlog "MenuGetItemText( MenuGetItemID(i)) = " + MenuGetItemText( MenuGetItemID(i))
622 '-------------------------------------------------------------------------
626 hFileOpen( gOfficePath & "user/database/biblio.odb" )
630 Database.MouseDown(50,50)
631 Database.MouseUp(50,50)
637 Kontext "ContainerView"