diff options
Diffstat (limited to 'testautomation/framework/required/includes/tools_customize.inc')
-rwxr-xr-x[-rw-r--r--] | testautomation/framework/required/includes/tools_customize.inc | 368 |
1 files changed, 191 insertions, 177 deletions
diff --git a/testautomation/framework/required/includes/tools_customize.inc b/testautomation/framework/required/includes/tools_customize.inc index 0db4af9fc487..6bf31e391f99 100644..100755 --- a/testautomation/framework/required/includes/tools_customize.inc +++ b/testautomation/framework/required/includes/tools_customize.inc @@ -34,7 +34,6 @@ testcase tUpdtCustomize( cApp as string ) printlog( "Tools/Customize dialog" ) - const CLOSE_METHOD = 1 ' 1 = Cancel button if ( hCreateDocument() ) then if ( hToolsCustomizeOpen() ) then @@ -42,7 +41,7 @@ testcase tUpdtCustomize( cApp as string ) hUpdtToolsCustomizeMenu() hUpdtToolsCustomizeToolbars() hUpdtToolsCustomizeEvents() - hToolsCustomizeClose( CLOSE_METHOD ) + hCloseDialog( TabCustomizeEvents, "cancel" ) else warnlog( "Tools/Customize dialog did not open" ) endif @@ -57,10 +56,19 @@ endcase function hUpdtToolsCustomizeMenu() - - const CFN = "hUpdtToolsCustomizeMenu::" + + const MENUITEM_MOVE = 1 + const MENUITEM_ADDSUBMENU = 1 + const MENUITEM_RENAME = 2 + const MENUITEM_DELETE = 3 + const MENUITEM_MODIFY = 2 + const MENUITEM_MODIFY_LARGE_MENU = 4 + + const APPLICATION_ONLY = 1 + const APPLICATION_AND_DOCUMENT = 2 const ITEMNAME = "tUpdtCustomize" + dim brc as boolean dim iItems as integer @@ -71,7 +79,7 @@ function hUpdtToolsCustomizeMenu() printlog( "" ) printlog( "Menu" ) - brc = hToolsCustomizeSelectTab( "Menu" ) + hToolsCustomizeSelectTab( "Menu" ) call DialogTest( TabCustomizeMenu ) printlog( CFN & "Click New..." ) @@ -79,48 +87,56 @@ function hUpdtToolsCustomizeMenu() BtnNew.click() Kontext "MenuOrganiser" - printlog( CFN & "MenuOrganiser" ) - call DialogTest( MenuOrganiser ) - - printlog( CFN & "Down..." ) - ButtonDown.click() - - printlog( CFN & "Up..." ) - ButtonUp.click() - - printlog( CFN & "Name the new menu" ) - MenuName.setText( "tUpdtCustomize" ) - - 'qaerrorlog( "#i60609# Undeclared listbox in menu organiser" ) - printlog( "TODO: Access the listbox in menuorganizer" ) - - printlog( CFN & "Close the menu with ok" ) - MenuOrganiser.ok() + if ( MenuOrganiser.exists( 2 ) ) then + printlog( CFN & "MenuOrganiser" ) + call DialogTest( MenuOrganiser ) + + printlog( CFN & "Down..." ) + ButtonDown.click() + + printlog( CFN & "Up..." ) + ButtonUp.click() + + printlog( CFN & "Name the new menu" ) + MenuName.setText( "tUpdtCustomize" ) + + 'qaerrorlog( "#i60609# Undeclared listbox in menu organiser" ) + printlog( "TODO: Access the listbox in menuorganizer" ) + + printlog( CFN & "Close the menu with ok" ) + hCloseDialog( MenuOrganiser, "ok" ) + else + warnlog( "Dialog <MenuOrganiser> did not open" ) + endif printlog( CFN & "Click the menu listbutton" ) kontext "TabCustomizeMenu" hOpenMenuButton( MenuBtn ) ' MenuBtn.OpenMenu() printlog( CFN & "Select Move..." ) - hMenuSelectNr( 1 ) + hMenuSelectNr( MENUITEM_MOVE ) kontext "MenuOrganiser" - printlog( CFN & "Click UP" ) - ButtonUp.click() - - kontext "MenuOrganiser" - printlog( CFN & "Click DOWN" ) - ButtonDown.click() + if ( MenuOrganiser.exists( 2 ) ) then + printlog( CFN & "Click UP" ) + ButtonUp.click() - printlog( CFN & "Cancel the dialog" ) - MenuOrganiser.cancel() + kontext "MenuOrganiser" + printlog( CFN & "Click DOWN" ) + ButtonDown.click() + + printlog( CFN & "Cancel the dialog" ) + hCloseDialog( MenuOrganiser, "cancel" ) + else + warnlog( "Dialog <MenuOrganizer> did not open" ) + endif printlog( CFN & "Click the menu listbutton" ) kontext "TabCustomizeMenu" hOpenMenuButton( MenuBtn ) ' MenuBtn.OpenMenu() printlog( CFN & "Select Rename..." ) - hMenuSelectNr( 2 ) + hMenuSelectNr( MENUITEM_RENAME ) printlog( CFN & "Cancel the renaming-dialog" ) kontext "RenameMenu" @@ -131,7 +147,7 @@ function hUpdtToolsCustomizeMenu() hOpenMenuButton( MenuBtn ) ' MenuBtn.OpenMenu() printlog( CFN & "Select Delete" ) - hMenuSelectNr( 3 ) + hMenuSelectNr( MENUITEM_DELETE ) kontext "TabCustomizeMenu" hUpdtToolsCustomizeScriptSelector( 3 ) @@ -139,12 +155,10 @@ function hUpdtToolsCustomizeMenu() printlog( CFN & "Check itemcount in SaveIn List" ) kontext "TabCustomizeMenu" select case gApplication - case "BACKGROUND" : brc = hToolsCustomizeTestSaveIn( 1 ) - case else : brc = hToolsCustomizeTestSaveIn( 2 ) + case "BACKGROUND" : brc = hToolsCustomizeTestSaveIn( APPLICATION_ONLY ) + case else : brc = hToolsCustomizeTestSaveIn( APPLICATION_AND_DOCUMENT ) end select - if ( not brc ) then - warnlog( "Incorrect itemcount in listbox, see above" ) - endif + if ( not brc ) then warnlog( "Incorrect itemcount in listbox, see above" ) printlog( CFN & "Down..." ) BtnDown.click() @@ -154,8 +168,8 @@ function hUpdtToolsCustomizeMenu() printlog( CFN & "Click the Modify-Button and select item 1 (Add submenu)" ) kontext "TabCustomizeMenu" - brc = hClickCommandButton( 1 ) - if ( not brc ) then + + if ( not hClickCommandButton( MENUITEM_ADDSUBMENU ) ) then warnlog( CFN & "Something went wrong when accessing the command button" ) exit function endif @@ -182,8 +196,8 @@ function hUpdtToolsCustomizeMenu() printlog( CFN & "Click the Modify-Button and select to rename the item" ) kontext "TabCustomizeMenu" - brc = hClickCommandButton( 3 ) - if ( not brc ) then + + if ( not hClickCommandButton( 3 ) ) then warnlog( CFN & "Something went wrong when accessing the command button" ) exit function endif @@ -202,16 +216,16 @@ function hUpdtToolsCustomizeMenu() printlog( CFN & "Click the Modify-Button and delete the current item" ) kontext "TabCustomizeMenu" - brc = hClickCommandButton( 4 ) - if ( not brc ) then + + if ( not hClickCommandButton( MENUITEM_MODIFY_LARGE_MENU ) ) then warnlog( CFN & "Something went wrong when accessing the command button" ) exit function endif printlog( CFN & "Click the Modify-Button and create a new group" ) kontext "TabCustomizeMenu" - brc = hClickCommandButton( 2 ) - if ( not brc ) then + + if ( not hClickCommandButton( MENUITEM_MODIFY ) ) then warnlog( CFN & "Something went wrong when accessing the command button" ) exit function endif @@ -219,8 +233,8 @@ function hUpdtToolsCustomizeMenu() ' Note: The current index for the delete-function is at pos 2. printlog( CFN & "Click the Modify-Button and delete the new group" ) kontext "TabCustomizeMenu" - brc = hClickCommandButton( 2 ) - if ( not brc ) then + + if ( not hClickCommandButton( MENUITEM_MODIFY ) ) then warnlog( CFN & "Something went wrong when accessing the command button" ) exit function endif @@ -231,13 +245,18 @@ end function function hUpdtToolsCustomizeToolbars() + const CFN = "hUpdtToolsCustomizeToolbars::" + const DOCUMENT_ONLY = 1 + const APPLICATION_AND_DOCUMENT = 2 + const MENUITEM_RENAME = 1 + const MENUITEM_DELETE = 2 + const MENUITEM_MODIFY = 4 + const DIALOG_DELAY = 3 - const CFN = "hUpdtToolsCustomizeToolbars::" dim brc as boolean - dim iCurrentItem as integer printlog( "" ) @@ -251,23 +270,22 @@ function hUpdtToolsCustomizeToolbars() BtnNew.click() kontext "NewToolbar" - if ( NewToolbar.exists( 2 ) ) then + if ( NewToolbar.exists( DIALOG_DELAY ) ) then printlog( CFN & "NewToolbar" ) call DialogTest( NewToolbar ) select case gApplication - case "BACKGROUND" : brc = hToolsCustomizeTestSaveIn( 1 ) - case else : brc = hToolsCustomizeTestSaveIn( 2 ) + case "BACKGROUND" : brc = hToolsCustomizeTestSaveIn( DOCUMENT_ONLY ) + case else : brc = hToolsCustomizeTestSaveIn( APPLICATION_AND_DOCUMENT ) end select - if ( not brc ) then - warnlog( "Incorrect itemcount in listbox, see above" ) - endif + + if ( not brc ) then warnlog( "Incorrect itemcount in listbox, see above" ) printlog( CFN & "Name the new toolbar for further usage" ) ToolbarName.setText( "tUpdtCustomize" ) printlog( CFN & "Close NewToolbar dialog with OK" ) - NewToolbar.ok() + hCloseDialog( NewToolbar, "ok" ) else warnlog( CFN & "Could not access New Toolbar dialog" ) endif @@ -277,13 +295,13 @@ function hUpdtToolsCustomizeToolbars() hOpenMenuButton( MenuBtn ) ' MenuBtn.OpenMenu() printlog( "Select rename" ) - hMenuSelectNr( 1 ) + hMenuSelectNr( MENUITEM_RENAME ) printlog( CFN & "Cancel the dialog" ) kontext "RenameToolbar" - if ( RenameToolbar.exists( 2 ) ) then + if ( RenameToolbar.exists( DIALOG_DELAY ) ) then call dialogtest( RenameToolbar ) - RenameToolbar.Cancel() + hCloseDialog( RenameToolbar, "Cancel" ) else warnlog( CFN & "Could not access Toolbar renaming dialog" ) endif @@ -293,19 +311,18 @@ function hUpdtToolsCustomizeToolbars() hOpenMenuButton( MenuBtn ) ' MenuBtn.OpenMenu() printlog( "Select delete" ) - hMenuSelectNr( 2 ) + hMenuSelectNr( MENUITEM_DELETE ) kontext "TabCustomizeToolbars" hUpdtToolsCustomizeScriptSelector( 2 ) kontext "TabCustomizeToolbars" select case gApplication - case "BACKGROUND" : brc = hToolsCustomizeTestSaveIn( 1 ) - case else : brc = hToolsCustomizeTestSaveIn( 2 ) + case "BACKGROUND" : brc = hToolsCustomizeTestSaveIn( DOCUMENT_ONLY ) + case else : brc = hToolsCustomizeTestSaveIn( APPLICATION_AND_DOCUMENT ) end select - if ( not brc ) then - warnlog( "Incorrect itemcount in listbox, see above" ) - endif + + if ( not brc ) then warnlog( "Incorrect itemcount in listbox, see above" ) printlog( CFN & "Down..." ) if ( BtnDown.isEnabled() ) then @@ -326,7 +343,7 @@ function hUpdtToolsCustomizeToolbars() AddCommands.click() kontext "ScriptSelector" - if ( ScriptSelector.exists( 5 ) ) then + if ( ScriptSelector.exists( DIALOG_DELAY ) ) then call dialogtest( ScriptSelector ) @@ -339,14 +356,11 @@ function hUpdtToolsCustomizeToolbars() printlog( CFN & "Add the default item" ) try kontext "ScriptSelector" - ScriptSelector.ok() + hCloseDialog( ScriptSelector, "ok" ) catch qaerrorlog( "#i79207# Could not access ok button on ScriptSelector" ) kontext "ScriptSelector" - if ( ScriptSelector.exists( 2 ) ) then - printlog( "Scriptselector is open" ) - endif - + if ( ScriptSelector.exists( DIALOG_DELAY ) ) then printlog( "Scriptselector is open" ) endcatch else @@ -354,47 +368,41 @@ function hUpdtToolsCustomizeToolbars() for iCurrentItem = 1 to 5 printlog( CFN & "LibraryTreeList: Moving down..." ) LibraryTreeList.typeKeys( "<DOWN>" ) - if ( ScriptSelector.isEnabled() ) then - exit for - endif + if ( ScriptSelector.isEnabled() ) then exit for next iCurrentItem endif ' Note: The Customize dialog in the background is updated immediately. This ' means that the cancel-button is active but blocked for a moment - WaitSlot( 2000 ) + 'WaitSlot( 2000 ) printlog( CFN & "Close the Script Selector, back to ToolsCustomize dialog" ) - ScriptSelector.cancel() - - ' make sure the dialog is really closed. At times it just refuses to do so?? - if ( ScriptSelector.exists( 1 ) ) then - ScriptSelector.close() - endif + hCloseDialog( ScriptSelector, "cancel" ) kontext "TabCustomizeToolbars" printlog( CFN & "Click the Modify-button" ) - brc = hClickCommandButton( 1 ) - if ( not brc ) then + + if ( not hClickCommandButton( 1 ) ) then warnlog( CFN & "Something went wrong when accessing the command button" ) exit function endif printlog( CFN & "Rename the item" ) + UseBindings kontext "CustomizeToolbarsRename" - if ( CustomizeToolbarsRename.exists( 2 ) ) then + if ( CustomizeToolbarsRename.exists( DIALOG_DELAY ) ) then call dialogtest( CustomizeToolbarsRename ) EingabeFeld.setText( "Renamed item" ) printlog( CFN & "Close the dialog" ) - CustomizeToolbarsRename.ok() + hCloseDialog( CustomizeToolbarsRename, "ok" ) else warnlog( CFN & "CustomizeToolbarsRename could not be accessed" ) endif kontext "TabCustomizeToolbars" - brc = hClickCommandButton( 2 ) - if ( not brc ) then + + if ( not hClickCommandButton( 2 ) ) then warnlog( CFN & "Something went wrong when accessing the command button" ) exit function endif @@ -405,8 +413,8 @@ function hUpdtToolsCustomizeToolbars() printlog( "******************** 1 ********************" ) hDeselectSeparator() printlog( "******************** 2 ********************" ) - brc = hClickCommandButton( 3 ) - if ( not brc ) then + + if ( not hClickCommandButton( 3 ) ) then warnlog( CFN & "Something went wrong when accessing the command button" ) exit function endif @@ -414,8 +422,8 @@ function hUpdtToolsCustomizeToolbars() kontext "TabCustomizeToolbars" waitslot printlog( CFN & "Click the Modify-button" ) - brc = hClickCommandButton( 4 ) - if ( not brc ) then + +if ( not hClickCommandButton( MENUITEM_MODIFY ) ) then warnlog( CFN & "Something went wrong when accessing the command button" ) exit function endif @@ -423,8 +431,8 @@ function hUpdtToolsCustomizeToolbars() kontext "TabCustomizeToolbars" WaitSlot printlog( CFN & "Click the Modify-button" ) - brc = hClickCommandButton( 1 ) - if ( not brc ) then + + if ( not hClickCommandButton( 1 ) ) then warnlog( CFN & "Something went wrong when accessing the command button" ) exit function endif @@ -435,26 +443,26 @@ function hUpdtToolsCustomizeToolbars() printlog( "******************** 3 ********************" ) hDeselectSeparator() printlog( "******************** 4 ********************" ) - brc = hClickCommandButton( 5 ) - if ( not brc ) then + + if ( not hClickCommandButton( 5 ) ) then warnlog( CFN & "Something went wrong when accessing the command button" ) exit function endif printlog( CFN & "On the Change Icon dialog: Click to import an icon" ) kontext "ChangeIcon" - if ( ChangeIcon.exists( 2 ) ) then + if ( ChangeIcon.exists( DIALOG_DELAY ) ) then call dialogtest( ChangeIcon ) import.click() printlog( CFN & "Cancel the FileOpen-dialog" ) kontext "OeffnenDlg" call dialogtest( OeffnenDlg ) - OeffnenDlg.cancel() + hCloseDialog( OeffnenDlg, "cancel" ) - printlog( CFN & "Cancel the Change Icon dialog" ) + printlog( CFN & "Close the Change Icon dialog with <ok>" ) kontext "ChangeIcon" - ChangeIcon.ok() + hCloseDialog( ChangeIcon, "ok" ) else warnlog( CFN & "Could not access Change Icon dialog" ) endif @@ -462,8 +470,8 @@ function hUpdtToolsCustomizeToolbars() kontext "TabCustomizeToolbars" waitslot printlog( CFN & "Click the Modify-button" ) - brc = hClickCommandButton( 3 ) - if ( not brc ) then + + if ( not hClickCommandButton( 3 ) ) then warnlog( CFN & "Something went wrong when accessing the command button" ) exit function endif @@ -475,59 +483,68 @@ end function function hUpdtToolsCustomizeEvents() - - - - const CFN = "hUpdtToolsCustomizeEvents::" + const APPLICATION_ONLY = 1 + const APPLICATION_AND_DOCUMENT = 2 + const TAB_EVENTS = 1 + dim brc as boolean printlog( "" ) printlog( "Events" ) - brc = hToolsCustomizeSelectTab( "events" ) - call DialogTest( TabCustomizeEvents ) - - hUpdtToolsCustomizeScriptSelector( 1 ) - - kontext "TabCustomizeEvents" - select case gApplication - case "BACKGROUND" : brc = hToolsCustomizeTestSaveIn( 1 ) - case else : brc = hToolsCustomizeTestSaveIn( 2 ) - end select - if ( not brc ) then - warnlog( "Incorrect itemcount in listbox, see above" ) - endif + hToolsCustomizeSelectTab( "events" ) + if ( TabCustomizeEvents.exists() ) then + if ( TabCustomizeEvents.isVisible() ) then + call DialogTest( TabCustomizeEvents ) -end function + hUpdtToolsCustomizeScriptSelector( TAB_EVENTS ) -'******************************************************************************* + kontext "TabCustomizeEvents" + select case gApplication + case "BACKGROUND" : brc = hToolsCustomizeTestSaveIn( APPLICATION_ONLY ) + case else : brc = hToolsCustomizeTestSaveIn( APPLICATION_AND_DOCUMENT ) + end select -function hUpdtToolsCustomizeKeyboard() as boolean + if ( not brc ) then warnlog( "Incorrect itemcount in listbox, see above" ) + else + warnlog( "<TabCustomizeEvents> is not visible" ) + endif + else + warnlog( "<TabCustomizeEvents> did not open" ) + endif +end function +'******************************************************************************* +function hUpdtToolsCustomizeKeyboard() as boolean const CFN = "hUpdtToolsCustomizeKeyboard::" - dim brc as boolean + const FIRST_CHANGEABLE_ITEM = 2 printlog( "" ) printlog( "Keyboard" ) - - brc = hToolsCustomizeSelectTab( "keyboard" ) - if ( not brc and gApplication = "BACKGROUND" ) then - qaerrorlog( "#i61765# TabTastatur is missing when called from Backing Window" ) - exit function + + if ( gApplication = "BACKGROUND" ) then + if ( not hToolsCustomizeSelectTab( "keyboard" ) ) then + qaerrorlog( "#i61765# TabTastatur is missing when called from Backing Window" ) + hUpdtToolsCustomizeKeyboard() = false + exit function + endif endif - + + hToolsCustomizeSelectTab( "keyboard" ) + + kontext "TabTastatur" call DialogTest( TabTastatur ) ' no verification of functionality, this is an update test! + kontext "TabTastatur" StarOffice.check() - hSelectNode( Tastatur , 2 ) + hSelectNode( Tastatur , FIRST_CHANGEABLE_ITEM ) hSelectTopNode( bereich ) - waitslot ' Workaround: It might still happen that the currently selected accelerator ' is "fixed" so we need to find another one that can be modified. @@ -537,12 +554,8 @@ function hUpdtToolsCustomizeKeyboard() as boolean loop Aendern.click() - - Zuruecksetzen.click() - - hSelectNode( Tastatur , 2 ) - waitslot + hSelectNode( Tastatur , FIRST_CHANGEABLE_ITEM ) ' Workaround: It might still happen that the currently selected accelerator ' is "fixed" so we need to find another one that can be modified. @@ -552,64 +565,65 @@ function hUpdtToolsCustomizeKeyboard() as boolean loop Aendern.click() - Loeschen.click() - Speichern.click() kontext "SpeichernDlg" - SpeichernDlg.cancel() + hCloseDialog( SpeichernDlg, "cancel" ) kontext "TabTastatur" Laden.click() kontext "OeffnenDlg" - OeffnenDlg.cancel() - + hCloseDialog( OeffnenDlg, "cancel" ) end function '******************************************************************************* -function hUpdtToolsCustomizeScriptSelector( iBtn as integer ) as boolean - - - - +function hUpdtToolsCustomizeScriptSelector( iPageButton as integer ) as boolean const CFN = "hUpdtToolsCustomizeScriptSelector::" - dim brc as boolean - brc = true - - select case iBtn - case 1 : kontext "TabCustomizeEvents" - printlog( CFN & "Assign Macro... (1)" ) - AssignMacro.click() - case 2 : kontext "TabCustomizeToolbars" - printlog( CFN & "Add... (2)" ) - AddCommands.click() - case 3 : kontext "TabCustomizeMenu" - printlog( CFN & "Add... (3)" ) - AddCommands.click() + dim brc as boolean : brc = true + const TAB_EVENTS = 1 + const TAB_TOOLBARS = 2 + const TAB_MENU = 3 + const DIALOG_DELAY = 2 + + select case iPageButton + case TAB_EVENTS + kontext "TabCustomizeEvents" + printlog( CFN & "Assign Macro... (1)" ) + AssignMacro.click() + case TAB_TOOLBARS + kontext "TabCustomizeToolbars" + printlog( CFN & "Add... (2)" ) + AddCommands.click() + case TAB_MENU + kontext "TabCustomizeMenu" + printlog( CFN & "Add... (3)" ) + AddCommands.click() case else - warnlog( CFN & "Invalid function parameter" ) - brc = false + warnlog( CFN & "Invalid function parameter" ) + hUpdtToolsCustomizeScriptSelector() = false + exit function end select - if ( brc ) then - kontext "ScriptSelector" + kontext "ScriptSelector" + if ( ScriptSelector.exists( DIALOG_DELAY ) ) then call DialogTest( ScriptSelector ) - + kontext "ScriptSelector" - ScriptSelector.cancel() - + hCloseDialog( ScriptSelector, "cancel" ) + else + warnlog( CFN & "Dialog <ScriptSelector> did not open" ) endif - select case iBtn - case 1 : kontext "TabCustomizeEvents" - case 2 : kontext "TabCustomizeToolbars" - case 3 : kontext "TabCustomizeMenu" + select case iPageButton + case TAB_EVENTS : kontext "TabCustomizeEvents" + case TAB_TOOLBARS : kontext "TabCustomizeToolbars" + case TAB_MENU : kontext "TabCustomizeMenu" end select hUpdtToolsCustomizeScriptSelector() = brc @@ -619,9 +633,6 @@ end function '******************************************************************************* function hToolsCustomizeTestSaveIn( iItems as integer ) as boolean - - - const CFN = "hToolsCustomizeTestSaveIn::" dim iPresentItems as integer @@ -661,15 +672,18 @@ function hOpenMenuButton( oControl as object ) as integer dim bUseSlowMethod as boolean : bUseSlowMethod = false const CFN = "hOpenMenuButton: " + const RC_FAILURE = -1 + const MAX_RETRIES = 3 + const DEFAULT_DELAY = 1000 - hOpenMenuButton() = -1 ' this is the general failure returnvalue + hOpenMenuButton() = RC_FAILURE - for iClick = 1 to 3 + for iClick = 1 to MAX_RETRIES if ( bUseSlowMethod ) then - wait( 1000 ) + wait( DEFAULT_DELAY ) oControl.OpenMenu() - wait( 3000 ) + wait( DEFAULT_DELAY * 3 ) else oControl.click() endif |