diff options
author | Joerg Skottke [jsk] <jsk@openoffice.org> | 2010-04-12 11:07:58 +0200 |
---|---|---|
committer | Joerg Skottke [jsk] <jsk@openoffice.org> | 2010-04-12 11:07:58 +0200 |
commit | 546dc2e09a52946937d642077cb948f92822506c (patch) | |
tree | 56345d02adc299690a5ba8234168350157ccd391 /testautomation/framework/optional | |
parent | 2992b6fb5b1c84da46598ccfcd17afa53dfe9c69 (diff) |
vitomation01: #i109562 - Code cleanup, use parameters where possible
Diffstat (limited to 'testautomation/framework/optional')
7 files changed, 65 insertions, 56 deletions
diff --git a/testautomation/framework/optional/includes/basic_delete_modules.inc b/testautomation/framework/optional/includes/basic_delete_modules.inc index c3bdc3368dd8..3a639f01e728 100755 --- a/testautomation/framework/optional/includes/basic_delete_modules.inc +++ b/testautomation/framework/optional/includes/basic_delete_modules.inc @@ -35,6 +35,8 @@ testcase tDeleteModulesAtRunningBasic printlog( "Delete BASIC module while BASIC is running" ) + const RAISE_MESSAGEBOX = 1 + dim brc as boolean const MAX_WAIT = 3000 dim iMenuItemCount as integer @@ -54,7 +56,7 @@ testcase tDeleteModulesAtRunningBasic endif printlog( "Insert a short script (1. page)" ) - brc = hInsertMacro( 1 ) + brc = hInsertMacro( RAISE_MESSAGEBOX ) if ( not brc ) then warnlog( "Unable to create a basic module for the document" ) goto endsub diff --git a/testautomation/framework/optional/includes/basic_library_export.inc b/testautomation/framework/optional/includes/basic_library_export.inc index 18bb4af4441c..6f5acacbdb24 100755 --- a/testautomation/framework/optional/includes/basic_library_export.inc +++ b/testautomation/framework/optional/includes/basic_library_export.inc @@ -38,7 +38,9 @@ testcase tBasicLibraryExport ' Assumption: All actions take place in the user/work directory ' macro taken from framework/tools/input/macros.txt::tBasicLibraryExport - ' For constants (UPPERCASE) see .BAS-file + ' For test specific global constants (UPPERCASE) see .BAS-file + + const LIBRARIES_TAB = 3 dim cDocumentName as string dim cLibraryName as string @@ -124,7 +126,7 @@ testcase tBasicLibraryExport Verwalten.click() printlog( "Go to the libraries-tab" ) - hSelectBasicObjectOrganizerTab( 3 ) + hSelectBasicObjectOrganizerTab( LIBRARIES_TAB ) kontext "TabBibliotheken" printlog( "Select the document at pos. " & DOCUMENT_POSITION ) diff --git a/testautomation/framework/optional/includes/basic_library_import.inc b/testautomation/framework/optional/includes/basic_library_import.inc index ec4cc8fa3b53..9d5dae88ff40 100755 --- a/testautomation/framework/optional/includes/basic_library_import.inc +++ b/testautomation/framework/optional/includes/basic_library_import.inc @@ -35,21 +35,29 @@ testcase tBasicLibraryImport printlog( "Import a BASIC library" ) + const MY_MACROS = 1 + const LIBRARIES_TAB = 3 + const STANDARD_LIBRARY = 1 + + const XLB_DIALOG_FILE = "dialog.xlb" + dim cMsg as string dim iCurrentLib as integer + dim cPath as string : cPath = hGetWorkPath() & LIBRARY_NAME + ToolsMacro_uno kontext "Makro" - MakroAus.Select( 1 ) + MakroAus.Select( MY_MACROS ) Verwalten.click() - hSelectBasicObjectOrganizerTab( 3 ) + hSelectBasicObjectOrganizerTab( LIBRARIES_TAB ) printlog( "Select My macros" ) kontext "TabBibliotheken" - Bibliothek.select( 1 ) + Bibliothek.select( STANDARD_LIBRARY ) printlog( "Click to add a library" ) Hinzufuegen.click() @@ -62,20 +70,18 @@ testcase tBasicLibraryImport OeffnenDlg.typeKeys( "<RETURN>" ) printlog( "Enter "dialog.xlb"" ) - DateiName.setText( "dialog.xlb" ) + DateiName.setText( XLB_DIALOG_FILE ) - printlog( "Open dialog.xlb" ) + printlog( "Open " & XLB_DIALOG_FILE ) Oeffnen.click() kontext "active" if ( active.exists( 1 ) ) then if ( active.getRT() <> 373 ) then - cMSG = Active.getText() - cMsg = hRemoveLineBreaks( cMsg ) - warnlog( "Autocompletion failed: " & cMsg ) + warnlog( "Autocompletion failed: " & Active.getText() ) Active.ok() Kontext "OeffnenDlg" - DateiName.setText( "dialog.xlb" ) + DateiName.setText( XLB_DIALOG_FILE ) Oeffnen.click() endif endif @@ -114,10 +120,10 @@ testcase tBasicLibraryImport hDestroyDocument() - hDeleteFile( hGetWorkPath() & LIBRARY_NAME & gPathSigne & "dialog.xlb" ) - hDeleteFile( hGetWorkPath() & LIBRARY_NAME & gPathSigne & "Module1.xba" ) - hDeleteFile( hGetWorkPath() & LIBRARY_NAME & gPathSigne & "script.xlb" ) - rmdir( hGetWorkPath() & LIBRARY_NAME ) : printlog( "Remove directory" ) + hDeleteFile( cPath & GetPathSeparator & XLB_DIALOG_FILE ) + hDeleteFile( cPath & GetPathSeparator & "Module1.xba" ) + hDeleteFile( cPath & GetPathSeparator & "script.xlb" ) + rmdir( cPath ) : printlog( "Remove directory" ) endcase diff --git a/testautomation/framework/optional/includes/basic_modulehide.inc b/testautomation/framework/optional/includes/basic_modulehide.inc index 88ab89227869..fb2ef75b31f5 100755 --- a/testautomation/framework/optional/includes/basic_modulehide.inc +++ b/testautomation/framework/optional/includes/basic_modulehide.inc @@ -35,6 +35,7 @@ testcase tBasicIdeModuleHide const CFN = "tBasicIdeModuleHide::" + const RAISE_MESSAGEBOX = 1 dim rc as integer dim brc as boolean @@ -46,7 +47,7 @@ testcase tBasicIdeModuleHide ToolsMacro_uno hCreateModuleForDoc() - brc = hInsertMacro( 1 ) + brc = hInsertMacro( RAISE_MESSAGEBOX ) if ( brc ) then printlog( CFN & "Macro has been written successfully" ) else @@ -60,7 +61,7 @@ testcase tBasicIdeModuleHide try ' hTestMacro is expected to fail, so we jump to the catch statement - rc = hTestMacro( 1 ) + rc = hTestMacro( RAISE_MESSAGEBOX ) if ( rc = 0 ) then warnlog( "For some reason the original module is still visible" ) else @@ -80,7 +81,7 @@ testcase tBasicIdeModuleHide endcatch - rc = hTestMacro( 1 ) + rc = hTestMacro( RAISE_MESSAGEBOX ) if ( rc = 1 ) then printlog( " * the correct macro-module is open. Good." ) else diff --git a/testautomation/framework/optional/includes/basic_package_export.inc b/testautomation/framework/optional/includes/basic_package_export.inc index a8a2ae00459d..28e214102dbb 100755 --- a/testautomation/framework/optional/includes/basic_package_export.inc +++ b/testautomation/framework/optional/includes/basic_package_export.inc @@ -40,6 +40,10 @@ testcase tBasicPackageExport const LIBRARY_NAME = "tBasicExport" const DOCUMENT_POSITION = 4 const PACKAGE_SIZE = 1325 + + const LIBRARIES_TAB = 3 + const LONG_WAIT = 3 + const SHORT_WAIT = 1 dim cDocumentName as string dim cLibraryName as string @@ -69,7 +73,7 @@ testcase tBasicPackageExport printlog( "Select the second document" ) kontext "Makro" - if ( Makro.exists( 1 ) ) then + if ( Makro.exists( SHORT_WAIT ) ) then iNodeCount = hGetNodeCount( MakroAus ) cDocumentName = hSelectNode( MakroAus, iNodeCount ) @@ -77,7 +81,7 @@ testcase tBasicPackageExport Verwalten.click() printlog( "Go to the libraries tabpage" ) - hSelectBasicObjectOrganizerTab( 3 ) + hSelectBasicObjectOrganizerTab( LIBRARIES_TAB ) kontext "TabBibliotheken" printlog( "Select the document at pos. " & DOCUMENT_POSITION ) @@ -93,7 +97,7 @@ testcase tBasicPackageExport Neu.click() kontext "NeueBibliothek" - if ( NeueBibliothek.exists( 1 ) ) then + if ( NeueBibliothek.exists( SHORT_WAIT ) ) then printlog( "Name the new library: " & LIBRARY_NAME ) BibliotheksName.setText( LIBRARY_NAME ) NeueBibliothek.ok() @@ -128,7 +132,7 @@ testcase tBasicPackageExport printlog( "Select the work document" ) kontext "Makro" - if ( Makro.exists( 1 ) ) then + if ( Makro.exists( SHORT_WAIT ) ) then iNodeCount = hGetNodeCount( MakroAus ) hSelectNode( MakroAus, iNodeCount ) @@ -136,10 +140,10 @@ testcase tBasicPackageExport Verwalten.click() printlog( "Libraries tab" ) - hSelectBasicObjectOrganizerTab( 3 ) + hSelectBasicObjectOrganizerTab( LIBRARIES_TAB ) kontext "TabBibliotheken" - if ( TabBibliotheken.exists( 1 ) and TabBibliotheken.isVisible() ) then + if ( TabBibliotheken.exists( SHORT_WAIT ) and TabBibliotheken.isVisible() ) then Bibliothek.select( DOCUMENT_POSITION ) printlog( "Select the new library" ) @@ -156,17 +160,17 @@ testcase tBasicPackageExport Export.click() kontext "ExportBasicLibraryDlg" - if ( ExportBasicLibraryDlg.exists( 3 ) ) then + if ( ExportBasicLibraryDlg.exists( LONG_WAIT ) ) then printlog( "Select to export as extension" ) ExportAsPackage.check() - ExportBasicLibraryDlg.ok() + hCloseDialog( ExportBasicLibraryDlg, "ok" ) kontext "SpeichernDlg" - if ( SpeichernDlg.exists( 3 ) ) then + if ( SpeichernDlg.exists( LONG_WAIT ) ) then printlog( "Save the file, suffix will be added automatically." ) DateiName.setText( hGetWorkPath() & LIBRARY_NAME ) Speichern.click() - Speichern.notExists( 1 ) + Speichern.notExists( SHORT_WAIT ) else warnlog( "Dialog <File Save> did not open" ) endif @@ -176,16 +180,14 @@ testcase tBasicPackageExport kontext "TabBibliotheken" printlog( "Close libraires tabpage" ) - TabBibliotheken.cancel() - TabBibliotheken.notExists( 1 ) + hCloseDialog( TabBibliotheken, "cancel" ) else warnlog( "Dialog <TabBibliotheken> is not available" ) endif kontext "Makro" printlog( "Close BASIC organizer" ) - Makro.cancel() - Makro.notExists( 1 ) + hCloseDialog( Makro, "cancel" ) else warnlog( "Dialog <Makro> did not open" ) endif diff --git a/testautomation/framework/optional/includes/basic_package_import.inc b/testautomation/framework/optional/includes/basic_package_import.inc index 4ef74de4f112..a16b9e4e50e2 100755 --- a/testautomation/framework/optional/includes/basic_package_import.inc +++ b/testautomation/framework/optional/includes/basic_package_import.inc @@ -41,6 +41,9 @@ testcase tBasicPackageImport dim package_name as string : package_name = "tBasicExport.oxt" const LIBRARY_NAME = "tBasicExport" + const MY_MACROS = 1 + const LIBRARIES_TAB = 3 + const SHORT_WAIT = 1 dim cDocumentName as string dim cLibraryName as string @@ -49,9 +52,9 @@ testcase tBasicPackageImport dim iCurrentLib as integer dim iStatus as integer - dim cFile as string - cFile = hGetWorkPath() & package_name - + dim cFile as string : cFile = hGetWorkPath() & package_name + + printlog( "Probe for test extension created by basic_packege_export" ) if ( Not FileExists( cFile ) or ( FileLen( cFile ) = 0 ) ) then warnlog( "#i105719# - Test extension is missing or has zero size. This is most likely" & _ " a follow-up error from the prior test case. Test stopped." ) @@ -80,14 +83,14 @@ testcase tBasicPackageImport ToolsMacro_uno kontext "Makro" - MakroAus.select( 1 ) + MakroAus.select( MY_MACROS ) Verwalten.click() - hSelectBasicObjectOrganizerTab( 3 ) + hSelectBasicObjectOrganizerTab( LIBRARIES_TAB ) kontext "TabBibliotheken" - Bibliothek.select( 1 ) + Bibliothek.select( SHORT_WAIT ) printlog( "Select the new library" ) kontext "TabBibliotheken" @@ -98,15 +101,13 @@ testcase tBasicPackageImport endif next iCurrentLib cLibraryName = BibliotheksListe.getSelText() - - try - Hinzufuegen.click() - catch + + if ( not hClickButton( Hinzufuegen ) ) then warnlog( "#i64007 - Office crashes on clicking import button" ) - endcatch + endif kontext "OeffnenDlg" - OeffnenDlg.cancel() + hCloseDialog( OeffnenDlg, "cancel" ) printlog( "Cleanup: Delete Library, close dialogs and remove package" ) @@ -119,19 +120,18 @@ testcase tBasicPackageImport Loeschen.click() kontext "active" - if ( active.exists( 1 ) ) then + if ( active.exists( SHORT_WAIT ) ) then active.yes() else warnlog( "No warning for library deletion" ) endif - endif - + endif kontext "TabBibliotheken" - TabBibliotheken.cancel() + hCloseDialog( TabBibliotheken, "cancel" ) kontext "Makro" - Makro.cancel() + hCloseDialog( Makro, "cancel" ) hExtensionRemoveGUI( package_name ) diff --git a/testautomation/framework/optional/includes/security_recommend_password.inc b/testautomation/framework/optional/includes/security_recommend_password.inc index eaceab3691b9..628fdecd7ae5 100755 --- a/testautomation/framework/optional/includes/security_recommend_password.inc +++ b/testautomation/framework/optional/includes/security_recommend_password.inc @@ -80,11 +80,8 @@ testcase tRecommendPassword( filetypeID as string ) if ( rc = 0 ) then - if AutomatischeDateinamenserweiterung.Exists then - AutomatischeDateinamenserweiterung.Uncheck - endif - - + AutomatischeDateinamenserweiterung.Uncheck + printlog( "Name the file" ) Dateiname.settext( workpath & workfile ) @@ -117,6 +114,5 @@ testcase tRecommendPassword( filetypeID as string ) printlog( "Close the current document" ) call hCloseDocument() - endcase |