[ooo-build-commit] Branch 'ooo/master' - testautomation/extensions testautomation/framework testautomation/global

Jan Holesovsky kendy at kemper.freedesktop.org
Mon Aug 10 19:41:57 PDT 2009


 testautomation/extensions/optional/includes/fileopen.inc       |    8 
 testautomation/framework/required/f_tools_customize.bas        |    2 
 testautomation/framework/required/includes/tools_customize.inc |  153 +++++++---
 testautomation/framework/tools/includes/customize_tools.inc    |  117 +------
 testautomation/global/tools/includes/required/t_dir.inc        |   28 +
 5 files changed, 158 insertions(+), 150 deletions(-)

New commits:
commit 246e10971f39012cb1475ae7b3111ae402ea02ec
Author: Release Engineers <releng at openoffice.org>
Date:   Mon Aug 10 11:06:58 2009 +0000

    CWS-TOOLING: integrate CWS jskhgpilot
    2009-07-31 skotti #i96753 - added just another 500ms wait - sad, that is
    2009-07-31 skotti #i96753 - cleanup, documentation
    2009-07-31 skotti #i96753 - fix
    2009-07-31 skotti #i96753 - OK, another approach for testing on different hardware...
    2009-07-31 skotti #i96753 - small adjustments, back to .click() method
    2009-07-29 skotti #i96753 - invented new dynamic function to deal with the menubutton which - as a nice sideefect allows to disable all sleep() statements within the test. This is good for -330 seconds of sleeping and in combination with a few optimizations makes the test run less than 20 minutes, about 8 minutes faster than before
    2009-07-28 skotti #i96753 - use MenuBtn.OpenMenu() instead of .click() as this appears to work better and is used in other places successfully as well
    2009-07-28 skotti #i103065 - fileopen dialog shows Mercurial and SVN directories which must be skipped
    2009-07-28 skotti #i103065 - Added mercurial hidden directory to the excludes list in global routine
    2009-07-28 skotti Rebase oder so...
    2009-07-28 skotti #i96753 - insert wait statements

diff --git a/testautomation/extensions/optional/includes/fileopen.inc b/testautomation/extensions/optional/includes/fileopen.inc
index 6d457df..ad700a4 100755
--- a/testautomation/extensions/optional/includes/fileopen.inc
+++ b/testautomation/extensions/optional/includes/fileopen.inc
@@ -70,12 +70,16 @@ testcase tExtensionFileOpen
     
     printlog( "Reopen Extension Manager UI, click Add.. and check the directory" )
     ToolsPackageManager
+    
     kontext "PackageManager"
     if ( PackageManager.exists( 3 ) ) then
         Add.click()
+        
         Kontext "OeffnenDlg"
         if ( OeffnenDlg.exists( 2 ) ) then
-            DateiAuswahl.select( DateiAuswahl.getItemCount() ) 
+
+            printlog( "Select the last item in the list which should be the extension" )            
+            DateiAuswahl.select( Dateiauswahl.getItemCount() )
             cString = DateiAuswahl.getSelText()
             if ( cString <> EXTENSION_NAME ) then
                 warnlog( "Incorrect extension listed. Please check path and filename" )
@@ -85,11 +89,13 @@ testcase tExtensionFileOpen
             else
                 printlog( "Found correct extension, the dialog remembers the path" )
             endif
+
             kontext "OeffnenDlg"
             OeffnenDlg.cancel()
         else
             warnlog( "Could not access Add Extensions Dialog" )
         endif
+        
         kontext "PackageManager"
         PackageManager.close()
     else
diff --git a/testautomation/framework/required/f_tools_customize.bas b/testautomation/framework/required/f_tools_customize.bas
index 0b43717..7adc482 100755
--- a/testautomation/framework/required/f_tools_customize.bas
+++ b/testautomation/framework/required/f_tools_customize.bas
@@ -39,6 +39,8 @@
 
 sub main
 
+    GLOBAL_USE_NEW_SLEEP = TRUE
+
     use "framework\required\includes\tools_customize.inc"
     
     dim cApp as string
diff --git a/testautomation/framework/required/includes/tools_customize.inc b/testautomation/framework/required/includes/tools_customize.inc
index 69d09f9..56654d8 100755
--- a/testautomation/framework/required/includes/tools_customize.inc
+++ b/testautomation/framework/required/includes/tools_customize.inc
@@ -39,41 +39,24 @@
 
 testcase tUpdtCustomize( cApp as string )
 
