summaryrefslogtreecommitdiff
path: root/testautomation/framework/tools
diff options
context:
space:
mode:
Diffstat (limited to 'testautomation/framework/tools')
-rwxr-xr-xtestautomation/framework/tools/includes/CJK_tools.inc325
-rwxr-xr-xtestautomation/framework/tools/includes/all_interfaces.txt125
-rw-r--r--testautomation/framework/tools/includes/apicalls.inc116
-rw-r--r--testautomation/framework/tools/includes/arrayfuncs.inc163
-rw-r--r--testautomation/framework/tools/includes/customize_tools.inc343
-rw-r--r--testautomation/framework/tools/includes/filedlg_tools.inc117
-rw-r--r--testautomation/framework/tools/includes/fileoperations.inc945
-rw-r--r--testautomation/framework/tools/includes/formcontrols.inc816
-rw-r--r--testautomation/framework/tools/includes/help_tools.inc431
-rw-r--r--testautomation/framework/tools/includes/i18n_tools.inc189
-rw-r--r--testautomation/framework/tools/includes/init_tools.inc205
-rw-r--r--testautomation/framework/tools/includes/javatools.inc151
-rw-r--r--testautomation/framework/tools/includes/options_tools.inc404
-rw-r--r--testautomation/framework/tools/includes/pbrowser_tools.inc476
-rw-r--r--testautomation/framework/tools/includes/performance.inc69
-rw-r--r--testautomation/framework/tools/includes/private_environment.inc335
-rw-r--r--testautomation/framework/tools/includes/scriptorganizer_tools.inc419
-rw-r--r--testautomation/framework/tools/includes/signature_tools.inc90
-rw-r--r--testautomation/framework/tools/includes/spadmin_tools.inc317
-rw-r--r--testautomation/framework/tools/includes/tabpages.inc95
-rw-r--r--testautomation/framework/tools/includes/template_tools.inc552
-rw-r--r--testautomation/framework/tools/includes/toolbar_tools.inc502
-rw-r--r--testautomation/framework/tools/includes/webtools.inc153
-rw-r--r--testautomation/framework/tools/includes/window_tools.inc86
-rw-r--r--testautomation/framework/tools/includes/wizards.inc618
-rwxr-xr-xtestautomation/framework/tools/input/i18ndata.txt45
-rwxr-xr-xtestautomation/framework/tools/input/menuentries.txt50
27 files changed, 8137 insertions, 0 deletions
diff --git a/testautomation/framework/tools/includes/CJK_tools.inc b/testautomation/framework/tools/includes/CJK_tools.inc
new file mode 100755
index 000000000000..e905b55bbebc
--- /dev/null
+++ b/testautomation/framework/tools/includes/CJK_tools.inc
@@ -0,0 +1,325 @@
+'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 : hercule.li@sun.com
+'*
+'* short description : Tools for CJK feature test in Writer
+'*
+'\***********************************************************************
+
+function CheckAsianLanguageSupport( sSupport as String ) as String
+
+ ToolsOptions
+ Call hToolsOptions("LANGUAGESETTINGS","LANGUAGES")
+
+ if ( aktivieren.exists() ) then
+ if ( aktivieren.isEnabled() ) then
+ if ( lcase( sSupport ) = "on" ) then
+ printlog( "Enabling Asian Language Support" )
+ Aktivieren.Check
+ else
+ printlog( "Disabling Asian Language Support" )
+ Aktivieren.uncheck()
+ endif
+ else
+ warnlog( "Activate Asian Language Support checkbox is disabled" )
+ endif
+ else
+ warnlog( "Activate Asian Language Support checkbox is missing" )
+ endif
+
+ Kontext "ExtrasOptionenDlg"
+ ExtrasOptionenDlg.OK()
+
+end function
+
+'******************************************************************************'
+
+function fStartupNavigator(navigatorItem as String , subItemNum as Integer)
+ Dim j as Integer
+
+ Kontext "Navigator"
+ if NOT Navigator.Exists then
+ ' If you don' t ask for the Navigator and it's open it would be clodes and test fails !
+ ViewNavigator
+ end if
+ Kontext "NavigatorWriter"
+ if Auswahlliste.GetItemCount < 11 then
+ Inhaltsansicht.Click
+ end if
+ if Auswahlliste.GetItemCount > 11 then
+ For j= 1 to 1
+ Auswahlliste.Select j
+ Auswahlliste.TypeKeys "-"
+ next j
+ end if
+ Kontext "NavigatorWriter"
+ Auswahlliste.TypeKeys "<Up>", 11
+ sleep 1
+ Select case navigatorItem
+ case "Headings" : goto GoON
+ case "Tables" : Auswahlliste.TypeKeys "<down>"
+ case "TextFrame" : Auswahlliste.TypeKeys "<down>" , 2
+ case "Graphics" : Auswahlliste.TypeKeys "<down>" , 3
+ case "OLEObject" : Auswahlliste.TypeKeys "<down>" , 4
+ case "Bookmarks" : Auswahlliste.TypeKeys "<down>" , 5
+ case "Section" : Auswahlliste.TypeKeys "<down>" , 6
+ case "Hyperlinks" : Auswahlliste.TypeKeys "<down>" , 7
+ case "References" : Auswahlliste.TypeKeys "<down>" , 8
+ case "Indexes" : Auswahlliste.TypeKeys "<down>" , 9
+ case "Notes" : Auswahlliste.TypeKeys "<down>" , 10
+ case "DrawObjects" : Auswahlliste.TypeKeys "<down>" , 11
+ end Select
+ sleep 1
+ GoON:
+ Auswahlliste.TypeKeys "<return>"
+ sleep 1
+ Toolbox.Click Inhaltsansicht
+ sleep 1
+ Auswahlliste.TypeKeys "<Up>",subItemNum
+ sleep 1
+end function
+
+'******************************************************************************'
+
+function fGetCountryName( CountryID as Integer ) as String
+
+ select case iSprache
+ case 01 : ' English (USA)
+ select case CountryID
+ case 1: fGetCountryName = "English (USA)"
+ case 33: fGetCountryName = "French (France)"
+ case 34: fGetCountryName = "Spanish (Spain)"
+ case 39: fGetCountryName = "Italian (Italy)"
+ case 46: fGetCountryName = "Swedish (Sweden)"
+ case 49: fGetCountryName = "German (Germany)"
+ case 55: fGetCountryName = "Portuguese (Brazil)"
+ case 81: fGetCountryName = "Japanese"
+ case 82: fGetCountryName = "Korean (RoK)"
+ case 86: fGetCountryName = "Chinese (simplified)"
+ case 88: fGetCountryName = "Chinese (traditional)"
+ case else :
+ QAErrorLog "Now, the test does not support for the language " +iSprache
+ fGetCountryName = ""
+ end select
+ case 33 : ' France
+ select case CountryID
+ case 1: fGetCountryName = "Anglais (U.S.A.)"
+ case 33: fGetCountryName = "Français (France)"
+ case 34: fGetCountryName = "Espagnol (Espagne)"
+ case 39: fGetCountryName = "Italien (Italie)"
+ case 46: fGetCountryName = "Suédois (Suède)"
+ case 49: fGetCountryName = "Allemand (Allemagne)"
+ case 55: fGetCountryName = "Portugais (Brésil)"
+ case 81: fGetCountryName = "Japonais"
+ case 82: fGetCountryName = "Coréen"
+ case 86: fGetCountryName = "Chinois (simple)"
+ case 88: fGetCountryName = "Chinois (traditionnel)"
+ case else :
+ QAErrorLog "Now, the test does not support for the language " +iSprache
+ fGetCountryName = ""
+ end select
+ case 34 : ' Spanish
+ select case CountryID
+ case 1: fGetCountryName = "Inglés (EE.UU.)"
+ case 33: fGetCountryName = "Francés (Francia)"
+ case 34: fGetCountryName = "Español (España)"
+ case 39: fGetCountryName = "Italiano (Italia)"
+ case 46: fGetCountryName = "Sueco (Suecia)"
+ case 49: fGetCountryName = "Alemán (Alemania)"
+ case 55: fGetCountryName = "Portugués (Brasil)"
+ case 81: fGetCountryName = "Japonés"
+ case 82: fGetCountryName = "Coreano"
+ case 86: fGetCountryName = "Chino (simple)"
+ case 88: fGetCountryName = "Chino (tradicional)"
+ case else :
+ QAErrorLog "Now, the test does not support for the language " +iSprache
+ fGetCountryName = ""
+ end select
+ case 39 : ' Italy
+ select case CountryID
+ case 1: fGetCountryName = "Inglese (US)"
+ case 33: fGetCountryName = "Francese (Francia)"
+ case 34: fGetCountryName = "Spagnolo (Spagna)"
+ case 39: fGetCountryName = "Italiano (Italia)"
+ case 46: fGetCountryName = "Svedese (Svezia)"
+ case 49: fGetCountryName = "Tedesco (Germania)"
+ case 55: fGetCountryName = "Portoghese (Brasile)"
+ case 81: fGetCountryName = "Giapponese"
+ case 82: fGetCountryName = "Coreano"
+ case 86: fGetCountryName = "Cinese (semplificato)"
+ case 88: fGetCountryName = "Cinese (tradizionale)"
+ case else :
+ QAErrorLog "Now, the test does not support for the language " +iSprache
+ fGetCountryName = ""
+ end select
+ case 46 : ' Swedish
+ select case CountryID
+ case 1: fGetCountryName = "engelska"
+ case 33: fGetCountryName = "franska (Frankrike)"
+ case 34: fGetCountryName = "spanska (Spanien)"
+ case 39: fGetCountryName = "italienska (Italien)"
+ case 46: fGetCountryName = "svenska (Sverige)"
+ case 49: fGetCountryName = "tyska (Tyskland)"
+ case 55: fGetCountryName = "portugisiska (Brasilien)"
+ case 81: fGetCountryName = "Japanska"
+ case 82: fGetCountryName = "koreanska"
+ case 86: fGetCountryName = "kinesiska (enkel)"
+ case 88: fGetCountryName = "kinesiska (trad.)"
+ case else :
+ QAErrorLog "Now, the test does not support for the language " +iSprache
+ fGetCountryName = ""
+ end select
+ case 49 : ' German
+ select case CountryID
+ case 1: fGetCountryName = "Englisch (USA)"
+ case 33: fGetCountryName = "Französisch (Frankreich)"
+ case 34: fGetCountryName = "Spanisch (Spanien)"
+ case 39: fGetCountryName = "Italienisch (Italien)"
+ case 46: fGetCountryName = "Schwedisch (Schweden)"
+ case 49: fGetCountryName = "Deutsch (Deutschland)"
+ case 55: fGetCountryName = "Portugiesisch (Brasilien)"
+ case 81: fGetCountryName = "Japanisch"
+ case 82: fGetCountryName = "Koreanisch (RoK)"
+ case 86: fGetCountryName = "Chinesisch (einfach)"
+ case 88: fGetCountryName = "Chinesisch (Trad.)"
+ case else :
+ QAErrorLog "Now, the test does not support for the language " +iSprache
+ fGetCountryName = ""
+ end select
+ case 50 : ' Slovenian
+ select case CountryID
+ case 1: fGetCountryName = "angleški (ZDA)"
+ case 33: fGetCountryName = "francoski (Francija)"
+ case 34: fGetCountryName = "španski (Španija)"
+ case 39: fGetCountryName = "italijanski (Italija)"
+ case 46: fGetCountryName = "švedski (Švedska)"
+ case 49: fGetCountryName = "nemški (Nemčija)"
+ case 55: fGetCountryName = "portugalski (Brazilija)"
+ case 81: fGetCountryName = "japonski"
+ case 82: fGetCountryName = "korejski (RK)"
+ case 86: fGetCountryName = "kitajski (poenostavljeni)"
+ case 88: fGetCountryName = "kitajski (tradicionalni)"
+ case else :
+ QAErrorLog "Now, the test does not support for the language " +iSprache
+ fGetCountryName = ""
+ end select
+ case 55 : ' Portuguese
+ select case CountryID
+ case 1: fGetCountryName = "Inglês (EUA)"
+ case 33: fGetCountryName = "Francês (França)"
+ case 34: fGetCountryName = "Espanhol (Espanha)"
+ case 39: fGetCountryName = "Italiano (Itália)"
+ case 46: fGetCountryName = "Sueco (Suécia)"
+ case 49: fGetCountryName = "Alemão (Alemanha)"
+ case 55: fGetCountryName = "Português (Brasil)"
+ case 81: fGetCountryName = "Japonês"
+ case 82: fGetCountryName = "Coreano (RoK)"
+ case 86: fGetCountryName = "Chinês (simplificado)"
+ case 88: fGetCountryName = "Chinês (tradicional)"
+ case else :
+ QAErrorLog "Now, the test does not support for the language " +iSprache
+ fGetCountryName = ""
+ end select
+ case 81 : ' Japanese
+ select case CountryID
+ case 1: fGetCountryName = "英語(米国)"
+ case 33: fGetCountryName = "フランス語(フランス)"
+ case 34: fGetCountryName = "スペイン語(スペイン)"
+ case 39: fGetCountryName = "イタリア語(イタリア)"
+ case 46: fGetCountryName = "スウェーデン語(スウェーデン)"
+ case 49: fGetCountryName = "ドイツ語(ドイツ)"
+ case 55: fGetCountryName = "ポルトガル語(ブラジル)"
+ case 81: fGetCountryName = "日本語"
+ case 82: fGetCountryName = "韓国語"
+ case 86: fGetCountryName = "中国語(簡体字)"
+ case 88: fGetCountryName = "中国語(繁体字)"
+ case else :
+ QAErrorLog "Now, the test does not support for the language " +iSprache
+ fGetCountryName = ""
+ end select
+ case 82 : ' Korean
+ select case CountryID
+ case 1: fGetCountryName = "영어(미국)"
+ case 33: fGetCountryName = "스페인어(스페인)"
+ case 34: fGetCountryName = "프랑스어(프랑스)"
+ case 39: fGetCountryName = "이탈리아어 (이태리)"
+ case 46: fGetCountryName = "스웨덴어(스웨덴)"
+ case 49: fGetCountryName = "독일어(독일)"
+ case 55: fGetCountryName = "포르투갈어(브라질)"
+ case 81: fGetCountryName = "일본어"
+ case 82: fGetCountryName = "한국어"
+ case 86: fGetCountryName = "중국어(간체)"
+ case 88: fGetCountryName = "중국어(번체)"
+ case else :
+ QAErrorLog "Now, the test does not support for the language " +iSprache
+ fGetCountryName = ""
+ end select
+ case 86 : ' Chinese (simplified)
+ select case CountryID
+ case 1: fGetCountryName = "英语(美国)"
+ case 33: fGetCountryName = "法语(法国)"
+ case 34: fGetCountryName = "西班牙语(西班牙)"
+ case 39: fGetCountryName = "意大利语(意大利)"
+ case 46: fGetCountryName = "瑞典语(瑞典)"
+ case 49: fGetCountryName = "德语(德国)"
+ case 55: fGetCountryName = "葡萄牙语(巴西)"
+ case 81: fGetCountryName = "日语"
+ case 82: fGetCountryName = "朝鲜语"
+ case 86: fGetCountryName = "中文(简体字)"
+ case 88: fGetCountryName = "中文(繁体字)"
+ case else :
+ QAErrorLog "Now, the test does not support for the language " +iSprache
+ fGetCountryName = ""
+ end select
+
+ case 88 : ' Chinese (traditional)
+ select case CountryID
+ case 1: fGetCountryName = "英語(美國)"
+ case 33: fGetCountryName = "法語(法國)"
+ case 34: fGetCountryName = "西班牙語(西班牙)"
+ case 39: fGetCountryName = "意大利語(意大利)"
+ case 46: fGetCountryName = "瑞典語(瑞典)"
+ case 49: fGetCountryName = "德語(德國)"
+ case 55: fGetCountryName = "葡萄牙語(巴西)"
+ case 81: fGetCountryName = "日文"
+ case 82: fGetCountryName = "韓語"
+ case 86: fGetCountryName = "中文(簡體字)"
+ case 88: fGetCountryName = "中文(繁體)"
+ case else :
+ QAErrorLog "Now, the test does not support for the language " +iSprache
+ fGetCountryName = ""
+ end select
+ case else : ' Fallback
+ QAErrorLog "Now, the test does not support for the language " +iSprache
+ fGetCountryName = ""
+ end select
+
+end function
+
+
+
diff --git a/testautomation/framework/tools/includes/all_interfaces.txt b/testautomation/framework/tools/includes/all_interfaces.txt
new file mode 100755
index 000000000000..e81f5b7834fa
--- /dev/null
+++ b/testautomation/framework/tools/includes/all_interfaces.txt
@@ -0,0 +1,125 @@
+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
new file mode 100644
index 000000000000..fca300c5eda7
--- /dev/null
+++ b/testautomation/framework/tools/includes/apicalls.inc
@@ -0,0 +1,116 @@
+'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
new file mode 100644
index 000000000000..df33885da4cd
--- /dev/null
+++ b/testautomation/framework/tools/includes/arrayfuncs.inc
@@ -0,0 +1,163 @@
+'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
new file mode 100644
index 000000000000..2d6d17443913
--- /dev/null
+++ b/testautomation/framework/tools/includes/customize_tools.inc
@@ -0,0 +1,343 @@
+'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 the use of the ToolsCustomize-Dialog
+'*
+'\******************************************************************************
+
+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>
+ ToolsCustomize
+
+ '///+<li>Switch to the Events Tab</li>
+ 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
+
+'*******************************************************************************
+
+function hToolsCustomizeSelectTab( cTab as string ) as boolean
+
+ '///<h3>Switch Tabpages on ToolsCustomize Dialog</h3>
+ '///<i>Starting point: The Tools/Customize dialog</i><br>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Name of the Tab (string)</li>
+ '///<ul>
+ '///+<li>&quot;Keyboard&quot;</li>
+ '///+<li>&quot;Menu&quot;</li>
+ '///+<li>&quot;Toolbars&quot;</li>
+ '///+<li>&quot;Events&quot;</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Errorstatus (boolean)</li>
+ '///<ul>
+ '///+<li>TRUE if the requested tab is open</li>
+ '///+<li>FALSE on any other condition</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+ const CFN = "hToolsCustomizeSelectTab::"
+ dim brc as boolean
+ brc = false
+
+ ctab = lcase( ctab )
+
+ '///+<li>Switch to one of the four available tabpages</li>
+ '///<ol>
+ kontext
+
+ try
+
+ select case ctab
+ '///+<li>Keyboard</li>
+ case "keyboard" : active.setPage TabTastatur
+ kontext "TabTastatur"
+ if ( Aendern.isVisible() ) then
+ brc = true
+ endif
+ '///+<li>Menu</li>
+ case "menu" : active.setPage TabCustomizeMenu
+ kontext "TabCustomizeMenu"
+ if ( Entries.isVisible() ) then
+ brc = true
+ endif
+ '///+<li>Toolbars</li>
+ case "toolbars" : active.setPage TabCustomizeToolbars
+ kontext "TabCustomizeToolbars"
+ if ( ToolbarContents.isVisible() ) then
+ brc = true
+ endif
+ '///+<li>Events</li>
+ case "events" : active.setPage TabCustomizeEvents
+ kontext "TabCustomizeEvents"
+ if ( AssignMacro.isVisible() ) then
+ brc = true
+ endif
+ end select
+ '///</ol>
+
+ catch
+
+ printlog( CFN & "Could not access requested tabpage" )
+ brc = 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 &quot;New...&quot; 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>
+ '///<i>Starting point: Tools/Customize: Toolbars must be open</i><br>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Nothing</li>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Position of the selected item (integer)</li>
+ '///<ul>
+ '///+<li>Always &gt; 1</li>
+ '///+<li>Always &lt; Max number of items</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+
+ dim iCurrentItem as integer
+ dim cString as string
+ dim irc as integer
+ const CFN = "hDeselectSeparator::"
+
+ kontext "ToolsCustomizeToolbars"
+ if ( ToolbarContents.getItemCount > 0 ) then
+
+ iCurrentItem = ToolbarContents.getSelIndex()
+ cString = ToolbarContents.getSelText()
+
+ '///+<li>Check whether the selected item contains a number of minus-chars (---)</li>
+ if ( instr( cString , "----" ) ) then
+
+ '///+<li>If we are at the beginning of the list: Move up</li>
+ if ( iCurrentItem = 1 ) then
+ irc = 2
+ ToolbarContents.select( irc )
+ printlog( CFN & " Moved away from separator (up)" )
+ else
+ '///+<li>If we are somewhere else in the list, move down</li>
+ irc = iCurrentItem - 1
+ ToolbarContents.select( irc )
+ printlog( CFN & " Moved away from separator (down)" )
+ endif
+
+ endif
+ else
+ irc = 0
+ endif
+
+ hDeselectSeparator() = irc
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
diff --git a/testautomation/framework/tools/includes/filedlg_tools.inc b/testautomation/framework/tools/includes/filedlg_tools.inc
new file mode 100644
index 000000000000..68d46216ed4d
--- /dev/null
+++ b/testautomation/framework/tools/includes/filedlg_tools.inc
@@ -0,0 +1,117 @@
+'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>&gt; 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
new file mode 100644
index 000000000000..b8040eb5fbfb
--- /dev/null
+++ b/testautomation/framework/tools/includes/fileoperations.inc
@@ -0,0 +1,945 @@
+'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 : check the internal file dialog ( extended tests )
+'*
+'\******************************************************************************
+
+function hSaveLoadDelSuccess( cFile as string ) as integer
+
+ '///<h3>Successfully save, close, load, close and delete a file</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>Errorcode (integer)</li>
+ '///<ul>
+ '///+<li>0 = all ok</li>
+ '///+<li>1 = Saving failed</li>
+ '///+<li>2 = Closing the file failed</li>
+ '///+<li>3 = Reloading failed</li>
+ '///+<li>4 = Closing the file failed</li>
+ '///+<li>5 = Deleting failed</li>
+ '///+<li>-1 = Post operation error</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+ dim brc as boolean
+ dim cFileExt as string : cFileExt = cFile & hGetSuffix( "current" )
+
+ const CFN = "hSaveLoadDelSuccess::"
+
+ printlog( "" )
+ printlog( CFN & "Enter with option: " & cFile & "/" & cFileExt )
+
+ '///+<li>Close the navigator if it exists</li>
+ hCloseNavigator()
+
+ '///+<li>Save the current file, overwriting existing</li>
+ brc = hSaveFileExpectSuccess( cFile , TRUE ) ' save and overwrite
+ if ( brc ) then
+
+ '///+<li>Close the file</li>
+ brc = hDestroyDocument()
+ if ( brc ) then
+
+ '///+<li>Reload the file</li>
+ brc = hLoadFileExpectSuccess( cFileExt )
+ if ( brc ) then
+
+ '///+<li>Close the document</li>
+ brc = hDestroyDocument()
+ if ( brc ) then
+
+ '///+<li>Delete the file via FileOpen</li>
+ brc = hDeleteFileViaFileOpen( cFileExt )
+ if ( brc ) then
+ printlog( CFN & "Save, close, load, close, delete ok" )
+ hSaveLoadDelSuccess() = 0
+ else
+ warnlog( CFN & "Failed to delete file" )
+ hSaveLoadDelSuccess() = 5
+ endif
+
+ else
+ warnlog( CFN & "Failed to close file" )
+ hSaveLoadDelSuccess() = 4
+ endif
+
+ else
+ warnlog( CFN & "Failed to load file" )
+ hSaveLoadDelSuccess() = 3
+ endif
+
+
+ else
+ warnlog( CFN & "Closing file failed" )
+ hSaveLoadDelSuccess() = 2
+ endif
+
+ else
+ warnlog( CFN & "Saving failed" )
+ hSaveLoadDelSuccess() = 1
+ endif
+
+ '///+<li>Close possible Messagebox (#i33946#)</li>
+ kontext "active"
+ if ( active.exists( 1 ) ) then
+ printlog( CFN & "Unexpected message: " & active.getText() )
+ qaerrorlog( "#i33946# - message when deleting last document in folder" )
+ active.ok()
+ hSaveLoadDelSuccess() = 6
+ endif
+
+ '///+<li>Close document</li>
+ brc = hDestroyDocument()
+
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hLoadFileExpectSuccess( fpath as string ) as boolean
+
+ '///<h3>Load a file where failure is expected</h3>
+ '///<i>Uses</i>: framework\tools\t_stringtools.inc<br><br>
+ '///<i>This function is quite similar to hLoadFile but does much less
+ '///+ errorhandling so the information of the type of failure is a little
+ '///+ more exact</i><br><br>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Filename incl. extension (string)</li>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Errorcondition (boolean)</li>
+ '///<ul>
+ '///+<li>TRUE = File was loaded without problems</li>
+ '///+<li>FALSE = Any error</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+ dim brc as boolean : brc = true
+
+ const CFN = "hLoadFileExpectSuccess::"
+ printlog( CFN & "Enter with option: " & fpath )
+
+ '///+<li>Click FileOpen (or use the menu)</li>
+ hUseAsyncSlot( "FileOpen" )
+
+ '///+<li>Enter the filename (with extension)</li>
+ 'printlog( " - Type the filepath/name into the entryfield" )
+ Kontext "OeffnenDLG"
+ if ( OeffnenDlg.exists( 1 ) ) then
+ DateiName.setText( fpath )
+
+ '///+<li>Click &quot;Open&quot;</li>
+ 'printlog( " - Click 'Open'" )
+ oeffnen.click()
+
+ '///+<li>Watch out for an unexpected messagebox<br>
+ Kontext "Active"
+ if ( Active.Exists( 1 ) ) then
+ printlog( "Unexpected active: " & active.getText() )
+ Active.OK()
+
+ Kontext "OeffnenDLG"
+ OeffnenDLG.cancel()
+ brc = false
+ endif
+
+ '///+recover in case of error so the test has a chance to continue</li>
+ ' try to recover in case of failure so the test can continue.
+ Kontext "OeffnenDLG"
+ if ( Oeffnen.exists( 1 ) ) then
+ warnlog( "The file was not opened, it doesn't appear to exist" )
+ OeffnenDLG.cancel()
+ brc = false
+ endif
+ else
+ warnlog( CFN & "File Open dialog did not open" )
+ endif
+
+ '///+<li>Return the errorcode</li>
+ printlog( CFN & "Exit with result: " & brc )
+ hLoadFileExpectSuccess() = brc
+ '///</ul>
+
+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 &quot;Open&quot;</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>
+ '///<i>Uses</i>: framework\tools\t_stringtools.inc<br><br>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Filename incl. extension (string)</li>
+ '///+<li>Replace file (boolean)</li>
+ '///<ul>
+ '///+<li>TRUE = Replace the file</li>
+ '///+<li>FALSE = Do not replace the file</li>
+ '///</ul>
+ '///</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 = "hSaveFileExpectSuccess::"
+ dim brc as boolean : brc = true
+
+ dim iDocumentCount as integer
+
+ printlog( CFN & "Enter with options: " & fpath & ", " & bReplace )
+
+ '///+<li>Make sure we start from the backing window</li>
+ hFileCloseAll()
+
+
+ '///+<li>Open a new document</li>
+ hCreateDocument()
+
+ '///+<li>Click &quot;Save As...&quot;</li>
+ hUseAsyncSlot( "FileSaveAs" )
+
+ Kontext "SpeichernDlg"
+ if ( SpeichernDlg.exists( 1 ) ) then
+
+ '///+<li>Enter a filename (with extension)</li>
+ Dateiname.setText( hGetWorkPath() & fpath )
+
+ '///+<li>Click &quot;Save&quot;</li>
+ speichern.click()
+
+ '///+<li>If the file exists, say &quot;yes&quot; to replace it</li>
+ if ( bReplace ) then
+ Kontext "Active"
+ if ( active.exists( 2 ) ) then
+ printlog( CFN & "Overwriting file" )
+ printlog( "Message: " & active.getText() )
+ try
+ active.yes()
+ catch
+ warnlog( CFN & "Unexpected active - no YES button available." )
+ printlog( CFN & "if any this should have been overwrite warning." )
+ endcatch
+ endif
+ endif
+
+ '///+<li>Handle any unexpected errormessage with &quot;OK&quot;</li>
+ Kontext "Active"
+ if ( active.exists( 2 ) ) then
+ printlog( CFN & "Unexpected active: " & active.getText() )
+ brc = false
+ active.ok()
+ endif
+
+ '///+<li>The FileSave dialog should be closed at this point</li>
+ kontext "SpeichernDlg"
+ if ( SpeichernDlg.exists( 1 ) ) then
+ warnlog( CFN & "File Save dialog is still open, it should be closed" )
+ SpeichernDlg.cancel()
+ endif
+ else
+ warnlog( CFN & "Failed to open File Open dialog" )
+ brc = false
+ endif
+
+ '///+<li>Verify that exactly one document is open</li>
+ if( getDocumentCount <> 1 ) then
+ warnlog( CFN & "Incorrect number of open documents" )
+ brc = false
+ endif
+
+ printlog( CFN & "Exit with result: " & brc )
+ hSaveFileExpectSuccess() = brc
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hSaveFileExpectFailure( fpath as string , errortype as integer ) as boolean
+
+ '///<h3>Save 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>
+ '///+<li>Errortype (Integer). Valid options are:</li>
+ '///<ul>
+ '///+<li>0 = Invalid characters in string</li>
+ '///+<li>1 = Filename is interpreted as device</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Errorcondition (boolean)</li>
+ '///<ul>
+ '///+<li>TRUE = <b><i>There was an error saving the file (as expected)</i></b></li>
+ '///+<li>FALSE = The file was saved without problems/any other error</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+ ' currently we have two different kinds of failure
+ ' 1. File cannot be saved due to invalid character(s)
+ ' This is errortype = 0
+ ' 2. File cannot be saved because the given name is interpreted as device
+ ' This is errortype = 1
+ ' This sequence tries to save a document with an invalid name. The errormsg
+ ' is closed, the filedialog cancelled and the file closed.
+
+ dim brc as boolean : brc = false
+
+ dim cMsg as string
+
+ const CFN = "hSaveFileExpectFailure::"
+
+ '///+<li>Open an new document</li>
+ hCreateDocument()
+
+ '///+<li>Click &quot;Save As;&quot;</li>
+ printlog( "" )
+ printlog( CFN & "Enter with options: " & fpath & ", " & errortype )
+ hUseAsyncSlot( "FileSaveAs" )
+
+ '///+<li>Enter the filename</li>
+ kontext "SpeichernDlg"
+ if ( SpeichernDlg.exists( 1 ) ) then
+
+ Kontext "SpeichernDlg"
+ Dateiname.setText( fpath )
+
+ '///+<li>Click &quot;Save&quot;</li>
+ speichern.click()
+
+ '///<ul>
+ '///+<li>Handle invalid characters (Errormessages)</li>
+ select case( errortype )
+ case 0:
+
+ brc = false
+
+ Kontext "Active"
+ if ( Active.exists( 1 ) ) then
+
+ printlog( CFN & "Check for possible overwrite warning..." )
+ try
+ Active.yes()
+ printlog( CFN & "Closed Messagebox with <YES>" )
+ printlog( CFN & "This was the overwrite warning" )
+ catch
+ endcatch
+ endif
+
+ Kontext "Active"
+ if ( Active.exists( 1 ) ) then
+ cMsg = active.getText()
+ try
+ Active.ok()
+ printlog( CFN & "Closed Save-Failure warning with <OK>" )
+ brc = true
+ catch
+ qaerrorlog( CFN & "Unknown dialog encountered, <OK> failed:" )
+ printlog( cMSG )
+ endcatch
+ endif
+
+
+ case 1:
+
+ Kontext "Active"
+ if ( Active.exists( 1 ) ) then
+ printlog( CFN & "Expected active: " & active.getText() )
+ Active.OK()
+
+ Kontext "SpeichernDLG"
+ if ( SpeichernDlg.exists( 1 ) ) then
+ SpeichernDLG.cancel()
+ brc = true
+ else
+ warnlog( CFN & "File Save dialog is missing. Bad!" )
+ brc = false
+ endif
+ else
+ warnlog( CFN & "Errormessage for '/', '\' or ':' is missing" )
+ brc = false
+ endif
+
+ end select
+
+ else
+ warnlog( CFN & "Failed to open File Save dialog" )
+ endif
+ '///</ul>
+
+ '///+<li>Close the document</li>
+ hDestroyDocument()
+
+ '///+<li>Return errorcondition</li>
+ printlog( CFN & "Exit with status: " & brc )
+ hSaveFileExpectFailure() = brc
+
+ '///</ul>
+
+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 &quot;File Open&quot;</li>
+ hUseAsyncSlot( "FileOpen" )
+
+ '///+<li>Click on &quot;New folder&quot;</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 &quot;OK&quot;</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>
+ '///<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 = File was deleted</li>
+ '///+<li>FALSE = Any other condition</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+ ' This sub deletes a file by name. No errors or warnings are expected.
+ ' if everything goes well, we're back to the originating document after
+ ' completion.
+
+ dim iSelectedFilePosition as integer
+ dim brc as boolean
+
+ const CFN = "hDeleteFileViaFileOpen::"
+ printlog( CFN & "Enter with option: " & cFile )
+
+ ' Test for wildcards - the dialog cannot handle those
+ if ( instr( cFile , "?" ) <> 0 ) then
+ warnlog( CFN & "Incorrect call to function, wildcards are not allowed" )
+ hDeleteFileViaFileOpen() = false
+ exit function
+ endif
+
+ ' Test for wildcards - the dialog cannot handle those
+ if ( instr( cFile , "*" ) <> 0 ) then
+ warnlog( CFN & "Incorrect call to function, wildcards are not allowed" )
+ hDeleteFileViaFileOpen() = false
+ exit function
+ endif
+
+ '///+<li>Click &quot;File Open&quot;</li>
+ hUseAsyncSlot( "FileOpen" )
+
+ '///+<li>Look for the requested file, get the position from the filelist</li>
+ Kontext "OeffnenDLG"
+ iSelectedFilePosition = hFindFileObjectViaFileOpen( cFile )
+
+ '///+<li>If the file exists, delete it + verify, if not: Warn and exit</li>
+ if ( iSelectedFilePosition > 0 ) then
+
+ ' Enable for debug
+ 'printlog( CFN & "Requested file: " & cFile )
+ 'printlog( CFN & "Object is at..: " & iSelectedFilePosition )
+ 'printlog( CFN & "Object name is: " & DateiAuswahl.getSelText() )
+
+ DateiAuswahl.TypeKeys( "<DELETE>" )
+
+ ' Confirm deletion. This dialog should always pop up when deleting
+ Kontext "ConfirmDelete"
+ if ( ConfirmDelete.exists( 1 ) ) then
+ Delete.click()
+ printlog( CFN & "Deleted file: " & cFile )
+ else
+ warnlog( CFN & "Messagebox to confirm deletion of file is missing" )
+ endif
+
+ ' Handle possible Warnings/Errormessages. If no errors happen,
+ ' verify that the file has been deleted. Note that this dialog will not
+ ' change the returnvalue.
+ Kontext "Active"
+ if( Active.exists( 1 ) ) then
+ warnlog( CFN & "Unexpected active: " & active.getText() )
+ Active.OK()
+ endif
+
+ ' Verify that the file does no longer exist in the filelist.
+ iSelectedFilePosition = hFindFileObjectViaFileOpen( cFile )
+ if ( iSelectedFilePosition = 0 ) then
+ brc = true
+ else
+ brc = false
+ endif
+
+ else
+
+ brc = false
+ warnlog( CFN & "File not found in workdir: " & cFile )
+
+ endif
+
+ '///+<li>Cancel the FileOpen dialog</li>
+ kontext "OeffnenDlg"
+ OeffnenDlg.cancel()
+
+ '///+<li>Return errorcondition</li>
+ printlog( CFN & "Exit with result: " & brc )
+ hDeleteFileViaFileOpen() = brc
+
+ '///</ul>
+
+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 &quot;File open&quot;</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
+
+ '///<h3>Create a filename with specified character at the end</h3>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Character as number (integer)</li>
+ '///<ul>
+ '///+<li>Only positive numbers are allowed</li>
+ '///+<li>Respect integer boundaries</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>A filename containing a special character at the end (before suffix)</li>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+ dim cFile as string
+ const CFN = "hNameGen_append::"
+
+ '///+<li>Create a string &quot;test&quot;, append ascii char</li>
+ cFile = "test" & CHR$( iDecChar )
+ printlog( CFN & "ASCII " & iDecChar & " appended, len = " & len( cFile ) )
+ if ( len( cFile ) <> 5 ) then
+ warnlog( CFN & "Character not appended" )
+ endif
+
+ '///+<li>Return the new filename</li>
+ hNameGen_append() = cFile
+
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hNameGen_lead( iDecChar as long ) as string
+
+ '///<h3>Create a filename with specified character at the beginning</h3>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Character as number (integer)</li>
+ '///<ul>
+ '///+<li>Only positive numbers are allowed</li>
+ '///+<li>Respect integer boundaries</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>A filename containing a special character at the beginning</li>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+ dim cFile as string
+ const CFN = "hNameGen_lead::"
+
+ '///+<li>Create a string beginning with ascii char and append &quot;test&quot</li>
+ cFile = CHR$( iDecChar ) & "test"
+ printlog( CFN & "ASCII " & iDecChar & " prepended, len = " & len( cFile ) )
+ if ( len( cFile ) <> 5 ) then
+ warnlog( CFN & "Character not prepended" )
+ endif
+
+ '///+<li>Return the new filename</li>
+ hNamegen_lead() = cFile
+
+ '///</ul>
+
+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. &quot;/home/oscar/mydir&quot;</li>
+ '///</ul>
+ '///+<li>Fully qualified path to the file/directory (string)</li>
+ '///<ul>
+ '///+<li>e.g. &quot;/home/oscar/mydir/somedir/myfile.txt&quot;</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Remaining part of the fully qualified path minus startdirectory (string)</li>
+ '///<ul>
+ '///+<li>e.g. &quot;/somedir/myfile.txt&quot;</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>
+ '///<i>Note that the filepicker must be open in order to use this function.<br>
+ '///The object with the given name is selected when leaving the function.</i><br>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Filename incl. extension (string) but without any pathseparator</li>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Position of the object in the filepicker list</li>
+ '///<ul>
+ '///+<li>0: Object not found</li>
+ '///+<li>&gt; 0: Position</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+ const CFN = "hFindFileObjectViaFileOpen::"
+
+ dim iCurrentObject as integer
+ dim cCurrentName as string
+ dim iFileOpenItemCount as integer
+
+ dim iPos as integer : iPos = 0
+ dim cPath as string : cPath = cName
+
+ dim iPathItems as integer
+ dim asPathList( 100 ) as string
+
+ dim iWait as integer ' some increment variable
+
+ printlog( CFN & "Enter with option (File): " & cName )
+
+ '///+<li>If a fully qualified path has been provided we have to split it up</li>
+ iPathItems = DirNameList( cPath, asPathList() )
+ 'printlog( CFN & "iPathItems (new): " & iPathItems )
+
+ if ( iPathItems > 3 ) then
+ cName = asPathList( iPathItems )
+ printlog( CFN & "CNAME from plist: " & cName )
+
+ '///+<li>And walk to the directory</li>
+ cPath = left( cPath , ( len ( cPath ) - len( cName ) ) - 1 )
+ printlog( CFN & "CPATH from plist: " & cPath )
+
+ kontext "OeffnenDlg"
+ if ( OeffnenDlg.exists( 1 ) ) then
+ Dateiname.setText( cPath )
+ Oeffnen.click()
+ else
+ warnlog( CFN & "File Open dialog is not open" )
+ hFindFileObjectViaFileOpen() = 0
+ exit function
+ endif
+ endif
+
+ '///+<li>get the number of items in the filepicker</li>
+ kontext "OeffnenDlg"
+ iWait = 0
+ while ( DateiAuswahl.getItemCount() = 0 )
+ wait( 100 )
+ iWait = iWait + 1
+ if ( iWait = 10 ) then
+ warnlog( "Filepicker is not populated within reasonable timeframe, aborting" )
+ kontext "OeffnenDlg"
+ OeffnenDlg.Close()
+ hFindFileObjectViaFileOpen() = 0
+ exit function
+ else
+ printlog( "Waiting for filepicker list to populate..." )
+ endif
+ wend
+
+ iFileOpenItemCount = DateiAuswahl.getItemCount()
+
+ '///+<li>Jump to the first item in the filelist and select it with SPACE</li>
+ DateiAuswahl.typeKeys( "<HOME>" )
+ DateiAuswahl.typeKeys( "<SPACE>" )
+
+ '///+<li>Navigate through the list until we find the requested object</li>
+ for iCurrentObject = 1 to iFileOpenItemCount
+
+ cCurrentName = DateiAuswahl.getSelText()
+
+ if ( cCurrentName = cName ) then
+ iPos = iCurrentObject
+ exit for
+ endif
+
+ DateiAuswahl.typeKeys( "<DOWN>" )
+
+ next iCurrentObject
+
+ '///+<li>Print some info to the log</li>
+ if ( iPos > 0 ) then
+ printlog( CFN & "Exit: Found item [" & cName & "] at pos: " & iPos )
+ else
+ printlog( CFN & "Exit: Requested item [" & cName & "] was not found." )
+ endif
+
+ '///+<li>return the position or 0 on failure</li>
+ hFindFileObjectViaFileOpen() = iPos
+ '///</ul>
+
+end function
+
diff --git a/testautomation/framework/tools/includes/formcontrols.inc b/testautomation/framework/tools/includes/formcontrols.inc
new file mode 100644
index 000000000000..49c8dbaff943
--- /dev/null
+++ b/testautomation/framework/tools/includes/formcontrols.inc
@@ -0,0 +1,816 @@
+'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 draw and select form controls in basic-ide
+' **
+'\******************************************************************************
+
+public const ICONTROLCOUNT = 22
+
+function hGetControlParams( cParam as string ) as integer
+
+ '///<h3>Retrieve basic parameters to draw formcontrols to a dialog</h3>
+ '///<i>All values are in percent relative to the window size.
+ '///+ All values are optimized for 1024x768 pixels screen resolution but
+ '///+ have been tested successfully with 1280x1024 and 800x600</i><br>
+ '///<i>In most cases it is desired to place multiple controls on a single
+ '///+ 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>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Name of the coordinate (string). Valid options are:</li>
+ '///<ul>
+ '///+<li>&quot;XOREGO&quot; (Upper left corner)</li>
+ '///+<li>&quot;YOREGO&quot; (Upper left corner)</li>
+ '///+<li>&quot;XDIST&quot; (Distance between the upper left corners of neighbor controls)</li>
+ '///+<li>&quot;YDIST&quot; (Distance between the upper left corners of neighbor controls)</li>
+ '///+<li>&quot;XSIZE&quot; (Width of control)</li>
+ '///+<li>&quot;YSIZE&quot; (Heighth of the control)</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Coordinate/Distance/Size in percent of window size (integer)</li>
+ '///<ul>
+ '///+<li>A number between 1 and 100</li>
+ '///+<li>0 on error (invalid function parameter)</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+ cParam = ucase( cParam )
+
+ '///+<li>Currently following values are defined:</li>
+ '///<ul>
+ select case cParam
+ '///+<li>XOREGO = 31</li>
+ case "XOREGO" : hGetControlParams() = 31
+ '///+<li>XDIST = 8</li>
+ case "XDIST" : hGetControlParams() = 8
+ '///+<li>XSIZE = 6</li>
+ case "XSIZE" : hGetControlParams() = 6
+ '///+<li>YOREGO = 30</li>
+ case "YOREGO" : hGetControlParams() = 30
+ '///+<li>YDIST = 7</li>
+ case "YDIST" : hGetControlParams() = 7
+ '///+<li>YSIZE = 5</li>
+ case "YSIZE" : hGetControlParams() = 5
+ '///+<li>Incorrect function parameter = 0</li>
+ case else : hGetControlParams() = 0
+ '///</ul>
+ end select
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hGetControlName( iControl as integer ) as string
+
+ '///<h3>A function to deliver a speaking name for all form controls</h3>
+ '///<i>Note that the numbers of the controls are unique</i><br>
+ '///<i>In most cases it is desired to place multiple controls on a single
+ '///+ 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>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Number of the control (integer)</li>
+ '///<ul>
+ '///+<li>Any number between 1 and 22, see description below</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Name for a control (string)</li>
+ '///<ul>
+ '///+<li>Name for a control (may contain whitespaces)</li>
+ '///+<li>An empty string in case of an invalid function parameter</li>
+ '///</ul>
+ '///</ol>
+ '///<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"
+ '///+<li>Image Control</li>
+ case 2 : sControl = "Image Control"
+ '///+<li>Check Box</li>
+ case 3 : sControl = "Check Box"
+ '///+<li>Radio Button</li>
+ case 4 : sControl = "Radio Button"
+ '///+<li>Fixed Text</li>
+ case 5 : sControl = "Fixed Text"
+ '///+<li>Edit Field</li>
+ case 6 : sControl = "Edit Field"
+ '///+<li>List Box</li>
+ case 7 : sControl = "List Box"
+ '///+<li>Combo Box</li>
+ case 8 : sControl = "Combo Box"
+ '///+<li>Vertical ScrollBar</li>
+ case 9 : sControl = "Vertical ScrollBar"
+ '///+<li>Horizontal ScrollBar</li>
+ case 10 : sControl = "Horizontal ScrollBar"
+ '///+<li>Frame</li>
+ case 11 : sControl = "Frame"
+ '///+<li>Progress Bar</li>
+ case 12 : sControl = "Progress Bar"
+ '///+<li>Vertical Fixed Line</li>
+ case 13 : sControl = "Vertical Fixed Line"
+ '///+<li>Horizontal Fixed Line</li>
+ case 14 : sControl = "Horizontal Fixed Line"
+ '///+<li>Date Field</li>
+ case 15 : sControl = "Date Field"
+ '///+<li>Time Field</li>
+ case 16 : sControl = "Time Field"
+ '///+<li>Numeric Field</li>
+ case 17 : sControl = "Numeric Field"
+ '///+<li>Currency Field</li>
+ case 18 : sControl = "Currency Field"
+ '///+<li>Form Field</li>
+ case 19 : sControl = "Form Field"
+ '///+<li>Pattern Field</li>
+ case 20 : sControl = "Pattern Field"
+ '///+<li>File Control</li>
+ case 21 : sControl = "File Control"
+ '///+<li>Tree Control</li>
+ case 22 : sControl = "Tree Control"
+ '///</ol>
+ '///+<li>&quot;&quot; for function parameter &lt; 1 or &gt; 22 </li>
+ case else : sControl = ""
+ end select
+
+ hGetControlName() = sControl
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hInsertControl( iControl as integer ) as string
+
+ '///<h3>Function to insert one of the BASIC formcontrols by index</h3>
+ '///<i>Note that the numbers of the controls are unique</i><br>
+ '///<i>In most cases it is desired to place multiple controls on a single
+ '///+ 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>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Number of the control (integer)</li>
+ '///<ul>
+ '///+<li>Any number between 1 and 22, see description below</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Name for a control (string)</li>
+ '///<ul>
+ '///+<li>Name for a control (may contain whitespaces)</li>
+ '///+<li>An empty string in case of an invalid function parameter</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+ const CFN = "hInsertControl::"
+
+ Kontext "ToolsCollectionBar"
+
+ '///+<li>Click on the requested button on the ToolsCollectionBar:</li>
+ '///<ol>
+ select case iControl
+ '///+<li>Push Button</li>
+ case 1 : InsPushButton.click()
+ '///+<li>Image Control</li>
+ case 2 : InsImgCtrl.click()
+ '///+<li>Check Box</li>
+ case 3 : InsCheckbox.click()
+ '///+<li>Radio Button</li>
+ case 4 : InsRadioButton.click()
+ '///+<li>Fixed Text</li>
+ case 5 : InsFixedText.click()
+ '///+<li>Edit Field</li>
+ case 6 : InsEditField.click()
+ '///+<li>List Box</li>
+ case 7 : InsListbox.click()
+ '///+<li>Combo Box</li>
+ case 8 : InsComboBox.click()
+ '///+<li>Vertical ScrollBar</li>
+ case 9 : InsScrollBarV.click()
+ '///+<li>Horizontal ScrollBar</li>
+ case 10 : InsScrollBarH.click()
+ '///+<li>Frame</li>
+ case 11 : InsFrame.click()
+ '///+<li>Progress Bar</li>
+ case 12 : InsProgressbar.click()
+ '///+<li>Vertical Fixed Line</li>
+ case 13 : InsFixedLineV.click()
+ '///+<li>Horizontal Fixed Line</li>
+ case 14 : InsFixedLineH.click()
+ '///+<li>Date Field</li>
+ case 15 : InsDateField.click()
+ '///+<li>Time Field</li>
+ case 16 : InsTimeField.click()
+ '///+<li>Numeric Field</li>
+ case 17 : InsNumField.click()
+ '///+<li>Currency Field</li>
+ case 18 : InsCurrencyField.click()
+ '///+<li>Form Field</li>
+ case 19 : InsFormField.click()
+ '///+<li>Pattern Field</li>
+ case 20 : InsPatternField.click()
+ '///+<li>File Control</li>
+ case 22 : InsFileCtrl.click()
+ '///+<li>Tree Control</li>
+ case 22 : InsTreeControl.click()
+ end select
+ '///</ol>
+ '///+<li>&quot;&quot; for function parameter &lt; 1 or &gt; 22 </li>
+
+ hInsertControl() = hGetControlName( iControl )
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hDrawControlOnDialog( iControl as integer ) as string
+
+ '///<h3>Draw a control on a dialog at a fixed position</h3>
+ '///<i>Note that the numbers of the controls are unique</i><br>
+ '///<i>In most cases it is desired to place multiple controls on a single
+ '///+ 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>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Number of the control (integer)</li>
+ '///<ul>
+ '///+<li>Any number between 1 and 22, see description for hInsertControl()</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Name for a control (string)</li>
+ '///<ul>
+ '///+<li>Name for a control (may contain whitespaces)</li>
+ '///+<li>An empty string in case of an invalid function parameter</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+ 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
+
+ ' coordinates of the controls on the dialog in the dialog-editor
+ dim iXO as integer
+ dim iYO as integer
+ dim iXE as integer
+ dim iYE as integer
+
+ '///+<li>determine where the control is to be painted (hGetControlPos...)</li>
+ iXO = hGetControlPosXO( iControl )
+ iYO = hGetControlPosYO( iControl )
+ iXE = hGetControlPosXE( iControl )
+ iYE = hGetControlPosYE( iControl )
+
+ '///+<li>click the desired control</li>
+ sControl = hInsertControl( iControl )
+ printlog( CFN & " at XO=" & iXO & _
+ " XE=" & iXE & _
+ " YO=" & iYO & _
+ " YE=" & iYE & _
+ " : " & sControl )
+
+ '///+<li>Draw the control (using hDrawControl(...))</li>
+ brc = hDrawControl( iXO, iYO, iXE, iYE )
+ hDrawControlOnDialog() = sControl
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hDrawControl( xPos as integer, _
+ yPos as integer, _
+ xEnd as integer, _
+ yEnd as integer ) as boolean
+
+ '///<h3>Draw a control on the dialog pane in the dialog editor</h3>
+ '///<i>Starting point: Basic IDE/Dialog editor</i><br>
+ '///<i>In most cases it is desired to place multiple controls on a single
+ '///+ 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>
+ '///<i>Note: All units are in percent of the relative to the current window size</i><br>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>X-Orego (Upper left corner) (integer)</li>
+ '///<ul>
+ '///+<li>Min = 0</li>
+ '///+<li>Max = 100 (allowed but not useful)</li>
+ '///</ul>
+ '///+<li>Y-Orego (Upper left corner) (integer)</li>
+ '///<ul>
+ '///+<li>Min = 0</li>
+ '///+<li>Max = 100 (allowed but not useful)</li>
+ '///</ul>
+ '///+<li>X-End (Lower right corner) (integer)</li>
+ '///<ul>
+ '///+<li>Min = 0</li>
+ '///+<li>Max = 100 (allowed but not useful)</li>
+ '///</ul>
+ '///+<li>Y-End (Lower right corner) (integer)</li>
+ '///<ul>
+ '///+<li>Min = 0</li>
+ '///+<li>Max = 100 (allowed but not useful)</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 = "hDrawControl::"
+
+ '///+<li>Set context to Basic IDE</li>
+ Kontext "BasicIDE"
+
+ '///+<li>Draw the control using mouse actions</li>
+ '///<ol>
+ '///+<li>Mouse down on pos X/Y-Orego</li>
+ '///+<li>Mouse move to pos X/Y-End</li>
+ '///+<li>Mouse up on pos X/Y-End</li>
+ '///</ol>
+ '///</ul>
+
+ DialogWindow.MouseUp( 20 , 20 )
+
+ try
+ DialogWindow.MouseDown ( xPos, yPos )
+ DialogWindow.MouseMove ( xEnd, yEnd )
+ DialogWindow.MouseUp ( xEnd, yEnd )
+ hDrawControl() = true
+ catch
+ warnlog( "#i39852# " & CFN & "Unable to complete mouseactions on dialog" )
+ hDrawControl() = false
+ endcatch
+
+
+end function
+
+'*******************************************************************************
+
+function hGetControlPosXO( iControl as integer ) as integer
+
+ '///<h3>Retrieve the upper left X-coordinate for a control</h3>
+ '///<i>In most cases it is desired to place multiple controls on a single
+ '///+ 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>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Number of the control (integer)</li>
+ '///<ul>
+ '///+<li>Any number between 1 and 22, see description for hInsertControl()</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>X-Orego in percent of window size (integer)</li>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+ dim xOffset as integer
+ xOffset = hGetControlParams( "xorego" )
+
+ dim xDistance as integer
+ xDistance = hGetControlParams( "xdist" )
+
+ '///+<li>Define an offset for the control depending on its ID</li>
+ '///<ul>
+ '///+<li>&lt; 7 : Column one</li>
+ '///+<li>7 ... 12 : Column two</li>
+ '///+<li>13 ... 18 : Column three</li>
+ '///+<li>&gt; 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
+
+end function
+
+'*******************************************************************************
+
+function hGetControlPosYO( iControl as integer ) as integer
+
+ '///<h3>Retrieve the upper left Y-coordinate for a control</h3>
+ '///<i>In most cases it is desired to place multiple controls on a single
+ '///+ 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>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Number of the control (integer)</li>
+ '///<ul>
+ '///+<li>Any number between 1 and 21, see description for hInsertControl()</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Y-Orego in percent of window size (integer)</li>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+ dim yOffset as integer
+ yOffset = hGetControlParams( "yorego" )
+
+ dim yDistance as integer
+ yDistance = hGetControlParams( "ydist" )
+
+ '///+<li>Define an offset for the control depending on its ID</li>
+ '///<ul>
+ '///+<li>1 , 7 , 13 , 19 : Row one</li>
+ '///+<li>2 , 8 , 14 , 20 : Row two</li>
+ '///+<li>3 , 9 , 15 , 21 : Row three</li>
+ '///+<li>4 , 10 , 16 , 22 : Row four</li>
+ '///+<li>5 , 11 , 17 : Row five</li>
+ '///+<li>6 , 12 , 18 : Row six</li>
+ '///</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
+ end select
+
+end function
+
+'*******************************************************************************
+
+function hGetControlPosXE( iControl as integer ) as integer
+
+ '///<h3>Retrieve the lower right X-coordinate for a control</h3>
+ '///<i>In most cases it is desired to place multiple controls on a single
+ '///+ 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>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Number of the control (integer)</li>
+ '///<ul>
+ '///+<li>Any number between 1 and 22, see description for hInsertControl()</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>X-End in percent of window size (integer)</li>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+ '///+<li>Get pos for X-Orego, add &quot;XSIZE&quot;</li>
+ hGetControlPosXE() = hGetControlPosXO( iControl ) + _
+ hGetControlParams( "xsize" )
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hGetControlPosYE( iControl as integer ) as integer
+
+ '///<h3>Retrieve the lower right Y-coordinate for a control</h3>
+ '///<i>In most cases it is desired to place multiple controls on a single
+ '///+ 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>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Number of the control (integer)</li>
+ '///<ul>
+ '///+<li>Any number between 1 and 22, see description for hInsertControl()</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Y-End in percent of window size (integer)</li>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+ '///+<li>Get pos for Y-Orego, add &quot;YSIZE&quot;</li>
+ hGetControlPosYE() = hGetControlPosYO( iControl ) + _
+ hGetControlParams( "ysize" )
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hGetControlPosXM( iControl as integer ) as integer
+
+ '///<h3>Retrieve the center (X) of a control</h3>
+ '///<i>In most cases it is desired to place multiple controls on a single
+ '///+ 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>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Number of the control (integer)</li>
+ '///<ul>
+ '///+<li>Any number between 1 and 22, see description for hInsertControl()</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>X-Center in percent of window size (integer)</li>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+ dim XO as integer
+ dim XE as integer
+
+ '///+<li>Find X-Orego</li>
+ XO = hGetControlPosXO( iControl )
+
+ '///+<li>Find X-End</li>
+ XE = hGetControlPosXE( iControl )
+
+ '///+<li>Calculate the distance, find the middle between the two</li>
+ hGetControlPosXM() = XO + 0.5 * ( XE - XO )
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hGetControlPosYM( iControl as integer ) as integer
+
+ '///<h3>Retrieve the center (Y) of a control</h3>
+ '///<i>In most cases it is desired to place multiple controls on a single
+ '///+ 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>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Number of the control (integer)</li>
+ '///<ul>
+ '///+<li>Any number between 1 and 22, see description for hInsertControl()</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Y-Center in percent of window size (integer)</li>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+ dim YO as integer
+ dim YE as integer
+
+ '///+<li>Find Y-Orego</li>
+ YO = hGetControlPosYO( iControl )
+
+ '///+<li>Find Y-End</li>
+ YE = hGetControlPosYE( iControl )
+
+ '///+<li>Calculate the distance, find the middle between the two</li>
+ hGetControlPosYM() = YO + 0.5 * ( YE - YO )
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hSelectControl( iControl as integer ) as boolean
+
+ '///<h3>Function to select one of the BASIC formcontrols by index</h3>
+ '///<i>Note: Refer to the inline documentation for implementation details</i><br>
+ '///<i>In most cases it is desired to place multiple controls on a single
+ '///+ 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>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Number of the control (integer)</li>
+ '///<ul>
+ '///+<li>Any number between 1 and 22, see description for hInsertControl()</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Errorstatus (boolean)</li>
+ '///<ul>
+ '///+<li>TRUE if the properties-button on ToolsCollectionBar is enabled</li>
+ '///+<li>FALSE in any other case</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+ dim xPos as integer
+ dim yPos as integer
+ dim iTry as integer ' we try five times to grab the control
+ dim iTab as integer
+
+ hSelectControl() = false
+
+ '///+<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
+
+ '///+<li>Verify that the ToolsCollectionBar is visible. if not: Abort</li>
+ kontext "ToolsCollectionBar"
+ if ( not ToolsCollectionBar.exists() ) then
+ warnlog( "The ToolsCollectionBar is not visible, open it first" )
+ exit function
+ endif
+
+ '///+<li>Enable the selection mode on ToolsCollectionBar</li>
+ SelectMode.click()
+
+ ' Note: The controls have areas where they ignore a mouseclick. E.g. the
+ ' framecontrol can only be grabbed at the border, you won't be able to
+ ' select it by clicking in the middle. Furthermore - even if the Dialog-
+ ' editor-window is maximized - we might still miss the upper left corner.
+ ' So what happens in this loop is that we try to click in the middle of the
+ ' control. This works in 21 out of 22 cases. If it fails, we try to grab the
+ ' border, first upper left corner then lower right. If this still fails,
+ ' we try to select the control by using a rectangle selection around the
+ ' control. If this last resort fails, the function exits gracefully but
+ ' with a warnlog (causing some other functions to fail with warnings
+ ' as well). Beware of possible problems with screen resolutions.
+ ' This function has been tested for 1024x768 and 1280x1024 pixels.
+ ' 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>
+ '///+<li>Mouse-Click on upper left corner</li>
+ '///+<li>Mouse-Click on lower right corner</li>
+ '///+<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
+
+ Kontext "BasicIDE"
+
+ select case iTry
+ case 1
+ 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.MouseMove( xPos, yPos )
+ DialogWindow.MouseDown( xPos, yPos )
+ DialogWindow.MouseUp ( xPos, yPos )
+ case 3
+ xPos = hGetControlPosXE( iControl )
+ yPos = hGetControlPosYE( iControl )
+ DialogWindow.MouseMove( xPos, yPos )
+ DialogWindow.MouseDown( xPos, yPos )
+ DialogWindow.MouseUp ( xPos, yPos )
+ case 4
+ xPos = hGetControlPosXO( iControl ) - 2
+ yPos = hGetControlPosYO( iControl ) - 2
+ DialogWindow.MouseMove( xPos, yPos )
+ DialogWindow.MouseDown( xPos, yPos )
+ DialogWindow.MouseUp ( xPos, yPos )
+
+ xPos = hGetControlPosXE( iControl ) + 2
+ yPos = hGetControlPosYE( iControl ) + 2
+ 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
+ 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 )
+ endif
+ endif
+
+ next iTry
+ '///</ul>
+
+end function
+
+
diff --git a/testautomation/framework/tools/includes/help_tools.inc b/testautomation/framework/tools/includes/help_tools.inc
new file mode 100644
index 000000000000..ed55c319fd40
--- /dev/null
+++ b/testautomation/framework/tools/includes/help_tools.inc
@@ -0,0 +1,431 @@
+'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 : Replacements for routines in t_lists.inc adds some
+'*
+'\******************************************************************************
+
+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::"
+
+ HelpContents
+
+ if ( WaitSlot( 3000 ) <> WSFinished ) then
+ printlog( CFN & "Failed to open help" )
+ hOpenHelp() = FALSE
+ else
+ kontext "StarOfficeHelp"
+ if ( StarOfficeHelp.exists() ) then
+ printlog( CFN & "Help was opened" )
+ hOpenHelp() = TRUE
+ else
+ printlog( CFN & "Help was not opened" )
+ hOpenHelp() = FALSE
+ endif
+ 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::"
+
+ 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")
+ hCloseHelp() = TRUE
+ endif
+
+end function
+
+'******************************************************************************
+
+function hSelectHelpTab( cTab as string ) as boolean
+
+ '///<h3>Select a tab on the help dialog by name</h3>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>The tab to open (string)</li>
+ '///<ul>
+ '///+<li>&quot;content&quot; for the contents tab</li>
+ '///+<li>&quot;index&quot; for the index tab</li>
+ '///+<li>&quot;find&quot; for the find tab</li>
+ '///+<li>&quot;bookmarks&quot; for the bookmarks tab</li>
+ '///</ul>
+ '///</ol>
+
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Errorcondition (boolean)</li>
+ '///<ul>
+ '///+<li>TRUE if the requested tabpage is open</li>
+ '///+<li>FALSE if the requested tabpage did not open</li>
+ '///</ul>
+ '///</ol>
+
+ '///<u>Description</u>:
+ '///<ul>
+ const CFN = "hSelectHelpTab::"
+
+ 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>
+ select case cTabName
+ case "content" : TabControl.setPage( ContentPage )
+ if ( SearchContent.isVisible() ) then
+ call DialogTest( ContentPage )
+ brc = true
+ endif
+ case "index" : TabControl.setPage( IndexPage )
+ if ( SearchIndex.isVisible() ) then
+ call DialogTest( IndexPage )
+ brc = true
+ endif
+ case "find" : TabControl.setPage( FindPage )
+ if ( SearchFind.isVisible() ) then
+ call DialogTest( FindPage )
+ brc = true
+ endif
+ case "bookmarks" : TabControl.setPage( BookmarksPage )
+ if ( Bookmarks.isVisible() ) then
+ call DialogTest( BookmarksPage )
+ brc = true
+ endif
+ case else
+ printlog( CFN & "Invalid parameter passed to function: " & cTab )
+ printlog( CFN & "Valid are: content, index, find, bookmarks" )
+ brc = false
+ end select
+
+ '///+<li>Print a comment to the log</li>
+ if ( brc ) then
+ printlog( CFN & "Exit: Selected Tabpage: " & cTab )
+ endif
+
+ '///+<li>Return TRUE or FALSE</li>
+ hSelectHelpTab() = brc
+
+ '///</ul>
+end function
+
+'*******************************************************************************
+
+function hUseBookmarksContextMenu( cAction as string ) as boolean
+
+ '///<h3>handle the bookmarks context menu in Help Browser</h3>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>The context item to execute (string)</li>
+ '///<ul>
+ '///+<li>&quot;show&quot;</li>
+ '///+<li>&quot;rename&quot;</li>
+ '///+<li>&quot;delete&quot;</li>
+ '///</ul>
+ '///</ol>
+
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Errorcondition (boolean)</li>
+ '///<ul>
+ '///+<li>TRUE on success</li>
+ '///+<li>FALSE on any other error</li>
+ '///</ul>
+ '///</ol>
+
+ '///<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>
+ Kontext "BookmarksPage"
+ if ( not BookmarksPage.exists() ) then
+ printlog( CFN & "BookmarksPage is not open" )
+ hUseBookmarksContextMenu() = false
+ exit function
+ endif
+
+ '///+<li>Find the index of the requested entry</li>
+ cSelection = lcase( cAction )
+ select case cSelection
+ case "show" : iActionPos = 1
+ case "rename" : iActionPos = 2
+ case "delete" : iActionPos = 3
+ case else : iActionPos = 0
+ end select
+
+ '///+<li>If action is unsuported, return false and exit the function</li>
+ if ( iActionPos = 0 ) then
+ printlog( CFN & "Invalid action passed to function" )
+ hUseBookmarksContextMenu() = false
+ exit function
+ endif
+
+ '///+<li>Open the context menu and select the requested index</li>
+ kontext "Bookmarks"
+ Bookmarks.openContextMenu()
+ printlog( CFN & "Exit: Opening item: " & MenuGetItemText( iActionPos ) )
+ MenuSelect( iActionPos )
+
+ '///+<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>
+
+ '///<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>&le; 0 = do not truncate</li>
+ '///</ul>
+ '///</ol>
+
+
+ '///<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>
+
+ const CFN = "hGetHelpContentHeader::"
+ printlog( CFN & "Enter with option (iLength): " & iLength )
+ dim cHeaderString as string
+
+ '///<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
+ endif
+ '///</ul>
+
+ printlog( CFN & "Exit: " & cHeaderString )
+ hGetHelpContentHeader() = cHeaderString
+
+end function
diff --git a/testautomation/framework/tools/includes/i18n_tools.inc b/testautomation/framework/tools/includes/i18n_tools.inc
new file mode 100644
index 000000000000..a2b65e12b736
--- /dev/null
+++ b/testautomation/framework/tools/includes/i18n_tools.inc
@@ -0,0 +1,189 @@
+'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 language dependent strings/values
+'*
+'\******************************************************************************
+
+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 &quot;siSpracheSetzen&quot;</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 -&gt; &quot;01&quot; - &quot;09&quot;</li>
+ '///+<li>10 - 99 -&gt; &quot;10&quot; - &quot;99&quot;</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
+
+
+ '///<h3>Test whether we are running on an utf8 locale (Linux only)</h3><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: Yes, this is a UTF-8 locale</li>
+ '///+<li>FALSE: Anything else</li>
+ '///</ul>
+ '///</ol>
+
+ const CFN = "hTestLocale::"
+ dim brc as boolean 'a multi purpose boolean returnvalue
+ dim irc as integer
+ irc = 0
+
+ dim lc_all as string
+ dim lang as string
+
+ '///<u>Description:</u>
+ '///<ul>
+
+ if ( gtSysName = "Linux" ) then
+
+ '///+<li>Retrieve LANG</li>
+ lang = environ( "LANG" )
+ lang = ucase( lang )
+ if ( instr( lang , "UTF8" ) or instr( lang , "UTF-8" ) ) then
+ irc = 1
+ endif
+
+ '///+<li>Retrieve LC_ALL (Note that this variable is mostly set but has no value assigned)</li>
+ lc_all = environ( "LC_ALL" )
+ lc_all = ucase( lc_all )
+ if ( instr( lc_all , "UTF8" ) or instr( lc_all , "UTF-8" ) ) then
+ irc = irc + 1
+ else
+ if ( lc_all = "" ) then
+ printlog( CFN & "No value set for LC_ALL, assuming UTF-8" )
+ irc = irc + 1
+ else
+ printlog( CFN & "LC_ALL is set but has no UTF-8 locale" )
+ endif
+ endif
+
+ else
+
+ irc = 2 ' this is Windows and Solaris - they always can handle weird content
+
+ endif
+
+ if ( irc = 2 ) then
+ printlog( CFN & "UTF-8 locale found" )
+ hTestLocale() = TRUE
+ else
+ printlog( CFN & "Please verify that you are running on UTF-8 locale" )
+ hTestLocale() = FALSE
+ endif
+
+ '///</ul>
+
+
+end function
diff --git a/testautomation/framework/tools/includes/init_tools.inc b/testautomation/framework/tools/includes/init_tools.inc
new file mode 100644
index 000000000000..e7b90fa75523
--- /dev/null
+++ b/testautomation/framework/tools/includes/init_tools.inc
@@ -0,0 +1,205 @@
+'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
new file mode 100644
index 000000000000..d5ac6fd36148
--- /dev/null
+++ b/testautomation/framework/tools/includes/javatools.inc
@@ -0,0 +1,151 @@
+'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
new file mode 100644
index 000000000000..baffbc968406
--- /dev/null
+++ b/testautomation/framework/tools/includes/options_tools.inc
@@ -0,0 +1,404 @@
+'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 : thorsten.bosbach@sun.com
+'*
+'* short description : tools for options tests
+'*
+'\******************************************************************************
+
+sub GetPathList ( ls1 () as String, ls2 () as String, ls3 () as String )
+
+ Dim lsInterim ( 50 ) as String
+ Dim i as Integer
+ Dim sList as String
+ Dim bNewCreate as Boolean
+ '///routine to get the correct comparison list for path-options
+ '///+ if the list does not exist => CreatePathList
+ '///+ you can find the lists for all languages in separate files
+ '///+[TesttoolPath]\framework\options\input\paths_[LanguageCode].txt
+ ls1 (0) = 0 : ls2 (0) = 0 : ls3 (0) = 0
+ sList = gTesttoolPath + "framework\optional\input\options\paths_" + iSprache + ".txt"
+ sList = convertpath( sList )
+
+ if App.Dir ( sList ) = "" then
+ bNewCreate = TRUE
+ CreatePathList
+ else
+ bNewCreate = FALSE
+ end if
+
+ if bAsianLan = TRUE then
+
+ select case iSystemSprache
+ case 01, 33, 34, 39, 46, 49
+ ListRead ( lsInterim (), sList, "utf8" )
+ case else
+
+ if bNewCreate = FALSE then
+ CreatePathList
+ endif
+
+ ListRead ( lsInterim (), sList, "utf8" )
+ end select
+
+ else
+ ListRead ( lsInterim (), sList , "utf8" )
+ end if
+
+ for i = 1 to ListCount ( lsInterim () )
+ ListAppend ( ls1 (), Left ( lsInterim (i), Instr ( lsInterim (i), ";" ) - 1 ) )
+ ListAppend ( ls2 (), Mid ( lsInterim (i), Len ( lsInterim (i) ) - 2, 1 ) )
+ ListAppend ( ls3 (), Right ( lsInterim (i), 1 ) )
+ next i
+
+end sub
+
+'*******************************************************************************
+
+sub CreatePathList
+
+ Dim i as Integer, iNum as Integer
+ Dim sType as String, sVario as String, sList as String
+ Dim lsInterim ( 50 ) as String
+ '///create the comparison list for path-options
+ '///+[TesttoolPath]\framework\options\input\paths_[LanguageCode].txt
+ sList = ConvertPath ( gTesttoolPath + "framework\optional\input\options\paths_" + iSprache + ".txt" )
+ call hNewDocument()
+ ToolsOptions
+ hToolsOptions ( "StarOffice", "Paths" )
+
+ for i=1 to Typ.GetItemCount
+
+ Kontext "TabPfade"
+
+ if i=1 then
+ Typ.TypeKeys "<Down>"
+ Typ.TypeKeys "<Home>"
+ else
+ Typ.TypeKeys "<Down>"
+ end if
+
+ sType = Typ.GetSelText
+
+ if Bearbeiten.IsEnabled then
+ Bearbeiten.Click
+
+ Kontext "OeffnenDlg"
+
+ if OeffnenDlg.Exists then
+ sVario = 1
+ iNum = 1
+ OeffnenDlg.Cancel
+ end if
+
+ Kontext "PfadeAuswaehlen"
+ if PfadeAuswaehlen.Exists then
+ sVario = 2
+ iNum = Pfade.GetItemCount
+ PfadeAuswaehlen.Cancel
+ end if
+
+ else
+ sVario = 0
+ iNum = 0
+ end if
+
+ ListAppend ( lsInterim(), sType + ";" + sVario + ";" + iNum )
+ next i
+
+ if bAsianLan = FALSE then
+ Warnlog "The file for comparison does not exists. The file will be written!"
+ Warnlog "Please check : " + sList
+ ListWrite ( lsInterim(), sList )
+ else
+ Warnlog "The file for comparison does not exists. The file will be written!"
+ Warnlog "Please check : " + sList
+ ListWrite ( lsInterim(), sList, "utf8" )
+ end if
+
+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 )
+ gApplication = "IMPRESS"
+ call hNewDocument()
+ WL_SD_Wuerfel
+ Sleep 1
+
+ Kontext "Documentimpress"
+ DocumentImpress.MouseDown 50, 50
+ DocumentImpress.MouseMove 30, 60
+ DocumentImpress.MouseUp 30, 60
+ Sleep 3
+ call hCloseDocument()
+ gApplication = "WRITER"
+
+end sub
+
+'*******************************************************************************
+
+sub DeleteColor( cColorName as String )
+ 'Deletes a color by name. The color is selected in the listbox
+ 'and should - if it exists - be visible in the entryfield above the list.
+ 'If this is not the case the color probably not exists and thus
+ 'cannot be deleted.
+ 'Remember i18n, only use this sub for colors you created yourself!
+ dim iItems as Integer 'Number of listed colors
+ dim i as Integer 'counter
+ dim bExists as Boolean 'TRUE if color has been successfully deleted
+ dim iPos as Integer 'Position of the deleted color
+ dim sColor as string
+
+ printlog "DeleteColor:: - Trying to delete color: '" + cColorName + "'"
+ Kontext "TabFarben"
+ bExists = FALSE
+ iItems = Farbe.getItemCount
+ i = 0
+ while ((i<iItems) AND (NOT bExists))
+ sColor = Farbe.getItemText(i+1)
+ if (sColor = cColorName) then
+ Loeschen.Click
+ Kontext "Active"
+ if Active.Exists then
+ printlog active.getText
+ Active.Yes
+ else
+ qaErrorlog "No warning about deleting the color."
+ endif
+ printlog " - successfully deleted color @ " + (i+1) + "/" + iItems
+ bExists = TRUE
+ else
+ inc (i)
+ endif
+' if FarbName.getText = cColorName then
+ wend
+ iPos = i+1
+
+ if bExists then
+ 'The userdefined colors usually are appended to the list. If they are
+ 'somewhere else this might be a bug.
+ if iItems <> iPos then
+ warnlog " The color was not located at the end of the list."
+ printlog " The Order of the list might be corrupted"
+ end if
+ else
+ 'Inform that the color did not exist. This usually is perfectly ok.
+ printlog " (The color was not deleted, it was not found)"
+ endif
+end sub
+
+'*******************************************************************************
+
+sub modifyColorRGB_PGUP( iColor as Integer )
+ 'The current color's values are set to maximum (255) for RGB
+ printlog( "modifyColorRGB_PGUP:: - change the color by pressing PAGE UP in RGB listboxes." )
+
+ Kontext "TabFarben"
+ Farbe.Select(iColor)
+ R.TypeKeys("<PageUp>")
+ G.TypeKeys("<PageUp>")
+ B.TypeKeys("<PageUp>")
+ printlog("modifyColorRGB_PGUP:: Press 'modify'")
+ Aendern.Click()
+ Sleep (1)
+end sub
+
+'*******************************************************************************
+
+sub createNewColor( aColor() as String )
+ ' INPUT : array: (1): Name; (2): Red value; (3): Green value; (4): Blue value
+ ' OUTPUT:
+ 'The desired color is selected by name and created.
+ 'If it already exists, there is a problem
+ printlog( "createNewColor:: Adding a color to the list: '" + aColor(1) + "'"
+ Kontext "TabFarben"
+ FarbName.setText(aColor(1))
+ R.SetText(aColor(2))
+ G.SetText(aColor(3))
+ B.SetText(aColor(4))
+ Sleep(1)
+ Hinzufuegen.Click
+ Sleep(1)
+
+ Kontext "DuplicateNameWarning"
+ if DuplicateNameWarning.Exists then
+ warnlog "createNewColor:: Color already exists."
+ DuplicateNameWarning.OK
+ Kontext "NameDlg"
+ if NameDlg.Exists then
+ printlog "createNewColor:: Naming dialog shown. Good, cancelling"
+ NameDlg.Cancel
+ else
+ warnlog "createNewColor:: Naming dialog didn't came up."
+ end if
+ else
+ printlog "createNewColor:: New color has been created"
+ end if
+end sub
+
+'*******************************************************************************
+
+sub getColorRGB( aColor() as String )
+ ' INPUT : array with index 1-4 that will get deleted
+ ' OUTPUT: array: (1): Name; (2): Red value; (3): Green value; (4): Blue value
+ 'A RGB color always has four attributes:
+ 'The name and the three RGB values (0...255)
+ printlog( "GetColorRGB:: Determining the current color" )
+ FarbModell.Select(1)
+
+ aColor(1) = FarbName.GetText()
+ aColor(2) = R.GetText()
+ aColor(3) = G.GetText()
+ aColor(4) = B.GetText()
+
+ printlog( "GetColorRGB:: N = " & aColor(1) )
+ printlog( "GetColorRGB:: R = " & aColor(2) )
+ printlog( "GetColorRGB:: G = " & aColor(3) )
+ printlog( "GetColorRGB:: B = " & aColor(4) )
+end sub
+
+'*******************************************************************************
+
+sub compareTwoColorsRGB( aColor() as String )
+ ' INPUT : array: (1): Name; (2): Red value; (3): Green value; (4): Blue value
+ ' and a selected color
+ ' OUTPUT:
+ 'Comparision of two colors. Tested values are:
+ 'Name and three RGB values
+ 'aColor is the expected value, bColor is the current color
+ dim i as Integer
+ dim bColor(4) as String
+
+ printlog( "compareTwoColorsRGB:: Compare saved default color with the current" )
+ call getColorRGB(bColor())
+ for i = 1 to 4
+ if aColor(i) <> bColor(i) then
+ warnlog( "compareTwoColorsRGB:: " & "(" & i & ") Expected: '" _
+ & aColor( i ) & "' found: '" & bColor(i) & "'" )
+ else
+ printlog( "compareTwoColorsRGB:: " & "(" & i & ") OK" )
+ endif
+ next i
+end sub
+
+'*******************************************************************************
+
+sub ModifyColorRGB( aColor() as String )
+ 'A RGB color always has four attributes:
+ 'The name and the three RGB values (0...255)
+
+ Kontext "TabFarben"
+ FarbName.SetText( aColor( 1 ) )
+ FarbModell.Select( 1 )
+ R.SetText( aColor( 2 ) )
+ G.SetText( aColor( 3 ) )
+ B.SetText( aColor( 4 ) )
+ Aendern.Click
+end sub
+
diff --git a/testautomation/framework/tools/includes/pbrowser_tools.inc b/testautomation/framework/tools/includes/pbrowser_tools.inc
new file mode 100644
index 000000000000..fefc739e48ea
--- /dev/null
+++ b/testautomation/framework/tools/includes/pbrowser_tools.inc
@@ -0,0 +1,476 @@
+'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 for working with the property browser for formcontrols
+'*
+'\******************************************************************************
+
+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>
+ 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
+ else
+ printlog( CFN & "General-tab is not visible." )
+ hOpenPropertyBrowser() = false
+ endif
+ else
+ printlog( CFN & "Could not open property browser" )
+ hOpenPropertyBrowser() = false
+ 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>
+ 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" )
+ hClosePropertyBrowser() = true
+ endif
+ else
+ printlog( CFN & "Property browser is not open" )
+ hClosePropertyBrowser() = false
+ 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 &quot;NameText&quot; (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 &quot;NameText&quot; exists</li>
+ kontext "TabGeneralControl"
+ if ( NameText.exists() ) then
+ '///+<li>Set the new name</li>
+ WaitSlot()
+
+ ' Name the control and append some Spaces which should be truncated.
+ printlog( CFN & "Naming control: " & cControl )
+ NameText.setText( cControl )
+ 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" )
+ Wait( 300 )
+ NameText.setText( cControl )
+ TabGeneralControl.typeKeys( "<RETURN>" )
+ Wait( 300 )
+
+ ' Test again, leave function if good
+ if ( NameText.getText() = cControl ) then
+ printlog( CFN & "Name is set ok: " & cControl )
+ 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 &quot;NameText&quot; exists, retrieve its text</li>
+ kontext "TabGeneralControl"
+ if ( TabGeneralControl.exists( 1 ) ) then
+ if ( TabGeneralControl.isVisible() ) then
+
+ 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 )
+ hPBGetControlName() = true
+ else
+ warnlog( CFN & "Unexpected control name:" )
+ printlog( CFN & "Found....: " & cControlName )
+ printlog( CFN & "Expected.: " & cControl )
+ hPBGetControlName() = false
+ endif
+ else
+ warnlog( CFN & "Dialog present but tabpage could not be accessed (TabGeneralControl)." )
+ hPBGetControlName() = false
+ endif
+ else
+ warnlog( CFN & "Unable to get the name from the control, dialog not accessible (TabGeneralControl)." )
+ 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 &quot;controlcfg.dat&quot;</li>
+ '///</ul>
+
+ '///+<li>Position of the control (integer)</li>
+ '///<ul>
+ '///+<li>&gt; 0 and &lt; 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 &quot;x&quot;</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
+ printlog( CFN & "Exit: Control Properties Dialog is not open, aborting" )
+ hSetPBTabPage() = false
+ exit function
+ else
+ if ( DEBUG_ENABLE ) then
+ printlog( CFN & "Control Properties Dialog is open" )
+ endif
+ endif
+
+ select case iPage
+ 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)" )
+ hSetPBTabPage() = true
+ exit function
+ else
+ printlog( CFN & "Exit: Failed to open Control Properties (false)" )
+ 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)" )
+ hSetPBTabPage() = true
+ exit function
+ else
+ printlog( CFN & "Exit: Failed to open events-page (false)" )
+ 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 &quot;NameText&quot; (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 &quot;NameText&quot; exists</li>
+ kontext "TabGeneralControl"
+ if ( Label.exists() ) then
+ '///+<li>Set the new name</li>
+ Label.setText( sLabelName )
+ TabGeneralControl.TypeKeys ("<RETURN>" , true)
+ hSetLabelName() = true
+ else
+ warnlog( "Unable to name the control." )
+ hSetLabelName() = false
+ endif
+ '///</ul>
+
+end function
+
diff --git a/testautomation/framework/tools/includes/performance.inc b/testautomation/framework/tools/includes/performance.inc
new file mode 100644
index 000000000000..01d46d7df415
--- /dev/null
+++ b/testautomation/framework/tools/includes/performance.inc
@@ -0,0 +1,69 @@
+'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/private_environment.inc b/testautomation/framework/tools/includes/private_environment.inc
new file mode 100644
index 000000000000..87cfab146f15
--- /dev/null
+++ b/testautomation/framework/tools/includes/private_environment.inc
@@ -0,0 +1,335 @@
+'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 private environment
+'*
+'\******************************************************************************
+
+function hGetPrivateHttpServer( _proxy as string, _port as string ) as boolean
+
+
+ '///<h3>Retrieve the name and port for a private http server</h3><br>
+
+ '///<u>Function parameters:</u><br>
+ '///<ol>
+
+ '///+<li>Fully qualified server name incl. domain (string)</li>
+ '///<ul>
+ '///+<li>The string comes without a protocol part (no http://)</li>
+ '///</ul>
+
+ '///+<li>Server port (string)</li>
+ '///<ul>
+ '///+<li>Please remember limits for integer data type</li>
+ '///</ul>
+
+ '///</ol>
+
+
+ '///<u>Returns:</u><br>
+
+ '///<ol>
+ '///+<li>Error condition (boolean)</li>
+ '///<ul>
+ '///+<li>&quot;TRUE&quot;: Data was retrieved successfully</li>
+ '///+<li>&quot;FALSE&quot;: Any error </li>
+ '///</ul>
+ '///</ol>
+
+ use "global\tools\includes\optional\t_key_tools.inc"
+
+ const CFN = "hGetPrivateHttpServer::"
+ dim cFile as string
+ dim cDataSet( 100 ) as string
+ dim iErr as integer
+
+ '///<u>Description:</u>
+ '///<ul>
+ '///+<li>Get the source file</li>
+ cFile = hGetPrivateInputFile( false )
+ printlog( CFN & "Using input file: " & cFile )
+
+ '///+<li>Retrieve the information from the datafile</li>
+ iErr = hGetDataFileSection( cFile, cDataSet(), "http_proxy", "", "" )
+ if ( iErr = 0 ) then
+ hGetPrivateHttpServer() = false
+ exit function
+ endif
+
+ '///+<li>Extract the proxy name</li>
+ _proxy = hGetValueForKeyAsString( cDataSet(), "name" )
+
+ '///+<li>Append the domain</li>
+ _proxy = _proxy & hGetValueForKeyAsString( cDataSet(), "domain" )
+
+ '///+<li>Get the port</li>
+ _port = hGetValueForKeyAsString( cDataSet() , "port" )
+
+ '///+<li>Print a log</li>
+ printlog( CFN & _proxy & ":" & _port )
+ '///</ul>
+
+ hGetPrivateHttpServer() = true
+
+end function
+
+'*******************************************************************************
+
+function hGetPrivateFtpServer( _proxy as string, _port as string ) as boolean
+
+
+ '///<h3>Retrieve the name and port for a private ftp server</h3><br>
+
+ '///<u>Function parameters:</u><br>
+ '///<ol>
+
+ '///+<li>Fully qualified server name incl. domain (string)</li>
+ '///<ul>
+ '///+<li>The string comes without a protocol part (no ftp://)</li>
+ '///</ul>
+
+ '///+<li>Server port (string)</li>
+ '///<ul>
+ '///+<li>Please remember limits for integer data type</li>
+ '///</ul>
+
+ '///</ol>
+
+
+ '///<u>Returns:</u><br>
+
+ '///<ol>
+ '///+<li>Error condition (boolean)</li>
+ '///<ul>
+ '///+<li>&quot;TRUE&quot;: Data was retrieved successfully</li>
+ '///+<li>&quot;FALSE&quot;: Any error </li>
+ '///</ul>
+ '///</ol>
+
+ use "global\tools\includes\optional\t_key_tools.inc"
+
+ const CFN = "hGetPrivateFtpServer::"
+ dim cFile as string
+ dim cDataSet( 100 ) as string
+ dim iErr as integer
+
+ '///<u>Description:</u>
+ '///<ul>
+ '///+<li>Get the source file</li>
+ cFile = hGetPrivateInputFile( false )
+ printlog( CFN & "Using input file: " & cFile )
+
+ '///+<li>Retrieve the information from the datafile</li>
+ iErr = hGetDataFileSection( cFile, cDataSet(), "ftp_proxy", "", "" )
+ if ( iErr = 0 ) then
+ hGetPrivateFtpServer() = false
+ exit function
+ endif
+
+ '///+<li>Extract the proxy name</li>
+ _proxy = hGetValueForKeyAsString( cDataSet(), "name" )
+
+ '///+<li>Append the domain</li>
+ _proxy = _proxy & hGetValueForKeyAsString( cDataSet(), "domain" )
+
+ '///+<li>Get the port</li>
+ _port = hGetValueForKeyAsString( cDataSet() , "port" )
+
+ '///+<li>Print a log</li>
+ printlog( CFN & _proxy & ":" & _port )
+ '///</ul>
+
+ hGetPrivateFtpServer() = true
+
+end function
+
+'*******************************************************************************
+
+function hGetPrivateSocksServer( _proxy as string, _port as string ) as boolean
+
+
+ '///<h3>Retrieve the name and port for a private socks server</h3><br>
+
+ '///<u>Function parameters:</u><br>
+ '///<ol>
+
+ '///+<li>Fully qualified server name incl. domain (string)</li>
+
+ '///+<li>Server port (string)</li>
+ '///<ul>
+ '///+<li>Please remember limits for integer data type</li>
+ '///</ul>
+
+ '///</ol>
+
+
+ '///<u>Returns:</u><br>
+
+ '///<ol>
+ '///+<li>Error condition (boolean)</li>
+ '///<ul>
+ '///+<li>&quot;TRUE&quot;: Data was retrieved successfully</li>
+ '///+<li>&quot;FALSE&quot;: Any error </li>
+ '///</ul>
+ '///</ol>
+
+ use "global\tools\includes\optional\t_key_tools.inc"
+
+ const CFN = "hGetPrivateSocksServer::"
+ dim brc as boolean 'a multi purpose boolean returnvalue
+ dim cFile as string
+ dim cDataSet( 100 ) as string
+ dim iErr as integer
+
+ '///<u>Description:</u>
+ '///<ul>
+ '///+<li>Get the source file</li>
+ cFile = hGetPrivateInputFile( false )
+
+ '///+<li>Retrieve the information from the datafile</li>
+ iErr = hGetDataFileSection( cFile, cDataSet(), "socks", "", "" )
+ if ( iErr = 0 ) then
+ hGetPrivateSocksServer() = false
+ exit function
+ endif
+
+ '///+<li>Extract the proxy name</li>
+ _proxy = hGetValueForKeyAsString( cDataSet(), "name" )
+
+ '///+<li>Append the domain</li>
+ _proxy = _proxy & hGetValueForKeyAsString( cDataSet(), "domain" )
+
+ '///+<li>Get the port</li>
+ _port = hGetValueForKeyAsString( cDataSet() , "port" )
+
+ '///+<li>Print a log</li>
+ printlog( CFN & _proxy & ":" & _port )
+ '///</ul>
+
+ hGetPrivateSocksServer() = true
+
+end function
+
+'*******************************************************************************
+
+function hGetPrivateInputPath( bVerbose as boolean ) as string
+
+
+ '///<h3>Switch the private input path from ../inc/ to ../input/</h3>
+
+ '/// This is part of the effort to allow usage of private data such as
+ '///+ servernames, paths, login names etc. within a Local Area Network (LAN).
+ '/// If you have to maintain data of any sort that may not get out to the
+ '///+ public you will want to put your data into this directory.<br><br>
+
+ '///<u>Input Value:</u><br>
+ '///<ol>
+ '///+<li>Toggle verbosity (boolean)</li>
+ '///<ul>
+ '///+<li>&quot;TRUE&quot;: Print path</li>
+ '///+<li>&quot;FALSE&quot;: Do not print path</li>
+ '///</ul>
+ '///</ol>
+
+ '///<u>Return Value:</u><br>
+ '///<ol>
+ '///+<li>Path to the private input directory (string)</li>
+ '///<ul>
+ '///+<li>Function is not supposed to fail</li>
+ '///+<li>Fully qualified path to the input directory including last pathseparator</li>
+ '///</ul>
+ '///</ol>
+
+ const CFN = "hGetPrivateInputPath::"
+ dim cPrivateInputPath as string
+
+ '///<u>Description:</u>
+ '///<ul>
+ '///+<li>Get the ../inc-path from global variable (assuming path is valid)</li>
+ cPrivateInputPath = gTesttoolPath & gPrivateEnvironmentLocation
+
+ '///+<li>Append input/ (platform specific)</li>
+ cPrivateInputPath = cPrivateInputPath & "input/"
+ cPrivateInputPath = convertpath( cPrivateInputPath )
+
+ '///+<li>Print the resulting path to the log</li>
+ if ( bVerbose ) then
+ printlog( CFN & "Private input directory is: " & cPrivateInputPath )
+ endif
+
+ hGetPrivateInputPath() = cPrivateInputPath
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hGetPrivateInputFile( bVerbose as boolean ) as string
+
+
+ '///<h3>Retrieve the fully qualified path to the datafile</h3><br>
+
+ '///<u>Input:</u>
+ '///<ol>
+ '///+<li>Toggle verbosity (boolean)</li>
+ '///<ul>
+ '///+<li>&quot;TRUE&quot;: Print path</li>
+ '///+<li>&quot;FALSE&quot;: Do not print path</li>
+ '///</ul>
+ '///</ol>
+
+
+ '///<u>Returns:</u>
+
+ '///<ol>
+ '///+<li>Fully qualified path to the datafile (string)</li>
+ '///</ol>
+
+ const CFN = "hGetPrivateInputFile::"
+ dim brc as boolean 'a multi purpose boolean returnvalue
+ dim cFile as string
+
+ '///<u>Description:</u>
+ '///<ul>
+ '///+<li>Append pathseparator and filename to input path</li>
+ cFile = hGetPrivateInputPath( false ) & "framework_network.txt"
+
+ '///+<li>Print path and filename to the log</li>
+ if ( bVerbose ) then
+ printlog( CFN & "Private datafile is: " & cFile )
+ endif
+
+ '///</ul>
+
+ hGetPrivateInputFile() = cFile
+
+end function
+
+
+
diff --git a/testautomation/framework/tools/includes/scriptorganizer_tools.inc b/testautomation/framework/tools/includes/scriptorganizer_tools.inc
new file mode 100644
index 000000000000..e141448b5b79
--- /dev/null
+++ b/testautomation/framework/tools/includes/scriptorganizer_tools.inc
@@ -0,0 +1,419 @@
+'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 : Test scripting-organizers / document-attached scripts
+'*
+'\******************************************************************************
+
+function hCreateScriptingObject( cName as string ) as boolean
+
+ '///<h3>Create a new scripting object for the current module</h3>
+ '///<i>Starting point: Script organizer is open, module selected</i><br>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Name of the module (string)</li>
+ '///<ul>
+ '///+<li>Any name the organizer can accept</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Errorcondition</li>
+ '///<ul>
+ '///+<li>TRUE on success</li>
+ '///+<li>FALSE on failure or invalid user input</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+
+ 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 &quot;Create...&quot; 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 &quot;Create...&quot; button is enabled</li>
+ if ( PBCreate.isEnabled() ) then
+
+ '///+<li>Click &quot;Create...&quot; to open the naming dialog</li>
+ PBCreate.click()
+
+ '///+<li>Name the new script</li>
+ Kontext "ScriptNameDlg"
+ if ( ScriptNameDlg.exists( 2 ) ) then
+
+ EFObjectName.setText( cName )
+ ScriptNameDlg.OK()
+ brc = true
+
+ endif
+
+ else
+ printlog( CFN & "Button is disabled" )
+ brc = 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
+ endif
+
+ hCreateScriptingObject() = brc
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hRenameScriptingObject( cName as string ) as boolean
+
+ '///<h3>Rename the selected script</h3>
+ '///<i>Starting point: Script organizer is open, a script is selected</i><br>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>New name of the script</li>
+ '///<ul>
+ '///+<li>Any name the script organizer does accept</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Errorcondition</li>
+ '///<ul>
+ '///+<li>TRUE on success</li>
+ '///+<li>FALSE on failure or invalid user input</li>
+ '///</ul>
+ '///</ol>
+ '///<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 &quot;Rename...&quot; 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 &quot;Rename...&quot; button is enabled</li>
+ if ( PBRename.isEnabled() ) then
+
+ '///+<li>Click &quot;Rename...&quot; 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
+
+ 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
+ endif
+
+ hRenameScriptingObject() = brc
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hDeleteScript( cName as string , bSuccess as boolean ) as boolean
+
+ '///<h3>Delete the selected script</h3>
+ '///<i>Starting point: Script organizer is open, a script is selected</i><br>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Name of the script (string)</li>
+ '///<ul>
+ '///+<li>For debugging purpose only, the name will be used for warnlogs</li>
+ '///+<li>May be an empty string (not recommended)</li>
+ '///</ul>
+ '///+<li>Expected result (boolean)</li>
+ '///<ul>
+ '///+<li>TRUE: The script is expected to be deleted without warnings/errors</li>
+ '///+<li>FALSE: The script should not be deletable</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Errorcondition (boolean) - see description</li>
+ '///<ul>
+ '///+<li>TRUE on success (expected outcome)</li>
+ '///+<li>FALSE on failure</li>
+ '///</ul>
+ '///</ol>
+ '///<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>
+ '///+<li>Delete is correctly enabled (success)</li>
+ kontext "ScriptOrganizer"
+ if ( PBDelete.isEnabled() and bSuccess ) then
+
+ PBDelete.click()
+ kontext "active"
+ cMessage = active.getText()
+ cMessage = hRemoveLineBreaks( cMessage )
+ printlog( CFN & cMessage )
+ active.yes()
+
+ kontext "active"
+ if ( active.exists( 1 ) ) then
+ cMessage = active.getText()
+ cMessage = hRemoveLineBreaks( cMessage )
+ qaerrorlog( CFN & "Message: Failed to delete object: " & cName )
+ printlog( CFN & cMessage )
+ active.ok()
+ endif
+ hDeleteScript() = true
+
+ '///+<li>Delete is disabled correctly (success)</li>
+ elseif ( ( not PBDelete.isEnabled() ) and ( not bSuccess ) ) then
+
+ printlog( CFN & "Delete-Button disabled for non-deletable object: " & cName )
+ hDeleteScript() = true
+
+ '///+<li>Delete is enabled but should not be (failure)</li>
+ elseif ( PBDelete.isEnabled() and ( not bSuccess ) ) then
+
+ PBDelete.click()
+
+ 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 )
+ 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 )
+ active.ok()
+ endif
+ hDeleteScript() = false
+
+ '///+<li>Delete is incorrectly disabled (failure)</li>
+ elseif ( ( not PBDelete.isEnabled() ) and bSuccess ) then
+
+ printlog( CFN & "Delete-Button disabled for deletable object" )
+ hDeleteScript() = false
+
+ else
+
+ warnlog( CFN & "Unknown condition in if-statement" )
+ hDeleteScript() = false
+
+ endif
+ '///</ol>
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hOpenScriptOrganizer( iDialog as integer ) as boolean
+
+ '///<h3>Open the ScriptOrganizers and verify that they are open</h3>
+ '///<i>Starting point: Any document</i><br>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Dialog-ID (integer)</li>
+ '///<ul>
+ '///+<li>1 = BeanShell organizer</li>
+ '///+<li>2 = JavaScript organizer</li>
+ '///+<li>3 = Python script organizer</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Errorcondition</li>
+ '///<ul>
+ '///+<li>TRUE if the expected organizer is open</li>
+ '///+<li>FALSE if the expected organizer is not open</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+ const CFN = "hOpenScriptOrganizer::"
+
+ '///<li>Call the associated slot</li>
+ select case iDialog
+ case 1 : ToolsMacrosOrganizeMacrosBeanShell
+ case 2 : ToolsMacrosOrganizeMacrosJavaScript
+ case 3 : ToolsMacrosOrganizeMacrosPython
+ end select
+
+ '///<li>Verify that the dialog is open, return TRUE if yes</li>
+ kontext "ScriptOrganizer"
+ if ( ScriptOrganizer.exists( 5 ) ) then
+ hOpenScriptOrganizer() = true
+ printlog( CFN & "Dialog is open" )
+ else
+ 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 &quot;Run Macro&quot; 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
new file mode 100644
index 000000000000..de9c56389eb0
--- /dev/null
+++ b/testautomation/framework/tools/includes/signature_tools.inc
@@ -0,0 +1,90 @@
+'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>&quot;GENERAL&quot; for the general (first page)</li>
+ '///+<li>&quot;DETAILS&quot; for the details (second page)</li>
+ '///+<li>&quot;PATH&quot; 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
new file mode 100644
index 000000000000..f444b4821a5f
--- /dev/null
+++ b/testautomation/framework/tools/includes/spadmin_tools.inc
@@ -0,0 +1,317 @@
+'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 : helper functions for SPAdmin
+'*
+'\******************************************************************************
+
+function hGetPrinterPosition( cName as string, bWarn as boolean ) as integer
+
+ '///<h3>Find a printer queue in the SpAdmin list</h3>
+ ' IN:
+ ' cName = Name of the queue to look for
+ ' bWarn = if TRUE we warn if the queue does not exist
+
+ const CFN = "hGetPrinterPosition::"
+
+ if ( cName = "" ) then
+ warnlog( CFN & "Invalid Parameter passed to function: Empty String" )
+ hGetPrinterPosition() = -1
+ exit function
+ endif
+
+ dim iCurrentQueue as integer
+ dim bFound as boolean
+ dim iPrinterCount as integer
+ iPrintercount = LBPrinters.getItemCount()
+
+ Kontext "SpAdmin"
+ bFound = false
+
+ for iCurrentQueue = 1 to iPrinterCount
+
+ wait( 200 )
+
+ LBPrinters.select( iCurrentQueue )
+ if ( LBPrinters.getseltext() = cName ) then
+ bFound = true
+ exit for
+ endif
+
+ next iCurrentQueue
+
+ ' warn if queue was not found and we requested a warning
+ if ( not bFound and bWarn ) then
+ iCurrentQueue = 0
+ printlog( CFN & "The specified printer queue could not be found" )
+ endif
+
+ ' print a message that the printer queue exists
+ if ( bFound ) then
+ printlog( CFN & "Printer Queue was found at pos " & iCurrentQueue )
+ endif
+
+ Kontext "SpAdmin"
+ hGetPrinterPosition() = iCurrentQueue
+
+end function
+
+'*******************************************************************************
+
+function hDelPrinter( cPrinterName as string ) as integer
+
+ '///<h3>Delete a printer queue by its name in SpAdmin</h3>
+
+ const CFN = "hDelPrinter::"
+
+ ' delete a printer-queue from the printers-list by name. Only exact matches
+ ' will be removed.
+
+ ' IN:
+ ' - Name of the queue
+ ' OUT:
+ ' -1 = Bad function call
+ ' 0 = Success
+ ' 1 = Confirmation Dialog for Delete is missing
+ ' 2 = Unable to press "OK" on Confirm-Delete Dialog
+ ' 3 = Printer queue does not exist so it was not deleted
+
+ if ( cPrinterName = "" ) then
+ warnlog( CFN & "Invalid Parameter passed to function: Empty String" )
+ hDelPrinter() = -1
+ exit function
+ endif
+
+ dim iPrinterPos as integer
+ dim iErr as integer
+ iErr = 1
+
+ Kontext "SpAdmin"
+ iPrinterPos = hGetPrinterPosition( cPrinterName , true )
+
+ if ( iPrinterPos > 0 ) then
+
+ LBPrinters.select( iPrinterPos )
+ PBRemove.click()
+
+ try
+ Kontext "Active"
+ if ( active.exists( 2 ) ) then
+ Active.Yes()
+ printlog( CFN & "Printer Queue deleted" )
+ iErr = 0
+ else
+ warnlog( CFN & "Confirm Delete Dialog is missing" )
+ iErr = 1
+ endif
+ catch
+ warnlog( CFN & "Unable to confirm printer deletion" )
+ iErr = 2
+ endcatch
+
+ else
+
+ printlog( CFN & "The printer queue does not exist" )
+ iErr = 3
+
+ endif
+
+ Kontext "SpAdmin"
+ hDelPrinter() = iErr
+
+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
+
+end function
+
+'*******************************************************************************
+
+function hShutdownOffice() as integer
+
+ '///<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
+ 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
+
+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 brc as boolean
+
+ ' start SPAdmin in automation mode.
+ try
+ start( cSpadminPath , "-enableautomation" )
+ printlog( CFN & "SpAdmin command executed successfully" )
+ brc = true
+ catch
+ warnlog( CFN & "Failure: SpAdmin command did not succeed" )
+ brc = false
+ endcatch
+
+ hOpenSpAdmin() = brc
+
+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." )
+ sleep( 10 )
+ bOpen = true
+ else
+ warnlog( CFN & "SpAdmin is not open, the test cannot continue" )
+ bOpen = false
+ endif
+
+ hWaitForSpadmin() = bOpen
+
+end function
+
+'*******************************************************************************
+
+function hCreateFaxDevice( cName as string ) as boolean
+
+ '///<h3>Open the printer creation dialog and create a fax device</h3>
+ ' The function verifies that the device has been created and returns
+ ' TRUE on success
+ '///<ul>
+
+ const CFN = "hCreateFaxDevice::"
+
+ if ( cName = "" ) then
+ warnlog( CFN & "Invalid Parmeter passed to function: Empty String" )
+ hCreateFaxDevice() = false
+ exit function
+ endif
+
+ ' quickly greates a fax device accepting all defaults
+ '///+<li>Click on "New Printer"</li>
+ Kontext "SpAdmin"
+ PBNewPrinter.click()
+
+ '///+<li>Click on "Next..."</li>
+ Kontext "SpPrinterWizard"
+ PBNext.click()
+
+ '///+<li>Click on "Next..."</li>
+ Kontext "SpPrinterWizard"
+ PBNext.click()
+
+ '///+<li>Enter "(PHONE)" as queue command</li>
+ Kontext "TabPWQueueCommand"
+ CBCommand.setText( """(PHONE)""" )
+
+ '///+<li>Click on "Next..."</li>
+ Kontext "SpPrinterWizard"
+ PBNext.click()
+
+ '///+<li>Enter a Fax-Printer Name</li>
+ Kontext "TabPWPrinterName"
+ EFFaxName.setText( cName )
+
+ '///+<li>Finish the wizard by pressing OK</li>
+ Kontext "SpPrinterWizard"
+ SpPrinterWizard.ok()
+
+ sleep( 1 )
+
+ '///+<li>Verify that the Queue has been created in SpAdmin</li>
+ Kontext "SpAdmin"
+ if ( hgetPrinterPosition( cName ) <> 0 ) then
+ hCreateFaxDevice() = true
+ printlog( CFN & "Successfully created Fax device" )
+ else
+ hCreateFaxDevice() = false
+ warnlog( CFN & "Failed to create a Fax device" )
+ endif
+ '///</ul>
+
+end function
diff --git a/testautomation/framework/tools/includes/tabpages.inc b/testautomation/framework/tools/includes/tabpages.inc
new file mode 100644
index 000000000000..f22b8bd5a206
--- /dev/null
+++ b/testautomation/framework/tools/includes/tabpages.inc
@@ -0,0 +1,95 @@
+'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>&quot;General&quot;</li>
+ '///+<li>&quot;Description&quot;</li>
+ '///+<li>&quot;User&quot;</li>
+ '///+<li>&quot;Internet&quot;</li>
+ '///+<li>&quot;Statistics&quot;</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
new file mode 100644
index 000000000000..6363bae7aaf9
--- /dev/null
+++ b/testautomation/framework/tools/includes/template_tools.inc
@@ -0,0 +1,552 @@
+'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 : Helper functions to ease usage of templates
+'*
+'\******************************************************************************
+
+function hFindTemplate( sTemplateName as string ) as integer
+
+ '///<H3>Find a template by name in FileNewFromTemplate</H3>
+ '///<i>Starting point: Templates and Documents dialog</i><br>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li> Name of the template to search for (string)</li>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li> Index of the Template in the containing folder (integer)</li>
+ '///<ul>
+ '///+<li>1 ... n : Index of the template (Position in folder)</li>
+ '///+<li>0 : No template found by given name</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+ const CFN = "hFindTemplate::"
+
+ dim brc as boolean
+ brc = false
+ dim irc as integer
+ irc = 0
+
+ dim iObjectFolder as integer
+ dim iObjectFolders as integer
+
+ dim iItemCount as integer
+ dim iCurrentItem as integer
+ dim cCurrentItem as string
+
+ '///+<li>select the templates from the category list</li>
+ hSelectCategory( "TEMPLATES" )
+
+ '///+<li>run through every item in the list to find the template.</li>
+ ' NOTE: If the name of the template is not unique, the function will find
+ ' the first occurrence
+ ' NOTE: As we do not know the name of "My Templates" (it is localized) we
+ ' need to search all folders..
+ iObjectFolders = FileList.getItemCount()
+
+ '///<ul>
+ for iObjectFolder = 1 to iObjectFolders
+
+ '///+<li>Select the (next) folder</li>
+ hSelectFileFolder( iObjectFolder , true )
+
+ '///+<li>Retrieve the number of items within the folder</li>
+ iItemCount = FileList.getItemCount()
+
+ '///+<li>For each item in the folder do:</li>
+ '///<ul>
+ for iCurrentItem = 1 to iItemCount
+
+ '///+<li>Select the (next) item</li>
+ FileList.select( iCurrentItem )
+
+ '///+<li>Get the name of the item</li>
+ cCurrentItem = FileList.getSelText()
+
+ '///+<li>If this is the item we are searching for, exit</li>
+ if ( cCurrentItem = sTemplateName ) then
+ irc = iCurrentItem : if ( irc = 0 ) then irc = 1 ' strange hack
+ brc = true
+ exit for
+ endif
+
+ next iCurrentItem
+ '///</ul>
+
+ '///+<li>Exit the outer loop</li>
+ if ( brc ) then
+ exit for
+ endif
+
+ '///+<li>Click &quot;Up one level&quot;</li>
+ UpOneLevel.click()
+
+ next iObjectFolder
+ '///</ul>
+
+ if ( brc ) then
+ printlog( CFN & "Template found: " & cCurrentItem )
+ else
+ printlog( CFN & "Template could not be found." )
+ endif
+
+ '///+<li>Return the index of the requested template</li>
+ hFindTemplate() = irc
+ '///</ul>
+
+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>&quot;NEWDOCUMENTS&quot; for New Documents</li>
+ '///+<li>&quot;TEMPLATES&quot; for Templates</li>
+ '///+<li>&quot;SAMPLES&quot; for Samples</li>
+ '///</ul>
+ '///+<li>Location (string)</li>
+ '///<ul>
+ '///+<li>&quot;TESTTOOL&quot; to use files below gTesttoolPath</li>
+ '///+<li>&quot;LOCAL&quot; 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>
+ '///<i>Requires: Templates and Documets dialog must be open</i><br>
+ '///<u>Input</u>: Category (string):
+ '///<ul>
+ '///+<li>NEWDOCUMENTS to select New Documents</li>
+ '///+<li>TEMPLATES to select Templates</li>
+ '///+<li>MYDOCUMENTS to select My Documents</li>
+ '///+<li>SAMPLES to select Samples</li>
+ '///</ul>
+ '///<u>Returns</u>: Alwas TRUE, no errorhandling
+
+ Kontext "TemplateAndDocuments"
+ if ( TemplateAndDocuments.exists( 2 ) ) then
+ Wait( 500 )
+ Category.typeKeys( "<HOME>" )
+ wait( 500 )
+
+ if ( UCASE( cCategory ) = "NEWDOCUMENTS" ) then
+ ' do nothing, the selection should be on this item
+
+ elseif ( UCASE( cCategory ) = "TEMPLATES" ) then
+ Category.typeKeys( "<DOWN>" )
+
+ elseif ( UCASE( cCategory ) = "MYDOCUMENTS" ) then
+ Category.typeKeys( "<DOWN>" )
+ Category.typeKeys( "<DOWN>" )
+
+ elseif ( UCASE( cCategory ) = "SAMPLES" ) then
+ Category.typeKeys( "<DOWN>" )
+ Category.typeKeys( "<DOWN>" )
+ Category.typeKeys( "<DOWN>" )
+ endif
+
+ hSelectCategory() = true
+ else
+ warnlog( "TemplateAndDocuments dialog did not open" )
+ endif
+
+end function
+
+'***************************************************************************
+
+function hSelectFileFolder( iFolder as integer , bVerbose as boolean ) as integer
+
+ '///<h3>Select a folder on the templates dialog's right pane by index</h3>
+ '///<i>Requires: Templates and Documents dialog must be open</i><br>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Index of the folder to be selected on the categories-pane (integer)</li>
+ '///<ul>
+ '///+<li>Must be > 0</li>
+ '///</ul>
+ '///+<li>Turn printlog on for debugging purpose (boolean)</li>
+ '///<ul>
+ '///+<li>TRUE : Be verbose</li>
+ '///+<li>FALSE : Run silent</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Number of items in the selected folder (integer)</li>
+ '///<ul>
+ '///+<li>Must be > 0</li>
+ '///</ul>
+ '///</ol>
+
+ '///<u>Description</u>:
+ '///<ul>
+ dim iItems as integer
+ dim cFolder as string
+
+ Kontext "TemplateAndDocuments"
+
+ '///+<li>Select the entry with the given index</li>
+ FileList.select( iFolder )
+
+ '///+<li>Retrieve the name of the selected object</li>
+ cFolder = FileList.getText()
+
+ '///+<li>Press return</li>
+ FileList.typeKeys( "<return>" )
+ wait( 500 )
+
+ '///+<li>Get the number of items in the current folder</li>
+ iItems = FileList.getItemCount()
+
+ '///+<li>Print a comment to the log if specified</li>
+ if ( bVerbose ) then
+ printlog( " * " & cFolder & " contains " & iItems & " items." )
+ endif
+
+ '///+<li>Return the number of items</li>
+ hSelectFileFolder() = iItems
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hGetFileFolderName( iFolder as integer ) as string
+
+ '///<h3>Get the name of the currently selected folder on templates dialog</h3>
+ '///<i>Requires: Templates and Documents dialog must be open</i><br>
+ '///<u>Input</u>: Index of the desired folder<br>
+ '///<u>Returns</u>: Name of the selected folder
+
+ Kontext "TemplateAndDocuments"
+ FileList.select( iFolder )
+ WaitSlot()
+ hGetFileFolderName() = FileList.getText()
+ WaitSlot()
+
+end function
+
+'*******************************************************************************
+
+function hSelectDocumentObject( iTitle as integer , iMode as integer ) as string
+
+ const CFN = "hSelectDocumentObject::"
+
+ '///<h3>Open or edit sample/template from the templates dialog</h3>
+ '///<i>Requires: Templates and Documents dialog must be open</i><br>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Index of the folder to be selected on the categories-pane (integer)</li>
+ '///+<li>Mode in which to open the template (integer)</li>
+ '///<ul>
+ '///+<li>0 = Do not open the object, just return its name</li>
+ '///+<li>1 = Open a new document based on the selected Template</li>
+ '///+<li>2 = edit the template</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ul>
+ '///+<li>The name of the selected item (string)</li>
+ '///</ul>
+ '///<u>Description</u>:
+ '///<ul>
+ '///+<li>Verify function parameter iMode</li>
+
+ if ( ( iMode < 0 ) or ( iMode > 2 ) ) then
+ warnlog( CFN & "Invalid function parameter iMode: " & iMode )
+ hSelectDocumentObject() = ""
+ exit function
+ endif
+
+ dim cTitle as string
+ dim brc as boolean
+ dim iObjectCount as integer
+
+ Kontext "TemplateAndDocuments"
+ '///+<li>Verify the function parameter iTitle > 0</li>
+ if ( iTitle < 1 ) then
+ warnlog( CFN & "Invalid function parameter iTitle: " & iTitle )
+ hSelectDocumentObject() = ""
+ exit function
+ endif
+
+ '///+<li>Verify that the index is not too large</li>
+ if ( iTitle > FileList.getItemCount() ) then
+ warnlog( CFN & "Invalid function parameter iTitle: " & iTitle )
+ hSelectDocumentObject() = ""
+ exit function
+ endif
+
+ '///+<li>Get the title of the selected object</li>
+ cTitle = hGetFileFolderName( iTitle )
+
+ '///+<li>Count the number of objects in the list</li>
+ iObjectCount = FileList.getItemCount()
+ printlog( CFN & "Title: " & cTitle )
+
+ select case iMode
+ case 0 ' do not load the document, return the title and exit the function
+ hSelectDocumentObject() = cTitle
+ exit function
+ case 1 ' open new document based on the template
+ WaitSlot()
+ kontext "TemplateAndDocuments"
+ FileList.typeKeys( "<return>" )
+ WaitSlot( 5000 )
+
+ try
+ kontext "TemplateAndDocuments"
+ if ( TemplateAndDocuments.exists() ) then
+ '///+<li>If yes: Try to determine if it is a new folder</li>
+ brc = hIsObjectAFolder( iObjectCount )
+
+ if ( brc ) then
+ hSelectDocumentObject() = "Folder"
+ exit function
+ endif
+
+ endif
+ catch
+ endcatch
+
+ hFileWait()
+ hHandleActivesOnLoad( 2, false )
+ hHandleInitialDialogs()
+
+ end select
+
+
+ '///+<li>If all initial dialogs were handled correctly, return the title</li>
+ if ( brc ) then
+ hSelectDocumentObject() = cTitle
+ else
+ hSelectDocumentObject() = ""
+ endif
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hIsTemplateDialogClosed() as boolean
+
+ const CFN = "hIsTemplateDialogClosed::"
+ '///<h3>Test whether the Templates and Documents dialog is closed after executing an object</h3>
+ '///<i>Requires: Templates and Documents dialog must be open</i><br>
+ '///<u>Returns</u>:
+ '///<ul>
+ '///+<li>TRUE if the Templates and Documents dialog cannot be found</li>
+ '///+<li>FALSE if the selected object was a foder (Templates and Documents still open</li>
+ '///</ul>
+
+ dim iTry as integer : iTry = 0
+
+
+ if ( WaitSlot( 2000 ) = WSFinished ) then
+ kontext "TemplateAndDocuments"
+ try
+ if ( TemplateAndDocuments.exists() ) then
+ printlog( CFN & "Dialog still open. Maybe we opened a folder" )
+ hIsTemplateDialogClosed() = false
+ exit function
+ else
+ printlog( CFN & "Regular object. Dialog is closed" )
+ hIsTemplateDialogClosed() = true
+ exit function
+ endif
+ catch
+ warnlog( "Failure to query Templates and Documents dialog" )
+ hIsTemplateDialogClosed() = true
+ endcatch
+ else
+ warnlog( "Slot not finished within 2000 msec" )
+ hIsTemplateDialogClosed() = true
+ endif
+
+end function
+
+'*******************************************************************************
+
+function hIsObjectAFolder( iObjects as integer ) as boolean
+
+ '///<h3>Test whether the &quot;Chapters&quot; folder has been selected</h3>
+ '///<i>E.g. the Chapters-folder belongs to a master document and must be skipped.
+ '///+ To didentify this folder, the number of items is checked (here: 4) which
+ '///+ should be unique (all other folders have more items)</i><br>
+ '///<i>Requires: Templates and Documents dialog must be open</i><br>
+ '///<u>Input</u>. Number of objects in the folder (integer)<br>
+ '///<u>Returns</u>: TRUE if number of items matches iObjects (boolean)<br>
+ '///<u>Description</u>:
+ '///<ul>
+
+ ' NOTE: This function should only handle one folder called "Chapters"
+ ' below "Text Documents". We do not want to load the chapters
+ ' separately, they are a part of a Master-Document and will be
+ ' loaded at another time.
+ ' To find out whether we are in a new folder or not, the number
+ ' of objects in the parent folder is compared to the number in the
+ ' current. This is a hack with a good probability to work.
+
+ const CFN = "hIsObjectAFolder::"
+ dim iCurrentObjects as integer
+
+ if ( iObjects < 1 ) then
+ warnlog( CFN & "Invalid Objectcount passed to function: " & iObjects )
+ warnlog( CFN & "Defaulting to 1 -> outcome is undefined" )
+ iObjects = 1
+ endif
+
+ kontext "TemplateAndDocuments"
+ '///+<li>Compare the objectcount. If different, this is another folder</li>
+ '///+<li>If the number is unchanged, we have an unknown error -> crash</li>
+ iCurrentObjects = Filelist.getItemCount()
+
+ if ( iCurrentObjects <> iObjects ) then
+ printlog( CFN & "Object appears to be a folder with " & iCurrentObjects & " items" )
+ hIsObjectAFolder() = true
+ else
+ warnlog( CFN & "Unknown error: Objectcount is unchanged" )
+ hIsObjectAFolder() = false
+ endif
+
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hDeleteUserTemplates() as integer
+
+ ' Recommendation: Use outside of testcase
+
+ '///<h3>Delete all files located in the user templates directory</h3>
+ '///<i>Uses hDeleteFile tzo remove all files below gOfficePath\user\template</i><br>
+ '///<u>Input</u>: Nothing<br>
+ '///<u>Returns</u>: Number of deleted objects<br>
+ '///<u>Description</u>:
+ '///<ul>
+
+ const CFN = "hDeleteUserTemplates::"
+
+ dim iFileCount as integer
+ dim aFileList( 200 ) as string
+ dim sPath as string
+ dim iCounter as integer
+
+ '///+<li>Set the path to the user-templates (default location)</li>
+ sPath = convertpath( gOfficePath & "user\template" )
+
+ '///+<li>Load the list of files into an array</li>
+ iFileCount = GetFileList( sPath, "*.*", aFileList() )
+ printlog( CFN & "Found " & iFileCount & " file(s)." )
+
+ '///+<li>Delete each file and print the result to the log</li>
+ for iCounter = 1 to iFileCount
+
+ hDeleteFile( aFileList( iCounter ) )
+
+ next iCounter
+
+ '///+<li>Return the number of files that was found in the templates directory</li>
+ hDeleteUserTemplates() = iFileCount
+
+ '///</ul>
+
+end function
diff --git a/testautomation/framework/tools/includes/toolbar_tools.inc b/testautomation/framework/tools/includes/toolbar_tools.inc
new file mode 100644
index 000000000000..e0952bfd9a2e
--- /dev/null
+++ b/testautomation/framework/tools/includes/toolbar_tools.inc
@@ -0,0 +1,502 @@
+'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 : global update test (Standardbar)
+'*
+'\***************************************************************************
+
+function hAccessStandardBar() as boolean
+
+ '///<h3>Verify that the Standard Bar exists</h3>
+ '///<i>This function works for all gApplications</i><br>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Nothing</li>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Errorcondition (boolean)</li>
+ '///<ul>
+ '///+<li>TRUE if StandardBar exists</li>
+ '///+<li>FALSE if standardBar does not exist</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+ const CFN = "hAccessStandardBar::"
+ dim brc as boolean
+
+ printlog( CFN & "Enter" )
+
+ '///+<li>Open a new document</li>
+ hCreateDocument()
+
+ '///+<li>Try to access the standardbar (query .exists())</li>
+ kontext "StandardBar"
+ if ( StandardBar.exists() ) then
+ if ( standardbar.isVisible() ) then
+ printlog( CFN & "StandardBar is visible. Good." )
+ brc = true
+ else
+ warnlog( "The StandardBar is not visible in " & gApplication )
+ brc = false
+ endif
+ else
+ warnlog( "The StandardBar does not exist in " & gApplication )
+ brc = false
+ endif
+
+ '///+<li>Close the navigator</li>
+ hCloseNavigator()
+
+ '///+<li>Close the document</li>
+ hDestroyDocument()
+ hAccessStandardBar() = brc
+ printlog( CFN & "Exit" )
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hResetStandardBar() as boolean
+
+ '///<h3>Reset the Standard Bar to default configuration</h3>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Nothing</li>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Errorcondition (boolean)</li>
+ '///<ul>
+ '///+<li>Always TRUE as no errorconditions are handled yet</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+ const CFN = "hResetStandardBar::"
+
+ printlog( CFN & "Enter" )
+
+ '///+<li>Create a new document</li>
+ hInitSingleDoc()
+ printlog " - Standardbar"
+
+ kontext "standardbar"
+ if ( Standardbar.exists() ) then
+
+ '///+<li>Open the context menu on Standardbar</li>
+ Standardbar.OpenContextmenu
+ sleep( 1 )
+
+ '///+<li>Click on 2. entry (Cutomize Toolbar)</li>
+ hMenuselectNr (2)
+ sleep( 1 )
+
+ kontext
+ Active.SetPage TabCustomizeToolbars
+ sleep( 1 )
+
+ '///+<li>Toggle to 'Toolbars' tab page.</li>
+ kontext "TabCustomizeToolbars"
+ if TabCustomizeToolbars.Exists( 2 ) then
+ sleep( 1 )
+
+ '///+<li>Press in first section '... Toolbars' the 'toolbar'-button</li>
+ MenuBtn.Click
+ sleep( 1 )
+
+ '///+<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 )
+
+ kontext
+ if ( active.exists( 2 ) ) then
+ if Active.GetRT = 304 then
+
+ '///+<li>Press Yes button on verification dialog.</li>
+ Active.Yes
+ end if
+ else
+ warnlog( "No verification comes up if the RESET button has been pressed!" )
+ end if
+
+ '///+<li>Close 'Toolbars' tab page and the dialog with OK.</li>
+ kontext "tabcustomizetoolbars"
+ TabCustomizeToolbars.OK
+ else
+ warnlog( "Cutomuze Toolbar not open (from context menu)" )
+ 'Closing the Context menu if the dialog does not come up.
+ Menuselect(0)
+ endif
+
+ else
+ warnlog( CFN & "Could not access Standardbar" )
+ endif
+
+ '///+<li>Close document.</li>
+ hDestroyDocument()
+ hResetStandardBar() = true
+ printlog( CFN & "Exit" )
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hStandardbarItemGetCount() as integer
+
+ '///<h3>Update test: Get the number of items in the StandardBar</h3>
+ '///<i>Starting point: Any plain document</i><br>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Nothing</li>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Number of items on the toolbar (integer)</li>
+ '///<ul>
+ '///+<li>No errorhandling is done. Beware.</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+ dim iToolbarItemsCurrent as integer
+ dim iToolbarItemsExpected as integer
+ iToolbarItemsExpected = 30
+
+ const CFN = "hStandardbarItemGetCount::"
+
+ gApplication = "WRITER"
+ printlog( CFN & "Enter" )
+
+ '///+<li>Look for additional icons on the standardbar (through extensions)</li>
+ printlog( CFN & "Count all items at the Standardbar" )
+
+ '///+<li>Open the context menu on the Standardbar</li>
+ Kontext "Standardbar"
+ Standardbar.OpenContextmenu()
+
+ '///+<li>Select the 1. entry</li>
+ hMenuselectNr( 1 )
+
+ '///+<li>Count all entries ( there must be 30 entries )</li>
+ iToolbarItemsCurrent = 0
+ iToolbarItemsCurrent = hMenuItemGetCount()
+
+ ' StarOffice/StarSuite come with a preinstalled extension beginning with build
+ ' 9181. This extension is not shipped with the Solaris patches as this would
+ ' violate Sun's patching policy. So StarSuite/StarOffice now have 30 or 31
+ ' items on the standardbar, OOo and its spinoffs have 30.
+
+
+ if ( iToolbarItemsCurrent = iToolbarItemsExpected ) then
+ printlog( CFN & "Correct number of items on the StandardBar. Good" )
+ else
+ warnlog( CFN & "Expected: " & iToolbarItemsExpected & _
+ " entries, found: " & iToolbarItemsCurrent )
+ endif
+
+ '///+<li>close the context menu</li>
+ hMenuClose()
+ hStandardbarItemGetCount() = iToolbarItemsCurrent
+ printlog( CFN & "Exit" )
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hToggleToolbarItem( iMenuPos as integer )
+
+ '///<h3>Update test: Toggle an icon on the Standardbar (on/off)</h3>
+ '///<i>Starting point: Any plain document</i><br>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Position of the item in the menu (integer)</li>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Nothing</li>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+ const CFN = "hToggleToolbarItem::"
+ dim iItemsInMenu as integer
+
+ printlog( CFN & "Enter with option (Menu position): " & iMenuPos )
+
+ '///+<li>Open the context menu of the standard bar</li>
+ Kontext "Standardbar"
+ Standardbar.OpenContextmenu()
+
+ '///+<li>Retrieve the number of items in the menu</li>
+ iItemsInMenu = hMenuItemGetCount()
+
+ ' in case the toolbar does not fit into the window we have more items
+ ' (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 )
+
+ '///+<li>Select the provided menu position</li>
+ hMenuselectNr( iMenuPos )
+ printlog( CFN & "Exit" )
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hStandardbarLoadUrl() as boolean
+
+ '///<h3>Update test: Access the url-entryfield</h3>
+ '///<i>Starting point: Any plain document</i><br>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Nothing</li>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Nothing</li>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+
+ ' this function tries to write to the url-EntryField. This should fail,
+ ' because the item is not visible. Then the item should be enabled,
+ ' written to and disabled again (no use of reset toolbar here, this is
+ ' done in another testcase
+
+ dim iItemMenuPos as integer
+ iItemMenuPos = 1
+
+ const ITEM_MENU_POSITION = 1
+ const CFN = "hStandardbarLoadUrl::"
+
+ printlog( CFN & "Enter" )
+
+ '///+<li>Write to URL-Filed (fails: Entryfiled is not visible)</li>
+ try
+ Kontext "Standardbar"
+ URLEingabe.settext( "Should not work" )
+ warnlog( CFN & "The Load URL EntryField is visible and active" )
+ catch
+ printlog( CFN & "The Load URL EntryField is not visible. Good." )
+ endcatch
+
+ '///+<li>add the control to the standardbar</li>
+ printlog( CFN & "activate load URL" )
+ hToggleToolbarItem( ITEM_MENU_POSITION )
+
+ '///+<li>verify its existence by entering some text</li>
+ Kontext "Standardbar"
+ try
+ URLEingabe.settext( "Should work" )
+ printlog( CFN & "The Load URL REntryFiled is visible and active. Good." )
+ catch
+ warnlog( CFN & "Could not write to 'load url' control" )
+ endcatch
+
+ '///+<li>remove the control from the standardbar</li>
+ printlog( CFN & "Deactivate load URL" )
+ hToggleToolbarItem( ITEM_MENU_POSITION )
+ Kontext "Standardbar"
+
+ '///+<li>try to modify non existing object, failure expected</li>
+ try
+ Kontext "Standardbar"
+ URLEingabe.settext( "Should not work" )
+ warnlog( CFN & "The Load URL EntryField is visible and active." )
+ catch
+ printlog( CFN & "The Load URL EntryField is not visible. Good." )
+ endcatch
+ printlog( CFN & "Exit" )
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hStandardbarNewDialog()
+
+ '///<h3>Update test: New from Template via StandardBar</h3>
+ '///<i>Starting point: Plain document</i><br>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Nothing</li>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Nothing</li>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+ const CFN = "hStandardbarNewDialog::"
+ const ITEM_MENU_POSITION = 3
+
+ printlog( CFN & "Enter" )
+
+ '///+<li>Click on &quot;New from Template&quot;-button (fails, it is not visible)</li>
+ try
+ NeuDialog.Click()
+ warnlog( CFN & "The 'New from Template'-button should not be visible." )
+ catch
+ printlog( CFN & "The control is not present or active." )
+ endcatch
+
+ '///+<li>add the control to the standardbar</li>
+ printlog( CFN & "activate New from Template button" )
+ 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
+
+ '///+<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 )
+ Kontext "Standardbar"
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hStandardbarSaveAs()
+
+ '///<h3>Update test: SaveAs button on StandardBar</h3>
+ '///<i>Starting point: Any plain document</i><br>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Nothing</li>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Nothing</li>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+
+ dim bBreakOnError as boolean
+
+ const ITEM_MENU_POSITION = 6
+ const CFN = "hStandardbarSaveAs::"
+
+ printlog( CFN & "Enter" )
+
+ '///+<li>Click on SaveAs (fails, item is not visible)</li>
+ try
+ SpeichernAls.Click()
+ catch
+ printlog( CFN & "The control is not present, good." )
+ endcatch
+
+ kontext "SpeichernDlg"
+ if ( SpeichernDlg.exists( 1 ) ) then
+ warnlog( "#i46363# (?)The 'SaveAs'-button should be invisible." )
+ SpeichernDlg.cancel()
+ else
+
+ '///+<li>Add the control to the standardbar</li>
+ printlog( CFN & "Activate 'Save As' button" )
+ hToggleToolbarItem( ITEM_MENU_POSITION )
+
+ '///+<li>Click the button</li>
+ Kontext "Standardbar"
+ hWaitForObject( SpeichernAls , 5000 )
+ SpeichernAls.click()
+
+ '///+<li>Close the save-as dialog</li>
+ printlog( CFN & "Close Save As (cancel)" )
+ Kontext "SpeichernDlg"
+ if ( SpeichernDlg.Exists( 2 ) ) then
+ SpeichernDlg.cancel()
+ else
+ qaerrorlog( "Retrying" )
+ Kontext "Standardbar"
+ SpeichernAls.click()
+ Kontext "SpeichernDlg"
+ if ( SpeichernDlg.exists( 1 ) ) then
+ printlog( "FileSaveAs dialog is open" )
+ SpeichernDlg.cancel()
+ else
+ warnlog( CFN & "The 'Save As'-dialog was not activated" )
+ endif
+ endif
+
+ '///+<li>Remove the button from the toolbar</li>
+ printlog( CFN & "Deactivate 'Save as' button" )
+ hToggleToolbarItem( ITEM_MENU_POSITION )
+
+ endif
+
+ Kontext "Standardbar"
+ printlog( CFN & "Exit" )
+ '///</ul>
+
+end function
+
+
+
+
diff --git a/testautomation/framework/tools/includes/webtools.inc b/testautomation/framework/tools/includes/webtools.inc
new file mode 100644
index 000000000000..a56639a269e3
--- /dev/null
+++ b/testautomation/framework/tools/includes/webtools.inc
@@ -0,0 +1,153 @@
+'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 web functionality
+'*
+'\******************************************************************************
+
+function hSetProxies( HTTP_Server as string, HTTP_Port as string, _
+ FTP_Server as string, FTP_Port as string, _
+ NoProxyFor as string ) as integer
+
+ use "global\tools\includes\optional\t_control_objects.inc"
+
+ '///<h3>Configure proxy settings via Tools/Options Internet page</h3>
+ '///<i>Starting point is a plain document of any type</i><br>
+ '///<i>If all fields are empty The proxy will be set to &quot;None&quot;</i><br>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>HTTP Server name (string)</li>
+ '///<ul>
+ '///+<li>As name, e.g. myProxy.com (FQDN recommended)</li>
+ '///+<li>As IP, e.g. 192.168.1.254</li>
+ '///+<li>Non optional parameter which may be an empty string</li>
+ '///+<li>Requires HTTP Server port to be set</li>
+ '///</ul>
+ '///+<li>HTTP Server port</li>
+ '///<ul>
+ '///+<li>e.g. 8080, 3128</li>
+ '///+<li>Non optional parameter which may be an empty string</li>
+ '///</ul>
+ '///+<li>FTP Server name (string)</li>
+ '///<ul>
+ '///+<li>As name, e.g. myProxy.com (FQDN recommended)</li>
+ '///+<li>As IP, e.g. 192.168.1.254</li>
+ '///+<li>Non optional parameter which may be an empty string</li>
+ '///+<li>Requires FTP Server port to be set</li>
+ '///</ul>
+ '///+<li>FTP Server port</li>
+ '///<ul>
+ '///+<li>e.g. 8080, 3128</li>
+ '///+<li>Non optional parameter which may be an empty string</li>
+ '///</ul>
+ '///+<li>Exclude domains (string)</li>
+ '///<ul>
+ '///+<li>e.g. .Sun.COM;.Germany.Sun.Com;MyServer.Sun.Com</li>
+ '///+<li>Non optional parameter which may be an empty string</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Errorcondition</li>
+ '///<ul>
+ '///+<li>0 = Successfully set/unset proxies</li>
+ '///+<li>1 - 5 = Number of failed actions</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+ const CFN = "hSetProxies::"
+ dim iControlStatus as integer
+ dim irc as integer
+ irc = 0
+
+ '///+<li>Open Tools/Options</li>
+ ToolsOptions
+
+ '///+<li>Go to the Proxy Settings (Internet/Proxy)</li>
+ hToolsOptions( "Internet", "Proxy" )
+
+ '///+<li>Select Manual Proxy (3. Item in the list)</li>
+ ProxyServer.select( 3 )
+
+ '///+<li>Set the new values</li>
+ '///<ol>
+
+ '///+<li>HTTP-Proxy</li>
+ iControlStatus = hSetControlValue( HTTPProxy , HTTP_Server )
+ if ( iControlStatus <> 0 ) then
+ qaerrorlog( CFN & "Failed to set HTTP-Proxy" )
+ irc = irc + 1
+ endif
+
+ '///+<li>HTTP-Port</li>
+ iControlStatus = hSetControlValue( HTTPPort , HTTP_Port )
+ if ( iControlStatus <> 0 ) then
+ qaerrorlog( CFN & "Failed to set HTTP-Port" )
+ irc = irc + 1
+ endif
+
+ '///+<li>FTP-Proxy</li>
+ iControlStatus = hSetControlValue( FTPProxy , FTP_Server )
+ if ( iControlStatus <> 0 ) then
+ qaerrorlog( CFN & "Failed to set FTP-Proxy" )
+ irc = irc + 1
+ endif
+
+ '///+<li>FTP-Port</li>
+ iControlStatus = hSetControlValue( FTPPort , FTP_Port )
+ if ( iControlStatus <> 0 ) then
+ qaerrorlog( CFN & "Failed to set FTP-Port" )
+ irc = irc + 1
+ endif
+
+ '///+<li>Exclusion list</li>
+ iControlStatus = hSetControlValue( NoProxy , NoProxyFor )
+ if ( iControlStatus <> 0 ) then
+ qaerrorlog( CFN & "Failed to set exclusion list" )
+ irc = irc + 1
+ endif
+ '///</ol>
+
+ if ( irc = 0 ) then
+ printlog( CFN & "Successfully updated proxy configuration" )
+ endif
+
+ '///+<li>Close Tools/Options</li>
+ Kontext "ExtrasOptionenDlg"
+ ExtrasOptionenDlg.OK()
+
+ hSetProxies() = irc
+ '///</ul>
+
+
+end function
+
+
diff --git a/testautomation/framework/tools/includes/window_tools.inc b/testautomation/framework/tools/includes/window_tools.inc
new file mode 100644
index 000000000000..bb8579edfba7
--- /dev/null
+++ b/testautomation/framework/tools/includes/window_tools.inc
@@ -0,0 +1,86 @@
+'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 handle windows/frames
+'*
+'\******************************************************************************
+
+function hMaximizeDocument() as boolean
+
+
+ '///<h3>Maximize a document window</h3>
+ '///<i>Note</i>: The function runs silent (no logs written)<br><br>
+ '///<u>Return Value:</u><br>
+
+ '///<ol>
+ '///+<li>Errorcondition (boolean)</li>
+ '///<ul>
+ '///+<li>TRUE if the window claims to have been maximized</li>
+ '///+<li>FALSE on invalid gApplication (with warning)</li>
+ '///+<li>FALSE if the window thinks it has not been maximized</li>
+ '///</ul>
+ '///</ol>
+
+ const CFN = "hMaximizeDocument::"
+ dim brc as boolean 'a multi purpose boolean returnvalue
+
+ '///<u>Description:</u>
+ '///<ul>
+ '///+<li>Maximize the documentwindow depending on gApplication</li>
+ select case ( ucase( gApplication ) )
+ case "WRITER" : Kontext "DocumentWriter"
+ DocumentWriter.maximize()
+ brc = DocumentWriter.isMaximized()
+ case "CALC" : Kontext "DocumentCalc"
+ DocumentCalc.maximize()
+ brc = DocumentCalc.isMaximized()
+ case "IMPRESS" : Kontext "DocumentImpress"
+ DocumentImpress.maximize()
+ brc = DocumentImpress.isMaximized()
+ case "DRAW" : Kontext "DocumentDraw"
+ DocumentDraw.maximize()
+ brc = DocumentDraw.isMaximized()
+ case "MATH" : Kontext "DocumentMath"
+ DocumentMath.maximize()
+ brc = DocumentMath.isMaximized()
+ case "MASTERDOCUMENT" : Kontext "DocumentWriter"
+ DocumentWriter.maximize()
+ brc = DocumentWriter.isMaximized()
+ case "HTML" : Kontext "DocumentWriter"
+ DocumentWriter.maximize()
+ brc = DocumentWriter.isMaximized()
+ case else : qaerrorlog( CFN & "Invalid documenttype" )
+ brc = false
+ end select
+
+ '///</ul>
+
+ hMaximizeDocument() = brc
+
+end function
diff --git a/testautomation/framework/tools/includes/wizards.inc b/testautomation/framework/tools/includes/wizards.inc
new file mode 100644
index 000000000000..f8890f0e5a4f
--- /dev/null
+++ b/testautomation/framework/tools/includes/wizards.inc
@@ -0,0 +1,618 @@
+'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 : helper functions for the wizards
+'*
+'\******************************************************************************
+
+function hOpenWizardWithMenu( cType as string ) as integer
+
+ const CFN = "hOpenWizardWithMenu::"
+
+ '///<h3>Open a wizard via menu</h3>
+ '///<i>Starting point: Any plain document</i><br>
+ '///<i>Uses: framework/tools/input/menuentries.txt</i><br>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Name of Wizard (string). Known Wizards are:</li>
+ '///<ul>
+ '///+<li>&quot;LETTER&quot;</li>
+ '///+<li>&quot;FAX&quot;</li>
+ '///+<li>&quot;AGENDA&quot;</li>
+ '///+<li>&quot;PRESENTATION&quot;</li>
+ '///+<li>&quot;WEBPAGE&quot;</li>
+ '///+<li>&quot;DOCCONV&quot;</li>
+ '///+<li>&quot;EUROCONV&quot;</li>
+ '///+<li>&quot;ADDRESS&quot;</li>
+ '///+<li>&quot;MAILMERGE&quot;</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Errorcode (integer)</li>
+ '///<ul>
+ '///+<li>0: The expected wizard is open</li>
+ '///+<li>1: No wizard is open</li>
+ '///+<li>2: The incorrect wizard is open</li>
+ '///+<li>3: The requested wizard is unknown to this function</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+ dim iMainMenuPosition as integer ' position in the main menu
+ dim iMenuPosition as integer ' the position of the menuentry
+ dim iWizardMenuPosition as integer ' the position of the wizards menu
+ dim iWizardID as integer ' a unique number to identify the wizard
+ dim iWait as integer ' time of the wizard to open
+ dim iOpen as integer ' identifier for the open dialog
+ dim brc as boolean ' some multi purpose boolean returnvalue
+
+ hOpenWizardWithMenu() = 0
+
+ '///+<li>find out where in the menustructure the wizards are located</li>
+ printlog( "Requested Wizard: " & cType )
+ iWizardID = hGetWizardParams( cType , "ID" )
+ iMainMenuPosition = hGetWizardParams( cType , "MAIN" )
+ iMenuPosition = hGetWizardParams( cType , "SUB" )
+ iWizardMenuPosition = 4 ' This is the "Wizards" menuentry below "File"
+
+ try
+ kontext "DocumentWriter"
+ hUseMenu()
+
+ '///+<li>Open the 'File' menu</li>
+ printlog( CFN & "Open Menu at pos " & iMainMenuPosition )
+ hMenuSelectNr( iMainMenuPosition )
+ WaitSlot( 2000 )
+
+ '///+<li>if we are in the filemenu the wizards are below a submenu</li>
+ if ( iMainMenuPosition = 1 ) then
+ printlog( CFN & "Select wizards-submenu at pos " & iWizardMenuPosition )
+ hMenuSelectNr( iWizardMenuPosition )
+ WaitSlot( 2000 )
+ else
+ printlog( CFN & "Wizard is not in File-Menu" )
+ endif
+
+ '///+<li>try to click the menuentry where we expect the wizard</li>
+ printlog( CFN & "Select " & cType & " wizard at pos " & iMenuPosition )
+ hMenuSelectNr( iMenuPosition )
+ WaitSlot( 2000 )
+ brc = true
+ catch
+ ' we end up here, when the menuitems could not be accessed
+ printlog( CFN & "Error accessing menuentry for wizard" )
+ hOpenWizardwithMenu() = 1
+ brc = false
+ endcatch
+
+ if ( not brc ) then
+ printlog( CFN & "Trying to open wizard using the slot" )
+ select case iWizardId
+ case 1 : FileAutopilotLetter
+ case 2 : FileAutopilotFax
+ case 3 : FileAutopilotAgenda
+ case 4 : FileAutopilotPresentation
+ end select
+ endif
+
+ '///+<li>wait for a wizard to open, iOpen is the number of the menuitem</li>
+ iOpen = hWaitForWizard()
+
+ '///+<li>Verify that the correct wizard is open. iOpen should match iMenuPosition</li>
+ ' This works because the menu-positions are unique. BEWARE!
+ if ( iOpen <> iWizardID ) then
+
+ qaerrorlog( CFN & "Incorrect Wizard is open, did the menu-order change?" )
+
+ hFinishWizard( 2 )
+ hOpenWizardWithMenu() = 2
+
+ else
+
+ hOpenWizardWithMenu() = 0
+
+ endif
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hFinishWizard( iMode as integer ) as boolean
+
+ const CFN = "hFinishWizard::"
+
+ '///<h3>Finish or cancel a wizard</h3>
+ '///<i>Starting point: Any known wizard must be open</i><br>
+ '///<i>If several wizards are open at the same time the outcome is undefined</i><br>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Closing method (integer). Valid options are:</li>
+ '///<ul>
+ '///+<li>1: Click Finish-Button</li>
+ '///+<li>2: Click Cancel-Button</li>
+ '///+<li>3: Use Accelerator for Finish-Button</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Errorcode (boolean)</li>
+ '///<ul>
+ '///+<li>TRUE: If everything is ok</li>
+ '///+<li>FALSE: On any error (including incorrect function parameters)</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+ '///+<li>Handle possible errors when invoking this function</li>
+ if ( ( iMode < 1 ) or ( iMode > 3 ) ) then
+ printlog( CFN & "Invalid iMode = " & iMode )
+ hFinishWizard() = false
+ exit function
+ endif
+
+ dim cAccel as string
+ dim iWait as integer
+ dim brc as boolean
+ brc = false
+
+
+ '///+<li>Try to close the wizard</li>
+ for iWait = 1 to 5
+
+ Kontext "AutopilotLetter"
+ if ( AutopilotLetter.exists() ) then
+ select case iMode
+ case 1 : hWaitForObject( FinishButton, 3000 ) : FinishButton.click()
+ case 2 : AutopilotLetter.cancel()
+ case 3 : cAccel = hGetAccel( "Finish_Wizard" )
+ AutopilotLetter.typeKeys( cAccel )
+ end select
+ brc = true
+ exit for
+ endif
+
+ Kontext "AutopilotFax"
+ if ( AutopilotFax.exists() ) then
+ select case iMode
+ case 1 : hWaitForObject( FinishButton, 3000 ) : FinishButton.click()
+ case 2 : AutopilotFax.cancel()
+ case 3 : cAccel = hGetAccel( "Finish_Wizard" )
+ AutopilotFax.typeKeys( cAccel )
+ end select
+ brc = true
+ exit for
+ endif
+
+ Kontext "AutopilotAgenda"
+ if ( AutopilotAgenda.exists() ) then
+ select case iMode
+ case 1 : hWaitForObject( createButton, 3000 ) : createButton.click()
+ case 2 : hWaitForObject( cancelButton, 3000 ) : cancelButton.click()
+ case 3 : cAccel = hGetAccel( "Finish_Wizard" )
+ AutopilotAgenda.typeKeys( cAccel )
+ end select
+ brc = true
+ exit for
+ endif
+
+ Kontext "MailMergeWizard"
+ if ( MailMergeWizard.exists() ) then
+ select case iMode
+ case 1 : MailMergeWizard.OK()
+ case 2 : MailMergeWizard.Cancel()
+ case 3 : cAccel = hGetAccel( "Finish_Wizard" )
+ MailMergeWizard.typeKeys( cAccel )
+ end select
+ brc = true
+ exit for
+ endif
+
+ Kontext "AutopilotPraesentation3"
+ if ( AutopilotPraesentation3.exists() ) then
+ select case iMode
+ case 1 : AutopilotPraesentation3.OK()
+ case 2 : AutopilotPraesentation3.Cancel()
+ case 3 : cAccel = hGetAccel( "Finish_Wizard" )
+ AutopilotPraesentation3.typeKeys( cAccel )
+ end select
+ brc = true
+ exit for
+ endif
+
+ Kontext "AutoPilotEuroKonverter"
+ if ( AutoPilotEuroKonverter.exists() ) then
+ select case iMode
+ case 1 : hWaitForObject( Konvertieren, 3000 ) : Konvertieren.click()
+ case 2 : hWaitForObject( abbrechen , 3000 ) : abbrechen.click()
+ case 3 : cAccel = hGetAccel( "Finish_Wizard" )
+ AutoPilotEuroKonverter.typeKeys( cAccel )
+ end select
+ brc = true
+ exit for
+ endif
+
+ next iWait
+
+ '///+<li>Verify that no wizard is open anymore</li>
+ if ( brc ) then
+ printlog( CFN & "Closed wizard" )
+ hFinishWizard() = true
+ else
+ qaerrorlog( CFN & "No (known) wizard is present to be closed" )
+ hFinishWizard() = false
+ endif
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hGetWizardParams( cType as string, cParam as string ) as integer
+
+ const CFN = "hGetWizardParams::"
+
+ '///<h3>Retrieve the location of a wizard in the menu</h3>
+ '///<i>Uses: framework/tools/input/menuentries.txt</i><br>
+ '///<i>Refer to inline documentation for further information</i><br>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Name of Wizard (string). Valid options are:</li>
+ '///<ul>
+ '///+<li>&quot;LETTER&quot;</li>
+ '///+<li>&quot;FAX&quot;</li>
+ '///+<li>&quot;AGENDA&quot;</li>
+ '///+<li>&quot;PRESENTATION&quot;</li>
+ '///+<li>&quot;WEBPAGE&quot;</li>
+ '///+<li>&quot;DOCCONV&quot;</li>
+ '///+<li>&quot;EUROCONV&quot;</li>
+ '///+<li>&quot;ADDRESS&quot;</li>
+ '///+<li>&quot;MAILMERGE&quot;</li>
+ '///</ul>
+ '///+<li>Menu Position (string). Valid options are:</li>
+ '///<ul>
+ '///+<li>&quot;ID&quot; - This is a unique id for the wizard</li>
+ '///+<li>&quot;MAIN&quot; - Main menu position (e.g. &quot;File&quot;</li>
+ '///+<li>&quot;SUB&quot; - Position below main menu</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Position of a menu entry (integer)</li>
+ '///<ul>
+ '///+<li>0: Invalid function parameter</li>
+ '///+<li>1-n: Position of the item in the menu</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+ dim iParam as integer
+
+ dim cInputArray( 200 ) as string
+ dim iArraySize as integer
+
+ dim cFile as string
+ cFile = gTesttoolPath & "framework\tools\input\menuentries.txt"
+ cFile = convertpath( cFile )
+
+ '///+<li>Lowercase all function parameters</li>
+ cType = ucase( cType )
+ cParam = ucase( cParam )
+
+ '///+<li>Read in the section containing the waizard parameters</li>
+ '///+<li>Retrieve the requested value from the section</li>
+ iArraySize = hGetDataFileSection( cFile , cInputArray() , ctype , "" , "" )
+ if ( iArraySize = 3 ) then
+
+ select case cParam
+ case "ID"
+ iParam = hGetValueForKeyAsInt( cInputArray() , "iWizardId" )
+ case "MAIN"
+ iParam = hGetValueForKeyAsInt( cInputArray() , "iMainMenuPosition" )
+ case "SUB"
+ iParam = hGetValueForKeyAsInt( cInputArray() , "iMenuPosition" )
+ end select
+
+ hGetWizardParams() = iParam
+ else
+ qaerrorlog( CFN & "hGetDataFileSection returned invalid data" )
+ hGetWizardParams() = 0
+ endif
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hWaitForWizard() as integer
+
+ const CFN = "hWaitForWizard::"
+ const MAXTRIES = 10
+
+ '///<h3>Wait for any wizard to open</h3>
+ '///<i>Uses: framework/tools/input/menuentries.txt</i><br>
+ '///<i>NOTE: Not all wizards are known to this function yet.</i><br>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Nothing</li>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Unique ID of the open wizard</li>
+ '///<ul>
+ '///+<li>0: In case of any error</li>
+ '///+<li>1-n: The unique ID of the currently open wizard (integer)</li>
+ '///+</ul>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+ dim iOpen as integer
+ dim iWait as integer
+
+ '///+<li>Determine the open wizard by trying wizard.exists()</li>
+ for iWait = 1 to MAXTRIES
+
+ iOpen = 0
+
+ kontext "AutopilotLetter"
+ if ( AutopilotLetter.exists() ) then
+ printlog( CFN & "Autopilot Letter is open" )
+ iOpen = hGetWizardParams( "LETTER" , "ID" )
+ exit for
+ endif
+
+ kontext "AutopilotFax"
+ if ( AutopilotFax.exists() ) then
+ printlog( CFN & "Autopilot Fax is open" )
+ iOpen = hGetWizardParams( "FAX" , "ID" )
+ exit for
+ endif
+
+ kontext "AutopilotAgenda"
+ if ( AutopilotAgenda.exists() ) then
+ printlog( CFN & "Autopilot Agenda is open" )
+ iOpen = hGetWizardParams( "AGENDA" , "ID" )
+ exit for
+ endif
+
+ Kontext "MailMergeWizard"
+ if ( MailMergeWizard.exists() ) then
+ printlog( CFN & "Mailmerge Wizard is open" )
+ iOpen = hGetWizardParams( "MAILMERGE" , "ID" )
+ exit for
+ endif
+
+ Kontext "AutopilotPraesentation1"
+ if ( AutopilotPraesentation1.exists() ) then
+ printlog( CFN & "Presentation Wizard is open" )
+ iOpen = hGetWizardParams( "IMPRESS" , "ID" )
+ exit for
+ endif
+
+ Kontext "AutoPilotEuroKonverter"
+ if ( AutoPilotEuroKonverter.exists() ) then
+ printlog( CFN & "Euro Converter is open" )
+ iOpen = hGetWizardParams( "EUROCONV" , "ID" )
+ exit for
+ endif
+
+ Kontext "DocumentConverter"
+ if ( DocumentConverter.exists( 1 ) ) then
+ printlog( CFN & "Document Converter is open" )
+ iOpen = hGetWizardParams( "DOCCONV" , "ID" )
+ exit for
+ endif
+
+ next iWait
+
+ hWaitForWizard() = iOpen
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hSetTemplateSavePath( cFile as string ) as integer
+
+ '///<h3>Set the template save-path</h3>
+ '///<i>Starting point: Last page on FAX-, AGENDA- or LETTERWIZARD</i><br>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Fully qualified path to target template name (string)</li>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Errorcode (integer)</li>
+ '///<ul>
+ '///+<li>0: No errors, path has been set correctly</li>
+ '///+<li>1: The &quot;SaveAs&quot;-dialog did not open</li>
+ '///+<li>2: The &quot;SaveAs&quot;-button could not be clicked</li>
+ '///+<li>-1: Incorrect call to function</li>
+ '///+</ul>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+ const CFN = "hSetTemplateSavePath::"
+
+ dim iErr as integer
+
+ '///+<li>Validate function parameter</li>
+ if ( cFile = "" ) then
+ printlog( CFN & "Invalid parameter passed to function: Empty Path" )
+ hSetTemplateSavePath() = -1
+ exit function
+ endif
+
+ printlog( CFN & "Open the file-save-dialog" )
+
+ '///+<li>Click on the save-as button</li>
+ try
+ SaveAsButton.click()
+
+ kontext "SpeichernDlg"
+ if ( SpeichernDlg.exists( 2 ) ) then
+ printlog( CFN & "File Save dialog shown. Good." )
+ iErr = 0
+ else
+ qaerrorlog( "#i49515# FileSave dialog does not open" )
+ iErr = 1
+ endif
+ catch
+ qaerrorlog( "#i58297# Cannot click SaveAs button" )
+ iErr = -1
+ endcatch
+
+ '///+<li>Enter a filename</li>
+ '///+<li>Save the file</li>
+ if ( iErr = 0 ) then
+ call dialogtest( SpeichernDlg )
+
+ printlog( CFN & "Name the file" )
+ DateiName.setText( cFile )
+
+ printlog( CFN & "Save the template" )
+ speichern.click()
+ endif
+
+ hSetTemplateSavePath() = iErr
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hHandleSaveError() as integer
+
+ const CFN = "hHandleSaveError::"
+
+ '///<h3>Handle errors while saving a template</h3>
+ '///<i>Starting point: Save-As dialog from last page on FAX-, AGENDA- or LETTERWIZARD</i><br>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Nothing</li>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Errorcode (integer)</li>
+ '///<ul>
+ '///+<li>0: No unexpected dialogs were displayed</li>
+ '///+<li>1: Unexpected Active closed by clicking YES</li>
+ '///+<li>2: Unexpected Active closed by clicking OK</li>
+ '///+</ul>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+ '///<li>Check for unexpected messagebox: file could not be saved</li>
+ '///<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
+ catch
+ active.yes()
+ iErr = 1
+ endcatch
+ else
+ iErr = 0
+ endif
+
+ hHandleSaveError() = iErr
+
+
+end function
+
+'*******************************************************************************
+
+function hClickNextButton() as boolean
+
+ '///<h3>Click the Next-Button on some wizards</h3>
+ '///<i>Starting point: Last page on FAX-, AGENDA- or LETTERWIZARD</i><br>
+ '///<i>Refer to inline documentation for further information</i><br>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Nothing</li>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Status (boolean)</li>
+ '///<ul>
+ '///+<li>TRUE: Everything is ok</li>
+ '///+<li>FALSE: Any error</li>
+ '///+</ul>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+
+ const CFN = "hClickNextButton::"
+ dim irc as integer
+ dim brc as boolean
+ brc = false
+ dim iBreak as integer
+ iBreak = 0
+
+ '///+<li>Click the &quot;Next&quot;-button</li>
+ irc = hWaitForObject( NextButton, 5000 )
+ if ( irc >= 0 ) then
+ printlog( CFN & "Next..." )
+ NextButton.click()
+ brc = true
+ else
+ qaerrorlog( CFN & "Button not available within specified time -> bad" )
+ endif
+
+ '///+<li>Handle the &quot;Document Creation&quot;-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
+ endif
+ loop
+
+ hClickNextButton() = brc
+ '///</ul>
+
+end function
+
diff --git a/testautomation/framework/tools/input/i18ndata.txt b/testautomation/framework/tools/input/i18ndata.txt
new file mode 100755
index 000000000000..f8b9f88410a9
--- /dev/null
+++ b/testautomation/framework/tools/input/i18ndata.txt
@@ -0,0 +1,45 @@
+# This file contains data about languages/locales etc.
+# The same data can be found in global/system/iniinfo.inc and should be in
+# sync.
+
+[english names]
+01=english
+03=portuguese
+07=russian
+31=dutch
+33=french
+34=spanish
+36=hungarian
+39=italian
+45=danish
+46=swedish
+48=polish
+49=german
+50=slovenian
+55=portuguese brazilian
+81=japanese
+82=korean
+86=chinese simplified
+88=chinese traditional
+
+# The styles and formats have been renamed with src680
+# They now sport a localized filename
+[locale_short]
+01=en-US
+03=pt
+07=ru
+31=nl
+33=fr
+34=es
+36=hu
+39=it
+45=en-US_da
+46=sv
+48=pl
+49=de
+50=sl
+55=pt-BR
+81=ja
+82=ko
+86=zh-CN
+88=zh-TW
diff --git a/testautomation/framework/tools/input/menuentries.txt b/testautomation/framework/tools/input/menuentries.txt
new file mode 100755
index 000000000000..e1517412bc26
--- /dev/null
+++ b/testautomation/framework/tools/input/menuentries.txt
@@ -0,0 +1,50 @@
+# This file contains the position of the menuentries for all
+# wizards ∧assigns them a unique number
+# iWizardId = Unique number
+# iMenuPosition = Position below the main menu entry
+# iMainMenuPosition = Position ∈main menu, e.g. "File"
+
+[LETTER]
+iWizardID=1
+iMenuPosition=1
+iMainMenuPosition=1
+
+[FAX]
+iWizardID=2
+iMenuPosition=2
+iMainMenuPosition=1
+
+[AGENDA]
+iWizardID=3
+iMenuPosition=3
+iMainMenuPosition=1
+
+[PRESENTATION]
+iWizardID=4
+iMenuPosition=4
+iMainMenuPosition=1
+
+[WEBPAGE]
+iWizardID=5
+iMenuPosition=5
+iMainMenuPosition=1
+
+[DOCCONV]
+iWizardID=6
+iMenuPosition=6
+iMainMenuPosition=1
+
+[EUROCONV]
+iWizardID=7
+iMenuPosition=7
+iMainMenuPosition=1
+
+[ADDRESS]
+iWizardID=8
+iMenuPosition=8
+iMainMenuPosition=1
+
+[MAILMERGE]
+iWizardID=11
+iMenuPosition=11
+iMainMenuPosition=7