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: MainApp.inc,v $
13 '* last change: $Author: obo $ $Date: 2008-07-22 12:34:32 $
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 Application Window
38 '************************************************************************
42 ' #1 tDatabaseProperties
46 ' #1 tRegisterDatabaseDialog
49 '\***********************************************************************************
52 printlog "------------------ MainApp.inc ---------------------"
56 call tDatabaseProperties
61 call tRegisterDatabaseDialog
65 '-------------------------------------------------------------------------
66 '-------------------------------------------------------------------------
67 '-------------------------------------------------------------------------
68 testcase tTableFilters
70 hFileOpen( gOfficePath & "user/database/biblio.odb" )
74 Database.MouseDown(50,50)
75 Database.MouseUp(50,50)
79 Kontext "TablesFilter"
88 '-------------------------------------------------------------------------
91 hFileOpen( gOfficePath & "user/database/biblio.odb" )
95 Database.MouseDown(50,50)
96 Database.MouseUp(50,50)
98 if not DatabaseSwapIconView.exists(1) then
99 warnlog "InsightSwapIconView doesn't exists"
103 '/// display Tables View
104 printlog "display Tables View"
106 Kontext "ContainerView"
107 if not TableTree.exists(1) then
108 warnlog "TableTree doesn't appear"
112 TableTree.TypeKeys("<HOME>")
113 TableTree.TypeKeys("<UP>")
120 '-------------------------------------------------------------------------
123 dim iCount as integer ' the numbers of the items in the creation list.
125 hFileOpen( gOfficePath & "user/database/biblio.odb" )
129 Database.MouseDown(50,50)
130 Database.MouseUp(50,50)
133 if Database.exists() then
134 printlog "Insight appear"
136 warnlog "Insight doesn't appear"
140 if DatabaseSwapView.exists() then
141 printlog "InsightSwapView appear"
143 warnlog "InsightSwapView doesn't appear"
147 '/// display Tables View
148 printlog "display Tables View"
150 if DatabaseTablesView.exists(1) then
151 printlog "InsightTablesView appear"
153 warnlog "InsightTablesView doesn't appear"
157 '/// count the items in the CreationList
158 printlog "count the items in the CreationList"
159 iCount = CreationList.getItemCount()
160 if ( iCount <> 2) then
161 warnlog "There are not 2 items in the CreationList. There are " + iCount + " items."
164 '/// display Queries View
165 printlog "display Queries View"
167 if DatabaseQueriesView.exists(1) then
168 printlog "InsightQueriesView appear"
170 warnlog "InsightQueriesView doesn't appear"
174 '/// count the items in the CreationList
175 printlog "count the items in the CreationList"
176 iCount = CreationList.getItemCount()
177 if ( iCount <> 3) then
178 warnlog "There are not 3 items in the CreationList. There are " + iCount + " items."
181 '/// display Forms View
182 printlog "display Forms View"
184 Kontext "ContainerView"
185 if FormTree.exists(1) then
186 printlog "InsightFormsView appear"
188 warnlog "InsightFormsView doesn't appear"
192 '/// count the items in the CreationList
193 printlog "count the items in the CreationList"
194 iCount = CreationList.getItemCount()
195 if ( iCount <> 2) then
196 warnlog "There are not 2 items in the CreationList. There are " + iCount + " items."
199 '/// display Reports View
200 printlog "display Reports View"
202 if DatabaseReportsView.exists(1) then
203 printlog "InsightReportsView appear"
205 warnlog "InsightReportsView doesn't appear"
209 '/// count the items in the CreationList
210 printlog "count the items in the CreationList"
211 Dim iCheckCount as Integer
212 iCount = CreationList.getItemCount()
213 if ( hIsExtensionAlreadyInstalled("sun-report-builder.oxt")) then
218 if ( iCount <> iCheckCount ) then
219 warnlog "There are not " + iCheckCount + " items in the CreationList. There are " + iCount + " items."
225 '-------------------------------------------------------------------------
228 hFileOpen( gOfficePath & "user/database/biblio.odb" )
232 Database.MouseDown(50,50)
233 Database.MouseUp(50,50)
239 Kontext "ContainerView"
251 Kontext "DatabaseBeamer"
252 if ( not DatabaseBeamer.exists(1) ) then
253 warnlog "the preview doesn't display the table"
255 printlog "preview displayed"
266 Kontext "DatabaseBeamer"
267 if ( DatabaseBeamer.exists(1) ) then
268 warnlog "the preview is still there"
270 printlog "preview turn off"
278 '-------------------------------------------------------------------------
279 testcase tMainMenuBar
281 dim iCount as integer ' the numbers of the items in the menu.
283 hFileOpen( gOfficePath & "user/database/biblio.odb" )
287 '/// check if there are 11 items in the file menu.
288 printlog "check if there are 11 items in the file menu."
289 '/// + there different count related to the file pick list.
290 printlog "+ there different count related to the file pick list."
291 hMenuSelectNr(1) ' the file menu
292 iCount = getMenuItemCount()
293 if ( lcase( gPlatform ) = "osx" ) then
294 if ( iCount <> 10 ) then
295 warnlog( "File menu: 10 items expected, found " & iCount )
298 if (iCount <> 11 ) then
299 warnlog "There should be 11 items in the file menu but there are " + iCount + " items."
303 '/// check if there are 12 items in the FILE/NEW menu.
304 printlog "check if there are 12 items in the FILE/NEW menu."
305 hMenuSelectNr(1) ' FILE/NEW menu
306 iCount = hMenuItemGetCount()
307 if (iCount <> 12) then
308 warnlog "There should 12 items in the FILE/NEW menu but there are " + iCount + " items."
310 call hMenuClose() ' close the FILE menu
312 '/// check the FILE/AUTOPILOTS
313 printlog "check the FILE/AUTOPILOTS"
315 hMenuSelectNr(1) ' the file menu
316 hMenuSelectNr(4) ' the autopilots menu
317 iCount = hMenuItemGetCount()
318 if (iCount <> 8) then
319 warnlog "There should 8 items in the FILE/AUTOPILOTS menu but there are " + iCount + " items."
323 '/// check if there are 15 items in the edit menu.
324 printlog "check if there are 15 items in the edit menu."
327 iCount = hMenuItemGetCount()
328 if (iCount <> 15) then
329 warnlog "There should 15 items in the edit menu but there are " + iCount + " items."
333 '/// check if there are 6 items in the view menu.
334 printlog "check if there are 6 items in the view menu."
337 iCount = hMenuItemGetCount()
338 if (iCount <> 6) then
339 warnlog "There should 6 items in the view menu but there are " + iCount + " items."
343 '/// check the VIEW/DATABASE OBJECTS
344 printlog "check the VIEW/DATABASE OBJECTS"
348 iCount = hMenuItemGetCount()
349 if (iCount <> 4) then
350 warnlog "There should 4 items in the VIEW/DATABASE menu but there are " + iCount + " items."
354 '/// check the VIEW/SORT OBJECTS
355 printlog "check the VIEW/SORT OBJECTS"
359 iCount = hMenuItemGetCount()
360 if (iCount <> 2) then
361 warnlog "There should 2 items in the VIEW/SORT menu but there are " + iCount + " items."
365 '/// check the VIEW/PREVIEW
366 printlog "check the VIEW/PREVIEW"
370 iCount = hMenuItemGetCount()
371 if (iCount <> 3) then
372 warnlog "There should 3 items in the VIEW/PREVIEW menu but there are " + iCount + " items."
376 '/// check if there are 8 items in the insert menu.
377 printlog "check if there are 8 items in the insert menu."
380 iCount = hMenuItemGetCount()
381 if (iCount <> 8) then
382 warnlog "There should 8 items in the insert menu but there are " + iCount + " items."
386 '/// check if there are 10 items in the tools menu.
387 printlog "check if there are 10 items in the tools menu."
390 iCount = hMenuItemGetCount()
391 if ( lcase( gPlatform ) = "osx" ) then
392 if ( iCount <> 9 ) then
393 warnlog( "Tools menu: 9 items expected, found " & iCount )
396 if (iCount <> 10) then
397 warnlog "There should 10 items in the tools menu but there are " + iCount + " items."
402 '/// check if there are 4 items in the TOOLS/MACRO menu.
403 printlog "check if there are 4 items in the TOOLS/MACRO menu."
407 iCount = hMenuItemGetCount()
408 if (iCount <> 4) then
409 warnlog "There should 4 items in the TOOLS/MACRO menu but there are " + iCount + " items."
416 '-------------------------------------------------------------------------
417 testcase tDatabaseProperties
421 hFileOpen( gOfficePath & "user/database/biblio.odb" )
424 Database.MouseDown(50,50)
425 Database.MouseUp(50,50)
433 Kontext "DatabaseProperties"
434 call DialogTest(DatabaseProperties)
435 ' TabControl.SetPage TabGeneral
437 ' '/// check the general tabpage
438 ' printlog "check the general tabpage"
439 ' Kontext "TabGeneral"
440 ' 'TODO: check real names.
441 ' sValue = SourceName.getText()
442 ' if ( strComp(sValue,"TT_Biblio") <> 0 ) then
443 ' warnlog "The datasource name is not right. it should be 'TT_Biblio' but it is " + sValue
445 ' sValue = DataBaseType.getSelText()
446 ' if ( strComp(sValue,"dBASE") <> 0 ) then
447 ' warnlog "The datasource type is not right. it should be 'dBase' but it is " + sValue
454 ' tabconnection in this script == tabgeneral in the office ( historic reasons )
455 '/// check the connection tabpage
456 printlog "check the connection tabpage"
457 Kontext "DatabaseProperties"
458 TabControl.SetPage TabConnection
460 Kontext "TabConnection"
461 if NOT TabConnection.exists(1) then
462 warnlog "Tabpage doesn't exists."
464 '/// check if the text in the path is correct
465 'printlog "check if the text in the path is correct"
466 sValue = dBasePath.getText()
467 'if ( strComp(sValue,"sdbc:dbase:$(userurl)/database/biblio") <> 0 ) then
468 ' warnlog "the path is not correct. It is " + sValue
470 '/// click the select path button
471 printlog "click the select path button"
474 Kontext "GeneralFileDialog"
475 '/// cancel the open dialog
476 printlog "cancel the open dialog"
477 GeneralFileDialog.Cancel
479 Kontext "TabConnection"
480 '/// click the test connection button
481 printlog "click the test connection button"
485 '/// close the messagesdialog
486 printlog "close the messagesdialog"
489 Kontext "DatabaseProperties"
490 '/// switch to the additional Settings
491 printlog "switch to the additional Settings"
492 TabControl.SetPage TabdBase
495 '/// open the index dialog
496 printlog "open the index dialog"
500 '/// close the index dialog with cancel
503 Kontext "DatabaseProperties"
504 '/// Cancel the datasource admin dialog
505 printlog "Cancel the datasource admin dialog"
506 DatabaseProperties.Cancel
508 call hCloseDocument()
511 '--------------------------------------------------------------------
512 testcase tRegisterDatabaseDialog
515 '/// open new document
516 printlog "open new document"
518 '/// open TOOLS / OPTIONS
519 printlog "open TOOLS / OPTIONS"
521 '/// open Data Source / DATABASES
522 printlog "open Data Source / DATABASES"
523 call hToolsOptions ( "Datasources", "Databases" )
525 Kontext "TabRegisteredDatabase"
526 call DialogTest( TabRegisteredDatabase )
527 if (RegisteredDatabases.getItemCount() = 0 ) then
528 warnlog "there are no registered databases. There should be at least a registered 'Bibliography' Database."
529 Kontext "OptionenDlg"
534 RegisteredDatabases.select 1
535 '/// check if the Bibliography is registered
536 printlog "check if the Bibliography is registered"
537 if RegisteredDatabases.getSeltext() <> "Bibliography" then
538 warnlog "the bibliography database is not registered"
540 printlog "database bibliography is registered"
542 '/// click in the delete button but don't delete the database
543 printlog "click in the delete button but don't delete the database"
547 '/// click on the new button
548 printlog "click on the new button"
549 Kontext "TabRegisteredDatabase"
552 '/// cancel the new dialog
553 printlog "cancel the new dialog"
554 Kontext "CreateDatabaseLink"
555 call DialogTest( CreateDatabaseLink )
556 CreateDatabaseLink.Cancel
558 '/// click on the edit button
559 printlog "click on the edit button"
560 Kontext "TabRegisteredDatabase"
563 '/// cancel the edit dialog
564 Kontext "CreateDatabaseLink"
565 call DialogTest( CreateDatabaseLink )
566 CreateDatabaseLink.Cancel
569 '/// close TOOLS / OPTIONS with cancel
570 printlog "close TOOLS / OPTIONS with cancel"
571 Kontext "OptionenDlg"
575 printlog "close document"
580 '--------------------------------------------------------------------
581 testcase tDatabaseBeamer
583 printlog "open new document"
586 printlog "open the database beamer"
590 printlog "select database Bibliography"
591 Kontext "DatabaseSelection"
592 DatabaseSelection.select 1
594 printlog "open the selected database"
595 DatabaseSelection.OpenContextmenu
600 If Database.exists(10) then
601 printlog "database open -> OK"
602 printlog "close the open database"
605 warnlog "database mot open"
608 printlog "close the open document"
612 '-------------------------------------------------------------------------
613 '-------------------------------------------------------------------------
614 '-------------------------------------------------------------------------
615 function getMenuItemCount as Integer
616 'use this function becasue this doesn't count the pick list
617 Dim i, j, Ende, nID as Integer
620 for i=1 to MenuGetItemCount
621 if NOT MenuIsSeperator ( i ) then
623 s = Mid(MenuGetItemText( MenuGetItemID(i)),3,1)
625 'printlog "MenuGetItemText( MenuGetItemID(i)) = " + MenuGetItemText( MenuGetItemID(i))