-	'///<h1>Update test for the Tools/Customize Dialog</h1>
-	'///<ul>
-    const CANCEL_BUTTON = 1
-    dim brc as boolean
-    
-    '///+<li>Open a new document (abort test on failure)</li>
-    brc = hCreateDocument()
-    if ( not brc ) then
-        warnlog( "Abort: Failed to create requested document: " & gApplication )
-        goto endsub
+    printlog( "Tools/Customize dialog" )
+    const CLOSE_METHOD = 1 ' 1 = Cancel button
+
+    if ( hCreateDocument() ) then    
+        if ( hToolsCustomizeOpen() ) then
+            hUpdtToolsCustomizeKeyboard()
+            hUpdtToolsCustomizeMenu()
+            hUpdtToolsCustomizeToolbars()
+            hUpdtToolsCustomizeEvents()
+            hToolsCustomizeClose( CLOSE_METHOD )
+        else
+            warnlog( "Tools/Customize dialog did not open" )
+        endif
+        hDestroyDocument
+    else
+        warnlog( "Failed to create initial document" )
     endif
     
-    '///+<li>Open Tools Customize</li>
-    brc = hToolsCustomizeOpen()
-    
-    '///+<li>Look at the Keyboard-Tabpage</li>
-    hUpdtToolsCustomizeKeyboard()
-    
-    '///+<li>Look at the Menu-Tabpage</li>
-    hUpdtToolsCustomizeMenu()
-    
-    '///+<li>Look at the Toolbars-Tabpage</li>
-    hUpdtToolsCustomizeToolbars()
-    
-    '///+<li>Look at the Events-Tabpage</li>
-    hUpdtToolsCustomizeEvents()
-    
-    '///+<li>Close Tools Customize</li>
-    brc = hToolsCustomizeClose( CANCEL_BUTTON )
-    
-    '///+<li>Close the document</li>
-    brc = hDestroyDocument
-    
-    '///</ul>
-    
 endcase
 
 '*******************************************************************************
@@ -142,7 +125,7 @@ function hUpdtToolsCustomizeMenu()
     '///+<li>Click the Menu List-Button</li>
     printlog( CFN & "Click the menu listbutton" )
     kontext "TabCustomizeMenu"
-    MenuBtn.click()
+    hOpenMenuButton( MenuBtn ) ' MenuBtn.OpenMenu()
     
     '///+<li>Select the first entry (Move...) to open the Menu Organiser</li>
     printlog( CFN & "Select Move..." )
@@ -165,7 +148,7 @@ function hUpdtToolsCustomizeMenu()
     '///+<li>Click the Menu List-Button</li>
     printlog( CFN & "Click the menu listbutton" )
     kontext "TabCustomizeMenu"
-    MenuBtn.click()
+    hOpenMenuButton( MenuBtn ) ' MenuBtn.OpenMenu()
     
     '///+<li>Select the second entry (Rename...) to open the Rename dialog</li>
     printlog( CFN & "Select Rename..." )
@@ -179,7 +162,7 @@ function hUpdtToolsCustomizeMenu()
     '///+<li>Click the Menu List-Button</li>
     printlog( CFN & "Click the menu listbutton" )
     kontext "TabCustomizeMenu"
-    MenuBtn.click()
+    hOpenMenuButton( MenuBtn ) ' MenuBtn.OpenMenu()
     
     '///+<li>Select the third entry (Delete) to delete the new menu<br>
     '///+Note that there will be no warning as the menu is empty</li>
@@ -361,8 +344,9 @@ function hUpdtToolsCustomizeToolbars()
     '///+<li>Access the &quot;Toolbar&quot;-Button and rename the toolbar</li>
     printlog( CFN & "Rename the toolbar via Toolbar-Button" )
     kontext "TabCustomizeToolbars"
-    MenuBtn.click()
-    waitslot
+    hOpenMenuButton( MenuBtn ) ' MenuBtn.OpenMenu()
+    
+    printlog( "Select rename" )
     hMenuSelectNr( 1 )
     
     '///+<li>Cancel the renaming-dialog</li>
@@ -379,8 +363,9 @@ function hUpdtToolsCustomizeToolbars()
     '///+Note that there will be no deletion warning</li>
     printlog( CFN & "Delete the toolbar via Toolbar-Button" )
     kontext "TabCustomizeToolbars"
-    MenuBtn.click()
-    waitslot
+    hOpenMenuButton( MenuBtn ) ' MenuBtn.OpenMenu()
+    
+    printlog( "Select delete" )
     hMenuSelectNr( 2 )
        
     '///+<li>Click the &quot;Add Commands...&quot; button</li>
