diff options
Diffstat (limited to 'testautomation/framework/tools/includes')
21 files changed, 421 insertions, 2726 deletions
diff --git a/testautomation/framework/tools/includes/all_interfaces.txt b/testautomation/framework/tools/includes/all_interfaces.txt deleted file mode 100755 index e81f5b7834fa..000000000000 --- a/testautomation/framework/tools/includes/all_interfaces.txt +++ /dev/null @@ -1,125 +0,0 @@ -function hGetFileLocationAPI() as string -function hGetDocTypeAPI() as string -function listdebug( lsList() as string , cComment as string ) as integer -function initlistdebug( cComment as string ) as integer -function listmoveitem( source() as string, target() as string, itemid as integer ) as integer -function listconvertpath( lsList() as string ) as integer -function listInsertSection( lsList() as string, cSection as string ) as integer -function CheckAsianLanguageSupport( sSupport as String ) as String -function fStartupNavigator(navigatorItem as String , subItemNum as Integer) -function fCloseNavigator -function fGetCountryName( CountryID as Integer ) as String -function hToolsCustomizeOpen() as boolean -function hToolsCustomizeSelectTab( cTab as string ) as boolean -function hToolsCustomizeClose( iMode as integer ) as boolean -function hToolsCustomizeAddNewMenu( cName as string, bMode as boolean ) as boolean -function hDeselectSeparator() as integer -function hClickCommandButton( iItemToClick as integer ) as boolean -function hFileOpenMultiSelect( iArray() as integer ) as integer -function hSaveLoadDelSuccess( cFile as string ) as integer -function hLoadFileExpectSuccess( fpath as string ) as boolean -function hLoadFileExpectFailure( fpath as string ) as boolean -function hSaveFileExpectSuccess( fpath as string , bReplace as boolean ) as boolean -function hSaveFileExpectFailure( fpath as string , errortype as integer ) as boolean -function hCreateDirectoryExpectSuccess( dirname as string ) as boolean -function hDeleteFileViaFileOpen( cFile as String ) as boolean -function hGetFileCountViaFileOpen() as integer -function hNameGen_append( iDecChar as long ) as string -function hNameGen_lead( iDecChar as long ) as string -function hGetRelPath( cStartDir, cFileName as String ) as string -function hFindFileObjectViaFileOpen( cName as string ) as integer -function hGetControlParams( cParam as string ) as integer -function hGetControlName( iControl as integer ) as string -function hInsertControl( iControl as integer ) as string -function hDrawControlOnDialog( iControl as integer ) as string -function hDrawControl( xPos as integer, yPos as integer, xEnd as integer, yEnd as integer ) as boolean -function hGetControlPosXO( iControl as integer ) as integer -function hGetControlPosYO( iControl as integer ) as integer -function hGetControlPosXE( iControl as integer ) as integer -function hGetControlPosYE( iControl as integer ) as integer -function hGetControlPosXM( iControl as integer ) as integer -function hGetControlPosYM( iControl as integer ) as integer -function hSelectControl( iControl as integer ) as boolean -function hOpenHelp() as boolean -function hCloseHelp() as boolean -function hSelectHelpTab( cTab as string ) as boolean -function hUseBookmarksContextMenu( cAction as string ) as boolean -function hHelpGetAboutItemCount() as integer -function hHelpGetSearchIndexItemCount() as integer -function hGetHelpContentHeader( iLength as integer ) as string -function hGetI18nData( cSection as string, cLanguage as string ) as string -function hGetTwoDigitLangCode( iLanguage as integer ) as string -function hTestLocale() as boolean -function hInitSingleDoc() as boolean -function hInitBackingMode() as boolean -function hInitWriteDocIdentifier( cString as string ) as boolean -function hBatchLoadJavaFiles( aFileList() , cIdent as string ) -function hFindCopyRemoveJavaLogs( cSourcePath as string ) as boolean -sub GetPathList ( ls1 () as String, ls2 () as String, ls3 () as String ) -sub CreatePathList -function URLGraphicCheck ( bRelativ as Boolean, sFile as String ) -sub DialogTestForViewOptions -sub DialogTextForViewOptions_move -sub MouseTestForViewOptions -sub Make3D -sub hResetAutosave() -sub DeleteColor( cColorName as String ) -sub modifyColorRGB_PGUP( iColor as Integer ) -sub createNewColor( aColor() as String ) -sub getColorRGB( aColor() as String ) -sub compareTwoColorsRGB( aColor() as String ) -sub ModifyColorRGB( aColor() as String ) -function hOpenPropertyBrowser() as boolean -function hClosePropertyBrowser() as boolean -function hPBSetControlName( cControl as string ) as boolean -function hPBGetControlName( cControl as string ) as boolean -function hCheckPropertyPresence ( cSetting as string , iPos as integer ) as boolean -function hSetPBTabPage( iPage as integer ) as boolean -function hSetLabelName( sLabelName as string ) as boolean -function hWaitForObject( oControl as object, iTime as integer ) as integer -function hGetPrivateHttpServer( _proxy as string, _port as string ) as boolean -function hGetPrivateFtpServer( _proxy as string, _port as string ) as boolean -function hGetPrivateSocksServer( _proxy as string, _port as string ) as boolean -function hGetPrivateInputPath( bVerbose as boolean ) as string -function hGetPrivateInputFile( bVerbose as boolean ) as string -function hCreateScriptingObject( cName as string ) as boolean -function hRenameScriptingObject( cName as string ) as boolean -function hDeleteScript( cName as string , bSuccess as boolean ) as boolean -function hOpenScriptOrganizer( iDialog as integer ) as boolean -function hCloseScriptOrganizer() as boolean -function hOpenRunMacroDialog() as boolean -function hSelectXMLSecTab( cTab as string ) as boolean -function hGetPrinterPosition( cName as string, bWarn as boolean ) as integer -function hDelPrinter( cPrinterName as string ) as integer -function hGetSpadminPath() as string -function hShutdownOffice() as integer -function hOpenSpadmin() as boolean -function hWaitForSpAdmin() as boolean -function hCreateFaxDevice( cName as string ) as boolean -function hDocumentInfoSelectTab( cTabPage as string ) as boolean -function hFindTemplate( sTemplateName as string ) as integer -function hGetRefFilePath( cCategory as string, location as string) as string -function hSelectCategory( cCategory as string ) as boolean -function hSelectFileFolder( iFolder as integer , bVerbose as boolean ) as integer -function hGetFileFolderName( iFolder as integer ) as string -function hSelectDocumentObject( iTitle as integer , iMode as integer ) as string -function hIsTemplateDialogClosed() as boolean -function hIsObjectAFolder( iObjects as integer ) as boolean -function hDeleteUserTemplates() as integer -function hAccessStandardBar() as boolean -function hResetStandardBar() as boolean -function hStandardbarItemGetCount() as integer -function hToggleToolbarItem( iMenuPos as integer ) -function hStandardbarLoadUrl() as boolean -function hStandardbarNewDialog() -function hStandardbarSaveAs() -function hSetProxies( HTTP_Server as string, HTTP_Port as string, FTP_Server as string, FTP_Port as string, NoProxyFor as string ) as integer -function hMaximizeDocument() as boolean -function hOpenWizardWithMenu( cType as string ) as integer -function hFinishWizard( iMode as integer ) as boolean -function hGetWizardParams( cType as string, cParam as string ) as integer -function hWaitForWizard() as integer -function hSetTemplateSavePath( cFile as string ) as integer -function hHandleSaveError() as integer -function hClickNextButton() as boolean - diff --git a/testautomation/framework/tools/includes/apicalls.inc b/testautomation/framework/tools/includes/apicalls.inc deleted file mode 100644 index fca300c5eda7..000000000000 --- a/testautomation/framework/tools/includes/apicalls.inc +++ /dev/null @@ -1,116 +0,0 @@ -'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 : joerg.skottke@sun.com -'* -'* short description : Various calls to the API -'* -'\****************************************************************************** - -function hGetFileLocationAPI() as string - - '///<h3>Get the location of the current file from API - experimental, do not use</h3> - - dim oUnoConnect as object - dim oUnoService as object - dim oDocument as object - dim cDocument as string - - const CFN = "hGetFileLocationAPI::" - - oUnoConnect = GetUNOApp - if ( isNull( oUnoConnect ) ) then - warnlog( CFN & "No UNO connection established" ) - else - oUnoService = oUnoConnect.createInstance( "com.sun.star.frame.Desktop" ) - if ( isNull( oUnoService ) ) then - warnlog( CFN & "No UNO Service available" ) - else - oDocument = oUnoService.getCurrentComponent() - if ( isNull( oDocument ) ) then - warnlog( CFN & "No current component available" ) - else - if ( oDocument.hasLocation() ) then - cDocument = oDocument.getLocation() - hGetFileLocationAPI() = cDocument - printlog( CFN & cDocument ) - else - warnlog( "Document has no storage location" ) - hGetFileLocationAPI() = "" - endif - endif - endif - endif - -end function - -'******************************************************************************* - -function hGetDocTypeAPI() as string - - '///<h3>Get the current document via API - experimental, do not use</h3> - - dim oUnoConnect as object - dim oUnoService as object - dim oDocument as object - dim cDocument as string - - const CFN = "hGetDocTypeAPI::" - - oUnoConnect = GetUNOApp - if ( isNull( oUnoConnect ) ) then - warnlog( CFN & "No UNO connection established" ) - else - oUnoService = oUnoConnect.createInstance( "com.sun.star.frame.Desktop" ) - if ( isNull( oUnoService ) ) then - warnlog( CFN & "No UNO Service available" ) - else - oDocument = oUnoService.getCurrentComponent() - if ( isNull( oDocument ) ) then - warnlog( CFN & "No current component available" ) - else - if ( oDocument.SupportsService( "com.sun.star.sheet.SpreadsheetDocument" ) )then - hGetDoctypeAPI() = "CALC" - elseif( oDocument.SupportsService( "com.sun.star.text.TextDocument" ) ) then - hGetDocTypeAPI() = "WRITER" - elseif( oDocument.SupportsService( "com.sun.star.drawing.DrawingDocument" ) ) then - hGetDocTypeAPI() = "DRAW" - elseif( oDocument.SupportsService( "com.sun.star.formula.FormulaProperties" ) ) then - hGetDocTypeAPI() = "MATH" - elseif( oDocument.SupportsService("com.sun.star.presentation.PresentationDocument") ) then - hGetDocTypeAPI() = "IMPRESS" - else - warnlog( "Unknown document type" ) - hGetDocTypeAPI() = "" - endif - endif - endif - endif - - -end function - diff --git a/testautomation/framework/tools/includes/arrayfuncs.inc b/testautomation/framework/tools/includes/arrayfuncs.inc deleted file mode 100644 index df33885da4cd..000000000000 --- a/testautomation/framework/tools/includes/arrayfuncs.inc +++ /dev/null @@ -1,163 +0,0 @@ -'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 : joerg.skottke@sun.com -'* -'* short description : misc functions for simpler listhandling. uses t_lists.inc -'* -'\****************************************************************************** - -function listdebug( lsList() as string , cComment as string ) as integer - - '///<h3>Write the content of a list plus a comment out to a file.</h3> - '///<i>It is required that following global variables are defined</i> - '///<ul> - '///+<li>LDN = ListDebugName (char) = the basename of the debugfiles</li> - '///+<li>LDC = ListDebugCounter (int) = a number added to the filename</li> - '///</ul> - - dim cFile as string - - LDC = LDC + 1 - cFile = LDN & LDC & ".log" - - dim sList( 5 ) as string - sList( 0 ) = "5" - sList( 1 ) = "" - sList( 2 ) = "---------------------------------------------------------------" - sList( 3 ) = cComment & " - Listsize: " & listcount( lsList() ) - sList( 4 ) = "---------------------------------------------------------------" - sList( 5 ) = "" - - ListWrite( sList() , cFile , "utf8" ) - ListWriteAppend( lsList() , cFile , "utf8" ) - -end function - -'******************************************************************************* - -function initlistdebug( cComment as string ) as integer - - '///<h3>Print leading text to a file and an index of the current debug session</h3> - '///<i>It is required that following global variables are defined</i> - '///<ul> - '///+<li>LDN = ListDebugName (char) = the basename of the debugfiles</li> - '///+<li>LDC = ListDebugCounter (int) = a number added to the filename</li> - '///</ul> - dim cFile as string - cFile = LDN & ".log" - - dim sList( 5 ) as string - sList( 0 ) = "5" - sList( 1 ) = "" - sList( 2 ) = "===============================================================" - sList( 3 ) = cComment & " ---- Debug-Offset is at: " & LDC - sList( 4 ) = "===============================================================" - sList( 5 ) = "" - - ListWrite( sList() , cFile , "utf8" ) - - printlog( "" ) - printlog( " *** Debug is enabled ***" ) - printlog( "" ) - -end function - -'******************************************************************************* - -function listmoveitem( source() as string, _ - target() as string, _ - itemid as integer ) as integer - - '///<h3>Move one item from one list to another by index</h3> - '///<ul> - - '///+<li>copy the list-item from list A to the end of list B, update listcount</li> - listappend( target() , source( itemid ) ) - - '///+<li>Delete the entry from the old list, reindex and update listcount</li> - listdelete( source() , itemid ) - - '///+<li>Return then updated listcount of the <i>source</i> list</li> - listmoveitem() = listcount( source() ) - - '///</ul> - -end function - -'******************************************************************************* - -function listconvertpath( lsList() as string ) as integer - - '///<h3>Execute <i>convertpath</i> on a list containing filepaths</h3> - '///<ul> - - dim iCurrentPath as integer - - '///+<li>Convert all listitems with <i>convertpath</i></li> - for iCurrentPath = 1 to listcount( lsList() ) - lsList( iCurrentPath ) = convertpath( lsList( iCurrentPath ) ) - next iCurrentPath - - '///+<li>Return the number of processed paths (listcount)</li> - listconvertpath() = listcount( lsList() ) - - '///</ul> - -end function - -'******************************************************************************* - -function listInsertSection( lsList() as string, _ - cSection as string ) as integer - - '///<h3>Appends a section (as ordinary list element) to a list</h3> - '///<ul> - - dim iPos as integer - dim sSectionString as string - - '///+<li>Get the current number of entries from the list</li> - iPos = listcount( lsList() ) - - '///+<li>Insert a blank list-entry if we are not at the beginning of the list</li> - if ( iPos > 2 ) then - listappend( lsList() , "" ) - end if - - '///+<li>Build the section string of type [section-name]</li> - sSectionString = "[" & cSection & "]" - - '///+<li>Append the new section to the list</li> - listappend( lsList() , sSectionString ) - - '///+<li>Return the new number of entries in the list (listcount)</li> - listInsertSection() = listcount( lsList() ) - - '///</ul> - -end function diff --git a/testautomation/framework/tools/includes/customize_tools.inc b/testautomation/framework/tools/includes/customize_tools.inc index 2d6d17443913..386c5423ee3a 100644..100755 --- a/testautomation/framework/tools/includes/customize_tools.inc +++ b/testautomation/framework/tools/includes/customize_tools.inc @@ -33,43 +33,10 @@ function hToolsCustomizeOpen() as boolean - '///<h3>Open Tools/Customize</h3> - '///<i>Starting point: Any plain document</i><br> - '///<u>Input</u>: - '///<ol> - '///+<li>Nothing</li> - '///</ol> - '///<u>Returns</u>: - '///<ol> - '///+<li>Errorstatus (boolean)</li> - '///<ul> - '///+<li>TRUE if the Keyboard-Tab is open</li> - '///+<li>FALSE on any other case</li> - '///</ul> - '///</ol> - '///<u>Description</u>: - '///<ul> - - const CFN = "hToolsCustomizeOpen::" - - '///+<li>Open Tools/Customize using the ToolsCustomize slot</li> + printlog( "Open Tools/Customize dialog" ) ToolsCustomize - - '///+<li>Switch to the Events Tab</li> - hToolsCustomizeSelectTab( "Events" ) + hToolsCustomizeOpen() = hToolsCustomizeSelectTab( "Events" ) - '///+<li>Verify that the requested tabpage is open</li> - Kontext TabCustomizeEvents - if ( TabCustomizeEvents.exists() ) then - hToolsCustomizeOpen() = true - printlog( CFN & "Successfully opened ToolsCustomize" ) - else - hToolsCustomizeOpen() = false - printlog( CFN & "Failed to open ToolsCustomize" ) - endif - '///+<li>Return TRUE on success</li> - '///</ul> - end function '******************************************************************************* @@ -100,189 +67,65 @@ function hToolsCustomizeSelectTab( cTab as string ) as boolean '///<ul> const CFN = "hToolsCustomizeSelectTab::" - dim brc as boolean - brc = false - + hToolsCustomizeSelectTab() = true ctab = lcase( ctab ) '///+<li>Switch to one of the four available tabpages</li> '///<ol> + + printlog( "Open Tools/Customize: <" & ctab & ">" ) kontext try - select case ctab '///+<li>Keyboard</li> - case "keyboard" : active.setPage TabTastatur - kontext "TabTastatur" - if ( Aendern.isVisible() ) then - brc = true - endif + case "keyboard" : + active.setPage TabTastatur + WaitSlot + kontext "TabTastatur" + if ( not Aendern.isVisible() ) then + printlog( CFN & "Keyboard tabpage is not available" ) + hToolsCustomizeSelectTab() = false + endif '///+<li>Menu</li> - case "menu" : active.setPage TabCustomizeMenu - kontext "TabCustomizeMenu" - if ( Entries.isVisible() ) then - brc = true - endif + case "menu" : + active.setPage TabCustomizeMenu + WaitSlot + kontext "TabCustomizeMenu" + if ( not Entries.isVisible() ) then + printlog( CFN & "Menu tabpage is not available" ) + hToolsCustomizeSelectTab() = false + endif '///+<li>Toolbars</li> - case "toolbars" : active.setPage TabCustomizeToolbars - kontext "TabCustomizeToolbars" - if ( ToolbarContents.isVisible() ) then - brc = true - endif + case "toolbars" : + active.setPage TabCustomizeToolbars + WaitSlot + kontext "TabCustomizeToolbars" + if ( not ToolbarContents.isVisible() ) then + printlog( CFN & "Toolbar tabpage is not available" ) + hToolsCustomizeSelectTab() = false + endif '///+<li>Events</li> - case "events" : active.setPage TabCustomizeEvents - kontext "TabCustomizeEvents" - if ( AssignMacro.isVisible() ) then - brc = true - endif + case "events" : + active.setPage TabCustomizeEvents + WaitSlot + kontext "TabCustomizeEvents" + if ( not AssignMacro.isVisible() ) then + printlog( CFN & "Assign Macro tabpage is not available" ) + hToolsCustomizeSelectTab() = false + endif end select '///</ol> - catch - printlog( CFN & "Could not access requested tabpage" ) - brc = false - + hToolsCustomizeSelectTab() = false endcatch - - if ( brc ) then - printlog( CFN & "Opened Tab: " & cTab ) - else - printlog( CFN & "Failed to open Tab: " & cTab ) - endif - - '///+<li>Return TRUE on success</li> '///</ul> - hToolsCustomizeSelectTab() = brc end function '******************************************************************************* -function hToolsCustomizeClose( iMode as integer ) as boolean - - '///<h3>Close the ToolsCustomize-Dialog</h3> - '///<i>Starting point: Tools/Customize dialog</i><br> - '///<u>Input</u>: - '///<ol> - '///+<li>Closing mode (integer)</li> - '///<ul> - '///+<li>1: Use OK-button</li> - '///+<li>2: Use Cancel-button</li> - '///</ul> - '///</ol> - '///<u>Returns</u>: - '///<ol> - '///+<li>Errorstatus (boolean)</li> - '///<ul> - '///+<li>TRUE if executing close action succeeded</li> - '///+<li>FALSE on any other condition</li> - '///</ul> - '///</ol> - '///<u>Description</u>: - '///<ul> - - const CFN = "hToolsCustomizeClose::" - dim brc as boolean : brc = true - - kontext - - '///+<li>Switch to the Events page by default</li> - active.setPage( TabCustomizeEvents ) - - '///+<li>Close dialog by OK or CANCEL</li> - '///<ol> - select case iMode - '///+<li>OK</li> - case 1 : TabCustomizeEvents.OK() - '///+<li>Cancel</li> - case 2 : TabCustomizeEvents.Cancel() - case else - brc = false - end select - '///</ol> - - - - '///+<li>Verify that the dialog has indeed been closed</li> - kontext "TabCustomizeEvents" - TabCustomizeEvents.notExists( 3 ) - if ( TabCustomizeEvents.exists() ) then - brc = false - endif - - if ( brc ) then - printlog( CFN & "Closed Tools/Customize" ) - else - printlog( CFN & "Failed to close Tools/Customize" ) - endif - - '///</ul> - hToolsCustomizeClose() = brc -end function - -'******************************************************************************* - -function hToolsCustomizeAddNewMenu( cName as string, bMode as boolean ) as boolean - - '///<h3>Add a new menu via Tools/Customize/Menu</h3> - '///<i>Starting point: Tools/Customize with Menu-Tab open</i><br> - '///<u>Input</u>: - '///<ol> - '///+<li>Name of the new menu (string)</li> - '///+<li>Mode (boolean). Options:</li> - '///<ul> - '///+<li>TRUE = The entry will be created (OK)</li> - '///+<li>FALSE = The entry will not be created (Cancel)</li> - '///</ul> - '///</ol> - '///<u>Returns</u>: - '///<ol> - '///+<li>Errorstatus (boolean)</li> - '///<ul> - '///+<li>TRUE on success</li> - '///+<li>FALSE on failure</li> - '///</ul> - '///</ol> - '///<u>Description</u>: - '///<ul> - - const CFN = "hToolsCustomizeAddNewMenu::" - dim brc as boolean - brc = false - - '///+<li>Click the "New..." button</li> - kontext "TabCustomizeMenu" - BtnNew.click() - - '///+<li>Verify that the menu organizer exists</li> - Kontext "MenuOrganiser" - if ( not MenuName.exists() ) then - printlog( CFN & "MenuOrganiser is not open" ) - exit function - endif - - '///+<li>Name the new menu if we intend to create the new entry</li> - if ( bMode ) then - printlog( CFN & "Naming menu: " & cName ) - MenuName.setText( cName ) - MenuOrganiser.OK() - brc = true - else - call DialogTest( MenuOrganiser ) - printlog( CFN & "Opened and closed MenuOrganiser" ) - MenuOrganiser.cancel() - brc = true - endif - - hToolsCustomizeAddNewMenu() = brc - '///</ul> - -end function - -'******************************************************************************* - function hDeselectSeparator() as integer '///<h3>Make sure that we do not work on a separator item (Toolbars)</h3> diff --git a/testautomation/framework/tools/includes/filedlg_tools.inc b/testautomation/framework/tools/includes/filedlg_tools.inc deleted file mode 100644 index 68d46216ed4d..000000000000 --- a/testautomation/framework/tools/includes/filedlg_tools.inc +++ /dev/null @@ -1,117 +0,0 @@ -'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 : joerg.skottke@sun.com -'* -'* short description : Special tasks on filedialogs -'* -'\****************************************************************************** - -function hFileOpenMultiSelect( iArray() as integer ) as integer - - - '///<h3>Multiselect files with the fileopen dialog</h3> - '///<i>This function uses keyboard navigation to select a number of files - '///+ (multiselection).</i><br> - '///<u>Starting point</u>: FileOpen dialog has context, workdirectory is - '///+ open<br><br> - - '///<u>Input value(s):</u><br> - '///<ol> - '///+<li>Array (integer)</li> - '///<ul> - '///+<li>if ( array( n ) = 1 ) select the file at pos n, starting at n = 1</li> - '///+<li>Any other value: Do not select, preferably preset with 0!</li> - '///+<li>The size of the array must less or equal the number of files in the filepicker<br> - '///+ Array( 0 ) is ignored</li> - '///</ul> - '///</ol> - - '///<u>Return Value:</u><br> - '///<ol> - '///+<li>Number of selected files (integer)</li> - '///<ul> - '///+<li>= 0: any error</li> - '///+<li>> 0: Number of selected files (Sum of Array( n ) = 1)</li> - '///</ul> - '///</ol> - - const CFN = "hFileOpenMultiSelect::" - dim brc as boolean 'a multi purpose boolean returnvalue - - dim iArraySize as integer - dim iCurrentFile as integer - dim cCurrentFile as string - dim iSelectedFilesCount as integer - iSelectedFilesCount = 0 - - '///<u>Description:</u> - '///<ul> - '///+<li>Get the size of the array</li> - iArraySize = ubound( iArray() ) - - '///+<li>Get the number of items from the filepicker</li> - kontext "OeffnenDlg" - iFileCount = Dateiauswahl.getItemCount() - - '///+<li>Verify that the array size is equal or less the number of files<br> - '///+ Exit with rc = 0 on error</li> - ' Note: This can be done because it is quite simply expected that we know the - ' number of files within the workdirectory. Take one input-dir. - if ( iFileCount < iArraySize ) then - qaerrorlog( CFN & "Array too large. Array must be <= file count" ) - printlog( CFN & "Files present in dialog: " & iFileCount ) - printlog( CFN & "Arraysize..............: " & iArraySize ) - hFileOpenMultiSelect() = 0 - exit function - endif - - '///+<li>Select the first object in the filelist</li> - kontext "OeffnenDlg" - DateiAuswahl.typeKeys( "<HOME>" ) - - '///+<li>Run through the filelist and select all items that are marked in the array</li> - '///<ul> - for iCurrentFile = 1 to iArraySize - - '///+<li>Select a file with CTRL+SPACE</li> - if ( iArray( iCurrentFile ) = 1 ) then - DateiAuswahl.typeKeys( "<MOD1 SPACE>" ) - cCurrentFile = DateiAuswahl.getSelText() ' does this work? - printlog( CFN & "Select: " & cCurrentFile & " at pos: " & iCurrentFile ) - iSelectedFilesCount = iSelectedFilesCount + 1 - endif - - '///+<li>Move one down with CTRL key pressed</li> - DateiAuswahl.typekeys( "<MOD1 DOWN>" ) - - next iCurrentFile - '///</ul> - '///</ul> - hFileOpenMultiSelect() = 0 - -end function diff --git a/testautomation/framework/tools/includes/fileoperations.inc b/testautomation/framework/tools/includes/fileoperations.inc index b8040eb5fbfb..dd91cc08f498 100644..100755 --- a/testautomation/framework/tools/includes/fileoperations.inc +++ b/testautomation/framework/tools/includes/fileoperations.inc @@ -64,7 +64,8 @@ function hSaveLoadDelSuccess( cFile as string ) as integer printlog( CFN & "Enter with option: " & cFile & "/" & cFileExt ) '///+<li>Close the navigator if it exists</li> - hCloseNavigator() + kontext "Navigator" + hCloseDialog( Navigator, "close,optional" ) '///+<li>Save the current file, overwriting existing</li> brc = hSaveFileExpectSuccess( cFile , TRUE ) ' save and overwrite @@ -203,90 +204,6 @@ end function '******************************************************************************* -function hLoadFileExpectFailure( fpath as string ) as boolean - - '///<h3>Load a file where failure is expected</h3> - '///<i>Uses</i>: framework\tools\t_stringtools.inc<br><br> - '///<u>Input</u>: - '///<ol> - '///+<li>Filename incl. extension (string)</li> - '///</ol> - '///<u>Returns</u>: - '///<ol> - '///+<li>Errorcondition (boolean)</li> - '///<ul> - '///+<li>TRUE = There was an error loading the file (as expected)</li> - '///+<li>FALSE = The file was loaded without problems/any other error</li> - '///</ul> - '///</ol> - '///<u>Description</u>: - '///<ul> - - const CFN = "hLoadFileExpectFailure::" - - dim brc as boolean : brc = true - - printlog( CFN & "Enter with option: " & fpath ) - - '///+<li>Click FileOpen</li> - hUseAsyncSlot( "FileOpen" ) - Kontext "OeffnenDLG" - - '///+<li>Enter filepath</li> - DateiName.setText( convertpath( fpath ) ) - - '///+<li>Click "Open"</li> - oeffnen.click() - - '///+<li>Close the expected warning dialog, return to FileOpen</li> - Kontext "Active" - if ( Active.Exists( 1 ) ) then - printlog( CFN & "Expected active: " & active.getText() ) - active.ok() - - Kontext "OeffnenDLG" - if ( OeffnenDlg.exists( 1 ) ) then - OeffnenDLG.cancel() - brc = true - else - warnlog( CFN & "File Open dialog is not open" ) - brc = false - endif - endif - - '///+<li>Verify that we are on FileOpen dialog, set errorcondition true</li> - if ( brc ) then - Kontext "OeffnenDLG" - if ( Oeffnen.exists( 1 ) ) then - printlog( CFN & "File is not loaded, still in File/Open. Good, cancelling" ) - OeffnenDLG.cancel() - brc = true - else - brc = false - endif - endif - - '///+<li>If the document is loaded, set errorcondition to false</li> - if ( not brc ) then - hFileWait( FALSE ) - warnlog( CFN & "The file appears to have loaded correctly. Not good" ) - - '///+<li>Click away possible messagebox to recover</li> - Kontext "Active" - if ( active.exists( 1 ) ) then - printlog( CFN & "Unexpected active: " & active.getText() ) - Active.OK() - endif - endif - - '///+<li>Return errorcondition</li> - hLoadFileExpectFailure() = brc - '///</ul> - -end function - -'******************************************************************************* - function hSaveFileExpectSuccess( fpath as string , bReplace as boolean ) as boolean '///<h3>Save a file with optional replace where success is expected</h3> @@ -514,80 +431,6 @@ end function '******************************************************************************* -function hCreateDirectoryExpectSuccess( dirname as string ) as boolean - - '///<h3>Create a directory where success is expected</h3> - '///<i>Uses</i>: framework\tools\t_stringtools.inc<br><br> - '///<u>Input</u>: - '///<ol> - '///+<li>Name of the directory (string)</li> - '///<ul> - '///+<li>Relative or absolute, absolute is recommended</li> - '///</ul> - '///</ol> - '///<u>Returns</u>: - '///<ol> - '///+<li>Errorcondition (boolean)</li> - '///<ul> - '///+<li>TRUE = The directory wass created</li> - '///+<li>FALSE = On any error (Unable to create or file already exists)</li> - '///</ul> - '///</ol> - '///<u>Description</u>: - '///<ul> - - dim brc as boolean : brc = true - - const CFN = "hCreateDirectoryExpectSuccess::" - printlog( CFN & "Enter with option: " & dirname ) - - '///+<li>Click "File Open"</li> - hUseAsyncSlot( "FileOpen" ) - - '///+<li>Click on "New folder"</li> - Kontext "OeffnenDlg" - if ( OeffnenDlg.exists( 2 ) ) then - - NeuerOrdner.click() - - '///+<li>Enter a name for the folder into the dialog</li> - Kontext "NeuerOrdner" - if ( NeuerOrdner.exists( 1 ) ) then - OrdnerName.setText( dirname ) - - '///+<li>Click "OK"</li> - NeuerOrdner.OK() - else - warnlog( CFN & "New folder dialog did not open." ) - brc = false - endif - - '///+<li>Handle possible messagebox (unexpected)</li> - Kontext "Active" - if Active.Exists( 1 ) then - printlog( CFN & "Unexpected active: " & active.getText() ) - brc = false - try - Active.YES() - catch - Active.OK() - endcatch - endif - else - warnlog( CFN & "File Open dialog is not open." ) - brc = false - endif - - '///+<li>Return errorcondition</li> - printlog( CFN & "Exit with result: " & brc ) - hCreateDirectoryExpectSuccess() = brc - - '///</ul> - -end function - -'******************************************************************************* - function hDeleteFileViaFileOpen( cFile as String ) as boolean '///<h3>Delete a file using the File Open dialog</h3> @@ -693,38 +536,6 @@ function hDeleteFileViaFileOpen( cFile as String ) as boolean end function -'****************************************************************************** - -function hGetFileCountViaFileOpen() as integer - - '///<h3>Get the number of items listed in the FilePicker (File Open)</h3> - '///<i>Note</i>: This function works on the current workdirectory<br><br> - '///<u>Input</u>: - '///<ol> - '///+<li>Nothing</li> - '///</ol> - '///<u>Returns</u>: - '///<ol> - '///+<li>Number of items listed in filepicker</li> - '///</ol> - '///<u>Description</u>: - '///<ul> - - '///+<li>Click "File open"</li> - hUseAsyncSlot( "FileOpen" ) - - '///+<li>Retrieve the number of items in the filepicker window</li> - Kontext "OeffnenDLG" - if ( OeffnenDlg.exists( 2 ) ) then - hGetFileCountViaFileOpen() = DateiAuswahl.getItemCount() - OeffnenDLG.cancel() - else - hGetFileCountViaFileOpen() = -1 - endif - '///</ul> - -end function - '******************************************************************************* function hNameGen_append( iDecChar as long ) as string @@ -801,39 +612,6 @@ end function '******************************************************************************* -function hGetRelPath( cStartDir, cFileName as String ) as string - - '///<h3>Remove the absolute component from a path specification</h3> - '///<i>Usually you do not need this function, avoid using it</i><br><br> - '///<u>Input</u>: - '///<ol> - '///+<li>Absolute part of a filespec (startdirectory) (string)</li> - '///<ul> - '///+<li>e.g. "/home/oscar/mydir"</li> - '///</ul> - '///+<li>Fully qualified path to the file/directory (string)</li> - '///<ul> - '///+<li>e.g. "/home/oscar/mydir/somedir/myfile.txt"</li> - '///</ul> - '///</ol> - '///<u>Returns</u>: - '///<ol> - '///+<li>Remaining part of the fully qualified path minus startdirectory (string)</li> - '///<ul> - '///+<li>e.g. "/somedir/myfile.txt"</li> - '///</ul> - '///</ol> - '///<u>Description</u>: - '///<ul> - - '///+<li>Find the end of startdir within the FQ filename</li> - hGetRelPath() = mid( cFileName , len( cStartDir + 1 ) ) - '///</ul> - -end function - -'******************************************************************************* - function hFindFileObjectViaFileOpen( cName as string ) as integer '///<h3>Get the position of a filesystem object in filelist of fileopen dialog</h3> diff --git a/testautomation/framework/tools/includes/formcontrols.inc b/testautomation/framework/tools/includes/formcontrols.inc index 49c8dbaff943..03ebb004ee3a 100644..100755 --- a/testautomation/framework/tools/includes/formcontrols.inc +++ b/testautomation/framework/tools/includes/formcontrols.inc @@ -31,7 +31,9 @@ ' ** '\****************************************************************************** -public const ICONTROLCOUNT = 22 +private const ICONTROLCOUNT = 22 + +'******************************************************************************* function hGetControlParams( cParam as string ) as integer @@ -72,7 +74,7 @@ function hGetControlParams( cParam as string ) as integer '///+<li>Currently following values are defined:</li> '///<ul> - select case cParam + select case ( cParam ) '///+<li>XOREGO = 31</li> case "XOREGO" : hGetControlParams() = 31 '///+<li>XDIST = 8</li> @@ -123,62 +125,57 @@ function hGetControlName( iControl as integer ) as string '///<u>Description</u>: '///<ul> - - dim sControl as string - '///+<li>Currently following control are defined:</li> '///<ol> select case iControl '///+<li>Push Button</li> - case 1 : sControl = "Push Button" + case 1 : hGetControlName() = "Push Button" '///+<li>Image Control</li> - case 2 : sControl = "Image Control" + case 2 : hGetControlName() = "Image Control" '///+<li>Check Box</li> - case 3 : sControl = "Check Box" + case 3 : hGetControlName() = "Check Box" '///+<li>Radio Button</li> - case 4 : sControl = "Radio Button" + case 4 : hGetControlName() = "Radio Button" '///+<li>Fixed Text</li> - case 5 : sControl = "Fixed Text" + case 5 : hGetControlName() = "Fixed Text" '///+<li>Edit Field</li> - case 6 : sControl = "Edit Field" + case 6 : hGetControlName() = "Edit Field" '///+<li>List Box</li> - case 7 : sControl = "List Box" + case 7 : hGetControlName() = "List Box" '///+<li>Combo Box</li> - case 8 : sControl = "Combo Box" + case 8 : hGetControlName() = "Combo Box" '///+<li>Vertical ScrollBar</li> - case 9 : sControl = "Vertical ScrollBar" + case 9 : hGetControlName() = "Vertical ScrollBar" '///+<li>Horizontal ScrollBar</li> - case 10 : sControl = "Horizontal ScrollBar" + case 10 : hGetControlName() = "Horizontal ScrollBar" '///+<li>Frame</li> - case 11 : sControl = "Frame" + case 11 : hGetControlName() = "Frame" '///+<li>Progress Bar</li> - case 12 : sControl = "Progress Bar" + case 12 : hGetControlName() = "Progress Bar" '///+<li>Vertical Fixed Line</li> - case 13 : sControl = "Vertical Fixed Line" + case 13 : hGetControlName() = "Vertical Fixed Line" '///+<li>Horizontal Fixed Line</li> - case 14 : sControl = "Horizontal Fixed Line" + case 14 : hGetControlName() = "Horizontal Fixed Line" '///+<li>Date Field</li> - case 15 : sControl = "Date Field" + case 15 : hGetControlName() = "Date Field" '///+<li>Time Field</li> - case 16 : sControl = "Time Field" + case 16 : hGetControlName() = "Time Field" '///+<li>Numeric Field</li> - case 17 : sControl = "Numeric Field" + case 17 : hGetControlName() = "Numeric Field" '///+<li>Currency Field</li> - case 18 : sControl = "Currency Field" + case 18 : hGetControlName() = "Currency Field" '///+<li>Form Field</li> - case 19 : sControl = "Form Field" + case 19 : hGetControlName() = "Form Field" '///+<li>Pattern Field</li> - case 20 : sControl = "Pattern Field" + case 20 : hGetControlName() = "Pattern Field" '///+<li>File Control</li> - case 21 : sControl = "File Control" + case 21 : hGetControlName() = "File Control" '///+<li>Tree Control</li> - case 22 : sControl = "Tree Control" + case 22 : hGetControlName() = "Tree Control" '///</ol> '///+<li>"" for function parameter < 1 or > 22 </li> case else : sControl = "" end select - - hGetControlName() = sControl '///</ul> end function @@ -305,14 +302,6 @@ function hDrawControlOnDialog( iControl as integer ) as string const CFN = "hDrawControlOnDialog::" - '///+<li>Verify function parameter (this is a top level function)</li> - if ( ( iControl < 1 ) or ( iControl > ICONTROLCOUNT ) ) then - warnlog( CFN & "Invalid control-number (iControl) passed: " & iControl ) - hDrawControlOnDialog() = false - exit function - endif - - dim sControl as string ' The name of the current control dim brc as boolean ' some returnvalue @@ -330,7 +319,8 @@ function hDrawControlOnDialog( iControl as integer ) as string '///+<li>click the desired control</li> sControl = hInsertControl( iControl ) - printlog( CFN & " at XO=" & iXO & _ + printlog( CFN & " Index=" & iControl & _ + " at XO=" & iXO & _ " XE=" & iXE & _ " YO=" & iYO & _ " YE=" & iYE & _ @@ -405,19 +395,21 @@ function hDrawControl( xPos as integer, _ '///+<li>Mouse up on pos X/Y-End</li> '///</ol> '///</ul> - - DialogWindow.MouseUp( 20 , 20 ) + + autoexecute = false + DialogWindow.MouseUp( 20 , 20 ) : wait 100 try - DialogWindow.MouseDown ( xPos, yPos ) - DialogWindow.MouseMove ( xEnd, yEnd ) - DialogWindow.MouseUp ( xEnd, yEnd ) + DialogWindow.MouseMove ( xPos, yPos ) : wait 100 + DialogWindow.MouseDown ( xPos, yPos ) : wait 100 + DialogWindow.MouseMove ( xEnd, yEnd ) : wait 100 + DialogWindow.MouseUp ( xEnd, yEnd ) : wait 100 hDrawControl() = true catch warnlog( "#i39852# " & CFN & "Unable to complete mouseactions on dialog" ) hDrawControl() = false endcatch - + autoexecute = true end function @@ -459,18 +451,15 @@ function hGetControlPosXO( iControl as integer ) as integer '///+<li>13 ... 18 : Column three</li> '///+<li>> 18 : Column four</li> '///</ul> - '///</ul> - - if ( iControl <= 6 ) then - hGetControlPosXO() = xOffset - elseif( ( iControl >= 7 ) and ( iControl <= 12 ) ) then - hGetControlPosXO() = xOffset + 1 * xDistance - elseif( ( iControl >= 13 ) and ( iControl <= 18 ) ) then - hGetControlPosXO() = xOffset + 2 * xDistance - else - hGetControlPosXO() = xOffset + 3 * xDistance - endif - + '///</ul> + + select case ( iControl ) + case 1, 2, 3, 4, 5, 6 : hGetControlPosXO() = xOffset + case 7, 8, 9, 10, 11, 12 : hGetControlPosXO() = xOffset + 1 * xDistance + case 13, 14, 15, 16, 17, 18 : hGetControlPosXO() = xOffset + 2 * xDistance + case 19, 20, 21, 22, 23, 24 : hGetControlPosXO() = xOffset + 3 * xDistance + end select + end function '******************************************************************************* @@ -514,13 +503,13 @@ function hGetControlPosYO( iControl as integer ) as integer '///</ul> '///</ul> - select case iControl - case 1 , 7 , 13 , 19 : hGetControlPosYO() = yOffset - case 2 , 8 , 14 , 20 : hGetControlPosYO() = yOffset + 1 * yDistance - case 3 , 9 , 15 , 21 : hGetControlPosYO() = yOffset + 2 * yDistance - case 4 , 10 , 16 , 22 : hGetControlPosYO() = yOffset + 3 * yDistance - case 5 , 11 , 17 : hGetControlPosYO() = yOffset + 4 * yDistance - case 6 , 12 , 18 : hGetControlPosYO() = yOffset + 5 * yDistance + select case ( iControl ) + case 1, 7, 13, 19 : hGetControlPosYO() = yOffset + case 2, 8, 14, 20 : hGetControlPosYO() = yOffset + 1 * yDistance + case 3, 9, 15, 21 : hGetControlPosYO() = yOffset + 2 * yDistance + case 4, 10, 16, 22 : hGetControlPosYO() = yOffset + 3 * yDistance + case 5, 11, 17, 23 : hGetControlPosYO() = yOffset + 4 * yDistance + case 6, 12, 18, 24 : hGetControlPosYO() = yOffset + 5 * yDistance end select end function @@ -679,8 +668,7 @@ function hSelectControl( iControl as integer ) as boolean '///+ dialog pane. To prevent the controls from overlapping each other '///+ they are arranged in rows and columns. Each control is identified '///+ by a unique number (see description for hInsertControl(...)). The - '///+ dimensions are defined in hGetControlParams(...). The coordinates - '///+ returned by this function can be used to draw and to select a control.</i><br> + '///+ dimensions are defined in hGetControlParams(...).</i><br> '///<u>Input</u>: '///<ol> '///+<li>Number of the control (integer)</li> @@ -701,16 +689,18 @@ function hSelectControl( iControl as integer ) as boolean dim xPos as integer dim yPos as integer - dim iTry as integer ' we try five times to grab the control - dim iTab as integer + dim iCurrentSelectionMethod as integer - hSelectControl() = false + const SELECT_MIDDLE = 1 ' click into the middle of the control + const SELECT_UPPER_LEFT = 2 ' click the upper left corner of the control + const SELECT_LOWER_RIGHT = 3 ' click the lower right corner of the control + const SELECT_FRAME_AROUND = 4 ' select by drawing a frame around the control - '///+<li>Check function parameter, this is a top level function</li> - if ( ( iControl < 1 ) or ( iControl > ICONTROLCOUNT ) ) then - warnlog( "Incorrect index passed to function" ) - exit function - endif + const EXTRA_FRAME_SIZE = 1 ' one percent in-/outside the border of the control + const SELECTION_METHODS = 4 ' this function sports four ways of seleting a control + const REPEAT_COUNT = 5 ' number of times to send a keystroke to the dialog window + + hSelectControl() = false '///+<li>Verify that the ToolsCollectionBar is visible. if not: Abort</li> kontext "ToolsCollectionBar" @@ -737,10 +727,6 @@ function hSelectControl( iControl as integer ) as boolean ' Method 4 is dangerous because it might accidentially select the ' background window which is the reason why this is not the default. - ' New: Method 5 is troublesome as well because #i79126 does not enable the - ' OpenProperties-button on the Macro Controls Float. Currently it is just used - ' to see what happens if we hack alog using keystrokes. Experimental. - '///+<li>Try four different ways of selecting the control before giving up</li> '///<ol> '///+<li>Mouse-Click in the middle</li> @@ -749,66 +735,64 @@ function hSelectControl( iControl as integer ) as boolean '///+<li>Rubberband around the control (Mouse movement)</li> '///+<li>Deselct everything and use <TAB> to activate the control</li> '///</ol> - for iTry = 1 to 5 - + + autoexecute = false + for iCurrentSelectionMethod = 1 to SELECTION_METHODS + Kontext "BasicIDE" - - select case iTry - case 1 + DialogWindow.typeKeys( "<UP><LEFT>" , REPEAT_COUNT ) + select case ( iCurrentSelectionMethod ) + case SELECT_MIDDLE + xPos = hGetControlPosXM( iControl ) yPos = hGetControlPosYM( iControl ) DialogWindow.MouseMove( xPos, yPos ) DialogWindow.MouseDown( xPos, yPos ) - DialogWindow.MouseUp ( xPos, yPos ) - case 2 - xPos = hGetControlPosXO( iControl ) - yPos = hGetControlPosYO( iControl ) + DialogWindow.MouseUp ( xPos, yPos ) + + case SELECT_UPPER_LEFT + + xPos = hGetControlPosXO( iControl ) + EXTRA_FRAME_SIZE + yPos = hGetControlPosYO( iControl ) + EXTRA_FRAME_SIZE DialogWindow.MouseMove( xPos, yPos ) DialogWindow.MouseDown( xPos, yPos ) - DialogWindow.MouseUp ( xPos, yPos ) - case 3 - xPos = hGetControlPosXE( iControl ) - yPos = hGetControlPosYE( iControl ) + DialogWindow.MouseUp ( xPos, yPos ) + + case SELECT_LOWER_RIGHT + + xPos = hGetControlPosXE( iControl ) - EXTRA_FRAME_SIZE + yPos = hGetControlPosYE( iControl ) - EXTRA_FRAME_SIZE DialogWindow.MouseMove( xPos, yPos ) DialogWindow.MouseDown( xPos, yPos ) - DialogWindow.MouseUp ( xPos, yPos ) - case 4 - xPos = hGetControlPosXO( iControl ) - 2 - yPos = hGetControlPosYO( iControl ) - 2 + DialogWindow.MouseUp ( xPos, yPos ) + + case SELECT_FRAME_AROUND + + xPos = hGetControlPosXO( iControl ) - EXTRA_FRAME_SIZE + yPos = hGetControlPosYO( iControl ) - EXTRA_FRAME_SIZE DialogWindow.MouseMove( xPos, yPos ) DialogWindow.MouseDown( xPos, yPos ) - DialogWindow.MouseUp ( xPos, yPos ) - xPos = hGetControlPosXE( iControl ) + 2 - yPos = hGetControlPosYE( iControl ) + 2 + xPos = hGetControlPosXE( iControl ) + EXTRA_FRAME_SIZE + yPos = hGetControlPosYE( iControl ) + EXTRA_FRAME_SIZE DialogWindow.MouseMove( xPos, yPos ) - DialogWindow.MouseUp ( xPos, yPos ) - case 5 - qaerrorlog( "#i79126# - OpenProperties disabled when selecting control via tab" ) - 'xPos = 80 - 'yPos = 20 - 'DialogWindow.MouseDown( xPos, yPos ) - 'DialogWindow.MouseUp ( xPos, yPos ) - 'for iTab = 1 to iControl + 1 - ' DialogWindow.typeKeys( "<TAB>" ) - 'next iTab + DialogWindow.MouseUp ( xPos, yPos ) + end select - - - - '///+<li>Check that the ToolsCollectionBar is open</li> - kontext "ToolsCollectionBar" - if ( ToolsCollectionBar.exists() ) then - wait( 300 ) - if ( OpenProperties.isEnabled() ) then - hSelectControl() = true - exit for - else - wait( 500 ) + + try + if ( iControl = 11 ) then + wait( 100 ) + printlog( "tried method: " & iCurrentSelectionMethod ) endif - endif + ContextProperties + hSelectControl() = true + exit for + catch + endcatch - next iTry + next iCurrentSelectionMethod + autoexecute = true '///</ul> end function diff --git a/testautomation/framework/tools/includes/help_tools.inc b/testautomation/framework/tools/includes/help_tools.inc index ed55c319fd40..8552954f4f34 100644..100755 --- a/testautomation/framework/tools/includes/help_tools.inc +++ b/testautomation/framework/tools/includes/help_tools.inc @@ -33,81 +33,35 @@ function hOpenHelp() as boolean - '///<h3>Function to open the Help Browser</h3> - '///<u>Input</u>: - '///<ol> - '///+<li>Nothing</li> - '///</ol> - - '///<u>Returns</u>: - '///<ol> - '///+<li>Errorcondition (boolean)</li> - '///<ul> - '///+<li>TRUE if the help is open</li> - '///+<li>FALSE if the help did not open</li> - '///</ul> - '///</ol> - - '///<u>Description</u>: - '///<ul> - - const CFN = "hOpenHelp::" + printlog( "Open Help Browser" ) HelpContents - - if ( WaitSlot( 3000 ) <> WSFinished ) then - printlog( CFN & "Failed to open help" ) - hOpenHelp() = FALSE + + kontext "StarOfficeHelp" + if ( StarOfficeHelp.exists( 5 ) ) then + hOpenHelp() = TRUE else - kontext "StarOfficeHelp" - if ( StarOfficeHelp.exists() ) then - printlog( CFN & "Help was opened" ) - hOpenHelp() = TRUE - else - printlog( CFN & "Help was not opened" ) - hOpenHelp() = FALSE - endif + warnlog( "Unable to open help browser" ) + hOpenHelp() = FALSE endif - + + end function '******************************************************************************* function hCloseHelp() as boolean - '///<h3>Function to close the Help Browser</h3> - '///<u>Input</u>: - '///<ol> - '///+<li>Nothing</li> - '///</ol> - - '///<u>Returns</u>: - '///<ol> - '///+<li>Errorcondition (boolean)</li> - '///<ul> - '///+<li>TRUE if the help is closed</li> - '///+<li>FALSE if the help did not close</li> - '///</ul> - '///</ol> - - const CFN = "hCloseHelp::" + printlog( "Close Help Browser" ) kontext "StarOfficeHelp" - if ( StarOfficeHelp.exists() ) then - - hUseAsyncSlot( "FileClose") - StarOfficeHelp.notExists( 3 ) - - if ( StarOfficeHelp.Exists() ) then - printlog( CFN & "Help was not closed") - hCloseHelp() = FALSE - else - printlog( CFN & "Help was closed") - hCloseHelp() = TRUE - endif - else - printlog( CFN & "Help is not open, no action taken") + StarOfficeHelp.typeKeys( "<MOD1 F4>" ) + + if ( StarOfficeHelp.notExists( 3 ) ) then hCloseHelp() = TRUE + else + warnlog( "Help browser could not be closed" ) + hCloseHelp() = FALSE endif end function @@ -125,9 +79,9 @@ function hSelectHelpTab( cTab as string ) as boolean '///+<li>"index" for the index tab</li> '///+<li>"find" for the find tab</li> '///+<li>"bookmarks" for the bookmarks tab</li> - '///</ul> + '///</ul> '///</ol> - + '///<u>Returns</u>: '///<ol> '///+<li>Errorcondition (boolean)</li> @@ -136,19 +90,16 @@ function hSelectHelpTab( cTab as string ) as boolean '///+<li>FALSE if the requested tabpage did not open</li> '///</ul> '///</ol> - - '///<u>Description</u>: + + '///<u>Description</u>: '///<ul> const CFN = "hSelectHelpTab::" - dim brc as boolean - brc = false - - dim cTabName as string - cTabName = lcase( cTab ) + dim brc as boolean : brc = false + dim cTabName as string : cTabName = lcase( cTab ) kontext "StarOfficeHelp" - + printlog( CFN & "Enter" ) '///+<li>Select the requested Tabpage, verify that it is open</li> @@ -173,7 +124,7 @@ function hSelectHelpTab( cTab as string ) as boolean call DialogTest( BookmarksPage ) brc = true endif - case else + case else printlog( CFN & "Invalid parameter passed to function: " & cTab ) printlog( CFN & "Valid are: content, index, find, bookmarks" ) brc = false @@ -183,9 +134,9 @@ function hSelectHelpTab( cTab as string ) as boolean if ( brc ) then printlog( CFN & "Exit: Selected Tabpage: " & cTab ) endif - + '///+<li>Return TRUE or FALSE</li> - hSelectHelpTab() = brc + hSelectHelpTab() = brc '///</ul> end function @@ -202,9 +153,9 @@ function hUseBookmarksContextMenu( cAction as string ) as boolean '///+<li>"show"</li> '///+<li>"rename"</li> '///+<li>"delete"</li> - '///</ul> + '///</ul> '///</ol> - + '///<u>Returns</u>: '///<ol> '///+<li>Errorcondition (boolean)</li> @@ -213,13 +164,13 @@ function hUseBookmarksContextMenu( cAction as string ) as boolean '///+<li>FALSE on any other error</li> '///</ul> '///</ol> - - '///<u>Description</u>: + + '///<u>Description</u>: '///<ul> const CFN = "hUseBookmarksContextMenu::" dim cSelection as string dim iActionPos as integer - + printlog( CFN & "Enter" ) '///+<li>Verify that we are on the Bookmarks Page</li> @@ -245,7 +196,7 @@ function hUseBookmarksContextMenu( cAction as string ) as boolean hUseBookmarksContextMenu() = false exit function endif - + '///+<li>Open the context menu and select the requested index</li> kontext "Bookmarks" Bookmarks.openContextMenu() @@ -254,178 +205,35 @@ function hUseBookmarksContextMenu( cAction as string ) as boolean '///+<li>Return TRUE if all went well so far</li> hUseBookmarksContextMenu() = true - - '///</ul> - -end function -'******************************************************************************* - -function hHelpGetAboutItemCount() as integer - - '///<h3>Get the number of applications listed in the Help ListBox</h3> - - '///<u>Input</u>: - '///<ol> - '///+<li>Nothing</li> - '///</ol> - - '///<u>Returns</u>: - '///<ol> - '///+<li>Number of applications listed (integer)</li> - '///<ul> - '///+<li>The default is 7</li> '///</ul> - '///</ol - - '///<u>Description</u>: - '///<ul> - - const I_ABOUT_ITEMS = 8 - const CFN = "hHelpGetAboutItemCount::" - - dim iItem as integer - dim cItemName as string - dim iAboutItems as integer - dim brc as boolean - - printlog( CFN & "Enter" ) - - '///+<li>Open Help</li> - brc = hOpenHelp() - if ( not brc ) then - qaerrorlog( CFN & "Help not open, aborting" ) - hHelpGetAboutItemCount() = 0 - exit function - endif - - hSelectHelpTab( "index" ) - Kontext "IndexPage" - - '///+<li>get the number of applications from the drop down box</li> - iAboutItems = HelpAbout.getItemCount() - if ( iAboutItems <> I_ABOUT_ITEMS ) then - warnlog( "The list of topics is incomplete:" ) - endif - - '///+<li>Print the list of items to the log</li> - printlog( CFN & "Items listed in Application Listbox (HelpAbout)" ) - for iItem = 1 to iAboutItems - cItemName = HelpAbout.getItemText( iItem ) - printlog( " " & cItemName ) - next iItem - - '///+<li>close help</li> - hCloseHelp() - '///</ul> - - printlog( CFN & "Exit with item count = " & iAboutItems ) - hHelpGetAboutItemCount() = iAboutItems - -end function - -'******************************************************************************* - -function hHelpGetSearchIndexItemCount() as integer - '///<h3>Get the number of items in the Help Search Index</h3> - '///<i>Starting point: Help / Index page</i><br> - '///<i>Note: Workaround for incorrect value returned by .getItemCount()</i><br> - - '///<u>Input</u>: - '///<ol> - '///+<li>Nothing</li> - '///</ol> - - '///<u>Returns</u>: - '///<ol> - '///+<li>Number of items in the list (integer)</li> - '///</ol> - - '///<u>Description</u>: - '///<ul> - - const CFN = "hHelpGetSearchIndexItemCount:" - - dim iItem as integer - printlog( CFN & "Enter" ) - - '///+<li>Run through the list and count the items, break on error</li> - for iItem = 1 to 10000 - - try - SearchIndex.select( iItem ) - catch - iItem = iItem - 1 - exit for - endcatch - - next iItem - - printlog( CFN & "Exit with item count = " & iItem ) - hHelpGetSearchIndexItemCount() = iItem - '///</ul> - end function '******************************************************************************* -function hGetHelpContentHeader( iLength as integer ) as string - - - '///<h3>Get the header of the content in the help browser</h3> - '///<i>This is the first line of the content page, truncated (if desired)</i><br><br> +function hHelpGetAboutItemCount() as integer - '///<u>Parameter(s):</u><br> - '///<ol> - '///+<li>Length of the requested string (Integer)</li> - '///<ul> - '///+<li>The max length of the string to be returned</li> - '///+<li>≤ 0 = do not truncate</li> - '///</ul> - '///</ol> + printlog( "Get the number of applications listed in the help listbox (should be 8)" ) + const ABOUT_ITEMS = 8 + dim itemcount as integer - '///<u>Returns:</u><br> - '///<ol> - '///+<li>Header (String)</li> - '///<ul> - '///+<li>A string containing the content header</li> - '///+<li>The header is the first line of the content page</li> - '///</ul> - '///</ol> + hOpenHelp() + hSelectHelpTab( "index" ) - const CFN = "hGetHelpContentHeader::" - printlog( CFN & "Enter with option (iLength): " & iLength ) - dim cHeaderString as string + Kontext "IndexPage" + itemcount = HelpAbout.getItemCount() - '///<u>Description:</u> - '///<ul> - '///+<li>Maximize the help viewer (required to avoid cut off strings)</li> - kontext "HelpContent" - 'StarOfficeHelp.maximize() - - '///+<li>Go to the top left position in the help browser</li> - HelpContent.typeKeys( "<MOD1 HOME>" ) - - '///+<li>Mark the entire line - note that this ends at the linebreak</li> - HelpContent.typeKeys( "<SHIFT END>" ) - - '///+<li>Copy the string to the clipboard</li> - EditCopy - - '///+<li>Assign the string to a variable</li> - cHeaderString = getClipboardText - - '///+<li>Truncate string</li> - if ( iLength > 0 ) then - if ( len( cHeaderString ) > iLength ) then - cHeaderString = left( cHeaderString, iLength ) - endif + if ( itemcount <> ABOUT_ITEMS ) then + warnlog( "Number of applications is incorrect" ) + printlog( "Found...: " & itemcount ) + printlog( "Expected: " & ABOUT_ITEMS endif - '///</ul> - printlog( CFN & "Exit: " & cHeaderString ) - hGetHelpContentHeader() = cHeaderString + hCloseHelp() + + hHelpGetAboutItemCount() = itemcount end function + diff --git a/testautomation/framework/tools/includes/i18n_tools.inc b/testautomation/framework/tools/includes/i18n_tools.inc index a2b65e12b736..131f162c8436 100644..100755 --- a/testautomation/framework/tools/includes/i18n_tools.inc +++ b/testautomation/framework/tools/includes/i18n_tools.inc @@ -31,90 +31,6 @@ '* '\****************************************************************************** -function hGetI18nData( cSection as string, cLanguage as string ) as string - - '///<h3>Retrieve various information about i18n</h3> - '///<i>Uses datafile: framework/tools/input/i18ndata.txt</i><br> - '///<u>Input</u>: - '///<ol> - '///+<li>Section from which to retrieve the data (string)</li> - '///<ul> - '///+<li>Any name of a section existing in the datafile</li> - '///</ul> - '///+<li>Language code as string</li> - '///<ul> - '///+<li>Use hGetTwoDigitLangCode(...) to ensure proper string formatting</li> - '///</ul> - '///</ol> - '///<u>Returns</u>: - '///<ol> - '///+<li>Language identifier (string)</li> - '///</ol> - '///<u>Description</u>: - '///<ul> - - '///+<li>Create the path to the datafile</li> - dim cPath as string - cPath = gTesttoolPath & "framework\tools\input\i18ndata.txt" - cPath = convertpath( cPath ) - - '///+<li>Find out the required size of the array to hold the entire file</li> - dim iFileSize as integer - iFileSize = hListFileGetSize( cPath ) - - '///+<li>Define an array to hold the datafile</li> - dim aFileContent( iFileSize ) as string - - '///+<li>Retrieve the requested section from the datafile</li> - hGetDatafileSection( cPath, aFileContent(), cSection, "", "" ) - - '///+<li>Isolate the requested language item</li> - hGetI18nData() = hGetValueForKeyAsString( aFileContent(), cLanguage ) - - '///</ul> - -end function - -'******************************************************************************* - -function hGetTwoDigitLangCode( iLanguage as integer ) as string - - '///<h3>Retrieve a two digit language code from integer</h3> - '///<i>Replaces and enhances deprecated sub "siSpracheSetzen"</i><br> - '///<u>Input</u>: - '///<ol> - '///+<li>Language Code (integer)</li> - '///<ul> - '///+<li>Any number between (and including) 1 and 99</li> - '///</ul> - '///</ol> - '///<u>Returns</u>: - '///<ol> - '///+<li>Language Code (string)</li> - '///<ul> - '///+<li>1 - 9 -> "01" - "09"</li> - '///+<li>10 - 99 -> "10" - "99"</li> - '///</ul> - '///</ol> - '///<u>Description</u>: - '///<ul> - dim cLanguage as string - - '///+<li>Convert single digit language code to two digit language string</li> - if ( ( iLanguage > 0 ) and ( iLanguage < 10 ) ) then - cLanguage = "0" & iLanguage - else - cLanguage = iLanguage - endif - - hGetTwoDigitLangCode() = cLanguage - '///</ul> - -end function - - -'******************************************************************************* - function hTestLocale() as boolean diff --git a/testautomation/framework/tools/includes/init_tools.inc b/testautomation/framework/tools/includes/init_tools.inc deleted file mode 100644 index e7b90fa75523..000000000000 --- a/testautomation/framework/tools/includes/init_tools.inc +++ /dev/null @@ -1,205 +0,0 @@ -'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 : joerg.skottke@sun.com -'* -'* short description : Tools to put the office into a defined state -'* -'\****************************************************************************** - -function hInitSingleDoc() as boolean - - '///<h3>Make sure exactly one single writer document is open</h3> - '///<i>The wizards cannot be triggered correctly from the backing window. - '///+ As a workaround this function checks the amount of open documents and - '///+ creates exactly one unchanged Writer document</i><br><br> - - '///<u>Parameter(s):</u><br> - '///<ol> - '///+<li>No input parameters</li> - '///</ol> - - - '///<u>Returns:</u><br> - '///<ol> - '///+<li>Errorcondition (Boolean)</li> - '///<ul> - '///+<li>TRUE: Exactly one Writer document is open</li> - '///+<li>FALSE: Any error</li> - '///</ul> - '///</ol> - - const CFN = "hInitSingleDoc::" - dim cOldApplication as string - - '///<u>Description:</u> - '///<ul> - '///+<li>Close all documents until we are on the backing window</li> - do while ( getDocumentCount > 0 ) - call hCloseDocument() - loop - - '///+<li>Save the previous gApplication</li> - cOldApplication = gApplication - - '///+<li>Set gApplication to WRITER</li> - gApplication = "WRITER" - - '///+<li>Open one new Writer document</li> - call hNewDocument() - - '///+<li>Verify that exactly one document is open</li> - if ( getDocumentCount = 1 ) then - printlog( CFN & "A single unchanged writer document is open" ) - hInitSingleDoc() = true - else - printlog( CFN & "Failed to open just one single writer document" ) - hInitSingleDoc() = false - endif - - '///+<li>Restore gApplication</li> - gApplication = cOldApplication - '///</ul> - -end function - -'******************************************************************************* - -function hInitBackingMode() as boolean - - use "global\tools\includes\optional\t_docfuncs.inc" - - '///<h3>Make that we are on the backing window (no open documents)</h3> - '///<i>Close all open documents</i><br><br> - - '///<u>Parameter(s):</u><br> - '///<ol> - '///+<li>No input parameters</li> - '///</ol> - - - '///<u>Returns:</u><br> - '///<ol> - '///+<li>Errorcondition (Boolean)</li> - '///<ul> - '///+<li>TRUE: No open documents are present</li> - '///+<li>FALSE: Any error</li> - '///</ul> - '///</ol> - - const CFN = "hInitBackingMode::" - - '///<u>Description:</u> - '///<ul> - '///+<li>Close all documents until we are on the backing window</li> - do while ( getDocumentCount > 0 ) - hCloseDocument() - loop - - '///+<li>verify that we do not have any open documents left (redundant check)</li> - if ( getDocumentCount = 0 ) then - printlog( CFN & "Office is in backing mode." ) - hInitBackingMode() = true - else - printlog( CFN & "Office is in undefined state." ) - hInitBackingMode() = false - endif - '///</ul> - -end function - -'******************************************************************************* - -function hInitWriteDocIdentifier( cString as string ) as boolean - - - '///<h3>Write a specific string to an open writer document</h3> - '///<i>This function verifies that exactly one document is open, that this is a - '///+ Writer document and writes the string to the document</i><br><br> - - '///<u>Parameter(s):</u><br> - '///<ol> - - '///+<li>A free form string (String) which serves as identifier for the document</li> - '///<ul> - '///+<li>The first character should be uppercase</li> - '///</ul> - - '///</ol> - - - '///<u>Returns:</u><br> - '///<ol> - '///+<li>Errorcondition (Boolean)</li> - '///<ul> - '///+<li>TRUE: The string was written correctly</li> - '///+<li>FALSE: Too many open documents</li> - '///+<li>FALSE: Not a Writer document</li> - '///+<li>FALSE: Any other error</li> - '///</ul> - '///</ol> - - const CFN = "hInitWriteDocIdentifier::" - - '///<u>Description:</u> - '///<ul> - '///+<li>Verify number of open documents</li> - if ( getDocumentCount <> 1 ) then - printlog( CFN & "Incorrect document count" ) - hInitWriteDocIdentifier() = false - exit function - endif - - '///+<li>Verify that it is a writer document</li> - kontext "DocumentWriter" - if ( not DocumentWriter.exists() ) then - printlog( CFN & "Open document is not a text document" ) - hInitWriteDocIdentifier() = false - exit function - endif - - '///+<li>Write the string</li> - kontext "DocumentWriter" - DocumentWriter.typeKeys( "<MOD1 END>" ) - DocumentWriter.typeKeys( "<MOD1 SHIFT HOME>" ) - DocumentWriter.typeKeys( "<DELETE>" ) - DocumentWriter.typekeys( cString ) - - '///+<li>Verify the string</li> - DocumentWriter.typeKeys( "<MOD1 END>" ) - DocumentWriter.typeKeys( "<MOD1 SHIFT HOME>" ) - EditCopy - if ( getClipboardText = cString ) then - printlog( CFN & "Document has been successfully modified." ) - hInitWriteDocIdentifier() = true - else - printlog( CFN & "Could not verify document identification string" ) - hInitWriteDocIdentifier() = false - endif - '///</ul> - -end function diff --git a/testautomation/framework/tools/includes/javatools.inc b/testautomation/framework/tools/includes/javatools.inc deleted file mode 100644 index d5ac6fd36148..000000000000 --- a/testautomation/framework/tools/includes/javatools.inc +++ /dev/null @@ -1,151 +0,0 @@ -'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 : joerg.Skottke@Sun.Com -'* -'* short description : Tools to ease working with files including Java -'* -'\****************************************************************************** - -function hBatchLoadJavaFiles( aFileList() , cIdent as string ) - - '///<h3>Load and close a list of files with recovery on error</h3> - '///<u>Input</u>: A list containing files to load<br> - '///<u>Returns</u>: No returnvalue - '///<ul> - - const CFN = "hBatchLoadJavaFiles::" - - dim iSourceFiles as integer - iSourceFiles = listcount( aFileList() ) - - dim iCurrentFile as integer - dim cCurrentFile as string - dim brc as boolean - - '///+<li>Loop through the list, starting at index 2</li> - for iCurrentFile = 2 to iSourceFiles - - cCurrentFile = aFileList( iCurrentFile ) - - printlog( "" ) - printlog( "Processing file: " & cCurrentFile ) - - '///+<li>Load a file, verify</li> - brc = hFileOpen( aFileList( iCurrentFile ) ) - if ( not brc ) then - warnlog( "Error while loading: " & cCurrentFile ) - endif - - '///+<li>close the file, verify</li> - brc = hDestroyDocument() - if ( not brc ) then - warnlog( "Error while closing: " & cCurrentFile ) - endif - - '///+<li>There should be one document left: The first doc</li> - if ( getDocumentCount() = 1 ) then - brc = hIdentifyWriterDoc( cIdent , false ) - if ( not brc ) then - warnlog( "Document <" & cIdent & "> is missing, restarting" ) - call ExitRestartTheOffice() - endif - - elseif ( getDocumentCount() <> 1 ) then - warnlog( "The number of open documents is incorrect, restarting" ) - call ExitRestartTheOffice() - - endif - - '///+<li>Check for hs_err_pidXXXX.log files (Java Exceptions)</li> - brc = hFindCopyRemoveJavaLogs( aFileList( 1 ) ) - if ( not brc ) then - warnlog( "Java Exceptions were created." ) - printlog( "Find the files in your local OOo-work directory." ) - endif - - next iCurrentFile - '///</ul> - -end function - -'******************************************************************************* - -function hFindCopyRemoveJavaLogs( cSourcePath as string ) as boolean - - '///<h3>Search/move hs_err_pidXXXX.log files within a directory recursively</h3> - '///<u>Input</u>: Start directory<br> - '///<u>Returns</u>: TRUE if no errors were found - '///<ul> - - ' Reason 1: The files are createn in the CVS tree and must be removed - ' Reason 2: The files have to be analyzed so the bugs can be fixed - ' Reason 3: The files must be moved away after each error so they can be - ' assigned to the correct documents - - const CFN = "hFindCopyRemoveJavaLogs::" - - dim aSourceFiles( 1000 ) as string - dim iSourceFiles as integer - dim aTargetPath as string - aTargetPath = hGetWorkPath() - - dim iCurrentFile as integer - dim brc as boolean - brc = true - - dim iSPLen as integer ' length of the source-path string + "/" + next letter - iSPLen = len( cSourcePath ) + 2 - - '///+<li>Look for leftover hs_err_pidXXXX.log files</li> - iSourceFiles = GetAllFileList( cSourcePath, "hs_err*.log", aSourceFiles() ) - if ( iSourceFiles > 1 ) then - - '///+<li>Print the list to the log</li> - hListPrint( aSourceFiles(), "New hs_err_pidXXXX.log files exist" ) - brc = false - - '///+<li>Copy the hs_err...log files to the local work directory</li> - for iCurrentFile = 2 to listcount( aSourceFiles() ) - - ' Create the name of the file we want to copy the hs_err...log to - aTargetPath = aTargetPath & mid( aSourceFiles( iCurrentFile ) , iSPLen ) - FileCopy( aSourceFiles( iCurrentFile ) , aTargetPath ) - - '///+<li>Delete the original log file(s)</li> - hDeleteFile( aSourceFiles( iCurrentFile ) ) - - next iCurrentFile - - else - Printlog( CFN & "No hs_err_pidXXXX.log file(s) found. Good." - endif - '///</ul> - - hFindCopyRemoveJavaLogs() = brc - -end function diff --git a/testautomation/framework/tools/includes/options_tools.inc b/testautomation/framework/tools/includes/options_tools.inc index baffbc968406..27969686dea6 100644..100755 --- a/testautomation/framework/tools/includes/options_tools.inc +++ b/testautomation/framework/tools/includes/options_tools.inc @@ -145,84 +145,6 @@ end sub '******************************************************************************* -function URLGraphicCheck ( bRelativ as Boolean, sFile as String ) - - Dim sGraphicPath, sTestString, sDummy as String - Dim lsFile ( 200 ) as String - Dim i as Integer - '///check if the pathname of a linked file is relative or not ( only for func_LoadSaveGeneral_2 ) - sGraphicPath = ( "/share/gallery/photos/desert1.jpg" ) - ListRead ( lsFile(), sFile ) - - for i=1 to ListCount ( lsFile() ) - - if Instr( lsFile(i), "IMG SRC" ) <> 0 then - sTestString = lsFile(i) - i=1000 - end if - - next i - - if bRelativ = TRUE then - - if Instr( sTestString, "../.." ) = 0 then - Warnlog "Bug => The path is not relativ!" - endif - - if Instr( sTestString, "file:///" ) <> 0 then - Warnlog "Bug => The relativ path contains 'file:///'" - endif - - else - if Instr( sTestString, "file:///" ) = 0 then - Warnlog "Bug => The path is relativ!" - endif - - if Instr( sTestString, "../.." ) <> 0 then - Warnlog "Bug => The nonrelativ path ( file:/// ) is not correct. It contains '../..'!" - endif - - end if - - if Instr( sTestString, sGraphicPath ) = 0 then - Warnlog "Wrong path to file, the graphic-part in filename is not correct!" - endif - -end function - -'******************************************************************************* - -sub DialogTestForViewOptions - - FormatParagraph - - Kontext - active.SetPage TabEinzuegeUndAbstaende - Active.SetPage TabAusrichtungAbsatz - active.SetPage TabTextfluss - - try - active.SetPage TabAsianTypography - catch - endcatch - - active.SetPage TabNumerierungAbsatz - active.SetPage TabTabulator - active.SetPage TabInitialen - active.SetPage TabUmrandung - active.SetPage TabHintergrund - - kontext "TabHintergrund" - TabHintergrund.Close - EditSearchAndReplace - - Kontext "FindAndReplace" - FindAndReplace.Close - -end sub - -'******************************************************************************* - sub Make3D '///test with 3D-objects when 3D-options are changed ( view page ) diff --git a/testautomation/framework/tools/includes/pbrowser_tools.inc b/testautomation/framework/tools/includes/pbrowser_tools.inc index fefc739e48ea..912b3f85aec2 100644..100755 --- a/testautomation/framework/tools/includes/pbrowser_tools.inc +++ b/testautomation/framework/tools/includes/pbrowser_tools.inc @@ -31,173 +31,109 @@ '* '\****************************************************************************** -private const DEBUG_ENABLE = false - function hOpenPropertyBrowser() as boolean - - '///<h3>Function to open the properties of a selected control</h3> - '///<i>The function verifies that the property browser is really open and - '///+ ensures that we are on the General tabpage</i><br><br> - - '///<u>Input</u>: - '///<ol> - - '///+<li>Nothing</li> - - '///</ol> - - '///<u>Returns</u>: - '///<ol> - - '///+<li>Errorcondition (boolean)</li> - '///<ul> - '///+<li>TRUE on successful open of the property browser</li> - '///+<li>FALSE on any error</li> - '///</ul> - - '///</ol> - - '///<u>Description</u>: - '///<ul> - - const CFN = "hOpenPropertyBrowser::" - dim irc as integer - - '///+<li>Open the property browser (call slot)</li> - irc = hUseAsyncSlot( "ContextProperties" ) - - ' Check that the slot did indeed get executed. If not: Warn and exit - if ( irc = -1 ) then - warnlog( CFN & "hUseAsyncSlot timed out for <ContextProperties>" ) - hOpenPropertyBrowser() = false - exit function - endif - - '///+<li>Verify that the property browser is open</li> + + '///<h3>Open the BASIC property browser</h3> + + const CFN = "framework::tools::includes::pbrowser_tools.inc::hOpenPropertyBrowser(): " + kontext "ControlPropertiesTabControl" - if ( ControlPropertiesTabControl.exists( 2 ) ) then - - '///+<li>Activate General-tabpage</li> - ControlPropertiesTabControl.setPage( TabGeneralControl ) - - '///+<li>Verify that the General-tabpage is visible</li> - kontext "TabGeneralControl" - if ( TabGeneralControl.isVisible() ) then - printlog( CFN & "ok" ) - hOpenPropertyBrowser() = true + if ( ControlPropertiesTabControl.exists() ) then + printlog( "Property Browser is already open, no action taken" ) + hOpenPropertyBrowser() = true + else + if ( hUseAsyncSlot( "ContextProperties" ) <> -1 ) then + kontext "ControlPropertiesTabControl" + if ( ControlPropertiesTabControl.exists( 2 ) ) then + ControlPropertiesTabControl.setPage( TabGeneralControl ) + hOpenPropertyBrowser() = true + else + warnlog( CFN & "Dialog <ControlPropertiesTabControl> is not available" ) + hOpenPropertyBrowser() = false + endif else - printlog( CFN & "General-tab is not visible." ) + warnlog( CFN & "Could not execute <ContextProperties> slot" ) hOpenPropertyBrowser() = false - endif - else - printlog( CFN & "Could not open property browser" ) - hOpenPropertyBrowser() = false + endif endif - '///</ul> - + end function '******************************************************************************* function hClosePropertyBrowser() as boolean - - '///<h3>A function that closes the Property-Browser</h3> - '///<i>The property browser is closed by executing the slot (the slot - '///+ toggles the dialog).</i><br><br> - - '///<u>Input</u>: - '///<ol> - '///+<li>Nothing</li> - '///</ol> - - '///<u>Returns</u>: - '///<ol> - - '///+<li>Errorcondition (boolean)</li> - '///<ul> - '///+<li>TRUE if the Property Browser has been closed</li> - '///+<li>FALSE if the property browser is not open</li> - '///+<li>FALSE if the property browser could not be closed</li> - '///</ul> - - '///</ol> - - '///<u>Description</u>: - '///<ul> - - const CFN = "hClosePropertyBrowser::" - '///+<li>Verify that the property browser is open</li> + const CFN = "framework::tools::includes::pbrowser_tools.inc::hClosePropertyBrowser(): " + printlog( "Closing Property-Browser (if open)" ) + kontext "ControlPropertiesTabControl" - if ( ControlPropertiesTabControl.exists( 1 ) ) then - - '///+<li>Execute the ContextProperties slot</li> - ContextProperties - - '///+<li>Verify that the property browser is closed</li> - if ( ControlPropertiesTabControl.exists() ) then - printlog( CFN & "Property browser could not be closed" ) - hClosePropertyBrowser() = false - else - printlog( CFN & "ok" ) + if ( ControlPropertiesTabControl.exists() ) then + + hUseAsyncSlot( "ContextProperties" ) + + if ( ControlPropertiesTabControl.notExists( 2 ) ) then hClosePropertyBrowser() = true + else + warnlog( CFN & "Failed to close dialog" ) + hClosePropertyBrowser() = false endif else - printlog( CFN & "Property browser is not open" ) - hClosePropertyBrowser() = false + printlog( "Property browser is not open, no action taken." ) + hClosePropertyBrowser() = true endif - '///</ul> - + end function '******************************************************************************* function hPBSetControlName( cControl as string ) as boolean - + '///<h3>Name a control, with limited errorhandling</h3> - + '///<i>This function was introduced due to a problem with the property- '///browser not being open fast enough or just refusing to accept input</i><br><br> - + '///<u>Input</u>: '///<ol> '///+<li>Text to be inserted in the control "NameText" (string)</li> '///</ol> - + '///<u>Returns</u>: '///<ol> - + '///+<li>Errorcondition</li> '///<ul> '///+<li>TRUE: The control name was successfully updated</li> '///+<li>FALSE: Control is not visible within current context</li> '///</ul> - + '///</ol> - + const CFN = "hPBSetControlName::" - + '///<u>Description</u>: '///<ul> '///+<li>Test that the control "NameText" exists</li> + + ' Note: A number of fallbacks are used here because the entryfield "NameText" + ' is less than reliable. My hope is that one of the methods succeeds. kontext "TabGeneralControl" if ( NameText.exists() ) then '///+<li>Set the new name</li> - WaitSlot() - + hDeleteEntryFieldContent( NameText ) + ' Name the control and append some Spaces which should be truncated. printlog( CFN & "Naming control: " & cControl ) NameText.setText( cControl ) - TabGeneralControl.typeKeys( " <RETURN>" ) + TabGeneralControl.typeKeys( "<RETURN>" ) WaitSlot() - - printlog( CFN & "Verifying rename..." ) + if ( NameText.getText() = cControl ) then printlog( CFN & "Name is set ok: " & cControl ) hPBSetControlName() = true exit function endif - + ' If the name cannot be set this is in 99% of the cases a timing problem. ' Here is a (costly) workaround. qaerrorlog( CFN & "Name not set correctly, retrying" ) @@ -212,55 +148,55 @@ function hPBSetControlName( cControl as string ) as boolean hPBSetControlName() = true exit function endif - + warnlog( CFN & "Unable to set control name: " & cControl ) hPBSetControlName() = false - + else warnlog( "Unable to name the control." ) hPBSetControlName() = false endif '///</ul> - + end function '******************************************************************************* function hPBGetControlName( cControl as string ) as boolean - + '///<h3>Verify that the expected control is open</h3> '///<i>Use hPBSetControlName( string ) to set the name and when you reopen it '///+ verify that you got the right control wit this function</i><br><br> - + '///<u>Input</u>: '///<ol> '///+<li>Name of the control (string)</li> '///</ol> - + '///<u>Returns</u>: '///<ol> - + '///+<li>Errorcondition (boolean)</li> '///<ul> '///+<li>TRUE: The control has the correct name</li> '///+<li>FALSE: Any other condition</li> '///</ul> - + '///</ol> - + '///<u>Description</u>: '///<ul> - + dim cControlName as string const CFN = "hPBGetControlName::" - + '///+<li>If "NameText" exists, retrieve its text</li> kontext "TabGeneralControl" if ( TabGeneralControl.exists( 1 ) ) then if ( TabGeneralControl.isVisible() ) then - + wait( 300 ) cControlName = NameText.getText() - + '///+<li>Verify that the name is correct</li> if ( cControlName = cControl ) then printlog( CFN & "The name of the control is correct: " & cControl ) @@ -280,100 +216,42 @@ function hPBGetControlName( cControl as string ) as boolean hPBGetControlName() = false endif '///</ul> - -end function -'******************************************************************************* - -function hCheckPropertyPresence ( cSetting as string , iPos as integer ) as boolean - - '///<h3>Function to determine whether a property is available for a control or not</h3> - '///<i>This function takes a string (provided by controlcfg.dat) and looks for an 'x' at. - '///+ a given position. If it is found it returns TRUE, FALSE if it is a '-'<br> - '///+Note that this function is a terrible workaround for a missing feature: In the current - '///+ version of the Testtool we cannot ask which controls are present on a dialog. So this - '///+ has to be kept in a list of some sort. This is especially bad for a property browser - '///+ test as we need to maintain such a list for 21 controls and a total of 76 (IIRC) - '///+ possible properties whereof only a small number (eight, i think) are common for all - '///+ controls. The test is barely maintainable, issues have been written but there is - '///+ no solution so far.</i><br><br> - - '///<u>Input</u>: - '///<ol> - - '///+<li>Configuration string (string)</li> - '///<ul> - '///+<li>The string must be taken from file "controlcfg.dat"</li> - '///</ul> - - '///+<li>Position of the control (integer)</li> - '///<ul> - '///+<li>> 0 and < 74 (all possible control config items)</li> - '///</ul> - - '///</ol> - - '///<u>Returns</u>: - '///<ol> - '///+<li>Status (boolean)</li> - '///<ul> - '///+<li>TRUE: The property should exist for the current control</li> - '///+<li>FALSE: The property is not expected to exist for this control</li> - '///</ul> - - '///</ol> - - '///<u>Description</u>: - '///<ul> - - ' this function looks at a given position in the string cSetting for either - ' a "x" or a "-". - ' if "x" is found, the function returns true, else false. - - - '///+<li>Find the requested position in the string, set TRUE if it is an "x"</li> - if ( mid( cSetting , iPos , 1 ) = "x" ) then - hCheckPropertyPresence() = true - else - hCheckPropertyPresence() = false - endif - '///</ul> - end function '******************************************************************************* function hSetPBTabPage( iPage as integer ) as boolean - + '///<h3>A small helper to switch between tabpages in the property-browser</h3> '///<u>Input</u>: '///<ol> - + '///+<li>Page-ID (integer)</li> '///<ul> '///+<li>1 = General page</li> '///+<li>2 = Events page</li> '///</ul> - + '///</ol> - + '///<u>Returns</u>: '///<ol> - + '///+<li>Errorcondition (boolean)</li> '///<ul> '///+<li>TRUE on success</li> '///+<li>FALSE on any error</li> '///</ul> - + '///</ol> - + '///<u>Description</u>: '///<ul> - + const CFN = "hSetPBTabPage::" printlog( CFN & "Enter with option: " & iPage ) - + '///+<li>Switch to the requested page</li> kontext "ControlPropertiesTabControl" if ( not ControlPropertiesTabControl.exists( 3 ) ) then @@ -381,18 +259,18 @@ function hSetPBTabPage( iPage as integer ) as boolean hSetPBTabPage() = false exit function else - if ( DEBUG_ENABLE ) then + if ( GVERBOSE ) then printlog( CFN & "Control Properties Dialog is open" ) endif endif - + select case iPage - case 1 - + case 1 + printlog( CFN & "Switching to control properties tabpage" ) kontext "ControlPropertiesTabControl" ControlPropertiesTabControl.setPage TabGeneralControl - + kontext "TabGeneralControl" if ( nametext.exists( 5 ) ) then printlog( CFN & "Exit: Control properties are open (true)" ) @@ -403,13 +281,13 @@ function hSetPBTabPage( iPage as integer ) as boolean hSetPBTabPage() = false exit function endif - + case 2 - + printlog( CFN & "Switching to event assignment tabpage" ) kontext "ControlPropertiesTabControl" ControlPropertiesTabControl.setPage TabEventsControl - + kontext "TabEventsControl" if ( PBFocusGained.exists( 5 ) ) then printlog( CFN & "Exit: Events page is open (true)" ) @@ -420,57 +298,32 @@ function hSetPBTabPage( iPage as integer ) as boolean hSetPBTabPage() = false exit function endif - + case else - + printlog( CFN & "Invalid parameter passed to function: " & iPage ) hSerPBTabPage() = false exit function - + end select '///</ul> - + end function '******************************************************************************* -function hSetLabelName( sLabelName as string ) as boolean - - '///<h3>Name a control, with limited errorhandling</h3> - - '///<i>This function was introduced due to a problem with the property- - '///browser not being open fast enough or just refusing to accept input</i><br><br> - - '///<u>Input</u>: - '///<ol> - '///+<li>Text to be inserted in the control "NameText" (string)</li> - '///</ol> - - '///<u>Returns</u>: - '///<ol> - - '///+<li>Errorcondition</li> - '///<ul> - '///+<li>TRUE: The control name was successfully updated</li> - '///+<li>FALSE: Control is not visible within current context</li> - '///</ul> - - '///</ol> - - '///<u>Description</u>: - '///<ul> - '///+<li>Test that the control "NameText" exists</li> - kontext "TabGeneralControl" - if ( Label.exists() ) then - '///+<li>Set the new name</li> - Label.setText( sLabelName ) - TabGeneralControl.TypeKeys ("<RETURN>" , true) - hSetLabelName() = true +function hDeleteEntryFieldContent( oControl as object ) as boolean + + printlog( "Original name is: " & oControl.getText() ) + + oControl.typeKeys( "<HOME>" ) + oControl.typeKeys( "<SHIFT END>" ) + oControl.typeKeys( "<DELETE>" ) + + if ( oControl.getText() = "" ) then + hDeleteEntryFieldContent() = true else - warnlog( "Unable to name the control." ) - hSetLabelName() = false + hDeleteEntryFieldContent() = false endif - '///</ul> - -end function +end function diff --git a/testautomation/framework/tools/includes/performance.inc b/testautomation/framework/tools/includes/performance.inc deleted file mode 100644 index 01d46d7df415..000000000000 --- a/testautomation/framework/tools/includes/performance.inc +++ /dev/null @@ -1,69 +0,0 @@ -'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 : joerg.skottke@sun.com -'* -'* short description : Tools to speed up test case performance -'* -'\****************************************************************************** - -private const VERBOSE = true - -function hWaitForObject( oControl as object, iTime as integer ) as integer - - const CFN = "hWaitForObject()::" - dim iWait as integer - - if ( VERBOSE ) then printlog( CFN & "Entering function for control: " & oControl.name() ) - - WaitSlot( 2000 ) - - for iWait = 0 to iTime - try - if ( oControl.isEnabled() ) then - printlog( CFN & "Control is enabled: " & oControl.name() ) - hWaitForObject() = 0 - exit function - else - if ( VERBOSE ) then printlog( "Waiting..." ) - endif - catch - wait( 1 ) - endcatch - next iWait - - printlog( CFN & "Control not found or not enabled, timeout reached" ) - hWaitForObject() = -1 - -end function - - - - - - - diff --git a/testautomation/framework/tools/includes/scriptorganizer_tools.inc b/testautomation/framework/tools/includes/scriptorganizer_tools.inc index e141448b5b79..0b09ed6270ac 100644..100755 --- a/testautomation/framework/tools/includes/scriptorganizer_tools.inc +++ b/testautomation/framework/tools/includes/scriptorganizer_tools.inc @@ -55,28 +55,12 @@ function hCreateScriptingObject( cName as string ) as boolean const CFN = "hNewScriptingObject::" - dim brc as boolean - '///+<li>Verify the function parameter</li> - if ( cName = "" ) then - warnlog( CFN & "Empty Name for scripting object passed to function" ) - hCreateScriptingObject() = false - exit function - endif - - '///+<li>Verify that the "Create..." button exists</li> - Kontext "ScriptOrganizer" - if ( not PBCreate.exists( 2 ) ) then - warnlog( CFN & "Create-button does not exist" ) - hCreateScriptingObject() = false - exit function - endif - '///+<li>Verify that the "Create..." button is enabled</li> if ( PBCreate.isEnabled() ) then '///+<li>Click "Create..." to open the naming dialog</li> - PBCreate.click() + hClickButton( PBCreate ) '///+<li>Name the new script</li> Kontext "ScriptNameDlg" @@ -84,23 +68,22 @@ function hCreateScriptingObject( cName as string ) as boolean EFObjectName.setText( cName ) ScriptNameDlg.OK() - brc = true + hCreateScriptingObject() = true endif else printlog( CFN & "Button is disabled" ) - brc = false + hCreateScriptingObject() = false endif '///+<li>Verify that we are back on the script organizer</li> kontext "ScriptOrganizer" if ( not ScriptOrganizer.exists( 2 ) ) then warnlog( CFN & "Could not return to ScriptOrganizer" ) - brc = false + hCreateScriptingObject() = false endif - hCreateScriptingObject() = brc '///</ul> end function @@ -129,63 +112,35 @@ function hRenameScriptingObject( cName as string ) as boolean '///<u>Description</u>: '///<ul> - use "global\tools\includes\optional\t_stringtools.inc" - const CFN = "hRenameScriptingObject::" - dim cMessage as string - dim brc as boolean - - brc = true - - '///+<li>Verify the function parameter</li> - if ( cName = "" ) then - warnlog( CFN & "Empty Name for scripting object passed to function" ) - hRenameScriptingObject() = false - exit function - endif - - '///+<li>Verify that the "Rename..." button exists</li> - Kontext "ScriptOrganizer" - if ( not PBRename.exists( 2 ) ) then - warnlog( CFN & "Rename button does not exist, aborting" ) - hRenameScriptingObject() = false - exit function - endif - - '///+<li>Verify that the "Rename..." button is enabled</li> - if ( PBRename.isEnabled() ) then + hRenameScriptingObject() = true - '///+<li>Click "Rename..." to open the renaming dialog</li> - PBRename.click() - - '///+<li>Name the new script</li> - Kontext "ScriptNameDlg" - if ( ScriptNameDlg.exists( 2 ) ) then - - EFObjectName.setText( cName ) - ScriptNameDlg.OK() - - '///+<li>Test for any messagebox, try to close it with OK</li> - kontext "active" - if ( active.exists( 1 ) ) then - cMessage = hRemoveLineBreaks( active.getText ) - printlog( CFN & cMessage ) - brc = false - active.OK() - endif - + '///+<li>Click "Rename..." to open the renaming dialog</li> + hClickButton( PBRename ) + + '///+<li>Name the new script</li> + Kontext "ScriptNameDlg" + if ( ScriptNameDlg.exists( 2 ) ) then + + EFObjectName.setText( cName ) + hCloseDialog( ScriptNameDlg, "ok" ) + + '///+<li>Test for any messagebox, try to close it with OK</li> + kontext "active" + if ( active.exists( 1 ) ) then + printlog( CFN & active.getText() ) + hRenameScriptingObject() = false + active.OK() endif - + endif '///+<li>Verify that we are back on the script organizer</li> kontext "ScriptOrganizer" if ( not ScriptOrganizer.exists( 2 ) ) then warnlog( CFN & "Could not return to ScriptOrganizer" ) - brc = false + hRenameScriptingObject() = false endif - - hRenameScriptingObject() = brc '///</ul> end function @@ -220,11 +175,7 @@ function hDeleteScript( cName as string , bSuccess as boolean ) as boolean '///<u>Description</u>: '///<ul> - use "global\tools\includes\optional\t_stringtools.inc" - const CFN = "hDeleteScript::" - dim iPos as integer - dim cMessage as string '///+<li>Test for the possible conditions:</li> '///<ol> @@ -232,19 +183,17 @@ function hDeleteScript( cName as string , bSuccess as boolean ) as boolean kontext "ScriptOrganizer" if ( PBDelete.isEnabled() and bSuccess ) then - PBDelete.click() + hClickButton( PBDelete ) kontext "active" - cMessage = active.getText() - cMessage = hRemoveLineBreaks( cMessage ) - printlog( CFN & cMessage ) - active.yes() + if ( Active.exists( 1 ) ) then + printlog( CFN & active.getText() ) + active.yes() + endif kontext "active" if ( active.exists( 1 ) ) then - cMessage = active.getText() - cMessage = hRemoveLineBreaks( cMessage ) qaerrorlog( CFN & "Message: Failed to delete object: " & cName ) - printlog( CFN & cMessage ) + printlog( CFN & active.getText() ) active.ok() endif hDeleteScript() = true @@ -257,24 +206,20 @@ function hDeleteScript( cName as string , bSuccess as boolean ) as boolean '///+<li>Delete is enabled but should not be (failure)</li> elseif ( PBDelete.isEnabled() and ( not bSuccess ) ) then - - PBDelete.click() + + hClickButton( PBDelete ) kontext "active" if ( active.exists( 1 ) ) then - cMessage = active.getText() - cMessage = hRemoveLineBreaks( cMessage ) printlog( CFN & "Delete-Button enabled for non deletable object" ) - printlog( CFN & cMessage ) + printlog( CFN & active.getText() ) active.yes() endif kontext "active" if ( active.exists( 2 ) ) then - cMessage = active.getText() - cMessage = hRemoveLineBreaks( cMessage ) printlog( CFN & "Message: Failed to delete object" ) - printlog( CFN & cMessage ) + printlog( CFN & active.getText() ) active.ok() endif hDeleteScript() = false @@ -335,85 +280,12 @@ function hOpenScriptOrganizer( iDialog as integer ) as boolean kontext "ScriptOrganizer" if ( ScriptOrganizer.exists( 5 ) ) then hOpenScriptOrganizer() = true - printlog( CFN & "Dialog is open" ) + printlog( "Script Organizer is open" ) else - hopenScriptOrganizer() = false + hOpenScriptOrganizer() = false warnlog( CFN & "Slot failed, dialog not open" ) endif '///</ul> end function - -'******************************************************************************* - -function hCloseScriptOrganizer() as boolean - - '///<h3>Close a Script Organizer (Cancel)</h3> - '///<i>Starting point: Any open Script Organizer</i><br> - '///<u>Input</u>: - '///<ol> - '///+<li>Nothing</li> - '///</ol> - '///<u>Returns</u>: - '///<ol> - '///+<li>Errorcondition (boolean)</li> - '///<ul> - '///+<li>TRUE if the Script Organizer was closed</li> - '///+<li>FALSE if the Script Organizer is still open</li> - '///</ul> - '///</ol> - '///<u>Description</u>: - '///<ul> - - - const CFN = "hCloseScriptOrganizer::" - - hCloseScriptOrganizer() = false - - '///+<li>Try to close the script </li> - kontext "ScriptOrganizer" - if ( ScriptOrganizer.exists( 5 ) ) then - ScriptOrganizer.cancel() - hCloseScriptOrganizer() = true - endif - - '///</ul> - -end function - -'******************************************************************************* - -function hOpenRunMacroDialog() as boolean - - '///<h3>Open the "Run Macro" dialog</h3> - '///<i>Starting point: Any document</i><br> - '///<u>Input</u>: - '///<ol> - '///+<li>Nothing</li> - '///</ol> - '///<u>Returns</u>: - '///<ol> - '///+<li>Errorcondition</li> - '///<ul> - '///+<li>TRUE if dialog is open</li> - '///+<li>FALSE if the Script Selector does not exist</li> - '///</ul> - '///</ol> - '///<u>Description</u>: - '///<ul> - - - '///+<li>Execute the ToolsMacrosRunMacro slot</li> - ToolsMacrosRunMacro - - '///+<li>Verify that the dialog is present</li> - kontext "ScriptSelector" - if ( ScriptSelector.exists( 2 ) ) then - hOpenRunMacroDialog() = true - else - hOpenRunMacroDialog() = false - endif - '///</ul> - -end function diff --git a/testautomation/framework/tools/includes/signature_tools.inc b/testautomation/framework/tools/includes/signature_tools.inc deleted file mode 100644 index de9c56389eb0..000000000000 --- a/testautomation/framework/tools/includes/signature_tools.inc +++ /dev/null @@ -1,90 +0,0 @@ -'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 : joerg.skottke@sun.com -'* -'* short description : Tools to ease working with digital signatures -'* -'\****************************************************************************** - -function hSelectXMLSecTab( cTab as string ) as boolean - - - '///<h3>Switch between tabpages on the Ceritficates/XML-Security Tabpage</h3> - - '///<u>Input value(s):</u><br> - '///<ol> - '///+<li>Identifier for the requested tabpage (string). Valid options are:</li> - '///<ul> - '///+<li>"GENERAL" for the general (first page)</li> - '///+<li>"DETAILS" for the details (second page)</li> - '///+<li>"PATH" for the certification path (third page)</li> - '///</ul> - '///</ol> - - - '///<u>Return Value:</u><br> - '///<ol> - '///+<li>Nothing</li> - '///</ol> - - - '///<u>Description:</u> - '///<ul> - - dim brc as boolean - brc = false - const CFN = "hSelectXMLSecTab::" - - '///+<li>Switch page</li> - kontext - - select case ( ucase( cTab ) ) - case "GENERAL" : active.setpage TabXMLSecGeneral - if ( TabXMLSecGeneral.exists() ) then - brc = true - printlog( CFN & "Switched to General page" ) - endif - - case "DETAILS" : active.setpage TabXMLSecDetails - if ( TabXMLSecDetails.exists() ) then - brc = true - printlog( CFN & "Switched to Details page" ) - endif - - case "PATH" : active.setpage TabXMLSecCertPath - if ( TabXMLSecCertPath.exists() ) then - brc = true - printlog( CFN & "Switched to Certification Path page" ) - endif - end select - - '///+<li>Set returnvalue</li> - hSelectXMLSecTab() = brc - '///</ul> - -end function diff --git a/testautomation/framework/tools/includes/spadmin_tools.inc b/testautomation/framework/tools/includes/spadmin_tools.inc index f444b4821a5f..b31e5dbe5a58 100644..100755 --- a/testautomation/framework/tools/includes/spadmin_tools.inc +++ b/testautomation/framework/tools/includes/spadmin_tools.inc @@ -109,8 +109,6 @@ function hDelPrinter( cPrinterName as string ) as integer endif dim iPrinterPos as integer - dim iErr as integer - iErr = 1 Kontext "SpAdmin" iPrinterPos = hGetPrinterPosition( cPrinterName , true ) @@ -125,25 +123,24 @@ function hDelPrinter( cPrinterName as string ) as integer if ( active.exists( 2 ) ) then Active.Yes() printlog( CFN & "Printer Queue deleted" ) - iErr = 0 + hDelPrinter() = 0 else warnlog( CFN & "Confirm Delete Dialog is missing" ) - iErr = 1 + hDelPrinter() = 1 endif catch warnlog( CFN & "Unable to confirm printer deletion" ) - iErr = 2 + hDelPrinter() = 2 endcatch else printlog( CFN & "The printer queue does not exist" ) - iErr = 3 + hDelPrinter() = 3 endif Kontext "SpAdmin" - hDelPrinter() = iErr end function @@ -151,55 +148,17 @@ end function function hGetSpadminPath() as string - '///<h3>Retrieve the path to the SpAdmin script/binary</h3> - const CFN = "hGetSpadminPath::" - const C_REL_PATH = "program\spadmin" - - dim sPath as string - - sPath = gNetzOfficePath & C_REL_PATH - sPath = convertpath( sPath ) - - printlog( CFN & "Using SPAdmin from: " & sPath - - hGetSpadminPath() = sPath + hGetSpadminPath() = convertpath( gNetzOfficePath & "program\spadmin" ) end function '******************************************************************************* -function hShutdownOffice() as integer +function hShutdownOffice() - '///<h3>Shutdown the office by closing all docs and the backing window</h3> - const CFN = "hShutdownOffice::" - - dim iOpenDocs as integer - iOpenDocs = getDocumentCount() - dim iThisDoc as integer - - ' close all open documents (One open document to remain) - for iThisDoc = 1 to iOpenDocs - call hCloseDocument() - next iThisDoc - - ' see how many documents are still open - should be exactly one - iOpenDocs = getDocumentCount() - if ( iOpenDocs <> 0 ) then - warnlog( CFN & "No open documents expected but found: " & iOpenDocs ) - endif - - ' shutdown the backing window, do not test with getDocumentCount() because - ' this would inevitably restart the office - ' we need some additional parameter for FileExit, this is a bug + hFileCloseAll() FileExit( "SynchronMode", TRUE ) - - ' wait long enough to ensure all office threads are removed from memory - sleep( 5 ) - - ' Print a somehow fuzzy message, we do not know for sure whether the office - ' has been shutdown or not - printlog( CFN & "The office should have been closed by now." ) - hShutdownOffice() = iOpenDocs + Wait( 5000 ) end function @@ -207,27 +166,16 @@ end function function hOpenSpadmin() as boolean - '///<h3>Execute the SpAdmin binary/Script and verify that it is open</h3> - ' Return TRUE if hWaitForSpadmin() completes successfully - - const CFN = "hOpenSpadmin::" - - dim cSpadminPath as string - cSpadminPath = hGetSpadminPath() + dim cSpadminPath as string : cSpadminPath = hGetSpadminPath() - dim brc as boolean - - ' start SPAdmin in automation mode. try start( cSpadminPath , "-enableautomation" ) - printlog( CFN & "SpAdmin command executed successfully" ) - brc = true + printlog( "Printer administration start-command was dispatched correctly" ) + hOpenSpAdmin() = true catch - warnlog( CFN & "Failure: SpAdmin command did not succeed" ) - brc = false + warnlog( "hOpenSpAdmin(): Failed to open printer administration tool" ) + hOpenSpAdmin() = false endcatch - - hOpenSpAdmin() = brc end function @@ -235,23 +183,15 @@ end function function hWaitForSpAdmin() as boolean - '///<h3>Wait for SpAdmin to be loaded and displayed</h3> - const CFN = "hWaitForSpAdmin::" - - dim bOpen as boolean - - ' Wait for SpAdmin to open kontext "SpAdmin" if ( SpAdmin.exists( 10 ) ) then - printlog( CFN & "SpAdmin is open. Good." ) + printlog( "Printer administration tool is open" ) + hWaitForSpadmin() = true sleep( 10 ) - bOpen = true else - warnlog( CFN & "SpAdmin is not open, the test cannot continue" ) - bOpen = false + warnlog( "hWaitForSpAdmin(): The dialog did not open within 10 seconds, aborting" ) + hWaitForSpadmin() = false endif - - hWaitForSpadmin() = bOpen end function diff --git a/testautomation/framework/tools/includes/tabpages.inc b/testautomation/framework/tools/includes/tabpages.inc deleted file mode 100644 index f22b8bd5a206..000000000000 --- a/testautomation/framework/tools/includes/tabpages.inc +++ /dev/null @@ -1,95 +0,0 @@ -'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 : joerg.skottke@sun.com -'* -'* short description : Tools to access special tabpages -'* -'\****************************************************************************** - -function hDocumentInfoSelectTab( cTabPage as string ) as boolean - - - '///<h3>Switch between the tabpages in the document info dialog</h3> - '///<i>The declaration of the document info dialog is not complete which - '///+ enforces special treatment</i><br><br> - - '///<u>Parameter(s):</u><br> - '///<ol> - - '///+<li>The name of the tabpage to be activated (String)</li> - '///<ul> - '///+<li>"General"</li> - '///+<li>"Description"</li> - '///+<li>"User"</li> - '///+<li>"Internet"</li> - '///+<li>"Statistics"</li> - '///+<li>The string is case insensitive</li> - - '///</ul> - - '///</ol> - - - '///<u>Returns:</u><br> - '///<ol> - '///+<li>Errorcondition (Boolean)</li> - '///<ul> - '///+<li>TRUE if tabpage is known and switching worked</li> - '///+<li>FALSE on icorrect input parameter</li> - '///+<li>FALSE on any other error</li> - '///</ul> - '///</ol> - - const CFN = "hDocumentInfoSelectTab::" - printlog( CFN & "Enter with option (tabpage): " & cTabPage ) - dim brc as boolean 'a multi purpose boolean returnvalue - brc = true - - '///<u>Description:</u> - '///<ul> - '///+<li>Kontext to the dialog</li> - Kontext - - '///+<li>Select the page to switch to, context to the new page</li> - select case ( ucase( cTabPage ) ) - case "GENERAL" : active.setPage TabDokument : kontext "TabDokument" - case "DESCRIPTION" : active.setPage TabBeschreibung : kontext "TabBeschreibung" - case "USER" : warnlog( "#i95523# - Cannot access controls on Custom page" ) - brc = false - 'active.setPage TabBenutzer : kontext "TabBenutzer" - case "INTERNET" : active.setPage TabInternet : kontext "TabInternet" - case "STATISTICS" : active.setPage TabStatistik : kontext "TabStatistik" - case default : brc = false - end select - - '///</ul> - - printlog( CFN & "Exit with result: " & brc ) - hDocumentInfoSelectTab() = brc - -end function diff --git a/testautomation/framework/tools/includes/template_tools.inc b/testautomation/framework/tools/includes/template_tools.inc index 6363bae7aaf9..5a1370b77262 100644..100755 --- a/testautomation/framework/tools/includes/template_tools.inc +++ b/testautomation/framework/tools/includes/template_tools.inc @@ -127,86 +127,6 @@ end function '******************************************************************************* -function hGetRefFilePath( cCategory as string, location as string) as string - - '///<h3>Retrieve the location of the reference files for filename comparision</h3> - '///<u>Input</u>: - '///<ol> - '///+<li>Category (string)</li> - '///<ul> - '///+<li>"NEWDOCUMENTS" for New Documents</li> - '///+<li>"TEMPLATES" for Templates</li> - '///+<li>"SAMPLES" for Samples</li> - '///</ul> - '///+<li>Location (string)</li> - '///<ul> - '///+<li>"TESTTOOL" to use files below gTesttoolPath</li> - '///+<li>"LOCAL" to use files below gOfficePath/user/work</li> - '///</ul> - '///</ol> - '///<u>Returns</u>: - '///<ol> - '///+<li>Fully qualified path to workfile (string)</li> - '///</ol> - - '///<u>Description</u>: - '///<ul> - - dim cFile as string - - cCategory = ucase( cCategory ) - - '///+<li>Retrieve the location</li> - '///<ul> - '///+<li>For TESTTOOL</li> - '///<ul> - if ( ucase( location ) = "TESTTOOL" ) then - - '///+<li>Prepend path within testtool-environment</li> - cFile = "framework\update\input\templdoc\" & gProductName - - '///+<li>Build a name containing langcode and .txt suffix</li> - if ( cCategory = "NEWDOCUMENTS" ) then - cFile = cFile & "\new_" & iSprache & ".txt" - elseif ( cCategory = "TEMPLATES" ) then - cFile = cFile & "\tem_" & iSprache & ".txt" - elseif ( cCategory = "SAMPLES" ) then - cFile = cFile & "\sam_" & iSprache & ".txt" - else - warnlog( "Invalid category passed to hGetRefFilePath" ) - endif - - '///+<li>Set returnvalue</li> - hGetRefFilePath() = convertpath( gTesttoolPath & cFile ) - - '///</ul> - '///+<li>For LOCAL</li> - '///<ul> - elseif ( ucase( location ) = "LOCAL" ) then - - '///+<li>Build a name containing langcode and .txt suffix</li> - if ( cCategory = "NEWDOCUMENTS" ) then - cFile = "new_" & iSprache & ".txt" - elseif ( cCategory = "TEMPLATES" ) then - cFile = "tem_" & iSprache & ".txt" - elseif ( cCategory = "SAMPLES" ) then - cFile = "sam_" & iSprache & ".txt" - else - warnlog( "Invalid category passed to hGetRefFilePath" ) - endif - - '///+<li>Set returnvalue</li> - hGetRefFilePath() = convertpath( hGetWorkPath() & cFile ) - - end if - '///</ul> - '///</ul> - '///</ul> - -end function - -'******************************************************************************* - function hSelectCategory( cCategory as string ) as boolean '///<h3>Select a category from the left pane of the templates dialog</h3> diff --git a/testautomation/framework/tools/includes/toolbar_tools.inc b/testautomation/framework/tools/includes/toolbar_tools.inc index e0952bfd9a2e..8d0b198b0441 100644..100755 --- a/testautomation/framework/tools/includes/toolbar_tools.inc +++ b/testautomation/framework/tools/includes/toolbar_tools.inc @@ -73,7 +73,8 @@ function hAccessStandardBar() as boolean endif '///+<li>Close the navigator</li> - hCloseNavigator() + kontext "Navigator" + hCloseDialog( Navigator, "close,optional" ) '///+<li>Close the document</li> hDestroyDocument() @@ -103,6 +104,13 @@ function hResetStandardBar() as boolean '///<ul> const CFN = "hResetStandardBar::" + const MIN_STATIC_DELAY = 1 + const DEFAULT_DELAY = 2 + const MENUITEM_RESTORE = 1 + const MENUITEM_CLOSEMENU = 0 + const TOOLBAR_MENUITEM_CUSTOMIZE = 2 + const EXPECTED_RESOURCE_ID = 304 + printlog( CFN & "Enter" ) @@ -115,36 +123,36 @@ function hResetStandardBar() as boolean '///+<li>Open the context menu on Standardbar</li> Standardbar.OpenContextmenu - sleep( 1 ) + sleep( MIN_STATIC_DELAY ) '///+<li>Click on 2. entry (Cutomize Toolbar)</li> - hMenuselectNr (2) - sleep( 1 ) + hMenuselectNr ( TOOLBAR_MENUITEM_CUSTOMIZE ) + sleep( MIN_STATIC_DELAY ) kontext Active.SetPage TabCustomizeToolbars - sleep( 1 ) + sleep( MIN_STATIC_DELAY ) '///+<li>Toggle to 'Toolbars' tab page.</li> kontext "TabCustomizeToolbars" - if TabCustomizeToolbars.Exists( 2 ) then - sleep( 1 ) + if TabCustomizeToolbars.Exists( DEFAULT_DELAY ) then + sleep( MIN_STATIC_DELAY ) '///+<li>Press in first section '... Toolbars' the 'toolbar'-button</li> MenuBtn.Click - sleep( 1 ) + sleep( MIN_STATIC_DELAY ) '///+<li>A drop down menu will be opened.</li> '///+<li>Select the first enabled menu entry which should be 'Restore...'</li> - hMenuSelectNr(1) - sleep( 1 ) + hMenuSelectNr( MENUITEM_RESTORE ) + sleep( MIN_STATIC_DELAY ) kontext - if ( active.exists( 2 ) ) then - if Active.GetRT = 304 then + if ( active.exists( DEFAULT_DELAY ) ) then + if ( Active.GetRT = EXPECTED_RESOURCE_ID ) then '///+<li>Press Yes button on verification dialog.</li> - Active.Yes + Active.Yes() end if else warnlog( "No verification comes up if the RESET button has been pressed!" ) @@ -152,11 +160,11 @@ function hResetStandardBar() as boolean '///+<li>Close 'Toolbars' tab page and the dialog with OK.</li> kontext "tabcustomizetoolbars" - TabCustomizeToolbars.OK + hCloseDialog( TabCustomizeToolbars, "ok" ) else warnlog( "Cutomuze Toolbar not open (from context menu)" ) 'Closing the Context menu if the dialog does not come up. - Menuselect(0) + Menuselect( MENUITEM_CLOSEMENU ) endif else @@ -192,8 +200,7 @@ function hStandardbarItemGetCount() as integer '///<ul> dim iToolbarItemsCurrent as integer - dim iToolbarItemsExpected as integer - iToolbarItemsExpected = 30 + const EXPECTED_TOOLBAR_ITEMCOUNT = 30 const CFN = "hStandardbarItemGetCount::" @@ -220,10 +227,10 @@ function hStandardbarItemGetCount() as integer ' items on the standardbar, OOo and its spinoffs have 30. - if ( iToolbarItemsCurrent = iToolbarItemsExpected ) then + if ( iToolbarItemsCurrent = EXPECTED_TOOLBAR_ITEMCOUNT ) then printlog( CFN & "Correct number of items on the StandardBar. Good" ) else - warnlog( CFN & "Expected: " & iToolbarItemsExpected & _ + warnlog( CFN & "Expected: " & EXPECTED_TOOLBAR_ITEMCOUNT & _ " entries, found: " & iToolbarItemsCurrent ) endif @@ -252,7 +259,8 @@ function hToggleToolbarItem( iMenuPos as integer ) '///<u>Description</u>: '///<ul> - const CFN = "hToggleToolbarItem::" + const CFN = "hToggleToolbarItem::" + const INVISIBLE_ITEMS_MODIFIER = 3 dim iItemsInMenu as integer printlog( CFN & "Enter with option (Menu position): " & iMenuPos ) @@ -268,7 +276,7 @@ function hToggleToolbarItem( iMenuPos as integer ) ' (those that are invisible will be listed as context menu entries), ' the menuitem (invisible items) is placed at position nItems - 3 '///+<li>Take the number of items -3, select the entry</li> - hMenuselectNr( iItemsInMenu - 3 ) + hMenuselectNr( iItemsInMenu - INVISIBLE_ITEMS_MODIFIER ) '///+<li>Select the provided menu position</li> hMenuselectNr( iMenuPos ) @@ -300,8 +308,7 @@ function hStandardbarLoadUrl() as boolean ' written to and disabled again (no use of reset toolbar here, this is ' done in another testcase - dim iItemMenuPos as integer - iItemMenuPos = 1 + dim iItemMenuPos as integer : iItemMenuPos = 1 const ITEM_MENU_POSITION = 1 const CFN = "hStandardbarLoadUrl::" @@ -367,6 +374,10 @@ function hStandardbarNewDialog() const CFN = "hStandardbarNewDialog::" const ITEM_MENU_POSITION = 3 + const TEMPLATE_DIALOG_MAX_RETRIES = 3 + const RC_TIMEOUT = -1 + + dim iTry as integer printlog( CFN & "Enter" ) @@ -383,35 +394,36 @@ function hStandardbarNewDialog() hToggleToolbarItem( ITEM_MENU_POSITION ) '///+<li>click the button</li> - Kontext "Standardbar" - sleep( 1 ) - try - NeuDialog.click() - catch - endcatch - - '///+<li>handle possible dialogs (there should never be one)</li> - kontext "Active" - if ( active.exists( 1 ) ) then - warnlog( CFN & "Unexpected active" ) - printlog( CFN & active.gettext() ) - try - printlog( CFN & "Closing dialog" ) - active.ok() - catch - warnlog( CFN & "Unknown dialog blocks test, now crashing" ) - endcatch - endif + for iTry = 1 to TEMPLATE_DIALOG_MAX_RETRIES + + Kontext "Standardbar" + hClickButton( NeuDialog ) + + '///+<li>handle possible dialogs (there should never be one)</li> + kontext "Active" + if ( active.exists() ) then + warnlog( CFN & "Unexpected active" ) + printlog( CFN & active.gettext() ) + if ( hCloseDialog( Active, "ok" ) = RC_TIMEOUT ) then + warnlog( CFN & "Unknown dialog blocks test, now crashing" ) + endif + endif + + '///+<li>close the templates and samples dialog</li> + printlog( CFN & "Close templates and samples (cancel)" ) + Kontext "TemplateAndDocuments" + if ( TemplateAndDocuments.Exists( 5 ) ) then + hCloseDialog( TemplateAndDocuments, "cancel" ) + exit for + else + if ( iTry = TEMPLATE_DIALOG_MAX_RETRIES ) then + warnlog( CFN & "The 'Template and Documents'-dialog was not activated" ) + endif + endif + + next iTry + - '///+<li>close the templates and samples dialog</li> - printlog( CFN & "Close templates and samples (cancel)" ) - Kontext "TemplateAndDocuments" - if ( TemplateAndDocuments.Exists( 5 ) ) then - TemplateAndDocuments.cancel() - else - warnlog( CFN & "The 'Template and Documents'-dialog was not activated" ) - endif - '///+<li>finally remove the button from the toolbar</li> printlog( CFN & "Deactivate New from Template button" ) hToggleToolbarItem( ITEM_MENU_POSITION ) @@ -455,7 +467,7 @@ function hStandardbarSaveAs() kontext "SpeichernDlg" if ( SpeichernDlg.exists( 1 ) ) then warnlog( "#i46363# (?)The 'SaveAs'-button should be invisible." ) - SpeichernDlg.cancel() + hCloseDialog( SpeichernDlg, "cancel" ) else '///+<li>Add the control to the standardbar</li> @@ -471,7 +483,7 @@ function hStandardbarSaveAs() printlog( CFN & "Close Save As (cancel)" ) Kontext "SpeichernDlg" if ( SpeichernDlg.Exists( 2 ) ) then - SpeichernDlg.cancel() + hCloseDialog( SpeichernDlg, "cancel" ) else qaerrorlog( "Retrying" ) Kontext "Standardbar" @@ -479,7 +491,7 @@ function hStandardbarSaveAs() Kontext "SpeichernDlg" if ( SpeichernDlg.exists( 1 ) ) then printlog( "FileSaveAs dialog is open" ) - SpeichernDlg.cancel() + hCloseDialog( SpeichernDlg, "cancel" ) else warnlog( CFN & "The 'Save As'-dialog was not activated" ) endif diff --git a/testautomation/framework/tools/includes/wizards.inc b/testautomation/framework/tools/includes/wizards.inc index f8890f0e5a4f..a140401c1202 100644..100755 --- a/testautomation/framework/tools/includes/wizards.inc +++ b/testautomation/framework/tools/includes/wizards.inc @@ -182,8 +182,7 @@ function hFinishWizard( iMode as integer ) as boolean dim cAccel as string dim iWait as integer - dim brc as boolean - brc = false + dim brc as boolean : brc = false '///+<li>Try to close the wizard</li> @@ -538,25 +537,20 @@ function hHandleSaveError() as integer '///<li>Close the dialog either with YES or OK</li> '///</ul> - dim iErr as integer - kontext "active" if ( active.exists( 2 ) ) then printlog( CFN & "Unexpected MsgBox: " & active.getText() ) try active.ok() - iErr = 2 + hHandleSaveError() = 2 catch active.yes() - iErr = 1 + hHandleSaveError() = 1 endcatch else - iErr = 0 + hHandleSaveError() = 0 endif - hHandleSaveError() = iErr - - end function '******************************************************************************* @@ -583,35 +577,19 @@ function hClickNextButton() as boolean const CFN = "hClickNextButton::" - dim irc as integer - dim brc as boolean - brc = false - dim iBreak as integer - iBreak = 0 + hClickNextButton() = true '///+<li>Click the "Next"-button</li> - irc = hWaitForObject( NextButton, 5000 ) - if ( irc >= 0 ) then - printlog( CFN & "Next..." ) - NextButton.click() - brc = true + if ( hClickButton( NextButton ) = -1 ) then + hClickNextButton() = false else - qaerrorlog( CFN & "Button not available within specified time -> bad" ) - endif - - '///+<li>Handle the "Document Creation"-dialog (Mailmerge Wizard)</li> - kontext "active" - do while ( active.exists( 1 ) ) - iBreak = iBreak + 1 - printlog( CFN & "Waiting for document creation to complete..." ) - if ( iBreak = 10 ) then - warnlog( "DocumentCreation (MailMergeWizard) not complete within 10 seconds" ) - brc = false - exit do + '///+<li>Handle the "Document Creation"-dialog (Mailmerge Wizard)</li> + kontext "active" + if ( active.exists( 1 ) ) then + ' The dialog must disappear within 10 seconds + if ( not active.notExists( 10 ) ) then hClickNextButton() = false endif - loop - - hClickNextButton() = brc + endif '///</ul> end function |