@@ -399,7 +384,6 @@ function hUpdtToolsCustomizeToolbars()
     endif
     
     '///+<li>Click &quot;Down&quot;</li>
-    WaitSlot()
     printlog( CFN & "Down..." )
     if ( BtnDown.isEnabled() ) then
         BtnDown.click()
@@ -846,4 +830,91 @@ function hToolsCustomizeTestSaveIn( iItems as integer ) as boolean
 
 end function
 
+'*******************************************************************************
 
+function hOpenMenuButton( oControl as object ) as integer
+
+    ' This function is very evil.
+    ' It was written to hopefully workaround the infamous menubutton which is a button 
+    ' that - when clicked - opens a menu. This feature is shaky and depends on 
+    ' a lot of factors. There is a simple working implemantation in t_menu.inc 
+    ' which has the drawback of being absolutely slow, costing the tools_customize
+    ' test a lot of time waiting for the control (30% of testtime spent waiting).
+    ' This approach tries to be dynamic: Machines that can do it the fast way
+    ' use it automatically, machines that are too slow get two retries with the 
+    ' slower approach.
+    ' The menubutton is one of the last remaining places where none of the
+    ' speed optmizations and enhancements apply, so neither WaitSlot() nor 
+    ' synchronous slot execution help here.
+
+    dim iClick as integer
+    dim bUseSlowMethod as boolean : bUseSlowMethod = false
+    
+    const CFN = "hOpenMenuButton: "
+    
+    hOpenMenuButton() = -1 ' this is the general failure returnvalue
+    
+    for iClick = 1 to 3
+    
+        if ( bUseSlowMethod ) then 
+            wait( 1000 )
+            oControl.OpenMenu()
+            wait( 3000 )
+        else
+            oControl.click()
+        endif
+            
+        try
+            hOpenMenuButton() = MenuGetItemCount
+            printlog( CFN & "Success on " & iClick & ". attempt" )
+            exit function
+        catch
+            qaerrorlog( CFN & "#i96753 - Failed to retrieve itemcount from Menu-/Command-button" )
+            bUseSlowMethod = true
+        endcatch
+        
+    next iClick
+    
+end function
+
+'*******************************************************************************
+
+function hClickCommandButton( iItemToClick as integer ) as boolean
+
+    const CFN = "hClickCommandButton::"
+    printlog( CFN & "Enter" )
+    
+    dim brc as boolean 'a multi purpose boolean returnvalue
+    dim iMenuItems as integer
+
+    iMenuItems = hOpenMenuButton( Command )
+    
+    ' exit on error
+    if ( iMenuItems < 0 ) then
+        warnlog( CFN & "Menu apparently not open, giving up." )
+    	hClickCommandButton() = false
+    	exit function
+    endif        
+    
+    hMenuSelectNr( iItemToClick ) 
+    wait( 500 )
+    ' check for the rename dialog (menu)
+    kontext "CustomizeMenuReName"
+    if ( CustomizeMenuReName.exists() ) then
+    	printlog( CFN & "Opened dialog: Rename Menu" )
+    	hClickCommandButton() = true
+    	exit function
+    endif
+    
+    ' check for the rename dialog (toolbar)    
+    kontext "CustomizeToolbarsRename"
+    if ( CustomizeToolbarsRename.exists() ) then
+    	printlog( CFN & "Opened dialog: Rename Toolbar" )
+    	hClickCommandButton() = true
+    	exit function
+    endif
+
+    printlog( CFN & "Exit" )
+    hClickCommandButton() = true
+
+end function
diff --git a/testautomation/framework/tools/includes/customize_tools.inc b/testautomation/framework/tools/includes/customize_tools.inc
index d072d74..8c0cbf8 100755
--- a/testautomation/framework/tools/includes/customize_tools.inc
+++ b/testautomation/framework/tools/includes/customize_tools.inc
@@ -316,24 +316,29 @@ function hDeselectSeparator() as integer
     const CFN = "hDeselectSeparator::"
     
     kontext "ToolsCustomizeToolbars"
-    iCurrentItem = ToolbarContents.getSelIndex()
-    cString = ToolbarContents.getSelText()
+    if ( ToolbarContents.getItemCount > 0 ) then
     
-    '///+<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
+        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
@@ -341,85 +346,5 @@ function hDeselectSeparator() as integer
     
 end function
 
-
 '*******************************************************************************
 
-function hClickCommandButton( iItemToClick as integer ) as boolean
-
-
-    '///<h3>Click a given entry on the command button</h3><br>
-
-    '///<u>Parameter(s):</u><br>
-    '///<ol>
-
-    '///+<li>Position of the item to click (Integer)</li>
-    '///<ul>
-    '///+<li>Only active items are selectable</li>
-    '///+<li>Position must be &gt; than 0 and &le; number of active items in menu</li>
-    '///+<li>Set context (kontext) before calling this function</li>
-    '///</ul>
-
-    '///</ol>
-
-
-    '///<u>Returns:</u><br>
-    '///<ol>
-    '///+<li>Success or failure (Boolean)</li>
-    '///<ul>
-    '///+<li>TRUE on success</li>
-    '///+<li>FALSE on failure or unknown status</li>
-    '///</ul>
-    '///</ol>
-
-    const CFN = "hClickCommandButton::"
-    printlog( CFN & "Enter" )
-    
-    dim brc as boolean 'a multi purpose boolean returnvalue
-    dim iMenuItems as integer
-
-    '///<u>Description:</u>
-    '///<ul>
-    '///+<li>Click the command button</li>
-    command.click()
-    
-    '///+<li>Verify that the menu is open</li>
-    try
-	    iMenuItems = hMenuItemGetCount()
-	catch
-		qaerrorlog( CFN & "Menu not open" )
-		hClickCommandButton() = false
-		exit function
-    endcatch
-    
-    '///+<li>Verify that the selected menuitem is valid</li>
-    printlog( CFN & "Found items: " & iMenuItems )
-    if ( iItemToClick > iMenuItems ) then
-    	warnlog( CFN & "#i90134# Selected item is not available: " & iItemToClick )
-		hClickCommandButton() = false
-		exit function
-    endif
-    
-    '///+<li>Now click on the requested item</li>
-    hMenuSelectNr( iItemToClick )
-    
-    '///+<li>Look for the Menu renaming dialog</li>
-    kontext "CustomizeMenuReName"
-    if ( CustomizeMenuReName.exists( 1 ) ) then
-    	printlog( CFN & "Opened dialog: Rename Menu" )
-    	hClickCommandButton() = true
-    	exit function
-    endif
-    
-    '///+<li>Look for the Toolbar renaming dialog</li>
-    kontext "CustomizeToolbarsRename"
-    if ( CustomizeToolbarsRename.exists() ) then
-    	printlog( CFN & "Opened dialog: Rename Toolbar" )
-    	hClickCommandButton() = true
-    	exit function
-    endif
-    '///</ul>
-
-    printlog( CFN & "Exit" )
-    hClickCommandButton() = true
-
-end function
diff --git a/testautomation/global/tools/includes/required/t_dir.inc b/testautomation/global/tools/includes/required/t_dir.inc
index ca88c6e..de9bcfd 100755
--- a/testautomation/global/tools/includes/required/t_dir.inc
+++ b/testautomation/global/tools/includes/required/t_dir.inc
@@ -180,23 +180,27 @@ function GetDirList ( sPath$, sMatch$ ,lsFile() as String ) as integer
     '/// Get Subdirectories from a directory and append them to a list (<b>with</b> path)
     '/// <u>Input</u>: Directory with complete path; Search Pattern, e.g *; List
     '/// <u>Return</u>: count of appended entries; updated list
-    Dim Count%
-    Dim i as Integer
-    Dim Verzeichnis as String
+    Dim iFolderCount as integer
+    Dim Folder as String
     ' at the end of the string has to be teh path seperator, else the dir-command doesn't work
     if right ( sPath$, 1 ) <> gPathSigne then sPath$ = sPath$ + gPathSigne
-    Verzeichnis = app.Dir( sPath$ + sMatch$ , 16)
-    Count% = 0
+    Folder = app.Dir( sPath$ + sMatch$ , 16)
+    iFolderCount = 0
 
-    do until Len(Verzeichnis) = 0
-        if Verzeichnis <> "." AND Verzeichnis <> ".." AND Lcase(Verzeichnis) <> ".svn" then
+    do until Len( Folder ) = 0
+        select case ( lcase( Folder ) )
+        case "."
+        case ".."
+        case ".svn"
+        case ".hg"
+        case default
             lsFile(0) = Val(lsFile(0)) + 1
-            lsFile( lsFile(0) ) = sPath$  + Verzeichnis + gPathSigne
-            Count% = Count% + 1
-        end if
-        Verzeichnis = app.Dir
+            lsFile( lsFile(0) ) = sPath$  + Folder + gPathSigne
+            iFolderCount = iFolderCount + 1
+        end select
+        Folder = app.Dir
     loop
-    GetDirList = Count%
+    GetDirList = iFolderCount
 end function
 '
 '-------------------------------------------------------------------------------


More information about the ooo-build-commit mailing list