diff options
author | obo <obo@openoffice.org> | 2010-06-18 16:25:03 +0200 |
---|---|---|
committer | obo <obo@openoffice.org> | 2010-06-18 16:25:03 +0200 |
commit | 86f6b528f49090c0c47df170c04ee857a14fb967 (patch) | |
tree | 9d584877469bd22a4e00053a253825ac848f5171 /testautomation/global | |
parent | e8d54724f09a68d8ffd99cd3c407401019b10437 (diff) | |
parent | a4d5cd0ecc4ae083865927c68dcdd1b7925b2995 (diff) |
CWS-TOOLING: integrate CWS vitomation01
Diffstat (limited to 'testautomation/global')
44 files changed, 2288 insertions, 6180 deletions
diff --git a/testautomation/global/input/accelerators.txt b/testautomation/global/input/accelerators.txt index cb518c9e3335..c46dc31f9dae 100755 --- a/testautomation/global/input/accelerators.txt +++ b/testautomation/global/input/accelerators.txt @@ -1,7 +1,7 @@ # This file contains a list of most commonly used accelerators. # These accelerators are language dependent -# Include framework/tools/inc/accels.inc and use hGetAccel( string ) -# to retrieve one specific accelerator, where string is one of the sections +# Include global/tools/includes/optional/t_accels.inc and use hGetAccel( <string> ) +# to retrieve one specific accelerator, where <string> is one of the sections # from this file. # mod1 = CTRL @@ -159,48 +159,3 @@ zh-CN=mod2 u zh-TW=mod2 u sl=mod2 i cs=mod2 a - - -# This is the accelerator that switches tabs in the BASIC IDE. I found it by accident -# and i'm not at all certain that it is documented somewhere. -[IDE_SWITCH_TAB+] -en-US=MOD1 PAGEUP -pt-PT=MOD1 PAGEUP -ru-RU=MOD1 PAGEUP -nl-NL=MOD1 PAGEUP -fr-FR=MOD1 PAGEUP -es=MOD1 PAGEUP -hu-HU=MOD1 PAGEUP -it=MOD1 PAGEUP -da-DK=MOD1 PAGEUP -sv=MOD1 PAGEUP -pl-PL=MOD1 PAGEUP -de=MOD1 PAGEUP -pt-BR=MOD1 PAGEUP -ja-JP=MOD1 PAGEUP -ko-KR=MOD1 PAGEUP -zh-CN=MOD1 PAGEUP -zh-TW=MOD1 PAGEUP -sl=MOD1 PAGEUP - -# This is the accelerator that switches tabs in the BASIC IDE. I found it by accident -# and i'm not at all certain that it is documented somewhere. -[IDE_SWITCH_TAB-] -en-US=MOD1 PAGEDOWN -pt-PT=MOD1 PAGEDOWN -ru-RU=MOD1 PAGEDOWN -nl-NL=MOD1 PAGEDOWN -fr-FR=MOD1 PAGEDOWN -es=MOD1 PAGEDOWN -hu-HU=MOD1 PAGEDOWN -it=MOD1 PAGEDOWN -da-DK=MOD1 PAGEDOWN -sv=MOD1 PAGEDOWN -pl-PL=MOD1 PAGEDOWN -de=MOD1 PAGEDOWN -pt-BR=MOD1 PAGEDOWN -ja-JP=MOD1 PAGEDOWN -ko-KR=MOD1 PAGEDOWN -zh-CN=MOD1 PAGEDOWN -zh-TW=MOD1 PAGEDOWN -sl=MOD1 PAGEDOWN diff --git a/testautomation/global/input/macros.txt b/testautomation/global/input/macros.txt index e0423fec3858..197b1b5ecebb 100755 --- a/testautomation/global/input/macros.txt +++ b/testautomation/global/input/macros.txt @@ -1,5 +1,5 @@ # This is a collection of BASIC macros that can cause Syntax errors, Exceptions, -# Runtime Errors. +# Runtime Errors. They are loaded in the test framework/optional/f_basic_issues.bas # ---------------------------------------------------------------------------- # @@ -39,7 +39,7 @@ end function '# TTMacro1: This is a short testscript for automated testing! sub main - print( "Hello" ) + print( "TTMacro1" ) end sub @@ -163,7 +163,7 @@ End Sub # ---------------------------------------------------------------------------- # [i86265] -' There should be no "Paramtheses do not match" warning +' There should be no "Parantheses do not match" warning OPTION EXPLICIT Public Const cMAX = 256 diff --git a/testautomation/global/input/officeinfo.txt b/testautomation/global/input/officeinfo.txt index 430e4141e3dd..966fba456718 100644 --- a/testautomation/global/input/officeinfo.txt +++ b/testautomation/global/input/officeinfo.txt @@ -1,5 +1,4 @@ [Current program versions] +Oracle Open Office=3.3 OpenOffice.org=3.3 BrOffice.org=3.3 -Oracle Open Office=3.3 - diff --git a/testautomation/global/required/includes/g_001.inc b/testautomation/global/required/includes/g_001.inc index 3d22b6b8a1df..07c294f44e2f 100644..100755 --- a/testautomation/global/required/includes/g_001.inc +++ b/testautomation/global/required/includes/g_001.inc @@ -50,73 +50,73 @@ testcase tFileExportAsPDF ' The file dialog has to come up Kontext "SpeichernDlg" if SpeichernDlg.exists(5) then - '/// the selected file type should be: 'PDF - Portable Document Format (.pdf)' ///' - sTemp = Dateityp.GetSelText - if (sTemp <> sPDF) then - Warnlog "filter for PDF export is missing :-( should: '" + sPDF + "'; is: '" + sTemp + "'" - endif - '///+ - set Textbox 'File name' to "abc" ///' - Dateiname.SetText "abc" - speichern.click - kontext - if active.exists(5) then - ' catch active about already existing file name - if active.getrt = 304 then - active.yes - endif - endif + '/// the selected file type should be: 'PDF - Portable Document Format (.pdf)' ///' + sTemp = Dateityp.GetSelText + if (sTemp <> sPDF) then + Warnlog "filter for PDF export is missing :-( should: '" + sPDF + "'; is: '" + sTemp + "'" + endif + '///+ - set Textbox 'File name' to "abc" ///' + Dateiname.SetText "abc" + speichern.click + kontext + if active.exists(5) then + ' catch active about already existing file name + if active.getrt = 304 then + active.yes + endif + endif else - ' changed with SRC680m210 - first options, then file dialog... - ' kept for testcase backwards compatibility - 'warnlog "Export dialog didn't come up." + ' changed with SRC680m210 - first options, then file dialog... + ' kept for testcase backwards compatibility + 'warnlog "Export dialog didn't come up." endif kontext '/// dialog 'PDF Options' comes up ///' if active.exists(5) then - '/// select the tab page 'General' ///' - active.setPage PDFOptions - kontext "PDFOptions" - if PDFOptions.exists(5) then - dialogTest(PDFOptions) - else - warnlog "Tab page 'PDF Options - General' isn't available." - endif + '/// select the tab page 'General' ///' + active.setPage PDFOptions + kontext "PDFOptions" + if PDFOptions.exists(5) then + dialogTest(PDFOptions) + else + warnlog "Tab page 'PDF Options - General' isn't available." + endif else - warnlog "Dialog 'PDF Options' didn't come up" + warnlog "Dialog 'PDF Options' didn't come up" endif kontext if active.exists(5) then - '/// select the tab page 'Initial View' ///' - active.setPage PDFOptionsInitialView - kontext "PDFOptionsInitialView" - if PDFOptionsInitialView.exists(5) then - dialogTest(PDFOptionsInitialView) - else - warnlog "Tab page 'PDF Options - Initial View' isn't available." - endif + '/// select the tab page 'Initial View' ///' + active.setPage PDFOptionsInitialView + kontext "PDFOptionsInitialView" + if PDFOptionsInitialView.exists(5) then + dialogTest(PDFOptionsInitialView) + else + warnlog "Tab page 'PDF Options - Initial View' isn't available." + endif endif kontext if active.exists(5) then - '/// select the tab page 'User Interface' ///' - active.setPage PDFOptionsUserInterface - kontext "PDFOptionsUserInterface" - if PDFOptionsUserInterface.exists(5) then - dialogTest(PDFOptionsUserInterface) - else - warnlog "Tab page 'PDF Options - User Interface' isn't available." - endif + '/// select the tab page 'User Interface' ///' + active.setPage PDFOptionsUserInterface + kontext "PDFOptionsUserInterface" + if PDFOptionsUserInterface.exists(5) then + dialogTest(PDFOptionsUserInterface) + else + warnlog "Tab page 'PDF Options - User Interface' isn't available." + endif endif kontext if active.exists(5) then - '/// select the tab page 'General' ///' - active.setPage PDFOptions - kontext "PDFOptions" - '/// close the dialog with 'Cancel' ///' - if PDFOptions.exists(5) then - PDFOptions.cancel - else - warnlog "Tab page 'PDF Options - General' isn't available." - endif + '/// select the tab page 'General' ///' + active.setPage PDFOptions + kontext "PDFOptions" + '/// close the dialog with 'Cancel' ///' + if PDFOptions.exists(5) then + PDFOptions.cancel + else + warnlog "Tab page 'PDF Options - General' isn't available." + endif endif '/// close application ///' Call hCloseDocument @@ -125,24 +125,24 @@ endcase '------------------------------------------------------------------------------- ' testcase tExportAsPDFButton - Dim sTemp as string + Dim sTemp as string '/// Create new document Call hNewDocument - '/// Click the button 'Export Directly as PDF' on the standard toolbar. - Kontext "Standardbar" - ExportAsPDF.click - '/// The 'Export as PDF' dialog has to come up, with the only 'File type' 'PDF - Portable Document Format' - Kontext "SpeichernDlg" - if SpeichernDlg.exists(1) then - sTemp = Dateityp.GetSelText - if InStr(sTemp, "PDF") = 0 then - warnlog "Filter for PDF export seems to be wrong or is missing in selection." - endif - '/// Leave dialog with CANCEL button - SpeichernDlg.Cancel - else - warnlog "SaveAsPDF dialog did not come up." + '/// Click the button 'Export Directly as PDF' on the standard toolbar. + Kontext "Standardbar" + ExportAsPDF.click + '/// The 'Export as PDF' dialog has to come up, with the only 'File type' 'PDF - Portable Document Format' + Kontext "SpeichernDlg" + if SpeichernDlg.exists(1) then + sTemp = Dateityp.GetSelText + if InStr(sTemp, "PDF") = 0 then + warnlog "Filter for PDF export seems to be wrong or is missing in selection." endif + '/// Leave dialog with CANCEL button + SpeichernDlg.Cancel + else + warnlog "SaveAsPDF dialog did not come up." + endif '/// Close spreadsheet document. Call hCloseDocument endcase diff --git a/testautomation/global/required/includes/g_009.inc b/testautomation/global/required/includes/g_009.inc index 1e6372bbdb7f..17b31cf3fd08 100644..100755 --- a/testautomation/global/required/includes/g_009.inc +++ b/testautomation/global/required/includes/g_009.inc @@ -43,10 +43,10 @@ testcase tHelpCheckForUpdates dim bOnceAgain as boolean dim sProxyFile as string dim iOldProxy as integer - + bProxy = FALSE bOnceAgain = TRUE - + '/// open application ///' Call hNewDocument @@ -56,7 +56,7 @@ testcase tHelpCheckForUpdates sIniFile = convertPath(gNetzOfficePath+"program\version.ini") endif sTemp = GetIniValue (sIniFile, "Version", "UpdateURL") - if (sTemp <> "" AND NOT gOOO) then + if (sTemp <> "" AND NOT gOOO) then '/// choose Help -> Check for Updates... ///' while (bOnceAgain) if bProxy AND bOnceAgain then @@ -70,14 +70,14 @@ testcase tHelpCheckForUpdates printlog "This could be a (patched) installation on Solaris Sparc/Intel or OOo - No Online Update Feature available." hCloseDocument else - warnlog "Help->Check for Updates failed" - hCloseDocument + warnlog "Help->Check for Updates failed" + hCloseDocument endif goto endsub endcatch ' The dialog has to come up: 'Check for Updates' Kontext "CheckForUpdates" -' if CheckForUpdates.exists(10) then ' id not in build for dialog workaround: ' not working due to i 80859 + ' if CheckForUpdates.exists(10) then ' id not in build for dialog workaround: ' not working due to i 80859 if Status.exists(10) then if sTemp <> "" then printlog "'Check for Updates' came up" @@ -103,25 +103,25 @@ testcase tHelpCheckForUpdates bOnceAgain = FALSE Kontext "CheckForUpdates" try - CheckForUpdates.cancel + CheckForUpdates.cancel catch - 'cancel button is no more availabale - printlog "cancel wasnt possible" - try - 'CheckForUpdates.close - ' close method doesn't work - printlog "1:"+status.gettext - printlog "2:"+description.gettext - closebtn.click - catch - printlog "close wasnt possible" - ' last fallback - 'printlog resetapplication - 'hNewDocument - printlog "1:"+status.gettext - printlog "2:"+description.gettext - cancel.click - endcatch + 'cancel button is no more availabale + printlog "cancel wasnt possible" + try + 'CheckForUpdates.close + ' close method doesn't work + printlog "1:"+status.gettext + printlog "2:"+description.gettext + closebtn.click + catch + printlog "close wasnt possible" + ' last fallback + 'printlog resetapplication + 'hNewDocument + printlog "1:"+status.gettext + printlog "2:"+description.gettext + cancel.click + endcatch endcatch endif else @@ -167,7 +167,7 @@ testcase tHelpCheckForUpdates bOnceAgain = FALSE endif endif - bOnceAgain = FALSE + bOnceAgain = FALSE wend else qaErrorlog "Test disabled, because it is OOo build and UpdateURL is empty and calling the slot would succeed" diff --git a/testautomation/global/required/includes/g_numberformatter1.inc b/testautomation/global/required/includes/g_numberformatter1.inc index 6eb8191c4367..2271bc333142 100644..100755 --- a/testautomation/global/required/includes/g_numberformatter1.inc +++ b/testautomation/global/required/includes/g_numberformatter1.inc @@ -29,16 +29,6 @@ '* '* short description : update and resouce test for numberformatter '* -'************************************************************************ -'* -'#1 tNumberformatterGetLanguage -'#1 sNumberformatterPreconditions -'#1 sNumberformatterOpenDialog -'#1 tNumberformatterPre -'#1 tNumberformatter -'#1 tUserDefinedNumberformatter -'#1 tButtonsNumberformatter -'* '\*********************************************************************** '///Setting Variables.. diff --git a/testautomation/global/system/includes/gvariabl.inc b/testautomation/global/system/includes/gvariabl.inc index 562cde3a216e..eff969fbee2c 100755 --- a/testautomation/global/system/includes/gvariabl.inc +++ b/testautomation/global/system/includes/gvariabl.inc @@ -174,6 +174,9 @@ Global gOOoImprovementIsEnabled as boolean '///* Performance flags Global GLOBAL_USE_NEW_SLEEP as boolean ' keep the old sleep() behavior +'///* If set to TRUE in master.inc many functions become more talkative +Global GVERBOSE as boolean + sub OnlyForDocuGVariables '///<b>System for the installed Office</b> '///<i>gPlatform</i>: Operatingsystem (internal shortkey) diff --git a/testautomation/global/system/includes/iniinfo.inc b/testautomation/global/system/includes/iniinfo.inc index 8a2807269152..552102588405 100755 --- a/testautomation/global/system/includes/iniinfo.inc +++ b/testautomation/global/system/includes/iniinfo.inc @@ -47,7 +47,7 @@ sub GetIniInformation dim bOOo(3) as string dim iSoffice(3) as integer dim sTemp as string - + gPathSigne = hGetPathSigne(gPLatform) gTTProfileName = hfGetTTProfileName() @@ -61,10 +61,10 @@ sub GetIniInformation gOfficePath = GetIniValue ( gTesttoolIni, "Office IniPath", "Current" ) + gPathSigne gRemotePath = GetIniValue ( gTesttoolIni, "RemoteBaseDir", "Current" ) + gPathSigne else - '/// The part of getting the location of the executable OOo is put into seperated functions. - '/// The first OOo executeable is being used. - '///+ <ol><li>Entry in TestTool control file (.testtoolrc on UNIX; testtool.ini on Win32)</li> - '///+ <li>or<ul><li><b>Win32</b>: Entry in registry</li><li><b>UNIX</b>: If link <pre>/usr/bin/soffice</pre> or <pre>$HOME/soffice</pre> exists</li></ul></li></ol> + '/// The part of getting the location of the executable OOo is put into seperated functions. + '/// The first OOo executeable is being used. + '///+ <ol><li>Entry in TestTool control file (.testtoolrc on UNIX; testtool.ini on Win32)</li> + '///+ <li>or<ul><li><b>Win32</b>: Entry in registry</li><li><b>UNIX</b>: If link <pre>/usr/bin/soffice</pre> or <pre>$HOME/soffice</pre> exists</li></ul></li></ol> sSoffice(0) = getSofficeTesttool() : bOOO(0) = gOOO ' DEBUG: If you need more detailed information about the installation environment ' enable the next line. @@ -73,47 +73,47 @@ sub GetIniInformation sSoffice(0) = getSofficeNative() : bOOO(0) = gOOO if (sSoffice(0) <> "") then gOfficePath = sSoffice(0) - gVersionsnummer = FindBuildID() + gVersionsnummer = FindBuildID() call hSetBuildVersionInformation(TRUE) iSoffice(0) = gBuild end if ' DEBUG: If you need more detailed information about the installation environment - ' enable the next line. + ' enable the next line. ' printlog "RESULT from Native : '" + sSoffice(0) + "' - OOo? " + bOOO(0) + " - BuildID: " + iSoffice(0) if sSoffice(0) = "" then warnlog "No OOo version found on this computer. - Please look into documentation, how to select an OOo version to test." end if else - printlog "----------------------------------------------------------------------------------------------------" - printlog "** Using [OOoProgramDir] value : " & sSoffice(0) + printlog "----------------------------------------------------------------------------------------------------" + printlog "** Using [OOoProgramDir] value : " & sSoffice(0) printlog "----------------------------------------------------------------------------------------------------" end if gOfficePath = sSoffice(0) gOOO = bOOO(0) end if - if ((gSamePC = TRUE) AND (gOfficePath = "")) then + if ((gSamePC = TRUE) AND (gOfficePath = "")) then MsgBox ("The test ends, because no OOo version was found on this computer. - Please look into documentation, how to select an OOo version to test.", 1, "No OOo program installed") end - end if + end if - gtHidLstPath = GetIniValue ( gTesttoolIni, gTTProfileName, "HIDDir" ) + hGetPathSigne(gtPlatform) - gPort = GetIniValue ( gTesttoolIni, "Communication", "TTPort" ) - '-------- - gPCName = GetIniValue ( gTesttoolIni, "Others", "PCname" ) - if (gPCName = "NOT_SET!" OR gPCName = "") then - gPCName = environ ( "HOSTNAME" ) - if (gPCName = "") then - gPCName = environ ( "COMPUTERNAME" ) - if (gPCName = "") then - gPCName = environ ( "hostname" ) - ' If testtool.ini/rc is unmodified, the default value is NOT_SET! - if gPCName = "" then - qaErrorLog "Please insert the computername in section [Others] on the line 'PCname=' in the TestTool confguration file at: '" + gTesttoolIni + "'" - end if - end if - end if - end if - '-------- + gtHidLstPath = GetIniValue ( gTesttoolIni, gTTProfileName, "HIDDir" ) + hGetPathSigne(gtPlatform) + gPort = GetIniValue ( gTesttoolIni, "Communication", "TTPort" ) + '-------- + gPCName = GetIniValue ( gTesttoolIni, "Others", "PCname" ) + if (gPCName = "NOT_SET!" OR gPCName = "") then + gPCName = environ ( "HOSTNAME" ) + if (gPCName = "") then + gPCName = environ ( "COMPUTERNAME" ) + if (gPCName = "") then + gPCName = environ ( "hostname" ) + ' If testtool.ini/rc is unmodified, the default value is NOT_SET! + if gPCName = "" then + qaErrorLog "Please insert the computername in section [Others] on the line 'PCname=' in the TestTool confguration file at: '" + gTesttoolIni + "'" + end if + end if + end if + end if + '-------- call GetTheInstallationType ' gNetzInst and gNetzOfficePath will be set if StarOffice is a Network-Installation gOfficeBasisPath = getOfficeBasisPath() @@ -135,13 +135,13 @@ end sub '------------------------------------------------------------------------- sub GetOfficeInformation -'/// Generates the path to the StarOffice executable. -'/// <u>Output</u>: <b>sAppExe</b> variable is the StarOffice executable or the client executable (StarOffice server, StarPortal™, Sun™ ONE Webtop, ...) + '/// Generates the path to the StarOffice executable. + '/// <u>Output</u>: <b>sAppExe</b> variable is the StarOffice executable or the client executable (StarOffice server, StarPortal™, Sun™ ONE Webtop, ...) Dim sProgramNeu as String Dim iClient as Integer Dim sPlatformProgramPath as string - Dim sPlatformBinExt as string - + Dim sPlatformBinExt as string + if ( lcase( gPlatform ) = "osx" ) then sPlatformProgramPath = "MacOS" sPlatformBinExt = "" @@ -153,154 +153,128 @@ sub GetOfficeInformation sPlatformBinExt = "" end if end if - - 'if it's a client on the same PC - if gClient = TRUE AND gClientUser <> "" then - if gtPlatform <> "w95" AND gtPlatform <> "wnt" AND gPlatform <> "w2k" AND gtPlatform <> "os2" AND gtPlatform <> "os4" then + + 'if it's a client on the same PC + if gClient = TRUE AND gClientUser <> "" then + if gtPlatform <> "w95" AND gtPlatform <> "wnt" AND gPlatform <> "w2k" AND gtPlatform <> "os2" AND gtPlatform <> "os4" then sAppExe = gsClient + "/bin/sclient" - else + else if right( lcase ( sAppExe ), 3 ) <> "exe" then sAppExe = gsClient + "\sclient.exe" - end if - sAppParameter = " -remote -connect=portal,service=soffice,host=" + gHost + ",port=8208,user=" + gClientUser + ",password=" + gClientUserPWD + ",type=compressed_secure" - else - if gNetzInst = TRUE then ' wenn es sich um eine Netzwerkinstallation handelt - select case UCase(gApplication) - case "WRITER" : sAppExe = gNetzOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt - sFactory = "-writer" - case "CALC" : sAppExe = gNetzOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt - sFactory = "-calc" - case "IMPRESS" : sAppExe = gNetzOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt - sFactory = "private:factory/simpress" - case "DRAW" : sAppExe = gNetzOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt - sFactory = "-draw" - case "MASTERDOCUMENT": sAppExe = gNetzOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt - sFactory = "-global" - case "MATH" : sAppExe = gNetzOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt - sFactory = "-math" - case "HTML" : sAppExe = gNetzOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt - sFactory = "-web" - case else : sAppExe = gNetzOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt - end select - 'If it's a normal (FAT) office - else + end if + sAppParameter = " -remote -connect=portal,service=soffice,host=" + gHost + ",port=8208,user=" + gClientUser + ",password=" + gClientUserPWD + ",type=compressed_secure" + else + if gNetzInst = TRUE then ' wenn es sich um eine Netzwerkinstallation handelt + select case UCase(gApplication) + case "WRITER" : sAppExe = gNetzOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt + sFactory = "-writer" + case "CALC" : sAppExe = gNetzOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt + sFactory = "-calc" + case "IMPRESS" : sAppExe = gNetzOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt + sFactory = "private:factory/simpress" + case "DRAW" : sAppExe = gNetzOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt + sFactory = "-draw" + case "MASTERDOCUMENT": sAppExe = gNetzOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt + sFactory = "-global" + case "MATH" : sAppExe = gNetzOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt + sFactory = "-math" + case "HTML" : sAppExe = gNetzOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt + sFactory = "-web" + case else : sAppExe = gNetzOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt + end select + 'If it's a normal (FAT) office + else 'If it's a RVP-Office if gClient = TRUE then - if gPlatgroup <> "unx" then - sAppExe = gOfficePath + "client\sclient.exe" - else - sAppExe = gOfficePath + "client/sclient" - end if + if gPlatgroup <> "unx" then + sAppExe = gOfficePath + "client\sclient.exe" + else + sAppExe = gOfficePath + "client/sclient" + end if else - select case UCase(gApplication) - case "WRITER" : sAppExe = gOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt - sFactory = "-writer" - case "CALC" : sAppExe = gOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt - sFactory = "-calc" - case "IMPRESS" : sAppExe = gOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt - sFactory = "private:factory/simpress" - case "DRAW" : sAppExe = gOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt - sFactory = "-draw" - case "MASTERDOCUMENT": sAppExe = gOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt - sFactory = "-global" - case "MATH" : sAppExe = gOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt - sFactory = "-math" - case "HTML" : sAppExe = gOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt - sFactory = "-web" - case else : sAppExe = gOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt - end select + select case ( gApplication ) + case "WRITER" : sAppExe = gOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt + sFactory = "-writer" + case "CALC" : sAppExe = gOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt + sFactory = "-calc" + case "IMPRESS" : sAppExe = gOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt + sFactory = "private:factory/simpress" + case "DRAW" : sAppExe = gOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt + sFactory = "-draw" + case "MASTERDOCUMENT": sAppExe = gOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt + sFactory = "-global" + case "MATH" : sAppExe = gOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt + sFactory = "-math" + case "HTML" : sAppExe = gOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt + sFactory = "-web" + case else : sAppExe = gOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt + end select end if - end if - end if + end if + end if end sub '------------------------------------------------------------------------- function hGetPathSigne(sPlatform as string) as string -'/// Seperators for the different platforms. -'/// <u>Input</u>: string of class gPlatform -'/// <u>Output</u>: string which can be used as seperator in directories + '/// Seperators for the different platforms. + '/// <u>Input</u>: string of class gPlatform + '/// <u>Output</u>: string which can be used as seperator in directories select case sPlatform - case "w95" : hGetPathSigne = "\" - case "w98" : hGetPathSigne = "\" - case "wnt" : hGetPathSigne = "\" - case "wme" : hGetPathSigne = "\" - case "wse" : hGetPathSigne = "\" - case "w2k" : hGetPathSigne = "\" - case "wxp" : hGetPathSigne = "\" - case "ecs" : hGetPathSigne = "\" - case "os4" : hGetPathSigne = "\" - case "os5" : hGetPathSigne = "\" - case "osx" : hGetPathSigne = "/" - case "ppc" : hGetPathSigne = "/" - case "sol" : hGetPathSigne = "/" - case "lin" : hGetPathSigne = "/" - case "x86" : hGetPathSigne = "/" - case "fbsd": hGetPathSigne = "/" - case "nbsd": hGetPathSigne = "/" - case "lin64": hGetPathSigne= "/" - case "linsparc": hGetPathSigne = "/" - case else : hGetPathSigne = "" - qaErrorLog " No pathseperator is defined for this platform : " + sPlatform + case "w95" : hGetPathSigne = "\" + case "w98" : hGetPathSigne = "\" + case "wnt" : hGetPathSigne = "\" + case "wme" : hGetPathSigne = "\" + case "wse" : hGetPathSigne = "\" + case "w2k" : hGetPathSigne = "\" + case "wxp" : hGetPathSigne = "\" + case "ecs" : hGetPathSigne = "\" + case "os4" : hGetPathSigne = "\" + case "os5" : hGetPathSigne = "\" + case "osx" : hGetPathSigne = "/" + case "ppc" : hGetPathSigne = "/" + case "sol" : hGetPathSigne = "/" + case "lin" : hGetPathSigne = "/" + case "x86" : hGetPathSigne = "/" + case "fbsd": hGetPathSigne = "/" + case "nbsd": hGetPathSigne = "/" + case "lin64": hGetPathSigne= "/" + case "linsparc": hGetPathSigne = "/" + case else : hGetPathSigne = "" + qaErrorLog " No pathseperator is defined for this platform : " + sPlatform end select end function '------------------------------------------------------------------------- -function ConvertPath ( sDatei$, optional sPlatform as string ) as String -'/// Path conversion -'/// <u>Input</u>: path as string; OPTIONAL: string of class gPlatform -'/// <u>Output</u>: converted path respected to gPlatform; if optional paramter: to that Platform -'/// Convert the <i>pathsigne</i> '\' to '/' when a test runs under UNIX - Dim iW32 as Integer : Dim iUNX as Integer - Dim i as Integer : Dim Ende as Integer - Dim s1$ : Dim s2$ : Dim s3$ - dim sLocalPlatGroup as string - dim sLocalPathSigne as string - - if (isMissing(sPlatform)) then - sLocalPlatGroup = gPlatGroup - sLocalPathSigne = gPathSigne - else - sLocalPlatGroup = hPlatformToGroup(sPlatform) - sLocalPathSigne = hGetPathSigne(sPlatform) - end if +function ConvertPath( sPath as string ) as string - s3$ = "" : iW32 = 0 : iUNX = 0 - s1$ = sDatei$ - Ende = len ( s1$ ) - -' convert all / to \ if WIN - if sLocalPlatGroup <> "unx" then - do - i = InStr( s1$, "/" ) - if i = 0 then exit do - s2$ = Left( s1$ , i-1 ) - s1$ = Mid( s1$ , i+1 ) - s3$ = s3$ + s2$ + "\" - loop until s1$="" - s1$ = s3$ + s1$ - s3$ = "" : s2$ = "" - end if + if ( getPathSeparator = "/" ) then + ConvertPath() = hStringReplaceChar( sPath, "\", "/" ) + else + ConvertPath() = hStringReplaceChar( sPath, "/", "\" ) + endif + +end function + +'------------------------------------------------------------------------------- - ' convert all \ to gPathSigne => WIN -> XXX - do - i = InStr( s1$, "\" ) - if i = 0 then exit do - s2$ = Left( s1$ , i-1 ) - s1$ = Mid( s1$ , i+1 ) - s3$ = s3$ + s2$ + sLocalPathSigne - loop until s1$="" +function hStringReplaceChar( byval myString as string, old_char as string, new_char as string ) as string + + dim iChar as integer + for iChar = 1 to len( myString ) + if ( mid( myString, iChar, 1 ) = old_char ) then mid( myString, iChar, 1, new_char ) + next iChar + hStringReplaceChar() = myString - ConvertPath = s3$ + s1$ end function -'------------------------------------------------------------------------- +'------------------------------------------------------------------------------- sub GetLanguageInformation -'/// Extracts the language information from <i>Setup.xcu</i>. -'/// <u>note</u>: It uses the <b>fgetL10Nvalue</b>. - Dim sLanOutIni as string + '/// Extracts the language information from <i>Setup.xcu</i>. + '/// <u>note</u>: It uses the <b>fgetL10Nvalue</b>. + Dim sLanOutIni as string ' function 'fgetL10Nvalue' is also in this library sLanOutIni = fgetL10Nvalue() @@ -310,11 +284,11 @@ sub GetLanguageInformation warnlog "=> default is now 01 = en_US" end if - 'language Code ISO 639 (and ISO 3166 for en language) is now gLangCode - 'ISO 639 http://www.oasis-open.org/cover/iso639a.html - 'ISO 3166: http://xml.coverpages.org/country3166.html + 'language Code ISO 639 (and ISO 3166 for en language) is now gLangCode + 'ISO 639 http://www.oasis-open.org/cover/iso639a.html + 'ISO 3166: http://xml.coverpages.org/country3166.html - gISOLang = sLanOutIni + gISOLang = sLanOutIni select case lcase ( sLanOutIni ) case "en_us", "en-us", "en" : iSprache = 01 ' English (USA) @@ -380,7 +354,7 @@ end sub '------------------------------------------------------------------------- function ConvertLanguage ( Sprache as String ) as Integer -'/// Sets international language code for the whole language name. + '/// Sets international language code for the whole language name. select case lCase ( Sprache ) case "deutsch", "german" : ConvertLanguage = 49 @@ -514,7 +488,7 @@ end function '------------------------------------------------------------------------- function ConvertCodeToLanguage ( sSprache as String ) as Integer -'/// Converts the old language code to international language code + '/// Converts the old language code to international language code select case lCase ( sSprache ) case "1033" : ConvertCodeToLanguage = 01 ' English (USA) @@ -569,18 +543,18 @@ sub GetTheInstallationType dim aTemp3 dim i,x as integer dim sPlatformProgramPath as string - + if ( lcase( gPlatform ) = "osx" ) then - sPlatformProgramPath = "MacOS" + sPlatformProgramPath = "MacOS" else - sPlatformProgramPath = "program" + sPlatformProgramPath = "program" endif - + if gSamePC = TRUE then gNetzInst = TRUE gNetzOfficePath = gOfficePath if (gSamePC = TRUE) then - if gPlatgroup = "unx" then + if gPlatgroup = "unx" then sTemp = GetIniValue (gOfficePath & sPlatformProgramPath & "/bootstraprc", "Bootstrap", "UserInstallation") else sTemp = GetIniValue (gOfficePath & sPlatformProgramPath & "\bootstrap.ini", "Bootstrap", "UserInstallation") @@ -599,8 +573,8 @@ sub GetTheInstallationType gOfficePath = sURL + gPathSigne else if inStr(sURL,"$BRAND_BASE_DIR") > 0 then - gOfficePath = gOfficePath & right(sURL, len(sURL) - (inStr(sURL,"$BRAND_BASE_DIR")+len("$BRAND_BASE_DIR"))) - else + gOfficePath = gOfficePath & right(sURL, len(sURL) - (inStr(sURL,"$BRAND_BASE_DIR")+len("$BRAND_BASE_DIR"))) + else qaErrorLog "ininfo.inc::GetTheInstallationType:: Unexpected entry in bootstrap file.(Entry UserInstallation not starting with: $SYSUSERCONFIG or $ORIGIN or file://; Using entry as absolute path!)" printlog "ininfo.inc::GetTheInstallationType:: original UserInstallation entry from 'bootstrap' file: '" + sTemp + "'" printlog "ininfo.inc::GetTheInstallationType:: using now converted from URL for 'gOfficePath': '" + sURL + "'" @@ -614,7 +588,7 @@ sub GetTheInstallationType ' to support some developer bootstraprc/ini's: gOfficePath = fRelativeToAbsolutePath(gOfficePath) gOfficePath = fRemoveDoubleCharacter(gOfficePath + gPathSigne, gPathSigne) - else + else gNetzInst = GetIniValue ( gTesttoolIni, "Network", "Net" ) gNetzOfficePath = GetIniValue ( gTesttoolIni, "Network", "Current" ) if Right ( gNetzOfficePath,1 ) <> gPathSigne then gNetzOfficePath = gNetzOfficePath + gPathSigne @@ -624,8 +598,8 @@ end sub '------------------------------------------------------------------------- function ReplaceCharacter(stringToChange$, charToReplace$, replaceWith$) As String -'/// Replaces a specified character in a string with another character that you specify -'///+ INPUT: <string> , <which characterto replace> , <which caracter the old one should be replaced> + '/// Replaces a specified character in a string with another character that you specify + '///+ INPUT: <string> , <which characterto replace> , <which caracter the old one should be replaced> Dim ln, n As Long Dim NextLetter As String Dim FinalString As String @@ -660,36 +634,32 @@ function fgetL10Nvalue() as string dim args(0) as new com.sun.star.beans.NamedValue args(0).Name = "nodepath" args(0).Value = "/org.openoffice.Setup/L10N" - fgetL10Nvalue = hGetUNOService()._ - createInstance("com.sun.star.configuration.DefaultProvider")._ - createInstanceWithArguments(_ - "com.sun.star.configuration.ConfigurationAccess", args())._ - getByName("ooLocale") + fgetL10Nvalue = hGetUNOService().createInstance("com.sun.star.configuration.DefaultProvider").createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", args()).getByName("ooLocale") end function '------------------------------------------------------------------------- function hPlatformToGroup(sPLatform as string) as string -'/// <u>Input</u>: string of class gPlatform -'/// <u>Output</u>: string of class gPlatGroup + '/// <u>Input</u>: string of class gPlatform + '/// <u>Output</u>: string of class gPlatGroup select case sPLatform - case "w95":hPlatformToGroup = "w95" - case "w98":hPlatformToGroup = "w95" - case "wse":hPlatformToGroup = "w95" - case "wme":hPlatformToGroup = "w95" - case "wnt":hPlatformToGroup = "w95" - case "w2k":hPlatformToGroup = "w95" - case "wxp":hPlatformToGroup = "w95" - case "mac":hPlatformToGroup = "mac" - case "ppc":hPlatformToGroup = "unx" - case "sol":hPlatformToGroup = "unx" - case "x86":hPlatformToGroup = "unx" - case "lin":hPlatformToGroup = "unx" - case "fbsd":hPlatformToGroup= "unx" - case "nbsd":hPlatformToGroup= "unx" - case "lin64":hPlatformToGroup= "unx" - case "linsparc":hPlatformToGroup = "unx" - case "ecs":hPlatformToGroup = "ecs" + case "w95":hPlatformToGroup = "w95" + case "w98":hPlatformToGroup = "w95" + case "wse":hPlatformToGroup = "w95" + case "wme":hPlatformToGroup = "w95" + case "wnt":hPlatformToGroup = "w95" + case "w2k":hPlatformToGroup = "w95" + case "wxp":hPlatformToGroup = "w95" + case "mac":hPlatformToGroup = "mac" + case "ppc":hPlatformToGroup = "unx" + case "sol":hPlatformToGroup = "unx" + case "x86":hPlatformToGroup = "unx" + case "lin":hPlatformToGroup = "unx" + case "fbsd":hPlatformToGroup= "unx" + case "nbsd":hPlatformToGroup= "unx" + case "lin64":hPlatformToGroup= "unx" + case "linsparc":hPlatformToGroup = "unx" + case "ecs":hPlatformToGroup = "ecs" end select end function @@ -699,72 +669,69 @@ sub sGetCrashreporterValues as boolean '/// This routine reads the values of the [Crashreporter] section '///+ in the TestTool control file (testtool.ini / .testtoolrc). '///It returns FALSE if one of the required - '///+ information is missing in testtool.ini. - + '///+ information is missing in testtool.ini. + sGetCrashreporterValues = FALSE '/// <i>gUseProxy</i> should be TRUE if you need a proxy or FALSE - '///+ if you have a direct connection to the (inter)net. - gUseProxy = GetIniValue ( gTesttoolIni, "Crashreporter" , "UseProxy" ) + '///+ if you have a direct connection to the (inter)net. + gUseProxy = GetIniValue ( gTesttoolIni, "Crashreporter" , "UseProxy" ) 'If there's no value (=no entries at all...) exit the routine. 'sGetCrashreporterValues = FALSE so the routine in master.inc 'will stop testing. - if gUseProxy = "" then + if gUseProxy = "" then exit sub else 'Making a boolean value from it. - gUseProxy = cBool(gUseProxy) + gUseProxy = cBool(gUseProxy) '/// <i>gConnectiontype</i> has the value DIRECT or MANUALPROXY in dependency '///+ of <i>gUseProxy</i>. If <i>gUseProxy</i> = TRUE then the value of '///+ <i>gConnectiontype</i> is MANUALPROXY otherwiese DIRECT. - if gUseProxy = FALSE then - gConnectionType = "DIRECT" + if gUseProxy = FALSE then + gConnectionType = "DIRECT" sGetCrashreporterValues = TRUE - else + else gConnectionType = "MANUALPROXY" end if - - if gUseProxy then - '/// <i>gProxyServer</i> should be the proxy server which is needed to send - '///+ the crashreporter data via the net. - gProxyServer = GetIniValue ( gTesttoolIni, "Crashreporter" , "ProxyServer" ) - 'Verifying that a proxy server has been entered if - 'gUseProxy has been set to TRUE. - if gUseProxy = TRUE AND gProxyServer = "" then - warnlog "qatesttool::global::system::inc::iniinfo.inc::sGetCrashReporterValue: " _ - & "In the [Crashreporter]-section of TestTool control file 'UseProxy=true' but 'ProxyServer=' (empty). Please correct it!" - sGetCrashreporterValues = FALSE - else - sGetCrashreporterValues = TRUE - end if - - '/// <i>gProxyPort</i> should be the proxy server port which is needed to send - '///+ the crashreporter data via the net. - gProxyPort = GetIniValue ( gTesttoolIni, "Crashreporter" , "ProxyPort" ) - 'Verifying that a proxy server port has been entered if - 'gUseProxy has been set to TRUE. - if gUseProxy = TRUE AND gProxyPort = "" then - sGetCrashreporterValues = FALSE - warnlog "qatesttool::global::system::inc::iniinfo.inc::sGetCrashReporterValue: " _ - & "In the [Crashreporter]-section of TestTool control file 'UseProxy=true' but 'ProxyPort=' (empty). Please correct it!" - end if - else - ' to workaround issue i94779 set server and port to empty in case of direkt access - gProxyServer = "" - gProxyPort = "" - endif - + + if gUseProxy then + '/// <i>gProxyServer</i> should be the proxy server which is needed to send + '///+ the crashreporter data via the net. + gProxyServer = GetIniValue ( gTesttoolIni, "Crashreporter" , "ProxyServer" ) + 'Verifying that a proxy server has been entered if + 'gUseProxy has been set to TRUE. + if gUseProxy = TRUE AND gProxyServer = "" then + warnlog "qatesttool::global::system::inc::iniinfo.inc::sGetCrashReporterValue: " & "In the [Crashreporter]-section of TestTool control file 'UseProxy=true' but 'ProxyServer=' (empty). Please correct it!" + sGetCrashreporterValues = FALSE + else + sGetCrashreporterValues = TRUE + end if + + '/// <i>gProxyPort</i> should be the proxy server port which is needed to send + '///+ the crashreporter data via the net. + gProxyPort = GetIniValue ( gTesttoolIni, "Crashreporter" , "ProxyPort" ) + 'Verifying that a proxy server port has been entered if + 'gUseProxy has been set to TRUE. + if gUseProxy = TRUE AND gProxyPort = "" then + sGetCrashreporterValues = FALSE + warnlog "qatesttool::global::system::inc::iniinfo.inc::sGetCrashReporterValue: " & "In the [Crashreporter]-section of TestTool control file 'UseProxy=true' but 'ProxyPort=' (empty). Please correct it!" + end if + else + ' to workaround issue i94779 set server and port to empty in case of direkt access + gProxyServer = "" + gProxyPort = "" + endif + '/// <i>gAllowContact</i> should be TRUE or FALSE gAllowContact = GetIniValue ( gTesttoolIni, "Crashreporter" , "AllowContact" ) gAllowContact = cBool(gAllowContact) - - '/// <i>gReturnAddress</i> should be the E-Mail address which can be used - '///+ to contact the user who has run the test scripts for additional information . + + '/// <i>gReturnAddress</i> should be the E-Mail address which can be used + '///+ to contact the user who has run the test scripts for additional information . gReturnAddress = GetIniValue ( gTesttoolIni, "Crashreporter" , "ReturnAddress" ) 'Verifying that a mail address has been entered if 'gAllowContact has been set to TRUE. if gAllowContact = TRUE AND gReturnAddress = "" then - warnlog "qatesttool::global::system::inc::iniinfo.inc::sGetCrashReporterValue: " _ - & "In the [Crashreporter]-section of TestTool control file 'AllowContact=true' but 'ReturnAddress=' (empty). Please correct it!" + warnlog "qatesttool::global::system::inc::iniinfo.inc::sGetCrashReporterValue: " & "In the [Crashreporter]-section of TestTool control file 'AllowContact=true' but 'ReturnAddress=' (empty). Please correct it!" sGetCrashreporterValues = FALSE end if end if @@ -800,7 +767,7 @@ function getSofficeNative() as string dim bError as boolean bError = false - + '/// separated handling between Linux/Unix and Win32 platforms ///' if ("unx" = gPlatGroup) then '/// on Linux/Unix systems we need to check/resolv 2 possible links which point to the directory with the 'soffice' executable ///' @@ -831,30 +798,30 @@ function getSofficeNative() as string sCandidates(2) = sTemp + "/" + sCandidates(2) end if ' DEBUG: If you need more detailed information about the installation environment - ' enable the next line. + ' enable the next line. ' printlog "getSofficeNative() - : $HOME/soffice : '" + sCandidates(2) + "' destination exists?: " +fileExists(sCandidates(2)) catch ' DEBUG: If you need more detailed information about the installation environment - ' enable the next line. + ' enable the next line. ' printlog "getSofficeNative() - : $HOME/soffice : NOT AVAILABLE" sCandidates(2) = "" endcatch - for i = 1 to 2 - if fileExists(sCandidates(i)) then - '/// cut off program//soffice from link destination ///' - y = instr(sCandidates(i), "program/soffice") - if ( lcase( gPlatform ) = "osx" AND y < 1 ) then - ' Accept also MacOS in link to soffice binary - y = instr(sCandidates(i), "MacOS/soffice") - end if - if (y > 0) then - sCandidates(i) = left(sCandidates(i), y-1) - else - qaErrorLog "master.inc::getSofficeNative():: expected 'program/soffice' at end of link destination: '" + sCandidates(i) + "'" - sCandidates(i) = "" - end if + for i = 1 to 2 + if fileExists(sCandidates(i)) then + '/// cut off program//soffice from link destination ///' + y = instr(sCandidates(i), "program/soffice") + if ( lcase( gPlatform ) = "osx" AND y < 1 ) then + ' Accept also MacOS in link to soffice binary + y = instr(sCandidates(i), "MacOS/soffice") end if - next i + if (y > 0) then + sCandidates(i) = left(sCandidates(i), y-1) + else + qaErrorLog "master.inc::getSofficeNative():: expected 'program/soffice' at end of link destination: '" + sCandidates(i) + "'" + sCandidates(i) = "" + end if + end if + next i if (("" = sCandidates(1)) or ("" = sCandidates(2))) then ' if one candidate doesn't exist '/// If only one candidate exist, take him. ///' @@ -873,17 +840,17 @@ function getSofficeNative() as string end if next i ' DEBUG: If you need more detailed information about the installation environment - ' enable the next line. + ' enable the next line. ' printlog "getSofficeNative() - : BildId (1): " + iBuildId(1) + " (2): " + iBuildId(2) '/// - Take the candidate which exists and comes from $HOME ///' - if (iBuildId(1) > iBuildId(2)) then + if (iBuildId(1) > iBuildId(2)) then gOfficePath = sCandidates(1) else '/// - If BuildIds are equal, the candidate from $HOME wins ///' gOfficePath = sCandidates(2) end if end if - if (not fileExists(gOfficePath)) then + if (not fileExists(gOfficePath)) then '/// - check if resulting candidate exist; No: error ///' bError = true end if @@ -905,14 +872,14 @@ function getSofficeNative() as string iVendorEntries = 1 sVendor(iVendorEntries) = "Sun Microsystems": inc (iVendorEntries) sVendor(iVendorEntries) = "OpenOffice.org" : inc (iVendorEntries) - sVendor(iVendorEntries) = "Oracle" : inc (iVendorEntries) + sVendor(iVendorEntries) = "Oracle" : inc (iVendorEntries) iOfficeEntries = 1 sOffice(iOfficeEntries) = "Oracle Open Office" : inc (iOfficeEntries) sOffice(iOfficeEntries) = "StarOffice" : inc (iOfficeEntries) sOffice(iOfficeEntries) = "StarSuite" : inc (iOfficeEntries) sOffice(iOfficeEntries) = "OpenOffice.org": inc (iOfficeEntries) - + iVersionEntries = 1 sVersion(iVersionEntries) = "9" : inc (iVersionEntries) sVersion(iVersionEntries) = "8" : inc (iVersionEntries) @@ -921,10 +888,10 @@ function getSofficeNative() as string sVersion(iVersionEntries) = "2.0.0" : inc (iVersionEntries) sVersion(iVersionEntries) = "680" : inc (iVersionEntries) sVersion(iVersionEntries) = "2.2" : inc (iVersionEntries) - + ' put new versions ABOVE THIS LINE! ^^^^^^^^^^^ sVersion(iVersionEntries) ="NotFound": inc (iVersionEntries) ' HAS TO Stay at LAST - + ' I have to walk over both sPath(z), ' over all sOffice(y)-1 ' over all sVersion(x)-2 @@ -939,15 +906,15 @@ function getSofficeNative() as string sTemp = sPath(z) + sVendor(j) + "\" + sOffice(y) + "\" + sVersion(x) sOfficePath(z) = getRegistryValue(sTemp, sKey) iOffice(z) = z*1000 + j*100 + y*10 + x - if (sOfficePath(z) <> "") AND fileExists(sOfficePath(z)) then + if (sOfficePath(z) <> "") AND fileExists(sOfficePath(z)) then ' DEBUG: If you need more detailed information about the installation environment - ' enable the next line. + ' enable the next line. ' printlog "getSofficeNative() - : A " + z + ":" + j + ":" + y + ":" + x + " " + sTemp + " +++++++++++ " + sOfficePath(z) - else - ' printlog "getSofficeNative() - : C " + z + ":" + j + ":" + y + ":" + x + " " + sTemp + " +++++++++++ " + sOfficePath(z) - sOfficePath(z) = "" - iOffice(z) = 0 - end if + else + ' printlog "getSofficeNative() - : C " + z + ":" + j + ":" + y + ":" + x + " " + sTemp + " +++++++++++ " + sOfficePath(z) + sOfficePath(z) = "" + iOffice(z) = 0 + end if else ' This is just for completeness. B has no effect, A counts. sTemp = sPath(z) + sVendor(j) + "\" + sOffice(y) + "\" + sVersion(x) @@ -955,7 +922,7 @@ function getSofficeNative() as string sTemp2 = getRegistryValue(sTemp, sKey) if (sTemp2 <> "") then ' DEBUG: If you need more detailed information about the installation environment - ' enable the next line. + ' enable the next line. ' printlog "getSofficeNative() - : B " + z + ":" + j + ":" + y + ":" + x + " " + sTemp + " +++++++++++ "+sTemp2 end if end if @@ -997,14 +964,14 @@ function getSofficeNative() as string end if end if ' now we have gOfficePath set. - + if (not bError) then ' needed input for function: fGetProductName() '/// Look, if we got an OpenOffice.org version ///' gNetzOfficePath = gOfficePath - '/// Setting the global <i>gProductName</i> variable here. + '/// Setting the global <i>gProductName</i> variable here. gProductName = fGetProductName - ' A special build of OpenOffice.org is OOo-dev; #i56804# + ' A special build of OpenOffice.org is OOo-dev; #i56804# if (gProductName = "OOo-dev") then gProductName = "OpenOffice.org" PrintLog "This is a 'OOo-dev' product build." @@ -1024,11 +991,11 @@ end function '------------------------------------------------------------------------- function getSofficeTesttool() as string - dim sTemp as string - + dim sTemp as string + sTemp = "" '/// <ol><li>Look into the current profile section of the TestTool control file </li> - '/// deprecated, just kept here for compatibility + '/// deprecated, just kept here for compatibility sTemp = GetIniValue ( gTesttoolIni, gTTProfileName, "OOoProgramDir" ) if (sTemp = "") then '///+ <li>Look into the global section of the TestTool control file OOoProgramDir section</li></ol> @@ -1036,7 +1003,7 @@ function getSofficeTesttool() as string end if ' Throw error, if the default '.' from first startup is found if fileExists(sTemp) AND NOT (sTemp = "." )then - ' make sure path ends with path seperator + ' make sure path ends with path seperator if (right(sTemp,1) <> gPathSigne) then sTemp = sTemp + gPathSigne end if @@ -1060,9 +1027,9 @@ function getSofficeTesttool() as string gOfficePath = sTemp gNetzOfficePath = gOfficePath '/// Setting the global <i>gProductName</i> variable here because GetSofficeNative() - '///+ won't fill this global variable if [OOoProgramDir] is being used. + '///+ won't fill this global variable if [OOoProgramDir] is being used. gProductName = fGetProductName - ' A special build of OpenOffice.org is OOo-dev; #i56804# + ' A special build of OpenOffice.org is OOo-dev; #i56804# if (gProductName = "OOo-dev") then gProductName = "OpenOffice.org" PrintLog "This is a 'OOo-dev' product build." @@ -1072,9 +1039,9 @@ function getSofficeTesttool() as string else gOOO = FALSE end if - getSofficeTesttool = sTemp + getSofficeTesttool = sTemp else - '/// No valid path will return an empty string. + '/// No valid path will return an empty string. getSofficeTesttool = "" end if end function @@ -1155,7 +1122,7 @@ function getOfficeBasisPath as string sTemp = gNetzOfficePath sFile = gNetzOfficePath & "basis-link" - + if FileExists( sFile ) then if ( lcase( gPlatform ) = "osx" ) then 'MacOS X @@ -1163,12 +1130,12 @@ function getOfficeBasisPath as string else if ( gPlatGroup = "unx" ) then 'Unixes - sPath = getLinkDestination( sFile ) - sTemp = fRelativeToAbsolutePath( gNetzOfficePath & sPath ) - if ( NOT FileExists( sTemp ) ) then + sPath = getLinkDestination( sFile ) + sTemp = fRelativeToAbsolutePath( gNetzOfficePath & sPath ) + if ( NOT FileExists( sTemp ) ) then sTemp = fRelativeToAbsolutePath( sPath ) - endif - + endif + else 'all other platforms are Windows/DOS style ListRead( lTemp, sFile ) @@ -1181,7 +1148,7 @@ function getOfficeBasisPath as string else warnlog( CFN & "Basis-link could not be found" ) endif - + if ( NOT FileExists( sTemp ) ) then warnlog( CFN & "Retrieved invalid path" ) endif diff --git a/testautomation/global/system/includes/inivalue.inc b/testautomation/global/system/includes/inivalue.inc index e73aa240fef5..cf70fa365f7e 100644..100755 --- a/testautomation/global/system/includes/inivalue.inc +++ b/testautomation/global/system/includes/inivalue.inc @@ -37,243 +37,200 @@ ' #1 SetIniValue2 ' subroutine for SetIniValue ' #1 ChangeExt ' change the extension of an file ' #1 AnhaengenAnDatei ' add a string into a file -' #1 DateiSperren ' set the hidden flag for file -' #1 DateiFreigeben ' reset the hidden flag for file '* '\**************************************************************** function GetIniValue ( Datei$, Gruppe$, Variable$ ) as String -'/// wrapper for GetIniValue2 ///' -'///+ reads a value from an ini-file ///' -'///+ INPUT : name of ini-file; name of group (the one in braces []); the item (left of '=') ///' -'///+ OUTPUT: value (the right of the '=') ///' - if Dir(Datei$) = "" then - Warnlog "Error in GetIniValue(...):" + Datei$ + " not found" - exit function - end if - - GetIniValue = GetIniValue2( Datei$, Gruppe$, Variable$ ) ' Arbeiten + '/// wrapper for GetIniValue2 ///' + '///+ reads a value from an ini-file ///' + '///+ INPUT : name of ini-file; name of group (the one in braces []); the item (left of '=') ///' + '///+ OUTPUT: value (the right of the '=') ///' + if Dir(Datei$) = "" then + Warnlog "Error in GetIniValue(...):" + Datei$ + " not found" + exit function + end if + + GetIniValue = GetIniValue2( Datei$, Gruppe$, Variable$ ) ' Arbeiten end function function SetIniValue( Datei$, Gruppe$, Variable$, Value$ ) as String -'/// wrapper for SetIniValue2 ///' -'///+ writes a value to an ini-file ///' -'///+ INPUT : name of ini-file; name of group (the one in braces []); the item (left of '='); value (the right of the '=') ///' -'///+ OUTPUT: - ///' - Dim FileNum as Integer - - if Dir(Datei$) = "" then - WarnLog "Error in SetIniValue(...):" + Datei$ + " not found. File will be created now!" - FileNum = FreeFile - Open Datei$ For Output As #FileNum ' make empty file - Print #FileNum, "" - Close #FileNum - end if - - SetIniValue = SetIniValue2( Datei$, Gruppe$, Variable$, Value$ ) + '/// wrapper for SetIniValue2 ///' + '///+ writes a value to an ini-file ///' + '///+ INPUT : name of ini-file; name of group (the one in braces []); the item (left of '='); value (the right of the '=') ///' + '///+ OUTPUT: - ///' + Dim FileNum as Integer + + if Dir(Datei$) = "" then + WarnLog "Error in SetIniValue(...):" + Datei$ + " not found. File will be created now!" + FileNum = FreeFile + Open Datei$ For Output As #FileNum ' make empty file + Print #FileNum, "" + Close #FileNum + end if + + SetIniValue = SetIniValue2( Datei$, Gruppe$, Variable$, Value$ ) end function function GetIniValue2( Datei$, Gruppe$, Variable$ ) as String -'/// see the wrapper for it : GetIniValue ///' - Dim FileNum% : Dim GruppeOK% : Dim Pos% : Dim IniZeile$ : Dim IniZeile2$ - - FileNum% = FreeFile - - GruppeOK%=FALSE - - GetIniValue2 = "" - - Open Datei$ For Input As #FileNum% - do until EOF(#FileNum%) = True - Line input #FileNum%, IniZeile$ - - IniZeile$ = TRIM(IniZeile$) - iniZeile2$ = UCASE( IniZeile$ ) ' compare case insensitive - if GruppeOK% = FALSE then ' still no group - if IniZeile2$= "[" + UCASE( Gruppe$ ) + "]" then 'Is it the wanted group? - GruppeOK% = TRUE - end if - else - If Left(IniZeile2$, 1) = "[" then 'sadly new group - goodby - Exit do - else - Pos% = Instr( IniZeile2$, "=" ) 'is the item valid? - if Pos%>0 then ' '=' not found - if Left( IniZeile2$ , Pos%-1 ) = UCASE( Variable$ ) then 'compare leftvalue - GetIniValue2 = Trim(Mid$( IniZeile$ , Pos%+ 1 )) 'return part right of '=' : with initial case - exit do - end if - end if - end if - end if - - loop - - Close #FileNum% - wait 1000 -end function - - -sub SetIniValue2( Datei$, Gruppe$, Variable$, Value$ ) as String -'/// see the wrapper for it : SetIniValue ///' - Dim DateiBak$ : Dim D$ : Dim IniZeile$ : Dim IniZeile2$ - Dim FileBak% : Dim GruppeOK% : Dim Gefunden% : Dim FileNum% : Dim Pos% + '/// see the wrapper for it : GetIniValue ///' + Dim FileNum% : Dim GruppeOK% : Dim Pos% : Dim IniZeile$ : Dim IniZeile2$ -' rename - DateiBak$ = ChangeExt( Datei$, "BAK" ) + FileNum% = FreeFile - GruppeOK% = FALSE - Gefunden% = FALSE + GruppeOK%=FALSE - if Dir(DateiBak$)<>"" then - kill DateiBak$ - end if + GetIniValue2 = "" - if Dir( Datei$ )<>"" then - D$ = CurDir - name Datei$ as DateiBak$ - else - FileNum% = FreeFile - Open Datei$ For Output As #FileNum% - Print #FileNum%, "[" + Trim(Gruppe$) + "]" - Print #FileNum%, Variable$ + "=" + Trim(Value$) - Close #FileNum% ' finished here - Exit sub - endif + Open Datei$ For Input As #FileNum% + do until EOF(#FileNum%) = True + Line input #FileNum%, IniZeile$ - FileNum% = FreeFile - Open Datei$ For Output As #FileNum% - - FileBak% = FreeFile - Open DateiBak$ For Input As #FileBak% - - do until EOF(#FileBak%) = True - - Line input #FileBak%, IniZeile$ + IniZeile$ = TRIM(IniZeile$) + iniZeile2$ = UCASE( IniZeile$ ) ' compare case insensitive + if GruppeOK% = FALSE then ' still no group + if IniZeile2$= "[" + UCASE( Gruppe$ ) + "]" then 'Is it the wanted group? + GruppeOK% = TRUE + end if + else + If Left(IniZeile2$, 1) = "[" then 'sadly new group - goodby + Exit do + else + Pos% = Instr( IniZeile2$, "=" ) 'is the item valid? + if Pos%>0 then ' '=' not found + if Left( IniZeile2$ , Pos%-1 ) = UCASE( Variable$ ) then 'compare leftvalue + GetIniValue2 = Trim(Mid$( IniZeile$ , Pos%+ 1 )) 'return part right of '=' : with initial case + exit do + end if + end if + end if + end if - IniZeile$ = TRIM(IniZeile$) + loop - if IniZeile$ <> "" then + Close #FileNum% + wait 1000 +end function - IniZeile2$ = UCASE( IniZeile$ ) - if Left(IniZeile$, 1) = "[" then - if GruppeOK% = TRUE then 'groupchange - if Gefunden%=FALSE then - Print #FileNum%, Variable$ + "=" + Trim(Value$) - Gefunden% = TRUE - end if - GruppeOK% = FALSE - end if - Print #FileNum%, "" 'empty line - Print #FileNum%, IniZeile$ - if IniZeile2$= "[" + UCASE( Gruppe$ ) + "]" then - GruppeOK% = TRUE - end if - else - if GruppeOK% = TRUE then ' found group - - Pos% = Instr( IniZeile$, "=" ) - if Left( IniZeile2$ , Pos%-1 ) = UCASE( Variable$ ) then - IniZeile$ = Left( IniZeile$ , Pos% ) +Trim( Value$ )' after the '=' - Gefunden% = TRUE - end if +sub SetIniValue2( Datei$, Gruppe$, Variable$, Value$ ) as String + '/// see the wrapper for it : SetIniValue ///' + Dim DateiBak$ : Dim D$ : Dim IniZeile$ : Dim IniZeile2$ + Dim FileBak% : Dim GruppeOK% : Dim Gefunden% : Dim FileNum% : Dim Pos% + + ' rename + DateiBak$ = ChangeExt( Datei$, "BAK" ) + + GruppeOK% = FALSE + Gefunden% = FALSE + + if Dir(DateiBak$)<>"" then + kill DateiBak$ + end if + + if Dir( Datei$ )<>"" then + D$ = CurDir + name Datei$ as DateiBak$ + else + FileNum% = FreeFile + Open Datei$ For Output As #FileNum% + Print #FileNum%, "[" + Trim(Gruppe$) + "]" + Print #FileNum%, Variable$ + "=" + Trim(Value$) + Close #FileNum% ' finished here + Exit sub + endif + + FileNum% = FreeFile + Open Datei$ For Output As #FileNum% + + FileBak% = FreeFile + Open DateiBak$ For Input As #FileBak% + + do until EOF(#FileBak%) = True + + Line input #FileBak%, IniZeile$ + + IniZeile$ = TRIM(IniZeile$) + + if IniZeile$ <> "" then + + IniZeile2$ = UCASE( IniZeile$ ) + + if Left(IniZeile$, 1) = "[" then + if GruppeOK% = TRUE then 'groupchange + if Gefunden%=FALSE then + Print #FileNum%, Variable$ + "=" + Trim(Value$) + Gefunden% = TRUE + end if + GruppeOK% = FALSE + end if + Print #FileNum%, "" 'empty line + Print #FileNum%, IniZeile$ + if IniZeile2$= "[" + UCASE( Gruppe$ ) + "]" then + GruppeOK% = TRUE + end if + else + if GruppeOK% = TRUE then ' found group + + Pos% = Instr( IniZeile$, "=" ) + if Left( IniZeile2$ , Pos%-1 ) = UCASE( Variable$ ) then + IniZeile$ = Left( IniZeile$ , Pos% ) +Trim( Value$ )' after the '=' + Gefunden% = TRUE + end if + end if + Print #FileNum%, IniZeile$ end if - Print #FileNum%, IniZeile$ - end if - end if + end if - loop + loop - if Gefunden% = FALSE then - ' set new group and value - if GruppeOK%=FALSE then - Print #FileNum%, "" - Print #FileNum%, "[" + Trim(Gruppe$) + "]" - end if - Print #FileNum%, Variable$ + "=" + Value$ - end if + if Gefunden% = FALSE then + ' set new group and value + if GruppeOK%=FALSE then + Print #FileNum%, "" + Print #FileNum%, "[" + Trim(Gruppe$) + "]" + end if + Print #FileNum%, Variable$ + "=" + Value$ + end if - Close #FileNum% - Close #FileBak% + Close #FileNum% + Close #FileBak% - wait 1000 + wait 1000 end sub sub AnhaengenAnDatei ( Datei as String, Texte as String ) -'/// append a string at the end of the file ///' -'///+ INPUT : filename; string///' -'///+ OUTPUT: - ///' - Dim FileNum% + '/// append a string at the end of the file ///' + '///+ INPUT : filename; string///' + '///+ OUTPUT: - ///' + Dim FileNum% - FileNum% = FreeFile - Open Datei for Append as #FileNum% + FileNum% = FreeFile + Open Datei for Append as #FileNum% - Print #FileNum%, Texte - Close #FileNum% + Print #FileNum%, Texte + Close #FileNum% end sub function ChangeExt( Datei$, Ext$ )as String -'/// change the extension of a file ///' -'///+ INPUT : filename; extension ///' -'///+ OUTPUT: - ///' - Dim i% - - i% = InStr( Right(Datei$, 4 ) , "." ) - if Ext$<>"" then - if i%=0 then - ChangeExt = Datei$ +"."+Ext$ - else - ChangeExt = Left( Datei$, Len(Datei$)-4+i% ) + Ext$ - end if - - elseif i%<>0 then - ChangeExt = Left( Datei$, Len(Datei$)-5+i% ) - end if + '/// change the extension of a file ///' + '///+ INPUT : filename; extension ///' + '///+ OUTPUT: - ///' + Dim i% + + i% = InStr( Right(Datei$, 4 ) , "." ) + if Ext$<>"" then + if i%=0 then + ChangeExt = Datei$ +"."+Ext$ + else + ChangeExt = Left( Datei$, Len(Datei$)-4+i% ) + Ext$ + end if + + elseif i%<>0 then + ChangeExt = Left( Datei$, Len(Datei$)-5+i% ) + end if end function -sub DateiSperren( Datei$ ) -'/// set the hidden flag of a file; lock the file ///' -'///+ INPUT : filename ///' -'///+ OUTPUT: - ///' - Dim i% - - if hFileExists ( Datei$ ) <> TRUE then - Warnlog "File '" + Datei$ + "' doesn't exist; exiting now!" - exit sub - end if - - i% = GetAttr( Datei$ ) - do while (i% AND 2) = 2 ' is file already locked? - Wait( int( 400 * Rnd + 5 ) - i% = GetAttr( Datei$ ) - loop - SetAttr( Datei$ , i% OR 2 ) ' Lock - - exit sub - -end sub - -sub DateiFreigeben( Datei$ ) -'/// reset the hidden flag of a file; release the file ///' -'///+ INPUT : filename ///' -'///+ OUTPUT: - ///' - Dim i% - - if hFileExists ( Datei$ ) <> TRUE then - Warnlog "File '" + Datei$ + "' doesn't exist; exiting now!" - exit sub - end if - - i% = GetAttr( Datei$ ) - SetAttr( Datei$ , i% AND NOT 2 ) ' release - exit sub - -end Sub - - - diff --git a/testautomation/global/system/includes/master.inc b/testautomation/global/system/includes/master.inc index 9e693eea445e..fafb5f758a85 100755 --- a/testautomation/global/system/includes/master.inc +++ b/testautomation/global/system/includes/master.inc @@ -70,6 +70,8 @@ sub GetUseFiles gTestcaseStart = Now() ' get start time of test preparation phase + GVERBOSE = FALSE ' global switch to make some functions more talkative for profiling purposes + use "global\system\includes\sysinfo.inc" '///+ sysinfo.inc : routines to get all system informations use "global\system\includes\inivalue.inc" '///+ inivalue.inc : routines to work with ini-files use "global\system\includes\iniinfo.inc" '///+ iniinfo.inc : routines to get all informations about OpenOffice.org @@ -281,7 +283,6 @@ end sub sub LoadGlobalIncludeFiles '///Load all important global files. use "global\tools\includes\required\t_dir.inc" '///+<li><b>t_dir</b>: Routines to parse directories (methods execute on the office side)</li> - use "global\tools\includes\required\t_dirloc.inc" '///+<li><b>t_dirloc</b>: Routines to parse directories (execute on the testtool side)</li> use "global\tools\includes\required\t_doc1.inc" '///+<li><b>t_doc1</b>: Global routines to work on office documents (I)</li> use "global\tools\includes\required\t_doc2.inc" '///+<li><b>t_doc2</b>: Global routines to work on office documents (II)</li> use "global\tools\includes\required\t_files.inc" '///+<ul><li><b>t_files</b>: Routines to open/save/print files</li> @@ -314,9 +315,7 @@ sub FirstOfficeStart 'Needs to get executed everytime after a 'ResetApplication' command catchGPF false ' Recover to backingwindow, until resetApplication can handle this - for i = 1 to getDocumentCount - hCloseDocument() - next i + hFileCloseAll() end sub '------------------------------------------------------------------------- @@ -334,7 +333,7 @@ sub hStartTheOffice (optional sProfPath as String, optional sProfParameter as St sErrorInformation = "global::systen::inc::master.inc:hStartTheOffice: " - if gPlatform = lcase("osx") then + if lcase( gPlatform ) = "osx" then sPlatformProgramPath = "MacOS" else sPlatformProgramPath = "program" @@ -533,11 +532,11 @@ sub ExitRestartTheOffice (optional sProfPath as String, optional sProfParameter catch endcatch 'Disable Quickstarter internaly - hDisableQuickstarterAPI + hDisableQuickstarterAPI + ' Recover to backingwindow, until resetApplication can handle this - for i = 1 to getDocumentCount - hCloseDocument() - next i + hFileCloseAll() + end sub '------------------------------------------------------------------------- @@ -671,15 +670,7 @@ sub PleaseRecover (sWhat as String) Kontext ' Recover to backingwindow, until resetApplication can handle this - a = getDocumentCount - for i = 1 to a - qaErrorLog "Needed to close window: (" + i + "/"+a+") on " + sWhat - hCloseDocument() - next i - a = getDocumentCount - if a > 0 then - warnlog "Failed to close window; There are still open: " + a - endif + hFileCloseAll() end sub '------------------------------------------------------------------------- @@ -1144,7 +1135,7 @@ sub sStartUpOffice (optional sProfPath as String, optional sProfParameter as Str ' Set a valid URE_BOOTSTRAP path for soffice, else the invalid one from this testtool instance ' will get used i86718 - would result in a message about vcl stuff and a not starting soffice - if gPlatform = lcase("osx") then + if lcase( gPlatform ) = "osx" then sPlatformProgramPath = "MacOS" sPlatformBinExt = "rc" else diff --git a/testautomation/global/tools/compressstatus.bas b/testautomation/global/tools/compressstatus.bas index aa469847b5ba..b8ed46d3b3f5 100755 --- a/testautomation/global/tools/compressstatus.bas +++ b/testautomation/global/tools/compressstatus.bas @@ -142,7 +142,7 @@ function fZip(sDirectory as string, sZipFileName as string) as integer oInfo.Attributes = 0 ' get all files in a directory - getFileNameListLocal (sDirectory+"/","*.txt",lsFile()) + getFileNameList (sDirectory+"/","*.txt",lsFile()) printlog "Going to zip Directory: '" + sDirectory + "'" for i = 1 to listCount(lsFile()) printlog "Going to add: " + i + ": '" + lsFile(i) + "'" diff --git a/testautomation/global/tools/includes/optional/t_basic_ide_tools.inc b/testautomation/global/tools/includes/optional/t_basic_ide_tools.inc index c13cb2ac1a04..fcf8d301db58 100644..100755 --- a/testautomation/global/tools/includes/optional/t_basic_ide_tools.inc +++ b/testautomation/global/tools/includes/optional/t_basic_ide_tools.inc @@ -36,21 +36,27 @@ function hShowMacroControls() as boolean '///<h3>Tear off the ToolsCollectionBar from the MacroBar</h3> '///<i>Starting point: Basic dialog editor is open and has the focus</i> '///<ul> - const CFN = "hShowMacroControls::" + const CFN = "hShowMacroControls::" + + const MAX_WAIT = 5 + const SHORT_WAIT = 1 + + const VERTICALLY_CENTERED = 50 + const HORIZONTALLY_CENTERED = 50 - printlog( CFN & "Enter" ) + if ( GVERBOSE ) then printlog( CFN & "Enter" ) '///+<li>Test whether the ToolsCollectionBar is already open. If yes, exit directly</li> kontext "ToolsCollectionBar" - if ( ToolsCollectionBar.exists( 3 ) ) then - printlog( CFN & "Exit: ToolsCollectionBar is already open." ) + if ( ToolsCollectionBar.exists( SHORT_WAIT ) ) then + printlog( CFN & "ToolsCollectionBar is already open." ) hShowMacroControls() = true exit function endif '///+<li>Verify that the Dialog Bar is available</li> Kontext "DialogBar" - if ( DialogBar.exists( 5 ) ) then + if ( DialogBar.exists( MAX_WAIT ) ) then '///+<li>Verify that the controls-button is enabled</li> try @@ -62,27 +68,23 @@ function hShowMacroControls() as boolean '///+<li>Verify that the ToolsCollectionBar is visible and can be accessed</li> kontext "ToolsCollectionBar" - if ( ToolsCollectionBar.exists( 5 ) ) then + if ( ToolsCollectionBar.exists( MAX_WAIT ) ) then '///+<li>Move it to the upper left corner at pos 50/50</li> - ToolsCollectionBar.Move ( 50 , 50 ) - printlog( CFN & "Exit: ToolsCollectionBar is open and has been placed" ) + ToolsCollectionBar.Move ( HORIZONTALLY_CENTERED , VERTICALLY_CENTERED ) + printlog( CFN & "ToolsCollectionBar is open and has been placed" ) hShowMacroControls() = true - exit function else - printlog( CFN & "Exit: ToolsCollectionBar is not available. Aborting." ) + printlog( CFN & "ToolsCollectionBar is not available. Aborting." ) hShowMacroControls() = false - exit function endif catch - printlog( CFN & "Exit: The Controls-Button is not enabled. Aborting." ) + printlog( CFN & "The Controls-Button is not enabled. Aborting." ) hShowMacroControls() = false - exit function endcatch else - printlog( CFN & "Exit: The Dialog Bar is not available. Aborting." ) + printlog( CFN & "The Dialog Bar is not available. Aborting." ) hShowMacroControls() = false - exit function endif '///</ul> @@ -94,22 +96,10 @@ function hGetBasicWorkFile( cMajorID as string ) as string '///<h3>Retrieve a filename, depending on gApplication and Build-ID</h3> '///<i>Structure: work-directory/basic[.suffix]</i> - '///<ul> - const CFN = "hGetBasicWorkFile::" - - dim sFile as string - - '///+<li>Build a path and a filename (path from UNO, Suffix from global-module)</li> - sFile = hGetWorkPath() & "basic" & hGetSuffix( cMajorId ) - sFile = ConvertPath( sFile ) - + dim sFile as string : sFile = hGetWorkPath() & "basic" & hGetSuffix( cMajorId ) printlog( CFN & sFile & " for " & gApplication & " (" & cMajorID & ")" ) - - '///+<li>Return the path as string</li> - hGetBasicWorkFile() = convertpath( sFile ) - - '///</ul> + hGetBasicWorkFile() = sFile end function @@ -119,31 +109,32 @@ function hOpenBasicIDE() as boolean '///<h3>Open the Basic IDE for the last module listed in the Macro Organizer</h3> '///<i>Starting point: Basic Macro Organizer has focus</i> - '///<ul> const CFN = "hOpenBasicIDE::" + const BUTTON_TIMEOUT = -1 + const MAX_WAIT = 2 - '///+<li>Select the last module in the treelist, verify that it can be edited</li> - hSelectTheLastModule( true ) - - '///+<li>Click the Edit-button</li> - Bearbeiten.click() - - '///+<li>Maximize the Basic IDE (required to ensure proper operation of mousemovements)</li> - sleep( 2 ) - kontext "BasicIde" - BasicIde.maximize() + if ( hSelectTheLastModule( true ) ) then - '///+<li>Verify that the Basic IDE is open, return TRUE on success</li> - if ( BasicIde.exists() ) then - printlog( CFN & "Open Basic-IDE for existing module: success" ) - hOpenBasicIDE() = true + if ( hClickButton( Bearbeiten) <> BUTTON_TIMEOUT ) then + + kontext "BASICIDE" + if ( BasicIDE.exists( MAX_WAIT ) ) then + printlog( "Basic IDE is open" ) + BasicIDE.maximize() + hOpenBasicIDE() = true + else + warnlog( CFN & "Failed to open BASIC IDE" ) + hOpenBasicIDE() = false + endif + else + warnlog( CFN & "Edit button is not enabled, cannot open BASIC IDE" + hOpenBasicIDE() = false + endif else - printlog( CFN & "Open Basic-IDE for existing module: failure" ) - hOpenBasicIDE() = false + warnlog( CFN & "Unable to select the last module" ) + hOpenBasicIDE() = false endif - - '///</ul> end function @@ -151,32 +142,10 @@ end function function hCloseBasicIDE() as boolean - '///<h3>Close the BASIC-IDE with best effort verification</h3> - '///<i>Starting point: Basic IDE is open and has the focus</i> - '///<ol> - '///+<li>File-menu</li> - '///+<li>Slot FileClose</li> - '///+<li>hCloseDocument()/hDestroyDocument()</li> - '///</ol> - '///<ul> - - use "global\tools\includes\optional\t_docfuncs.inc" - - const CFN = "hCloseBasicIDE::" - dim brc as boolean - - '///+<li>Close the macro controls float</li> + '///<h3>Close the BASIC-IDE</h3> hCloseCollectionBar() - - '///+<li>Try to close the current document</li> - brc = hDestroyDocument() - if ( brc ) then - hCloseBasicIDE() = true - else - hCloseBasicIDE() = false - qaerrorlog( "#i54135# Failed to close BASIC IDE" ) - endif - '///</ul> + kontext "BasicIDE" + hCloseBasicIDE() = hDestroyDocument() end function @@ -186,36 +155,31 @@ function hReOpenBasicDialog() as boolean '///<h3>Open BASIC-IDE after loading a workfile with documentbound macro</h3> '///<i>Starting point: Focus on document containing at least one macro</i><br> - '///<i>IMPORTANT: Errorhandling is incomplete, test may end up in undefined state</i> - '///<ul> + const CFN = "hReopenBasicDialog: " + const BUTTON_TIMEOUT = -1 - dim brc as boolean - - '///+<li>open the macro dialog, select the last module</li> - brc = hSelectTheLastModule( true ) - if ( not brc ) then - warnlog( "Could not open the last module for editing." ) - hReOpenBasicDialog() = false - exit function - endif + if ( hSelectTheLastModule( true ) ) then - '///+<li>edit the module</li> - Bearbeiten.Click() + if ( hClickButton( Bearbeiten ) <> BUTTON_TIMEOUT ) then - '///+<li>find the dialog window.</li> - kontext "BasicIDE" - BasicIde.maximize() + kontext "BasicIDE" + BasicIde.maximize() - brc = hFindFirstDialog() - if ( not brc ) then - warnlog( "Could not find any dialog" ) - hReOpenBasicDialog() = false + if ( hFindFirstDialog() ) then + printlog( "BASIC IDE is open." ) + hReOpenBasicDialog() = true + else + warnlog( CFN & "Could not find any dialog" ) + hReOpenBasicDialog() = false + endif + else + warnlog( CFN & "Unable to click Edit button, BASIC IDE not open" ) + hReOpenBasicDialog() = false + endif else - hReOpenBasicDialog() = true + warnlog( CFN & "Could not open the last module for editing." ) + hReOpenBasicDialog() = false endif - - '///+<li>Return TRUE on success, FALSE on failure</li> - '///</ul> end function @@ -227,39 +191,34 @@ function hFindFirstDialog() as boolean '///<i>Starting point: Basic IDE must be open and has the focus</i> '///<ul> - dim iPosOverTabbar as integer - dim brc as boolean const CFN = "hFindFirstDialog::" + const REPEAT_COUNT = 5 ' number of times to send a keystroke to BASIC IDE + const MAX_NUMBER_OF_RETRIES = 20 + const SELECT_TAB_RIGHT = "<MOD1 PAGEUP>" + const SCROLL_UP_LEFT = "<UP><LEFT>" + + dim iPosOverTabbar as integer + hFindFirstDialog() = false '///+<li>Set focus to Basic IDE, maximize it</li> - kontext "BasicIde" + kontext "BasicIDE" BasicIde.maximize() - - brc = false '///+<li>move pointer over the tabbar and click until a dialog opens (hopefully)</li> - for iPosOverTabbar = 1 to 20 + for iPosOverTabbar = 1 to MAX_NUMBER_OF_RETRIES - Tabbar.MouseDown ( 5 * iPosOverTabbar , 50 ) - Tabbar.MouseUp ( 5 * iPosOverTabbar , 50 ) + BASICIDE.typeKeys( SELECT_TAB_RIGHT ) if ( DialogWindow.Exists() ) then - brc = true - DialogWindow.typeKeys( "<up>", 5 ) + printlog( "BASIC Dialog window found" ) + hFindFirstDialog() = true + DialogWindow.typeKeys( SCROLL_UP_LEFT , REPEAT_COUNT ) exit for endif next iPosOverTabbar - - '///+<li>Return TRUE on success, FALSE on failure</li> - if ( brc ) then - printlog( CFN & "Found dialog" ) - else - printlog( CFN & "Could not find the first dialog via tabbar" ) - endif - hFindFirstDialog() = brc - '///</ul> + '///</ul> end function @@ -269,27 +228,19 @@ function hSelectDialogPane() as boolean '///<h3>Select the dialog pane in the Basic dialog editor</h3> '///<i>Starting point: Basic dialog editor is open and has the focus</i> - '///<ul> - const CFN = "hSelectDialogPane::" - printlog( CFN & "Enter" ) + const UP_LEFT = 10 + const DOWN_RIGHT = 90 + + if ( GVERBOSE ) then printlog( CFN & "Enter" ) - '///+<li>Select background dialog by rubberband</li> kontext "BasicIDE" + DialogWindow.mouseDown( DOWN_RIGHT , DOWN_RIGHT ) + DialogWindow.mouseMove( UP_LEFT , UP_LEFT ) + DialogWindow.mouseUp ( UP_LEFT , UP_LEFT ) - '///+<li>Set the mousepointer down at 90/90</li> - DialogWindow.mouseDown( 90 , 90 ) - - '///+<li>Move it to 10/10</li> - DialogWindow.mouseMove( 10 , 10 ) - - '///+<li>Release the mouse pointer at 10/10</li> - DialogWindow.mouseUp ( 10 , 10 ) - - '///+<li>Return TRUE, currently no verification is implemented</li> - printlog( CFN & "Exit: Selected dialog pane (not verified)" ) + printlog( CFN & "Selected dialog pane (not verified)" ) hSelectDialogPane() = true - '///</ul> end function @@ -297,33 +248,23 @@ end function function hCloseCollectionBar() as boolean - '///<h3>Close the ToolsCollectionBar (Macro Controls Float)</h3> - '///<i>Starting point: Basic Dialog editor is open, ToolsCollectionBar is open</i> - '///<ul> - - const CFN = "hCloseCollectionBar::" - const RETRIES = 3 - - dim iTry as integer - iTry = 0 - - '///+<li>Try to close the ToolsCollectionBar max 3 times</li> + const CFN = "hCloseCollectionBar(): " + kontext "ToolsCollectionBar" - while ( ToolsCollectionBar.exists( 1 ) ) - iTry = iTry + 1 - printlog( CFN & "Closing ToolsCollectionBar..." ) - ToolsCollectionBar.close() - - if ( iTry = RETRIES ) then - printlog( CFN & "Failed to close ToolsCollectionBar" ) + if ( ToolsCollectionBar.exists() ) then + + if ( hCloseDialog( ToolsCollectionBar, "close" ) ) then + printlog( "Closed Macro Controls Float" ) + hCloseCollectionBar() = true + else + warnlog( CFN & "Failed to close Macro Controls Float" ) hCloseCollectionBar() = false - exit function endif - wend + else + printlog( "Macro Controls Float not open" ) + hCloseCollectionBar() = true + endif - hCloseCollectionBar() = true - '///</ul> - end function '******************************************************************************* @@ -331,51 +272,19 @@ end function function hDeleteMacro() as boolean '///<h3>Delete all text in the Basic IDE editor</h3> - '///<i>Starting point: Basic IDE is open, has focus, code can be edited</i> - '///<ul> + const CFN = "hDeleteMacro(): " - use "global\tools\includes\optional\t_accels.inc" - - '///+<li>Verify all prerequisites are met (BasicIDE must be open)</li> kontext "BasicIDE" - if ( not BasicIde.exists() ) then - warnlog( "hDeleteMacro::BasicIDE is not visible/active. Aborting" ) + if ( BasicIDE.exists() ) then + WaitSlot() : Wait( 100 ) : EditWindow.typeKeys( "<MOD1 HOME>" ) + WaitSlot() : Wait( 100 ) : EditWindow.typeKeys( "<MOD1 SHIFT END>" ) + WaitSlot() : Wait( 100 ) : EditWindow.typeKeys( "<DELETE>" ) + hDeleteMacro() = hIsEditWindowEmpty() + else + warnlog( CFN & "Basic IDE is not open" ) hDeleteMacro() = false - exit function - endif - - dim brc as boolean - - '///+<li>get the languagespecific accelerator for "Edit->Select All"</li> - dim cAccelerator as string - cAccelerator = hGetAccel( "SelectAll" ) - - printlog( "hDeleteMacro::Using Accel: " & cAccelerator ) - - ' Common for all actions is that we delete the existing macro before - ' inserting the new one. This fails if the accelerator for SelectAll - ' is incorrect, we try to recover by doing this manually then. - '///+<li>Delete the entire content of the Basic IDE editor</li> - EditWindow.TypeKeys( cAccelerator ) - EditWindow.TypeKeys( "<Delete>" ) - - ' Verify that the EditWindow is empty, if not use a method that - ' should work for all languages/locales - '///+<li>Verify that the editor window is indeed empty</li> - brc = hIsEditWindowEmpty() - if ( not brc ) then - qaerrorlog( "#i52430# hDeleteMacro::Accelerator " & cAccelerator & " failed" ) - printlog( "hDeleteMacro::Trying alternative method" ) - EditWindow.TypeKeys( "<Mod1 Home>" ) - EditWindow.TypeKeys( "<Mod1 Shift End>" ) - EditWindow.TypeKeys( "<Delete>" ) - brc = hIsEditWindowEmpty() endif - '///+<li>Return TRUE on success, FALSE on failure</li> - hDeleteMacro() = brc - '///</ul> - end function '******************************************************************************* @@ -384,112 +293,66 @@ function hIsEditWindowEmpty() as boolean '///<h3>Test if the Basic-EditWindow is empty</h3> '///<i>Starting point: Basic IDE editor is open and has the focus</i> - '///<ul> - - '///+<li>Verify that prerequisites are met: Basic IDE must be open</li> - kontext "BasicIDE" - if ( not BasicIDE.exists() ) then - warnlog( "hIsEditWindowEmpty::BasicIde is not open/visible" ) - hIsEditWindowEmpty() = false - exit function - endif - - '///+<li>Verify that the EditWindow is empty. EditCopy is disabled when empty</li> - EditWindow.TypeKeys( "<Mod1 Home>" ) - EditWindow.TypeKeys( "<Mod1 Shift End>" ) - try - EditCopy - printlog( "EditCopy should be enabled for empty Basic IDE editor" ) - catch - setClipboard( "" ) - endcatch + const CFN = "hIsEditWindowEmpty(): " - if ( getClipBoardText() <> "" ) then - hIsEditWindowEmpty() = false - printlog( "hIsEditWindowEmpty::no - content follows:" ) - printlog( GetClipboardText ) + kontext "BasicIDE" + if ( BasicIDE.exists() ) then + SetClipboard( "" ) + WaitSlot() : EditWindow.typeKeys( "<MOD1 HOME>" ) + WaitSlot() : EditWindow.typeKeys( "<MOD1 SHIFT END>" ) + hUseAsyncSlot( "EditCopy" ) + + if ( GetClipBoardText() = "" ) then + hIsEditWindowEmpty() = true + else + warnlog( CFN & "Edit window is not empty" ) + hIsEditWindowEmpty() = false + endif else - hIsEditWindowEmpty() = true - printlog( "hIsEditWindowEmpty::yes" ) + warnlog( CFN & "BasicIDE is not open" ) + hIsEditWindowEmpty() = false endif - '///+<li>Return TRUE on success, FALSE on failure</li> - '///</ul> - end function '******************************************************************************* function hRenameTab( cTabName as string ) as integer - '///<h3>Rename the first tab in the Basic IDE Tabbar</h3> - '///<i>Starting point: Basic IDE is open, at least one tab exists</i><br> - '///Return values are: - '///<ul> - '///+<li>0 = Tab was correctly renamed</li> - '///+<li>1 = Invalid name warning is displayed (handle outside of function)</li> - '///+<li>2 = Unknown error / failed to rename the tab</li> - '///+<li>3 = Unable to access context menu</li> - '///</ul> - '///Description - '///<ul> - - const CFN = "hRenameTab::" - - dim cString as string - dim iWait as integer - dim iTry as integer - dim brc as boolean - brc = false + const CFN = "hRenameTab(): " - cString = "<HOME><SHIFT END>" & cTabName & "<RETURN>" - kontext "basicide" - - '///+<li>Open the context menu of the tabbar</li> - for iTry = 1 to 5 - try - kontext "basicide" - Tabbar.OpenContextMenu - hMenuSelectNr( 3 ) - sleep( 2 ) - brc = true + const MENUITEM_RENAME = 3 + const MAX_WAIT = 1000 + const RETVAL_SUCCESS = 0 + const RETVAL_NO_IDE = 1 + const RETVAL_NO_ACCESS = 2 + const RETVAL_NO_MENU = 3 + + dim sFullString as string : sFullString = "<HOME><SHIFT END>" & cTabName & "<RETURN>" + + kontext "BasicIDE" + if ( BasicIDE.exists() ) then + try + hRenameTab() = RETVAL_NO_MENU + Tabbar.openContextMenu() + hMenuSelectNr( MENUITEM_RENAME ) + Wait( MAX_WAIT ) + + ' At this point the string on the tab should be selected, print the + ' string to the log and overwrite it with the new name + hRenameTab() = RETVAL_NO_ACCESS + + Tabbar.typeKeys( sFullString , true ) + hRenameTab() = RETVAL_SUCCESS catch - printlog( "No context menu, retrying..." ) + warnlog( CFN & "Failed to rename the current module" ) endcatch - next iTry - '///+<li>Select to rename the tab</li> - if ( not brc ) then - warnlog( CFN & "Unable to access Context Menu" ) - hRenameTab() = 3 - exit function + else + warnlog( CFN & "BASIC IDE is not open" ) + hRenameTab() = RETVAL_NO_IDE endif - - try - '///+<li>Overwrite the old name of the tab</li> - kontext "basicide" - Tabbar.TypeKeys( cString , true ) - hRenameTab() = 0 - printlog( CFN & "Tab renamed: " & cTabName ) - catch - '///+<li>Handle possible errors</li> - hRenameTab() = 2 - warnlog( CFN & "Failed to rename tab: " & cTabName ) - exit function - endcatch - - kontext "active" - for iWait = 1 to 3 - sleep( 1 ) - if ( active.exists() ) then - hRenameTab() = 1 - printlog( CFN & "Invalid name for tab: Warning is displayed" ) - exit for - endif - next iWait - '///+<li>Return 0, 1 or 2</li> - '///</ul> - + end function '******************************************************************************* @@ -532,6 +395,7 @@ function hNewDialog() as boolean '///<ul> const CFN = "hNewDialog::" + const MAX_WAIT = 2000 '///+<li>Open the context menu for the tabbar</li> kontext "basicide" @@ -539,20 +403,20 @@ function hNewDialog() as boolean '///+<li>Select the first item (insert)</li> hMenuSelectNr( 1 ) - WaitSlot( 1000 ) ' sleep( 1 ) + WaitSlot( MAX_WAIT ) ' sleep( 1 ) '///+<li>Select the second item (new dialog)</li> hMenuSelectNr( 2 ) - WaitSlot( 2000 ) ' sleep( 2 ) + WaitSlot( MAX_WAIT ) ' sleep( 2 ) '///+<li>Verify that a new dialog is opened and has the focus</li> if ( DialogWindow.Exists() ) then printlog( CFN & "New dialog is open" ) hNewDialog() = true - if ( DialogWindow.IsMax() = false ) then - DialogWindow.Maximize() - Wait( 2000 ) - end if + if ( DialogWindow.IsMax() = false ) then + DialogWindow.Maximize() + Wait( MAX_WAIT ) + end if else warnlog( CFN & "New dialog is not open" ) hNewDialog() = false @@ -571,6 +435,7 @@ function hNewModule() as boolean '///<ul> const CFN = "hNewModule::" + const MAX_WAIT = 2000 '///+<li>Open the context menu for the tabbar</li> kontext "basicide" @@ -578,11 +443,11 @@ function hNewModule() as boolean '///+<li>Select the first item (insert)</li> hMenuSelectNr( 1 ) - WaitSlot( 1000 ) ' sleep( 1 ) + WaitSlot( MAX_WAIT ) ' sleep( 1 ) '///+<li>Select the first item (new module)</li> hMenuSelectNr( 1 ) - WaitSlot( 2000 ) ' sleep( 2 ) + WaitSlot( MAX_WAIT ) ' sleep( 2 ) '///+<li>Verify that a new module is opened and has the focus</li> if ( EditWindow.Exists() ) then @@ -606,6 +471,7 @@ function hHideModule() as boolean '///<ul> const CFN = "hHideModule::" + const MENUENTRY_HIDE = 4 kontext "basicide" @@ -614,7 +480,7 @@ function hHideModule() as boolean tabbar.openContextMenu '///+<li>Select the fourth entry (Hide)</li> - hMenuSelectNr( 4 ) + hMenuSelectNr( MENUENTRY_HIDE ) sleep( 1 ) hHideModule() = true printlog( CFN & "Success" ) @@ -643,14 +509,13 @@ function hInitFormControls( cModule as string ) as boolean '///Description: '///<ul> - const CFN = "hInitFormControls::" - dim brc as boolean + const CFN = "hInitFormControls::" + hInitFormControls() = false '///+<li>Create and edit a new module for the current document</li> - brc = hInitBasicIde( cModule ) - if ( not brc ) then + + if ( not hInitBasicIde( cModule ) ) then warnlog( "Could not create new module" ) hCloseBasicIde() - hInitFormControls() = false exit function endif @@ -658,20 +523,16 @@ function hInitFormControls( cModule as string ) as boolean BasicIde.maximize() '///+<li>Create a new dialog.</li> - brc = hNewDialog() - if ( not brc ) then + if ( not hNewDialog() ) then warnlog( "Could not create Basic-Dialog" ) hCloseBasicIde() - hInitFormControls() = false exit function endif '///+<li>Open the macro controls float.</li> - brc = hShowMacroControls() - if ( not brc ) then + if ( not hShowMacroControls() ) then warnlog( CFN & "Could not tear off the macro controls float" ) hCloseBasicIde() - hInitFormControls() = false exit function endif @@ -688,53 +549,33 @@ function hInitBasicIde( cModule as string ) as boolean '///<h3>Get from a new document to the Basic IDE in one go</h3> '///<i>Starting point: New, plain document</i> - '///<ul> - - use "global\tools\includes\optional\t_basic_organizer_tools.inc" - use "global\tools\includes\optional\t_listfuncs.inc" const CFN = "hInitBasicIde::" - if ( cModule = "" ) then - warnlog( CFN & "Invalid parameter passed to function" ) - hInitBasicIde() = false - exit function - endif - - ' some multi-purpose return code - dim brc as boolean - - '///+<li>Open the basic Organizer</li> - brc = hOpenBasicOrganizerFromDoc() - if ( not brc ) then - warnlog( CFN & "Could not open the Basic Organizer, aborting" ) - hInitBasicIde() = false - exit function - endif + ToolsMacro_uno - '///+<li>Create a new module for the current document</li> - brc = hCreateModuleForDoc( cModule ) - if ( not brc ) then - warnlog( CFN & "The Basic-IDE is not open, aborting" ) - hInitBasicIde() = false - - kontext "Makro" - if ( Makro.exists() ) then - printlog( CFN & "Closed Macro Organizer" ) - Makro.cancel() + kontext "Makro" + if ( Makro.exists( 2 ) ) then + + if ( hCreateModuleForDoc( cModule ) ) then + + kontext "BasicIDE" + if ( BasicIDE.exists( 2 ) ) then + BasicIDE.maximize() + hInitBasicIde() = true + else + warnlog( CFN & "Failed to open BASIC IDE" ) + hInitBasicIde() = false + endif + else + warnlog( CFN & "Failed to create a module for the current document" ) + hInitBasicIde() = false endif - exit function + else + warnlog( CFN & "Failed to open macro organizer" ) + hInitBasicIde() = false endif - '///+<li>Maximize the BasicIDE</li> - kontext "BasicIde" - BasicIde.maximize() - - '///+<li>Verify that the Basic IDE is open, return TRUE on success, FASLE on failure</li> - hInitBasicIde() = true - '///</ul> - '///NOTE: The function will try to to clean up after itself in case of any error - end function '******************************************************************************* @@ -746,19 +587,12 @@ function hInsertMacro( _id as integer ) as boolean '///<ul> const CFN = "hInsertMacro::" - dim brc as boolean - - if ( ( _id < 1 ) or ( _id > 3 ) ) then - warnlog( CFN & "Invalid parameter passed to function: " & _id ) - hInsertMacro() = false - exit function - endif - kontext "basicide" + + printlog( CFN & "This function is deprecated" ) '///+<li>Delete the content of the edit window</li> - brc = hDeleteMacro() - if ( not brc ) then + if ( not hDeleteMacro() ) then warnlog( CFN & "Content of Basic-IDE was not deleted" ) hInsertMacro() = false exit function @@ -803,6 +637,7 @@ function hTestMacro( _id as integer ) as integer '///<ul> const CFN = "hTestMacro::" + qaerrorlog( CFN & "This function is deprecated, remove me!" ) kontext "basicide" @@ -843,59 +678,49 @@ end function function hCreateBasicWorkFiles() as string '///<H3>Create a macro, attach it to a file, save the file</H3> - '///<i>Starting point: The first doc or any other plain document</i> + '///<i>Starting point: Any plain document or the backing window</i> '///<ul> const CFN = "hCreateBasicWorkFiles::" const CMACRO = "TestMacro" - ' some returncodes - dim brc as boolean - dim irc as integer - dim crc as string - - dim sFile as string - sFile = hGetBasicWorkFile( "CURRENT" ) + dim sFile as string : sFile = hGetBasicWorkFile( "CURRENT" ) '///+<li>Open a new document</li> - call hCreateDocument() + hCreateDocument() '///+<li>Change the document (to save it)</li> - crc = hChangeDoc() - printlog( CFN & crc ) + printlog( CFN & hChangeDoc() ) '///+<li>Open Basic-Organizer, select the document and create a module</li> - brc = hInitBasicIde( CMACRO ) - if ( not brc ) then + if ( not hInitBasicIde( CMACRO ) ) then printlog( CFN & "Unable to create a module, aborting" ) - call hDestroyDocument() + hDestroyDocument() hCreateBasicWorkFiles() = "" exit function endif '///+<li>Insert a macro that triggers a messagebox</li> - brc = hInsertMacro( 3 ) - if ( not brc ) then + if ( not hInsertMacro( 3 ) ) then printlog( CFN & "Unable to insert macro, aborting" ) hCloseBasicIde() - call hDestroyDocument() + hDestroyDocument() hCreateBasicWorkFiles() = "" exit function endif '///+<li>Close the Basic-IDE</li> - brc = hCloseBasicIde() + hCloseBasicIde() '///+<li>Save the file without autoextension, overwrite existing</li> - brc = hFileSaveAsKill( sFile ) - if ( not brc ) then + if ( not hFileSaveAsKill( sFile ) ) then printlog( CFN & "Unknown error while saving the file. Resetting" ) - call ExitRestartTheOffice + ExitRestartTheOffice hCreateBasicWorkFiles() = "" exit function endif '///+<li>Close the document</li> - call hDestroyDocument() + hDestroyDocument() '///</ul> @@ -906,9 +731,6 @@ end function function hIDESelectTabByIndex( iIndex as integer ) as string - use "global\tools\includes\optional\t_accels.inc" - - '///<h3>Select a tab within the BASIC-IDE by index</h3> '///<i>The BASIC-IDE has to be open and has the focus. This function '///+ selects the tab by sending CTRL+PAGEUP or CTRL+PAGEDOWN to the IDE using @@ -947,7 +769,6 @@ function hIDESelectTabByIndex( iIndex as integer ) as string dim cTabName as string dim iCurrentTab as integer - dim cAccel as string '///<u>Description:</u> '///<ul> @@ -957,15 +778,14 @@ function hIDESelectTabByIndex( iIndex as integer ) as string '///+<li>Retrieve the accelerator to switch tabs</li> '///+<li>Switch tabs</li> select case iIndex - case 0 : cAccel = "" - case 1 : cAccel = hGetAccel( "IDE_SWITCH_TAB-" ) - for iTab = 1 to 20 - BasicIDE.typeKeys( cAccel ) - next iTab - case else: cAccel = hGetAccel( "IDE_SWITCH_TAB+" ) - for iTab = 1 to iIndex - BasicIDE.typeKeys( cAccel ) - next iTab + case 1 : + for iTab = 1 to 20 + BasicIDE.typeKeys( "<MOD1 PAGEDOWN>" ) + next iTab + case else: + for iTab = 1 to iIndex + BasicIDE.typeKeys( "<MOD1 PAGEUP>" ) + next iTab end select '///+<li>Select the Tabbar</li> @@ -978,7 +798,7 @@ function hIDESelectTabByIndex( iIndex as integer ) as string hSelectMenuNr( 3 ) '///+<li>Copy the selected string to the clipboard</li> - EditCopy + hUseAsyncSlot( "EditCopy" ) '///+<li>Send ESC to the tabbar to deselect the tab</li> Kontext "Tabbar" @@ -988,8 +808,9 @@ function hIDESelectTabByIndex( iIndex as integer ) as string cTabName = getClipboardText '///+<li>Print exit message, set return value</li> - printlog( CFN & "Exit with result: " & cTabName ) + if ( GVERBOSE ) then printlog( CFN & "Exit with result: " & cTabName ) hIDESelectTabByIndex() = cTabName '///</ul> end function + diff --git a/testautomation/global/tools/includes/optional/t_basic_organizer_tools.inc b/testautomation/global/tools/includes/optional/t_basic_organizer_tools.inc index cb348d3c1c3f..b813ee2bf706 100644..100755 --- a/testautomation/global/tools/includes/optional/t_basic_organizer_tools.inc +++ b/testautomation/global/tools/includes/optional/t_basic_organizer_tools.inc @@ -70,76 +70,49 @@ end function function hCreateModuleForDoc( optional cName as string ) as boolean - use "global\tools\includes\optional\t_treelist_tools.inc" - use "global\tools\includes\optional\t_stringtools.inc" - '///<h3>Create a new Basic module for the current document</h3> '///<i>Starting point: Basic Macro Organizer is visible and has focus</i> - '///<ul> - const CFN = "hCreateModuleForDoc::" + const DEFAULT_WAIT = 2 + const RETVAL_FAILURE = 0 - dim iWait as integer ' how long we had to wait for the IDE to open - dim iPos as integer - dim brc as boolean ' boolean returncode, a temporary variable - brc = false - dim cMsg as string + if ( isMissing( cName ) ) then cName = "TTModule" - ' make sure that we have a name for the module - if ( isMissing( cName ) ) Then - cName = "TTModule" - endif - - '///+<li>Select the last module (it should belong to the current document)</li> kontext "Makro" - iPos = hSelectTheLastNode( MakroAus ) - - '///+<li>Click the New-Button, name the module</li> - if ( Neu.isEnabled() ) then - 'printlog( CFN & "New-button is enabled" ) - else - warnlog( CFN & "New-button is disabled" ) - hCreateModuleForDoc() = false - exit function - endif - - Neu.Click() - - '///+<li>If the module already exists we end up on the Deletion dialog</li> - kontext "Active" - if ( Active.exists() ) then - cMsg = active.getText() - cMsg = hRemoveLineBreaks( cMsg ) - printlog( "Module seems to exist, deleting Main: " & cMsg ) - Active.Yes() - endif - - Kontext "NeuesModul" - if ( NeuesModul.exists() ) then - Modulname.SetText( cName ) - NeuesModul.OK() + if ( Makro.exists() ) then + if ( hSelectTheLastNode( MakroAus ) > RETVAL_FAILURE ) then + + kontext "Makro" + if ( hClickButton( Neu ) ) then + + Kontext "NeuesModul" + if ( NeuesModul.exists( DEFAULT_WAIT ) ) then + Modulname.SetText( cName ) + hCloseDialog( NeuesModul, "ok" ) + + kontext "BasicIDE" + if ( BasicIde.exists( DEFAULT_WAIT ) ) then + hCreateModuleForDoc() = true + else + printlog( CFN & "BASIC IDE is not open" ) + hCreateModuleForDoc() = false + endif + else + warnlog( CFN & "Dialog <NeuesModul> did not open" ) + hCreateModuleForDoc() = false + endif + else + warnlog( CFN & "Failed to click <Neu> button" ) + hCreateModuleForDoc() = false + endif + else + warnlog( CFN & "Failed to select the last node" ) + hCreateModuleForDoc() = false + endif else - warnlog( CFN & "Failed create a new module, aborting" ) + warnlog( CFN & "Macro organizer is not open" ) hCreateModuleForDoc() = false - kontext "Makro" - Makro.cancel() - exit function endif - - '///+<li>Wait for the BASIC_IDE to open, verify</li> - ' BasicIDE is bad for "Kontexting", using the default toolbar instead - kontext "MacroBar" - if ( MacroBar.exists( 3 ) ) then - printlog( CFN & "Exit: New module: " & cName & ". IDE is open" ) - brc = true - else - warnlog( CFN & "Exit: Failed to create the Module" ) - brc = false - endif - - hCreateModuleForDoc() = brc - '///+<li>Return TRUE on success, FALSE on failure</li> - '///</ul> end function @@ -157,17 +130,12 @@ function hOpenBasicObjectOrganizer( iTabPage as integer ) as boolean ' BASIC-IDE ' NOTE: This is the organizer for libraries, modules and dialogs, ' not the one to run or assign macros! - - dim iMenuSize as integer - dim brc as boolean - '///+<li>Open the context menu of the tabbar</li> kontext "basicide" - Tabbar.OpenContextMenu + Tabbar.OpenContextMenu() '///+<li>Select the last entry of the context menu (dynamic menu!)</li> - iMenuSize = hMenuItemgetCount() - if ( iMenuSize = 2 ) then + if ( hMenuItemGetCount() = 2 ) then printlog( " * short context menu (no edit-window)" ) hMenuSelectNr( 2 ) else @@ -178,13 +146,12 @@ function hOpenBasicObjectOrganizer( iTabPage as integer ) as boolean WaitSlot() '///+<li>On the basic object organizer switch to the Modules tab</li> - brc = hSelectBasicObjectOrganizerTab( 1 ) - if ( not brc ) then + if ( hSelectBasicObjectOrganizerTab( 1 ) ) then + printlog( CFN & "Requested page is open" ) + hOpenBasicObjectOrganizer() = true + else warnlog( CFN & "Failed to open requested Tabpage" ) hOpenBasicObjectOrganizer() = false - else - printlog( CFN & "Requested page is open" ) - hOpenBasicObjectOrganizer = true endif '///+<li>Return TRUE on success, FALSE on failure</li> '///</ul> @@ -194,37 +161,6 @@ end function '******************************************************************************* -function hOpenBasicOrganizerFromDoc() as boolean - - '///<h3>Open the Basic Macro Organizer from a plain document</h3> - '///<i>Starting point: Plain document</i> - '///<ul> - - const CFN = "hOpenBasicOrganizerFromDoc::" - - '///+<li>Use the slot ToolsMacro_uno to open the Basic Macro organizer</li> - ToolsMacro_uno - - '///+<li>Verify that the dialog is open</li> - kontext "Makro" - if ( not Makro.exists() ) then - warnlog( CFN & "Could not open Macro Organizer" ) - hOpenBasicOrganizerFromDoc() = false - exit function - endif - - call dialogtest( Makro ) - - '///+<li>Return TRUE on success, FALSE on failure</li> - printlog( CFN & "Basic Organizer is open" ) - hOpenBasicOrganizerFromDoc() = true - kontext "Makro" - '///</ul> - -end function - -'******************************************************************************* - function hSelectBasicObjectOrganizerTab( iTabPage as integer ) as boolean const CFN = "hSelectBasicObjectOrganizerTab::" @@ -239,13 +175,6 @@ function hSelectBasicObjectOrganizerTab( iTabPage as integer ) as boolean '///Description: '///<ul> - '///+<li>Verify function parameters</li> - if ( ( iTabPage < 1 ) or ( iTabPage > 3 ) ) then - warnlog( CFN & "Illegal argument passed to function: " & iTabPage ) - hSelectBasicObjectOrganizerTab() = false - exit function - endif - '///+<li>Switch between tabpages 1, 2 or 3</li> select case iTabPage case 1 : @@ -295,22 +224,16 @@ function hDeleteLibrary( iLocation as integer, cLibName as string ) as boolean const CFN = "hDeleteLibrary::" const ITABPOS = 3 - '///+<li>Verify function parameters</li> - if ( ( iLocation < 1 ) or ( iLocation > 3 ) ) then - warnlog( CFN & "Invalid parameter passed to function" ) - hDeleteLibrary() = false - endif - dim iObjectCount as integer dim iCurrentObject as integer dim cCurrentObjectName as string '///+<li>Open Macro Organizer</li> - hOpenBasicOrganizerFromDoc() + ToolsMacro_uno '///+<li>Click Manage-button</li> Kontext "Makro" - Verwalten.click() + hClickButton( Verwalten ) '///+<li>Go to the Libraries Tab on the Macro Object Organizer</li> hSelectBasicObjectOrganizerTab( ITABPOS ) @@ -329,7 +252,7 @@ function hDeleteLibrary( iLocation as integer, cLibName as string ) as boolean if ( cCurrentObjectName = cLibName ) then '///+<li>Click Delete</li> - Loeschen.click() + hClickButton( Loeschen ) exit for endif @@ -337,7 +260,7 @@ function hDeleteLibrary( iLocation as integer, cLibName as string ) as boolean '///+<li>Confirm to delete library</li> Kontext "Active" - if ( Active.exists() ) then + if ( Active.exists( 1 ) ) then active.yes() else warnlog( CFN & "No confirmation for delete" ) @@ -354,11 +277,11 @@ function hDeleteLibrary( iLocation as integer, cLibName as string ) as boolean endif '///+<li>Cancel Macro Object Organizer</li> - TabBibliotheken.cancel() + hCloseDialog( TabBibliotheken, "cancel" ) '///+<li>Cancel Basic Macro Organizer</li> Kontext "Makro" - Makro.cancel() + hCloseDialog( Makro, "cancel" ) '///+<li>Return TRUE on success, FALSE on failure</li> '///</ul> @@ -366,84 +289,6 @@ end function '******************************************************************************* -function hIsMacroEditButtonEnabled() as boolean - - '///<h3>Test whether the "Edit..." button is enabled or not</h3> - '///<i>Starting point: Basic Macro Organizer</i> - '///<ul> - - const CFN = "hIsMacroEditButtonEnabled::" - dim brc as boolean - - '///+<li>Check that the macro dialog is open</li> - Kontext "Makro" - if ( not Makro.exists() ) then - warnlog( "Macro organizer is not open, aborting function" ) - hIsMacroEditButtonEnabled() = false - exit function - endif - - '///+<li>Verify that the Edit...-Button exists and is enabled</li> - if ( bearbeiten.exists() ) then - if ( bearbeiten.isEnabled() ) then - printlog( CFN & "Button exists and is enabled" ) - brc = true - else - printlog( CFN & "Button exists but is disabled" ) - brc = false - endif - else - warnlog( CFN & "Button does not exist" ) - brc = false - endif - - '///+<li>Return TRUE if button exists and is enabled</li> - '///</ul> - hIsMacroEditButtonEnabled() = brc - -end function - -'******************************************************************************* - -function hIsMacroNewButtonEnabled() as boolean - - '///<h3>Find out whether the "New..." button is enabled or not</h3> - '///<i>Starting point: Basic Macro Organizer</i> - '///<ul> - - const CFN = "hIsMacroNewButtonEnabled::" - dim brc as boolean - - '///+<li>Check that the macro dialog is open</li> - Kontext "Makro" - if ( not Makro.exists() ) then - warnlog( "Macro organizer is not open, aborting function" ) - hIsMacroNewButtonEnabled() = false - exit function - endif - - '///+<li>Verify that the New...-Button exists and is enabled</li> - if ( neu.exists() ) then - if ( neu.isEnabled() ) then - printlog( CFN & "Button exists and is enabled" ) - brc = true - else - printlog( CFN & "Button exists but is disabled" ) - brc = false - endif - else - warnlog( CFN & "Button does not exist" ) - brc = false - endif - - '///+<li>Return TRUE if button exists and is enabled</li> - '///</ul> - hIsMacroNewButtonEnabled() = brc - -end function - -'******************************************************************************* - function hNameBasicModule( cName as string ) as boolean '///<h3>Name a Basic Module</h3> @@ -466,12 +311,7 @@ function hNameBasicModule( cName as string ) as boolean '///<u>Description</u>: '///<ul> - use "global\tools\includes\optional\t_stringtools.inc" - const CFN = "hNameBasicModule::" - dim brc as boolean - brc = true - dim cMsg as string '///+<li>Verify that the naming dialog is open</li> kontext "NeuesModul" @@ -484,22 +324,20 @@ function hNameBasicModule( cName as string ) as boolean Modulname.SetText( cName ) '///+<li>Accept the name with OK</li> - NeuesModul.OK() + hCloseDialog( NeuesModul, "ok" ) '///+<li>If there is no warning, the name should be valid.</li> kontext "BasicIDE" if ( BasicIde.exists( 2 ) ) then - brc = true + hNameBasicModule() = true printlog( CFN & "Name accepted, Basic-Ide is open" ) else - brc = false + hNameBasicModule() = false '///+<li>Look for invalid name warning, close it</li> kontext "active" if ( active.exists() ) then - cMsg = active.getText() - cMsg = hRemoveLineBreaks( cMsg - printlog( CFN & "Msgbox: " & cMsg ) - active.ok() + printlog( CFN & "Msgbox: " & active.exists() ) + hCloseDialog( active, "ok" ) endif '///+<li>If the name is invalid, get back to the naming-dialog</li> @@ -510,8 +348,6 @@ function hNameBasicModule( cName as string ) as boolean warnlog( CFN & "Naming failed but we are not on the naming dialog" ) endif endif - - hNameBasicModule() = brc '///</ul> end function diff --git a/testautomation/global/tools/includes/optional/t_ctrl_1.inc b/testautomation/global/tools/includes/optional/t_ctrl_1.inc deleted file mode 100644 index d7fd3ac42f81..000000000000 --- a/testautomation/global/tools/includes/optional/t_ctrl_1.inc +++ /dev/null @@ -1,955 +0,0 @@ -'encoding UTF-8 Do not remove or change this line! -'************************************************************************** -' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -' -' Copyright 2000, 2010 Oracle and/or its affiliates. -' -' OpenOffice.org - a multi-platform office productivity suite -' -' This file is part of OpenOffice.org. -' -' OpenOffice.org is free software: you can redistribute it and/or modify -' it under the terms of the GNU Lesser General Public License version 3 -' only, as published by the Free Software Foundation. -' -' OpenOffice.org is distributed in the hope that it will be useful, -' but WITHOUT ANY WARRANTY; without even the implied warranty of -' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -' GNU Lesser General Public License version 3 for more details -' (a copy is included in the LICENSE file that accompanied this code). -' -' You should have received a copy of the GNU Lesser General Public License -' version 3 along with OpenOffice.org. If not, see -' <http://www.openoffice.org/license.html> -' for a copy of the LGPLv3 License. -' -'/************************************************************************ -'* -'* owner : marc.neumann@sun.com -'* -'* short description : -'* -'******************************************************************* -'* -' #1 hChangeControlSettings -'* -'\****************************************************************** - -function hChangeControlSettings ( sType as String, lsProps( ) ) as Boolean - - if bAsianLan = TRUE then - printlog " ******************************************* " - printlog " *** running on asian office version *** " - printlog " ******************************************* " - else - printlog " ******************************************* " - printlog " *** running on non-asian office version *** " - printlog " ******************************************* " - endif - - Kontext "TabGeneralControl" - if TabGeneralControl.Exists = FALSE then - Kontext "TB_MacroControls" - printlog " activate properties for '" + sType + "'" - Properties.Click - Kontext "TabGeneralControl" - Sleep (1) - end if - - printlog "- change global settings" - NameText.SetText "tt_" + sType + "_tt" - ListAppend ( lsProps(), NameText.GetText ) - - if Enabled.GetSelIndex = 1 then - Enabled.Select 2 - else - Enabled.Select 1 - end if - - ListAppend ( lsProps(), Enabled.GetSelText ) - - if sType <> "dialog" then - if Printable.GetSelIndex = 1 then - Printable.Select 2 - else - Printable.Select 1 - end if - ListAppend ( lsProps(), Printable.GetSelText ) - else - ListAppend ( lsProps(), "not testable" ) ' dummy entry - end if - -' PageStep.More 2 -' ListAppend ( lsProps(), PageStep.GetText ) - ListAppend ( lsProps(), "not testable" ) ' dummy entry - Order.More 2 - Height.Less 3 - ListAppend ( lsProps(), Order.GetText ) ' have to be checked after another control is changed ( it depends on the number of controls ) - ListAppend ( lsProps(), Height.GetText ) - Width.More 4 - ListAppend ( lsProps(), Width.GetText ) -' PositionX.More 3 -' ListAppend ( lsProps(), PositionX.GetText ) - ListAppend ( lsProps(), "not testable" ) ' dummy entry -' PositionY.Less 2 -' ListAppend ( lsProps(), PositionY.GetText ) - ListAppend ( lsProps(), "not testable" ) ' dummy entry - Information.SetText "tt info" - ListAppend ( lsProps(), Information.GetText ) - Help.SetText "tt help" - ListAppend ( lsProps(), Help.GetText ) - HelpURL.SetText "www.mopo.de" - ListAppend ( lsProps(), HelpURL.GetText ) - - printlog "- change special settings for '" + sType + "'" -'##### CommandButton ##### - if instr ( lcase ( sType ), "commandbutton" ) then -' SetControlType CTBrowseBox -' Label.TypeKeys "tt_label_tt" -' ListAppend ( lsProps(), Label.GetText ) - ListAppend ( lsProps(), "not testable" ) ' dummy entry - TabStop.Select 3 - ListAppend ( lsProps(), TabStop.GetSelText ) - CharacterSetButton.Click - - Kontext "TabFont" - if bAsianLan = TRUE then - FontEast.Select ( 5 ) - else - Font.Select ( 5 ) - endif - TabFont.OK - - Kontext "TabGeneralControl" - ListAppend ( lsProps(), CharacterSet.GetText ) - Background.Select 17 - ListAppend ( lsProps(), Background.GetSelText ) -' ButtonType.Select 3 -' ListAppend ( lsProps(), ButtonType.GetSelText ) - ListAppend ( lsProps(), "not testable" ) ' dummy entry -' if State.GetSelIndex = 1 then -' State.Select 2 -' else -' State.Select 1 -' end if -' ListAppend ( lsProps(), State.GetSelText ) - - ListAppend ( lsProps(), "not testable" ) ' dummy entry - if DefaultButton.GetSelIndex = 1 then - DefaultButton.Select 2 - else - DefaultButton.Select 2 - end if - - ListAppend ( lsProps(), DefaultButton.GetSelText ) - GraphicsButton.Click - - Kontext "GrafikEinfuegenDlg" - Dateiname.SetText ( ConvertPath ( gTesttoolPath + "global\input\graf_inp\baer.tif" ) ) - DateiTyp.Select 1 ' set the filter to 'all formats' - Oeffnen.Click - - Kontext "TabGeneralControl" - ListAppend ( lsProps(), Graphics.GetText ) - GraphicsAlignment.Select 4 - ListAppend ( lsProps(), GraphicsAlignment.GetSelText ) - end if - -'##### ImageControl ##### - if instr ( lcase ( sType ), "imagecontrol" ) then - Background.Select 14 - ListAppend ( lsProps(), Background.GetSelText ) - GraphicsButton.Click - - Kontext "GrafikEinfuegenDlg" - Dateiname.SetText ( ConvertPath ( gTesttoolPath + "global\input\graf_inp\baer.tif" ) ) - DateiTyp.Select 1 ' set the filter to 'all formats' - Oeffnen.Click - - Kontext "TabGeneralControl" - ListAppend ( lsProps(), Graphics.GetText ) -' if Scale.GetSelIndex = 1 then -' Scale.Select 2 -' else -' Scale.Select 1 -' end if -' ListAppend ( lsProps(), Scale.GetSelText ) - ListAppend ( lsProps(), "not testable" ) ' dummy entry - end if - -'##### CheckBox ##### - if instr ( lcase ( sType ), "checkbox" ) then -' SetControlType CTBrowseBox -' Label.TypeKeys "tt_label_tt" -' ListAppend ( lsProps(), Label.GetText ) - ListAppend ( lsProps(), "not testable" ) ' dummy entry - TabStop.Select 3 - ListAppend ( lsProps(), TabStop.GetSelText ) - -' if State.GetSelIndex = 1 then -' State.Select 2 -' else -' State.Select 1 -' end if -' ListAppend ( lsProps(), State.GetSelText ) - ListAppend ( lsProps(), "not testable" ) ' dummy entry - -' if TriState.GetSelIndex = 1 then -' TriState.Select 2 -' else -' TriState.Select 1 -' end if -' ListAppend ( lsProps(), TriState.GetSelText ) - ListAppend ( lsProps(), "not testable" ) ' dummy entry - end if - -'##### OptionButton ##### - if instr ( lcase ( sType ), "optionbutton" ) then -' SetControlType CTBrowseBox -' Label.TypeKeys "tt_label_tt" -' ListAppend ( lsProps(), Label.GetText ) - ListAppend ( lsProps(), "not testable" ) ' dummy entry - TabStop.Select 3 - ListAppend ( lsProps(), TabStop.GetSelText ) - CharacterSetButton.Click - - Kontext "TabFont" - if bAsianLan = TRUE then - FontEast.Select ( 5 ) - else - Font.Select ( 5 ) - endif - TabFont.OK - - Kontext "TabGeneralControl" - ListAppend ( lsProps(), CharacterSet.GetText ) - -' if State.GetSelIndex = 1 then -' State.Select 2 -' else -' State.Select 1 -' end if -' ListAppend ( lsProps(), State.GetSelText ) - ListAppend ( lsProps(), "not testable" ) ' dummy entry - end if - -'##### Label ##### - if instr ( lcase ( sType ), "label" ) then -' SetControlType CTBrowseBox -' Label.TypeKeys "tt_label_tt" -' ListAppend ( lsProps(), Label.GetText ) - ListAppend ( lsProps(), "not testable" ) ' dummy entry - TabStop.Select 3 - ListAppend ( lsProps(), TabStop.GetSelText ) - - CharacterSetButton.Click - - Kontext "TabFont" - if bAsianLan = TRUE then - FontEast.Select ( 5 ) - else - Font.Select ( 5 ) - endif - TabFont.OK - - Kontext "TabGeneralControl" - ListAppend ( lsProps(), CharacterSet.GetText ) - - Align.Select 4 - ListAppend ( lsProps(), Align.GetSelText ) - Background.Select 20 - ListAppend ( lsProps(), Background.GetSelText ) - Border.Select 3 - ListAppend ( lsProps(), Border.GetSelText ) - - if MultiLine.GetSelIndex = 1 then - MultiLine.Select 2 - else - MultiLine.Select 1 - end if - - ListAppend ( lsProps(), MultiLine.GetSelText ) - end if - -'##### TextField ##### - if instr ( lcase ( sType ), "textfield" ) then -' SetControlType CTBrowseBox -' TextText.TypeKeys "tt_text_tt" -' ListAppend ( lsProps(), TextText.GetText ) - ListAppend ( lsProps(), "not testable" ) ' dummy entry - MaxTextLen.More 5 - ListAppend ( lsProps(), MaxTextLen.GetText ) - - if Readonly.GetSelIndex = 1 then - Readonly.Select 2 - else - Readonly.Select 1 - end if - - ListAppend ( lsProps(), Readonly.GetSelText ) - TabStop.Select 3 - ListAppend ( lsProps(), TabStop.GetSelText ) - CharacterSetButton.Click - - Kontext "TabFont" - if bAsianLan = TRUE then - FontEast.Select ( 5 ) - else - Font.Select ( 5 ) - endif - TabFont.OK - - Kontext "TabGeneralControl" - ListAppend ( lsProps(), CharacterSet.GetText ) - Align.Select 1 - ListAppend ( lsProps(), Align.GetSelText ) - Background.Select 20 - ListAppend ( lsProps(), Background.GetSelText ) - Border.Select 3 - ListAppend ( lsProps(), Border.GetSelText ) - - if MultiLine.GetSelIndex = 1 then - MultiLine.Select 2 - else - MultiLine.Select 1 - end if - - ListAppend ( lsProps(), MultiLine.GetSelText ) - - if ManualLineBreak.GetSelIndex = 1 then - ManualLineBreak.Select 2 - else - ManualLineBreak.Select 1 - end if - - ListAppend ( lsProps(), ManualLineBreak.GetSelText ) - - if HorizontalScroll.GetSelIndex = 1 then - HorizontalScroll.Select 2 - else - HorizontalScroll.Select 1 - end if - - ListAppend ( lsProps(), HorizontalScroll.GetSelText ) - - if VerticalScroll.GetSelIndex = 1 then - VerticalScroll.Select 2 - else - VerticalScroll.Select 1 - end if - - ListAppend ( lsProps(), VerticalScroll.GetSelText ) - Password.SetText "t" - ListAppend ( lsProps(), Password.GetText ) - - end if - -'##### Listbox ##### - if instr ( lcase ( sType ), "listbox" ) then - - if Readonly.GetSelIndex = 1 then - Readonly.Select 2 - else - Readonly.Select 1 - end if - - ListAppend ( lsProps(), Readonly.GetSelText ) - TabStop.Select 3 - ListAppend ( lsProps(), TabStop.GetSelText ) -' SetControlType CTBrowseBox -' ListEntries.TypeKeys "tt_text_tt" -' ListAppend ( lsProps(), ListEntries.GetText ) - ListAppend ( lsProps(), "not testable" ) ' dummy entry - CharacterSetButton.Click - - Kontext "TabFont" - if bAsianLan = TRUE then - FontEast.Select ( 5 ) - else - Font.Select ( 5 ) - endif - TabFont.OK - - Kontext "TabGeneralControl" - ListAppend ( lsProps(), CharacterSet.GetText ) - Background.Select 1 - ListAppend ( lsProps(), Background.GetSelText ) - Border.Select 1 - ListAppend ( lsProps(), Border.GetSelText ) - - if DropDown.GetSelIndex = 1 then - DropDown.Select 2 - else - DropDown.Select 1 - end if - - ListAppend ( lsProps(), DropDown.GetSelText ) - LineCount.Less 1 - ListAppend ( lsProps(), LineCount.GetText ) - - if MultiSelection.GetSelIndex = 1 then - MultiSelection.Select 2 - else - MultiSelection.Select 1 - end if - - ListAppend ( lsProps(), MultiSelection.GetSelText ) - end if - -'##### Combobox ##### - if instr ( lcase ( sType ), "combobox" ) then - - TextText.SetText "tt_text_tt" - ListAppend ( lsProps(), TextText.GetText ) - MaxTextLen.More 2 - ListAppend ( lsProps(), MaxTextLen.GetText ) - - if Readonly.GetSelIndex = 1 then - Readonly.Select 2 - else - Readonly.Select 1 - end if - - ListAppend ( lsProps(), Readonly.GetSelText ) - TabStop.Select 3 - ListAppend ( lsProps(), TabStop.GetSelText ) -' SetControlType CTBrowseBox -' ListEntries.TypeKeys "tt_text_tt" -' ListAppend ( lsProps(), ListEntries.GetText ) - ListAppend ( lsProps(), "not testable" ) ' dummy entry - CharacterSetButton.Click - - Kontext "TabFont" - if bAsianLan = TRUE then - FontEast.Select ( 5 ) - else - Font.Select ( 5 ) - endif - TabFont.OK - - Kontext "TabGeneralControl" - ListAppend ( lsProps(), CharacterSet.GetText ) - Background.Select 1 - ListAppend ( lsProps(), Background.GetSelText ) - Border.Select 1 - ListAppend ( lsProps(), Border.GetSelText ) - - if DropDown.GetSelIndex = 1 then - DropDown.Select 2 - else - DropDown.Select 1 - end if - - ListAppend ( lsProps(), DropDown.GetSelText ) - - if AutoComplete.GetSelIndex = 1 then - AutoComplete.Select 2 - else - AutoComplete.Select 1 - end if - - ListAppend ( lsProps(), AutoComplete.GetSelText ) - LineCount.More 5 - ListAppend ( lsProps(), LineCount.GetText ) - Border.Select 2 ' sometimes the line count is not saved correctly, when it was changed as last property - Border.Select 1 ' as work-around : change another property and then set it to the last entry - - end if - -'##### Scrollbar ##### - if instr ( lcase ( sType ), "scrollbar" ) then - -' ScrollValue.More 5 -' ListAppend ( lsProps(), ScrollValue.GetText ) - ListAppend ( lsProps(), "not testable" ) ' dummy entry -' ScrollValueMax.Less 5 -' ListAppend ( lsProps(), ScrollValueMax.GetText ) - ListAppend ( lsProps(), "not testable" ) ' dummy entry -' LineIncrement.More 1 -' ListAppend ( lsProps(), LineIncrement.GetText ) - ListAppend ( lsProps(), "not testable" ) ' dummy entry -' BlockIncrement.Less 1 -' ListAppend ( lsProps(), BlockIncrement.GetText ) - ListAppend ( lsProps(), "not testable" ) ' dummy entry -' VisibleSize.Less 2 -' ListAppend ( lsProps(), VisibleSize.GetText ) - ListAppend ( lsProps(), "not testable" ) ' dummy entry -' if Orientation.GetSelIndex = 1 then -' Orientation.Select 2 -' else -' Orientation.Select 1 -' end if -' ListAppend ( lsProps(), Orientation.GetSelText ) - ListAppend ( lsProps(), "not testable" ) ' dummy entry - Border.Select 2 - ListAppend ( lsProps(), Border.GetSelText ) - end if - -'##### FrameControl ##### - if instr ( lcase ( sType ), "framecontrol" ) then -' SetControlType CTBrowseBox -' Label.TypeKeys "tt_label_tt" -' ListAppend ( lsProps(), Label.GetText ) - ListAppend ( lsProps(), "not testable" ) ' dummy entry - CharacterSetButton.Click - - Kontext "TabFont" - if bAsianLan = TRUE then - FontEast.Select ( 3 ) - else - Font.Select ( 3 ) - endif - TabFont.OK - - Kontext "TabGeneralControl" - ListAppend ( lsProps(), CharacterSet.GetText ) - - end if - -'##### progressBar ##### - if instr ( lcase ( sType ), "progressbar" ) then - -' ScrollValue.More 5 -' ListAppend ( lsProps(), ScrollValue.GetText ) - ListAppend ( lsProps(), "not testable" ) ' dummy entry -' ScrollValueMax.Less 5 -' ListAppend ( lsProps(), ScrollValueMax.GetText ) - ListAppend ( lsProps(), "not testable" ) ' dummy entry -' LineIncrement.More 1 -' ListAppend ( lsProps(), LineIncrement.GetText ) - ListAppend ( lsProps(), "not testable" ) ' dummy entry -' BlockIncrement.Less 1 -' ListAppend ( lsProps(), BlockIncrement.GetText ) - ListAppend ( lsProps(), "not testable" ) ' dummy entry -' VisibleSize.Less 2 -' ListAppend ( lsProps(), VisibleSize.GetText ) - ListAppend ( lsProps(), "not testable" ) ' dummy entry -' if Orientation.GetSelIndex = 1 then -' Orientation.Select 2 -' else -' Orientation.Select 1 -' end if -' ListAppend ( lsProps(), Orientation.GetSelText ) - ListAppend ( lsProps(), "not testable" ) ' dummy entry - Background.Select 4 - ListAppend ( lsProps(), Background.GetSelText ) - end if - -'##### FixedLine ##### - if instr ( lcase ( sType ), "fixedline" ) then -' SetControlType CTBrowseBox -' Label.TypeKeys "tt_label_tt" -' ListAppend ( lsProps(), Label.GetText ) - ListAppend ( lsProps(), "not testable" ) ' dummy entry -' if Orientation.GetSelIndex = 1 then -' Orientation.Select 2 -' else -' Orientation.Select 1 -' end if -' ListAppend ( lsProps(), Orientation.GetSelText ) - ListAppend ( lsProps(), "not testable" ) ' dummy entry - CharacterSetButton.Click - - Kontext "TabFont" - if bAsianLan = TRUE then - FontEast.Select ( 3 ) - else - Font.Select ( 3 ) - endif - TabFont.OK - - Kontext "TabGeneralControl" - ListAppend ( lsProps(), CharacterSet.GetText ) - end if - - -'##### DateField ##### - if instr ( lcase ( sType ), "datefield" ) then - if StrictFormat.GetSelIndex = 1 then - StrictFormat.Select 2 - else - StrictFormat.Select 1 - end if - ListAppend ( lsProps(), StrictFormat.GetSelText ) - if Readonly.GetSelIndex = 1 then - Readonly.Select 2 - else - Readonly.Select 1 - end if - ListAppend ( lsProps(), Readonly.GetSelText ) - TabStop.Select 2 - ListAppend ( lsProps(), TabStop.GetSelText ) - DateField.More 3 - ListAppend ( lsProps(), DateField.GetText ) - DateMin.More 3 - ListAppend ( lsProps(), DateMin.GetText ) - DateMax.Less 3 - ListAppend ( lsProps(), DateMax.GetText ) - DateFormat.Select 7 - ListAppend ( lsProps(), DateFormat.GetSelText ) - CharacterSetButton.Click - - Kontext "TabFont" - if bAsianLan = TRUE then - FontEast.Select ( 3 ) - else - Font.Select ( 3 ) - endif - TabFont.OK - - Kontext "TabGeneralControl" - ListAppend ( lsProps(), CharacterSet.GetText ) - Background.Select 1 - ListAppend ( lsProps(), Background.GetSelText ) - Border.Select 1 - ListAppend ( lsProps(), Border.GetSelText ) - if DropDown.GetSelIndex = 1 then - DropDown.Select 2 - else - DropDown.Select 1 - end if - ListAppend ( lsProps(), DropDown.GetSelText ) - if Spin.GetSelIndex = 1 then - Spin.Select 2 - else - Spin.Select 1 - end if - ListAppend ( lsProps(), Spin.GetSelText ) - end if - -'##### TimeField ##### - if instr ( lcase ( sType ), "timefield" ) then - - if StrictFormat.GetSelIndex = 1 then - StrictFormat.Select 2 - else - StrictFormat.Select 1 - end if - - ListAppend ( lsProps(), StrictFormat.GetSelText ) - - if Readonly.GetSelIndex = 1 then - Readonly.Select 2 - else - Readonly.Select 1 - end if - - ListAppend ( lsProps(), Readonly.GetSelText ) - TabStop.Select 1 - ListAppend ( lsProps(), TabStop.GetSelText ) - TimeField.Less 3 - ListAppend ( lsProps(), TimeField.GetText ) - TimeMin.More 2 - ListAppend ( lsProps(), TimeMin.GetText ) - TimeMax.Less 3 - ListAppend ( lsProps(), TimeMax.GetText ) - TimeFormat.Select 3 - ListAppend ( lsProps(), TimeFormat.GetSelText ) - CharacterSetButton.Click - - Kontext "TabFont" - if bAsianLan = TRUE then - FontEast.Select ( 3 ) - else - Font.Select ( 3 ) - endif - TabFont.OK - - Kontext "TabGeneralControl" - ListAppend ( lsProps(), CharacterSet.GetText ) - Background.Select 1 - ListAppend ( lsProps(), Background.GetSelText ) - Border.Select 1 - ListAppend ( lsProps(), Border.GetSelText ) - - if Spin.GetSelIndex = 1 then - Spin.Select 2 - else - Spin.Select 1 - end if - - ListAppend ( lsProps(), Spin.GetSelText ) - end if - -'##### NumericField ##### - if instr ( lcase ( sType ), "numericfield" ) then - - if StrictFormat.GetSelIndex = 1 then - StrictFormat.Select 2 - else - StrictFormat.Select 1 - end if - - ListAppend ( lsProps(), StrictFormat.GetSelText ) - - if Readonly.GetSelIndex = 1 then - Readonly.Select 2 - else - Readonly.Select 1 - end if - - ListAppend ( lsProps(), Readonly.GetSelText ) - TabStop.Select 1 - ListAppend ( lsProps(), TabStop.GetSelText ) - Value.Less 3 - ListAppend ( lsProps(), Value.GetText ) - ValueMin.Less 2 - ListAppend ( lsProps(), ValueMin.GetText ) - ValueMax.Less 3 - ListAppend ( lsProps(), ValueMax.GetText ) - ValueStep.More 5 - ListAppend ( lsProps(), ValueStep.GetText ) - Accuray.More 3 - ListAppend ( lsProps(), Accuray.GetText ) - - if ThousandSeperator.GetSelIndex = 1 then - ThousandSeperator.Select 2 - else - ThousandSeperator.Select 1 - end if - - ListAppend ( lsProps(), ThousandSeperator.GetSelText ) - CharacterSetButton.Click - - Kontext "TabFont" - if bAsianLan = TRUE then - FontEast.Select ( 3 ) - else - Font.Select ( 3 ) - endif - TabFont.OK - - Kontext "TabGeneralControl" - ListAppend ( lsProps(), CharacterSet.GetText ) - Background.Select 1 - ListAppend ( lsProps(), Background.GetSelText ) - Border.Select 1 - ListAppend ( lsProps(), Border.GetSelText ) - if Spin.GetSelIndex = 1 then - Spin.Select 2 - else - Spin.Select 1 - end if - ListAppend ( lsProps(), Spin.GetSelText ) - end if - - -'##### CurrencyField ##### - if instr ( lcase ( sType ), "currencyfield" ) then - - if StrictFormat.GetSelIndex = 1 then - StrictFormat.Select 2 - else - StrictFormat.Select 1 - end if - - ListAppend ( lsProps(), StrictFormat.GetSelText ) - - if Readonly.GetSelIndex = 1 then - Readonly.Select 2 - else - Readonly.Select 1 - end if - - ListAppend ( lsProps(), Readonly.GetSelText ) - TabStop.Select 1 - ListAppend ( lsProps(), TabStop.GetSelText ) - Value.Less 3 - ListAppend ( lsProps(), Value.GetText ) - ValueMin.Less 2 - ListAppend ( lsProps(), ValueMin.GetText ) - ValueMax.Less 3 - ListAppend ( lsProps(), ValueMax.GetText ) - ValueStep.More 5 - ListAppend ( lsProps(), ValueStep.GetText ) - Accuray.More 2 - ListAppend ( lsProps(), Accuray.GetText ) - - if ThousandSeperator.GetSelIndex = 1 then - ThousandSeperator.Select 2 - else - ThousandSeperator.Select 1 - end if - - ListAppend ( lsProps(), ThousandSeperator.GetSelText ) - CurrencySymbol.SetText "#" - ListAppend ( lsProps(), CurrencySymbol.GetText ) - - if CurrSymPosition.GetSelIndex = 1 then - CurrSymPosition.Select 2 - else - CurrSymPosition.Select 1 - end if - - ListAppend ( lsProps(), CurrSymPosition.GetSelText ) - CharacterSetButton.Click - - Kontext "TabFont" - if bAsianLan = TRUE then - FontEast.Select ( 3 ) - else - Font.Select ( 3 ) - endif - TabFont.OK - - Kontext "TabGeneralControl" - ListAppend ( lsProps(), CharacterSet.GetText ) - Background.Select 1 - ListAppend ( lsProps(), Background.GetSelText ) - Border.Select 1 - ListAppend ( lsProps(), Border.GetSelText ) - - if Spin.GetSelIndex = 1 then - Spin.Select 2 - else - Spin.Select 1 - end if - - ListAppend ( lsProps(), Spin.GetSelText ) - end if - -'##### FormattedField ##### - if instr ( lcase ( sType ), "formattedfield" ) then - MaxTextLen.More 4 - ListAppend ( lsProps(), MaxTextLen.GetText ) - - if StrictFormat.GetSelIndex = 1 then - StrictFormat.Select 2 - else - StrictFormat.Select 1 - end if - - ListAppend ( lsProps(), StrictFormat.GetSelText ) - - if Readonly.GetSelIndex = 1 then - Readonly.Select 2 - else - Readonly.Select 1 - end if - - ListAppend ( lsProps(), Readonly.GetSelText ) - TabStop.Select 1 - ListAppend ( lsProps(), TabStop.GetSelText ) -' Effective.SetText "2" -' ListAppend ( lsProps(), Effective.GetText ) - ListAppend ( lsProps(), "not testable" ) ' dummy entry - EffectiveMin.SetText "1" - ListAppend ( lsProps(), EffectiveMin.GetText ) - EffectiveMax.SetText "1" - ListAppend ( lsProps(), EffectiveMax.GetText ) - FormatkeyButton.Click - - Kontext "ZahlenFormat" - Kategorie.Select 3 - Kategorieformat.Select ( Kategorieformat.GetItemCount ) - ZahlenFormat.OK - - Kontext "TabGeneralControl" - ListAppend ( lsProps(), FormatKey.GetText ) - CharacterSetButton.Click - - Kontext "TabFont" - if bAsianLan = TRUE then - FontEast.Select ( 3 ) - else - Font.Select ( 3 ) - endif - TabFont.OK - - Kontext "TabGeneralControl" - ListAppend ( lsProps(), CharacterSet.GetText ) - Align.Select 1 - ListAppend ( lsProps(), Align.GetSelText ) - Background.Select 1 - ListAppend ( lsProps(), Background.GetSelText ) - Border.Select 1 - ListAppend ( lsProps(), Border.GetSelText ) - - if Spin.GetSelIndex = 1 then - Spin.Select 2 - else - Spin.Select 1 - end if - - ListAppend ( lsProps(), Spin.GetSelText ) - end if - -'##### PatternField ##### - if instr ( lcase ( sType ), "patternfield" ) then - TextText.SetText "tt_text_tt" - ListAppend ( lsProps(), TextText.GetText ) - MaxTextLen.More 4 - ListAppend ( lsProps(), MaxTextLen.GetText ) - EditMask.SetText "aeiopu" - ListAppend ( lsProps(), EditMask.GetText ) - LiteralMask.SetText "upqpsd" - ListAppend ( lsProps(), LiteralMask.GetText ) - - if StrictFormat.GetSelIndex = 1 then - StrictFormat.Select 2 - else - StrictFormat.Select 1 - end if - - ListAppend ( lsProps(), StrictFormat.GetSelText ) - - if Readonly.GetSelIndex = 1 then - Readonly.Select 2 - else - Readonly.Select 1 - end if - - ListAppend ( lsProps(), Readonly.GetSelText ) - TabStop.Select 1 - ListAppend ( lsProps(), TabStop.GetSelText ) - CharacterSetButton.Click - - Kontext "TabFont" - if bAsianLan = TRUE then - FontEast.Select ( 3 ) - else - Font.Select ( 3 ) - endif - TabFont.OK - - Kontext "TabGeneralControl" - ListAppend ( lsProps(), CharacterSet.GetText ) - Background.Select 1 - ListAppend ( lsProps(), Background.GetSelText ) - Border.Select 1 - ListAppend ( lsProps(), Border.GetSelText ) - end if - -'##### FileControl ##### - if instr ( lcase ( sType ), "filecontrol" ) then - TextText.SetText "tt_text_tt" - ListAppend ( lsProps(), TextText.GetText ) - - if Readonly.GetSelIndex = 1 then - Readonly.Select 2 - else - Readonly.Select 1 - end if - - ListAppend ( lsProps(), Readonly.GetSelText ) - TabStop.Select 1 - ListAppend ( lsProps(), TabStop.GetSelText ) - CharacterSetButton.Click - - Kontext "TabFont" - if bAsianLan = TRUE then - FontEast.Select ( 3 ) - else - Font.Select ( 3 ) - endif - TabFont.OK - - Kontext "TabGeneralControl" - ListAppend ( lsProps(), CharacterSet.GetText ) - Background.Select 1 - ListAppend ( lsProps(), Background.GetSelText ) - Border.Select 1 - ListAppend ( lsProps(), Border.GetSelText ) - end if - -end function diff --git a/testautomation/global/tools/includes/optional/t_ctrl_2.inc b/testautomation/global/tools/includes/optional/t_ctrl_2.inc deleted file mode 100644 index 498f6f9f33ce..000000000000 --- a/testautomation/global/tools/includes/optional/t_ctrl_2.inc +++ /dev/null @@ -1,355 +0,0 @@ -'encoding UTF-8 Do not remove or change this line! -'************************************************************************** -' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -' -' Copyright 2000, 2010 Oracle and/or its affiliates. -' -' OpenOffice.org - a multi-platform office productivity suite -' -' This file is part of OpenOffice.org. -' -' OpenOffice.org is free software: you can redistribute it and/or modify -' it under the terms of the GNU Lesser General Public License version 3 -' only, as published by the Free Software Foundation. -' -' OpenOffice.org is distributed in the hope that it will be useful, -' but WITHOUT ANY WARRANTY; without even the implied warranty of -' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -' GNU Lesser General Public License version 3 for more details -' (a copy is included in the LICENSE file that accompanied this code). -' -' You should have received a copy of the GNU Lesser General Public License -' version 3 along with OpenOffice.org. If not, see -' <http://www.openoffice.org/license.html> -' for a copy of the LGPLv3 License. -' -'/************************************************************************ -'* -'* owner : marc.neumann@sun.com -'* -'* short description : -'* -'******************************************************************* -'* -' #1 hCheckControlSettings -'* -'\****************************************************************** - -function hCheckControlSettings ( sType as String, lsProps( ) ) as Boolean - - Kontext "TabGeneralControl" - if TabGeneralControl.Exists = FALSE then - Kontext "TB_MacroControls" - printlog " activate properties for '" + sType + "'" - Properties.Click - Kontext "TabGeneralControl" - Sleep (1) - end if - - printlog "- check global settings" - if NameText.GetText <> lsProps(1) then Warnlog "Name => changes not saved! should : '" + lsProps(1) + "' is : '" + NameText.GetText + "'" - if Enabled.GetSelText <> lsProps(2) then Warnlog "Enabled => changes not saved! should : '" + lsProps(2) + "' is : '" + Enabled.GetSelText + "'" - if sType <> "dialog" then - if Printable.GetSelText <> lsProps(3) then Warnlog "Printable => changes not saved! should : '" + lsProps(3) + "' is : '" + Printable.GetSelText + "'" - end if -' if PageStep.GetText <> lsProps(4) then Warnlog "Page Step => changes not saved! should : '" + lsProps(4) + "' is : '" + PageStep.GetText + "'" - if Order.GetText <> lsProps(5) then Warnlog "Order => changes not saved! should : '" + lsProps(5) + "' is : '" + Order.GetText + "'" - if Height.GetText <> lsProps(6) then Warnlog "Height => changes not saved! should : '" + lsProps(6) + "' is : '" + Height.GetText + "'" - if Width.GetText <> lsProps(7) then Warnlog "Width => changes not saved! should : '" + lsProps(7) + "' is : '" + Width.GetText + "'" -' if PositionX.GetText <> lsProps(8) then Warnlog "Position x => changes not saved! should : '" + lsProps(8) + "' is : '" + PositionX.GetText + "'" -' if PositionY.GetText <> lsProps(9) then Warnlog "Position y => changes not saved! should : '" + lsProps(9) + "' is : '" + PositionY.GetText + "'" - if Information.GetText <> lsProps(10) then Warnlog "Information => changes not saved! should : '" + lsProps(10) + "' is : '" + Information.GetText + "'" - if Help.GetText <> lsProps(11) then Warnlog "Help => changes not saved! should : '" + lsProps(11) + "' is : '" + Help.GetText + "'" - if HelpURL.GetText <> lsProps(12) then Warnlog "Help URL => changes not saved! should : '" + lsProps(12) + "' is : '" + HelpURL.GetText + "'" - - printlog "- check special settings for " + sType - -'##### CommandButton ##### - if instr ( lcase ( sType ), "commandbutton" ) then -' if Label.GetText <> lsProps(13) then Warnlog "Label => changes not saved! should : '" + lsProps(13) + "' is : '" + Label.GetText + "'" - if TabStop.GetSelText <> lsProps(14) then Warnlog "Tab stop => changes not saved! should : '" + lsProps(14) + "' is : '" + TabStop.GetSelText + "'" - if CharacterSet.GetText <> lsProps(15) then Warnlog "Character set => changes not saved! should : '" + lsProps(15) + "' is : '" + CharacterSet.GetText + "'" - if Background.GetSelText <> lsProps(16) then Warnlog "Background => changes not saved! should : '" + lsProps(16) + "' is : '" + Background.GetSelText + "'" -' if ButtonType.GetSelText <> lsProps(17) then Warnlog "Button type => changes not saved! should : '" + lsProps(17) + "' is : '" + ButtonType.GetSelText + "'" -' if State.GetSelText <> lsProps(18) then Warnlog "State => changes not saved! should : '" + lsProps(18) + "' is : '" + State.GetSelText + "'" - if DefaultButton.GetSelText <> lsProps(19) then Warnlog "Default button => changes not saved! should : '" + lsProps(19) + "' is : '" + DefaultButton.GetSelText + "'" - if Graphics.GetText <> lsProps(20) then Warnlog "Graphics => changes not saved! should : '" + lsProps(20) + "' is : '" + Graphics.GetText + "'" - if GraphicsAlignment.GetSelText <> lsProps(21) then Warnlog "Graphics alignment => changes not saved! should : '" + lsProps(21) + "' is : '" + GraphicsAlignment.GetSelText + "'" - end if - -'##### ImageControl ##### - if instr ( lcase ( sType ), "imagecontrol" ) then - if Background.GetSelText <> lsProps(13) then Warnlog "Background => changes not saved! should : '" + lsProps(13) + "' is : '" + Background.GetSelText + "'" - if Graphics.GetText <> lsProps(14) then Warnlog "Graphics => changes not saved! should : '" + lsProps(14) + "' is : '" + Graphics.GetText + "'" -' if Scale.GetSelText <> lsProps(15) then Warnlog "Scale => changes not saved! should : '" + lsProps(15) + "' is : '" + Scale.GetSelText + "'" - end if - -'##### CheckBox ##### - if instr ( lcase ( sType ), "checkbox" ) then -' if Label.GetText <> lsProps(13) then Warnlog "Label => changes not saved! should : '" + lsProps(13) + "' is : '" + Label.GetText + "'" - if TabStop.GetSelText <> lsProps(14) then Warnlog "Tab stop => changes not saved! should : '" + lsProps(14) + "' is : '" + TabStop.GetSelText + "'" -' if State.GetSelText <> lsProps(15) then Warnlog "State => changes not saved! should : '" + lsProps(15) + "' is : '" + State.GetSelText + "'" -' if TriState.GetSelText <> lsProps(16) then Warnlog "TriState => changes not saved! should : '" + lsProps(16) + "' is : '" + TriState.GetSelText + "'" - end if - -'##### OptionButton ##### - if instr ( lcase ( sType ), "optionbutton" ) then -' if Label.GetText <> lsProps(13) then Warnlog "Label => changes not saved! should : '" + lsProps(13) + "' is : '" + Label.GetText + "'" - if TabStop.GetSelText <> lsProps(14) then Warnlog "Tab stop => changes not saved! should : '" + lsProps(14) + "' is : '" + TabStop.GetSelText + "'" - if CharacterSet.GetText <> lsProps(15) then Warnlog "Character set => changes not saved! should : '" + lsProps(15) + "' is : '" + CharacterSet.GetText + "'" -' if State.GetSelText <> lsProps(16) then Warnlog "State => changes not saved! should : '" + lsProps(16) + "' is : '" + State.GetSelText + "'" - end if - -'##### Label ##### - if instr ( lcase ( sType ), "label" ) then -' if Label.GetText <> lsProps(13) then Warnlog "Label => changes not saved! should : '" + lsProps(13) + "' is : '" + Label.GetText + "'" - if TabStop.GetSelText <> lsProps(14) then Warnlog "Tab stop => changes not saved! should : '" + lsProps(14) + "' is : '" + TabStop.GetSelText + "'" - if CharacterSet.GetText <> lsProps(15) then Warnlog "Character set => changes not saved! should : '" + lsProps(15) + "' is : '" + CharacterSet.GetText + "'" - if Align.GetSelText <> lsProps(16) then Warnlog "Alignment => changes not saved! should : '" + lsProps(16) + "' is : '" + Align.GetSelText + "'" - if Background.GetSelText <> lsProps(17) then Warnlog "Background => changes not saved! should : '" + lsProps(17) + "' is : '" + Background.GetSelText + "'" - if Border.GetSelText <> lsProps(18) then Warnlog "Border => changes not saved! should : '" + lsProps(18) + "' is : '" + Border.GetSelText + "'" - if MultiLine.GetSelText <> lsProps(19) then Warnlog "MultiLine => changes not saved! should : '" + lsProps(19) + "' is : '" + MultiLine.GetSelText + "'" - end if - -'##### TextField ##### - if instr ( lcase ( sType ), "textfield" ) then -' if TextText.GetText <> lsProps(13) then Warnlog "Text => changes not saved! should : '" + lsProps(13) + "' is : '" + TextText.GetText + "'" - if MaxTextLen.GetText <> lsProps(14) then Warnlog "Max text lengh => changes not saved! should : '" + lsProps(14) + "' is : '" + MaxTextLen.GetText + "'" - if Readonly.GetSelText <> lsProps(15) then Warnlog "Readonly => changes not saved! should : '" + lsProps(15) + "' is : '" + Readonly.GetSelText + "'" - if TabStop.GetSelText <> lsProps(16) then Warnlog "Tab stop => changes not saved! should : '" + lsProps(16) + "' is : '" + TabStop.GetSelText + "'" - if CharacterSet.GetText <> lsProps(17) then Warnlog "Character set => changes not saved! should : '" + lsProps(17) + "' is : '" + CharacterSet.GetText + "'" - if Align.GetSelText <> lsProps(18) then Warnlog "Alignment => changes not saved! should : '" + lsProps(18) + "' is : '" + Align.GetSelText + "'" - if Background.GetSelText <> lsProps(19) then Warnlog "Background => changes not saved! should : '" + lsProps(19) + "' is : '" + Background.GetSelText + "'" - if Border.GetSelText <> lsProps(20) then Warnlog "Border => changes not saved! should : '" + lsProps(20) + "' is : '" + Border.GetSelText + "'" - if MultiLine.GetSelText <> lsProps(21) then Warnlog "MultiLine => changes not saved! should : '" + lsProps(21) + "' is : '" + MultiLine.GetSelText + "'" - if ManualLineBreak.GetSelText <> lsProps(22) then Warnlog "Manual line break => changes not saved! should : '" + lsProps(22) + "' is : '" + ManualLineBreak.GetSelText + "'" - if HorizontalScroll.GetSelText <> lsProps(23) then Warnlog "Horizontal scrollbar => changes not saved! should : '" + lsProps(23) + "' is : '" + HorizontalScroll.GetSelText + "'" - if VerticalScroll.GetSelText <> lsProps(24) then Warnlog "Vertical scrollbar => changes not saved! should : '" + lsProps(24) + "' is : '" + VerticalScroll.GetSelText + "'" - if Password.GetText <> lsProps(25) then Warnlog "Password => changes not saved! should : '" + lsProps(25) + "' is : '" + Password.GetText + "'" - end if - -'##### Listbox ##### - if instr ( lcase ( sType ), "listbox" ) then - if Readonly.GetSelText <> lsProps(13) then Warnlog "Readonly => changes not saved! should : '" + lsProps(13) + "' is : '" + Readonly.GetSelText + "'" - if TabStop.GetSelText <> lsProps(14) then Warnlog "Tab stop => changes not saved! should : '" + lsProps(14) + "' is : '" + TabStop.GetSelText + "'" -' if ListEntries.GetText <> lsProps(15) then Warnlog "List entries => changes not saved! should : '" + lsProps(15) + "' is : '" + ListEntries.GetText + "'" - if CharacterSet.GetText <> lsProps(16) then Warnlog "Character set => changes not saved! should : '" + lsProps(16) + "' is : '" + CharacterSet.GetText + "'" - if Background.GetSelText <> lsProps(17) then Warnlog "Background => changes not saved! should : '" + lsProps(17) + "' is : '" + Background.GetSelText + "'" - if Border.GetSelText <> lsProps(18) then Warnlog "Border => changes not saved! should : '" + lsProps(18) + "' is : '" + Border.GetSelText + "'" - if DropDown.GetSelText <> lsProps(19) then Warnlog "Drop Down => changes not saved! should : '" + lsProps(19) + "' is : '" + DropDown.GetSelText + "'" - if LineCount.GetText <> lsProps(20) then Warnlog "Line counte => changes not saved! should : '" + lsProps(20) + "' is : '" + LineCount.GetText + "'" - if MultiSelection.GetSelText <> lsProps(21) then Warnlog "Multi selection. => changes not saved! should : '" + lsProps(21) + "' is : '" + MultiSelection.GetSelText + "'" - end if - -'##### Combobox ##### - if instr ( lcase ( sType ), "combobox" ) then - if TextText.GetText <> lsProps(13) then Warnlog "Text => changes not saved! should : '" + lsProps(13) + "' is : '" + TextText.GetText + "'" - if MaxTextLen.GetText <> lsProps(14) then Warnlog "Max text lenght => changes not saved! should : '" + lsProps(14) + "' is : '" + MaxTextLen.GetText + "'" - if Readonly.GetSelText <> lsProps(15) then Warnlog "Readonly => changes not saved! should : '" + lsProps(15) + "' is : '" + Readonly.GetSelText + "'" - if TabStop.GetSelText <> lsProps(16) then Warnlog "Tab stop => changes not saved! should : '" + lsProps(16) + "' is : '" + TabStop.GetSelText + "'" -' if ListEntries.GetText <> lsProps(17) then Warnlog "List entries => changes not saved! should : '" + lsProps(17) + "' is : '" + ListEntries.GetText + "'" - if CharacterSet.GetText <> lsProps(18) then Warnlog "Character set => changes not saved! should : '" + lsProps(18) + "' is : '" + CharacterSet.GetText + "'" - if Background.GetSelText <> lsProps(19) then Warnlog "Background => changes not saved! should : '" + lsProps(19) + "' is : '" + Background.GetSelText + "'" - if Border.GetSelText <> lsProps(20) then Warnlog "Border => changes not saved! should : '" + lsProps(20) + "' is : '" + Border.GetSelText + "'" - if DropDown.GetSelText <> lsProps(21) then Warnlog "Drop Down => changes not saved! should : '" + lsProps(21) + "' is : '" + DropDown.GetSelText + "'" - if AutoComplete.GetSelText <> lsProps(22) then Warnlog "Auto complete => changes not saved! should : '" + lsProps(22) + "' is : '" + AutoComplete.GetSelText + "'" - if LineCount.GetText <> lsProps(23) then Warnlog "Line count => changes not saved! should : '" + lsProps(23) + "' is : '" + LineCount.GetText + "'" - end if - -'##### Scrollbar ##### - if instr ( lcase ( sType ), "scrollbar" ) then -' if ScrollValue.GetText <> lsProps(13) then Warnlog "Scroll value => changes not saved! should : '" + lsProps(13) + "' is : '" + ScrollValue.GetText + "'" -' if ScrollValueMax.GetText <> lsProps(14) then Warnlog "Scroll value max => changes not saved! should : '" + lsProps(14) + "' is : '" + ScrollValueMax.GetText + "'" -' if LineIncrement.GetText <> lsProps(15) then Warnlog "Line increment => changes not saved! should : '" + lsProps(15) + "' is : '" + LineIncrement.GetText + "'" -' if BlockIncrement.GetText <> lsProps(16) then Warnlog "Block increment => changes not saved! should : '" + lsProps(16) + "' is : '" + BlockIncrement.GetText + "'" -' if VisibleSize.GetText <> lsProps(17) then Warnlog "Visible size => changes not saved! should : '" + lsProps(17) + "' is : '" + VisibleSize.GetText + "'" -' if Orientation.GetSelText <> lsProps(18) then Warnlog "Orientation => changes not saved! should : '" + lsProps(18) + "' is : '" + Orientation.GetSelText + "'" - if Border.GetSelText <> lsProps(19) then Warnlog "Border => changes not saved! should : '" + lsProps(19) + "' is : '" + Border.GetSelText + "'" - end if - -'##### FrameControl ##### - if instr ( lcase ( sType ), "framecontrol" ) then -' if Label.GetText <> lsProps(13) then Warnlog "Label => changes not saved! should : '" + lsProps(13) + "' is : '" + Label.GetText + "'" - if CharacterSet.GetText <> lsProps(14) then Warnlog "Character set => changes not saved! should : '" + lsProps(14) + "' is : '" + CharacterSet.GetText + "'" - end if - - -'##### progressBar ##### - if instr ( lcase ( sType ), "progressbar" ) then -' if ScrollValue.GetText <> lsProps(13) then Warnlog "Scroll value => changes not saved! should : '" + lsProps(13) + "' is : '" + ScrollValue.GetText + "'" -' if ScrollValueMax.GetText <> lsProps(14) then Warnlog "Scroll value max. => changes not saved! should : '" + lsProps(14) + "' is : '" + ScrollValueMax.GetText + "'"' -' if LineIncrement.GetText <> lsProps(15) then Warnlog "Line increment => changes not saved! should : '" + lsProps(15) + "' is : '" + LineIncrement.GetText + "'"' -' if BlockIncrement.GetText <> lsProps(16) then Warnlog "Block increment => changes not saved! should : '" + lsProps(16) + "' is : '" + BlockIncrement.GetText + "'"' -' if VisibleSize.GetText <> lsProps(17) then Warnlog "Visible size => changes not saved! should : '" + lsProps(17) + "' is : '" + VisibleSize.GetText + "'"' -' if Orientation.GetSelText <> lsProps(18) then Warnlog "Orientation => changes not saved! should : '" + lsProps(18) + "' is : '" + Orientation.GetSelTextGetText + "'"' - if Background.GetSelText <> lsProps(19) then Warnlog "Background => changes not saved! should : '" + lsProps(19) + "' is : '" + Background.GetSelText + "'" - end if - -'##### FixedLine ##### - if instr ( lcase ( sType ), "fixedline" ) then -' if Label.GetText <> lsProps(13) then Warnlog "Label => changes not saved! should : '" + lsProps(13) + "' is : '" + Label.GetText + "'" -' if Orientation.GetSelText <> lsProps(14) then Warnlog "Orientation => changes not saved! should : '" + lsProps(14) + "' is : '" + Orientation.GetSelTextGetText + "'"' - if CharacterSet.GetText <> lsProps(15) then Warnlog "Character set => changes not saved! should : '" + lsProps(15) + "' is : '" + CharacterSet.GetText + "'" - end if - -'##### DateField ##### - if instr ( lcase ( sType ), "datefield" ) then - if StrictFormat.GetSelText <> lsProps(13) then Warnlog "Strict format => changes not saved! should : '" + lsProps(13) + "' is : '" + StrictFormat.GetSelText + "'"' - if Readonly.GetSelText <> lsProps(14) then Warnlog "Read only => changes not saved! should : '" + lsProps(14) + "' is : '" + Readonly.GetSelText + "'" - if TabStop.GetSelText <> lsProps(15) then Warnlog "Tab stop => changes not saved! should : '" + lsProps(15) + "' is : '" + TabStop.GetSelText + "'" - if DateField.GetText <> lsProps(16) then Warnlog "Date => changes not saved! should : '" + lsProps(16) + "' is : '" + DateField.GetSelText + "'" - if DateMin.GetText <> lsProps(17) then Warnlog "Date min. => changes not saved! should : '" + lsProps(17) + "' is : '" + DateMin.GetSelText + "'" - if DateMax.GetText <> lsProps(18) then Warnlog "Date max => changes not saved! should : '" + lsProps(18) + "' is : '" + DateMax.GetSelText + "'" - if DateFormat.GetSelText <> lsProps(19) then Warnlog "Date format => changes not saved! should : '" + lsProps(19) + "' is : '" + DateFormat.GetSelText + "'" - if CharacterSet.GetText <> lsProps(20) then Warnlog "Character set => changes not saved! should : '" + lsProps(20) + "' is : '" + CharacterSet.GetText + "'" - if Background.GetSelText <> lsProps(21) then Warnlog "Background => changes not saved! should : '" + lsProps(21) + "' is : '" + Background.GetSelText + "'" - if Border.GetSelText <> lsProps(22) then Warnlog "Border => changes not saved! should : '" + lsProps(22) + "' is : '" + Border.GetSelText + "'" - if DropDown.GetSelText <> lsProps(23) then Warnlog "Drop Down => changes not saved! should : '" + lsProps(23) + "' is : '" + DropDown.GetSelText + "'" - if Spin.GetSelText <> lsProps(24) then Warnlog "Spin button => changes not saved! should : '" + lsProps(24) + "' is : '" + Spin.GetSelText + "'" - end if - -'##### TimeField ##### - if instr ( lcase ( sType ), "timefield" ) then - if StrictFormat.GetSelText <> lsProps(13) then Warnlog "Strict format => changes not saved! should : '" + lsProps(13) + "' is : '" + StrictFormat.GetSelText + "'"' - if Readonly.GetSelText <> lsProps(14) then Warnlog "Read only => changes not saved! should : '" + lsProps(14) + "' is : '" + Readonly.GetSelText + "'" - if TabStop.GetSelText <> lsProps(15) then Warnlog "Tab stop => changes not saved! should : '" + lsProps(15) + "' is : '" + TabStop.GetSelText + "'" - if TimeField.GetText <> lsProps(16) then Warnlog "Time => changes not saved! should : '" + lsProps(16) + "' is : '" + TimeField.GetText + "'" - if TimeMin.GetText <> lsProps(17) then Warnlog "Time min. => changes not saved! should : '" + lsProps(17) + "' is : '" + TimeMin.GetText + "'" - if TimeMax.GetText <> lsProps(18) then Warnlog "Time max => changes not saved! should : '" + lsProps(18) + "' is : '" + TimeMax.Getext + "'" - if TimeFormat.GetSelText <> lsProps(19) then Warnlog "Time format => changes not saved! should : '" + lsProps(19) + "' is : '" + TimeFormat.GetSelText + "'" - if CharacterSet.GetText <> lsProps(20) then Warnlog "Character set => changes not saved! should : '" + lsProps(20) + "' is : '" + CharacterSet.GetText + "'" - if Background.GetSelText <> lsProps(21) then Warnlog "Background => changes not saved! should : '" + lsProps(21) + "' is : '" + Background.GetSelText + "'" - if Border.GetSelText <> lsProps(22) then Warnlog "Border => changes not saved! should : '" + lsProps(22) + "' is : '" + Border.GetSelText + "'" - if Spin.GetSelText <> lsProps(23) then Warnlog "Spin button => changes not saved! should : '" + lsProps(23) + "' is : '" + Spin.GetSelText + "'" - end if - -'##### NumericField ##### - if instr ( lcase ( sType ), "numericfield" ) then - if StrictFormat.GetSelText <> lsProps(13) then Warnlog "Strict format => changes not saved! should : '" + lsProps(13) + "' is : '" + StrictFormat.GetSelText + "'"' - if Readonly.GetSelText <> lsProps(14) then Warnlog "Read only => changes not saved! should : '" + lsProps(14) + "' is : '" + Readonly.GetSelText + "'" - if TabStop.GetSelText <> lsProps(15) then Warnlog "Tab stop => changes not saved! should : '" + lsProps(15) + "' is : '" + TabStop.GetSelText + "'" - - if Value.GetText <> lsProps(16) then - if Value.GetText <> lsProps(16) + "000" then - Warnlog "Value => changes not saved! should : '" + lsProps(16) + "' is : '" + Value.GetText + "'" - else - Warnlog "Value => changes not saved! should : '" + lsProps(16) + "' is : '" + Value.GetText + "'" - end if - end if - if ValueMin.GetText <> lsProps(17) then - if ValueMin.GetText <> "-1,000,002.00000" then - Warnlog "Value min. => changes not saved! should : '-1,000,002.00000' is : '" + ValueMin.GetText + "'" - else - Warnlog "Value min. => changes not saved! should : '" + lsProps(17) + "' is : '" + ValueMin.GetText + "'" - end if - end if - if ValueMax.GetText <> lsProps(18) then - if ValueMax.GetText <> "999,997.00000" then - Warnlog "Value max => changes not saved! should : '999,997.00000' is : '" + ValueMax.GetText + "'" - else - Warnlog "Value max => changes not saved! should : '" + lsProps(18) + "' is : '" + ValueMax.GetText + "'" - end if - end if - if ValueStep.GetText <> lsProps(19) then Warnlog "Incr./decrement value => changes not saved! should : '" + lsProps(19) + "' is : '" + ValueStep.GetText + "'" - if Accuray.GetText <> lsProps(20) then Warnlog "Dec. accuracy => changes not saved! should : '" + lsProps(20) + "' is : '" + Accuray.GetText + "' Bugid #106852#" - if ThousandSeperator.GetSelText <> lsProps(21) then Warnlog "Thousands seperator => changes not saved! should : '" + lsProps(21) + "' is : '" + ThousandSeperator.GetSelText + "' Bugid #106852#" - if CharacterSet.GetText <> lsProps(22) then Warnlog "Character set => changes not saved! should : '" + lsProps(22) + "' is : '" + CharacterSet.GetText + "'" - if Background.GetSelText <> lsProps(23) then Warnlog "Background => changes not saved! should : '" + lsProps(23) + "' is : '" + Background.GetSelText + "'" - if Border.GetSelText <> lsProps(24) then Warnlog "Border => changes not saved! should : '" + lsProps(24) + "' is : '" + Border.GetSelText + "'" - if Spin.GetSelText <> lsProps(25) then Warnlog "Spin button => changes not saved! should : '" + lsProps(25) + "' is : '" + Spin.GetSelText + "'" - end if - -'##### CurrencyField ##### - if instr ( lcase ( sType ), "currencyfield" ) then - if StrictFormat.GetSelText <> lsProps(13) then Warnlog "Strict format => changes not saved! should : '" + lsProps(13) + "' is : '" + StrictFormat.GetSelText + "'"' - if Readonly.GetSelText <> lsProps(14) then Warnlog "Read only => changes not saved! should : '" + lsProps(14) + "' is : '" + Readonly.GetSelText + "'" - if TabStop.GetSelText <> lsProps(15) then Warnlog "Tab stop => changes not saved! should : '" + lsProps(15) + "' is : '" + TabStop.GetSelText + "'" - if Value.GetText <> lsProps(16) then - if Value.GetText <> lsProps(16) + "000" then - Warnlog "Value => changes not saved! should : '" + lsProps(16) + "' is : '" + Value.GetText + "'" - else - Warnlog "Value => changes not saved! should : '" + lsProps(16) + "' is : '" + Value.GetText + "'" - end if - end if - if ValueMin.GetText <> lsProps(17) then - if ValueMin.GetText <> "-1,000,002.00000" then - Warnlog "Value min. => changes not saved! should : '-1,000,002.00000' is : '" + ValueMin.GetText + "'" - else - Warnlog "Value min. => changes not saved! should : '" + lsProps(17) + "' is : '" + ValueMin.GetText + "'" - end if - end if - if ValueMax.GetText <> lsProps(18) then - if ValueMax.GetText <> "999,997.00000" then - Warnlog "Value max => changes not saved! should : '999,997.00000' is : '" + ValueMax.GetText + "'" - else - Warnlog "Value max => changes not saved! should : '" + lsProps(18) + "' is : '" + ValueMax.GetText + "'" - end if - end if - if ValueStep.GetText <> lsProps(19) then Warnlog "Incr./decrement value => changes not saved! should : '" + lsProps(19) + "' is : '" + ValueStep.GetText + "'" - if Accuray.GetText <> lsProps(20) then Warnlog "Dec. accuracy => changes not saved! should : '" + lsProps(20) + "' is : '" + Accuray.GetText + "' Bugid #106852#" - if ThousandSeperator.GetSelText <> lsProps(21) then Warnlog "Thousands seperator => changes not saved! should : '" + lsProps(21) + "' is : '" + ThousandSeperator.GetSelText + "' Bugid #106852#" - if CurrencySymbol.GetText <> lsProps(22) then Warnlog "Currency symbol => changes not saved! should : '" + lsProps(22) + "' is : '" + CurrencySymbol.GetSelText + "'" - if CurrSymPosition.GetSelText <> lsProps(23) then Warnlog "Prefix symbol => changes not saved! should : '" + lsProps(23) + "' is : '" + CurrSymPosition.GetSelText + "'" - if CharacterSet.GetText <> lsProps(24) then Warnlog "Character set => changes not saved! should : '" + lsProps(24) + "' is : '" + CharacterSet.GetText + "'" - if Background.GetSelText <> lsProps(25) then Warnlog "Background => changes not saved! should : '" + lsProps(25) + "' is : '" + Background.GetSelText + "'" - if Border.GetSelText <> lsProps(26) then Warnlog "Border => changes not saved! should : '" + lsProps(26) + "' is : '" + Border.GetSelText + "'" - if Spin.GetSelText <> lsProps(27) then Warnlog "Spin button => changes not saved! should : '" + lsProps(27) + "' is : '" + Spin.GetSelText + "'" - end if - -'##### FormattedField ##### - if instr ( lcase ( sType ), "formattedfield" ) then - if MaxTextLen.GetText <> lsProps(13) then Warnlog "Max text lenght => changes not saved! should : '" + lsProps(13) + "' is : '" + MaxTextLen.GetText + "'" - if StrictFormat.GetSelText <> lsProps(14) then Warnlog "Strict format => changes not saved! should : '" + lsProps(14) + "' is : '" + StrictFormat.GetSelText + "'"' - if Readonly.GetSelText <> lsProps(15) then Warnlog "Read only => changes not saved! should : '" + lsProps(15) + "' is : '" + Readonly.GetSelText + "'" - if TabStop.GetSelText <> lsProps(16) then Warnlog "Tab stop => changes not saved! should : '" + lsProps(16) + "' is : '" + TabStop.GetSelText + "'" -' if Effective.GetText <> lsProps(17) then Warnlog "Value => changes not saved! should : '" + lsProps(17) + "' is : '" + Effective.GetText + "'" - if EffectiveMin.GetText <> lsProps(18) then - printlog " Bugid #106852#:" - if EffectiveMin.GetText <> "1.00" then - Warnlog "Value min => changes not saved! should : '" + lsProps(18) + "' is : '" + EffectiveMin.GetText + "'" - else - Warnlog "Value min => changes not saved! should : '1.00' is : '" + EffectiveMin.GetText + "'" - end if - end if - if EffectiveMax.GetText <> lsProps(19) then - printlog " Bugid #106852#:" - if EffectiveMax.GetText <> "1.00" then - Warnlog "Value max => changes not saved! should : '1.00' is : '" + EffectiveMax.GetText + "'" - else - Warnlog "Value max => changes not saved! should : '" + lsProps(19) + "' is : '" + EffectiveMax.GetText + "'" - end if - end if - if FormatKey.GetText <> lsProps(20) then Warnlog "Format key => changes not saved! should : '" + lsProps(20) + "' is : '" + FormatKey.GetText + "'" - if CharacterSet.GetText <> lsProps(21) then Warnlog "Character set => changes not saved! should : '" + lsProps(21) + "' is : '" + CharacterSet.GetText + "'" - if Align.GetSelText <> lsProps(22) then Warnlog "Alignment => changes not saved! should : '" + lsProps(22) + "' is : '" + Align.GetSelText + "' BugId #106872#" - if Background.GetSelText <> lsProps(23) then Warnlog "Background => changes not saved! should : '" + lsProps(23) + "' is : '" + Background.GetSelText + "'" - if Border.GetSelText <> lsProps(24) then Warnlog "Border => changes not saved! should : '" + lsProps(24) + "' is : '" + Border.GetSelText + "'" - if Spin.GetSelText <> lsProps(25) then Warnlog "Spin button => changes not saved! should : '" + lsProps(25) + "' is : '" + Spin.GetSelText + "'" - end if - -'##### PatternField ##### - if instr ( lcase ( sType ), "patternfield" ) then - if TextText.GetText <> lsProps(13) then Warnlog "Text => changes not saved! should : '" + lsProps(13) + "' is : '" + TextText.GetText + "'" - if MaxTextLen.GetText <> lsProps(14) then Warnlog "Max text lenght => changes not saved! should : '" + lsProps(14) + "' is : '" + MaxTextLen.GetText + "'" - if EditMask.GetText <> lsProps(15) then Warnlog "Edit mask => changes not saved! should : '" + lsProps(15) + "' is : '" + EditMask.GetText + "'" - if LiteralMask.GetText <> lsProps(16) then Warnlog "Literal mask => changes not saved! should : '" + lsProps(16) + "' is : '" + LiteralMask.GetText + "'" - if StrictFormat.GetSelText <> lsProps(17) then Warnlog "Strict format => changes not saved! should : '" + lsProps(17) + "' is : '" + StrictFormat.GetSelText + "'"' - if Readonly.GetSelText <> lsProps(18) then Warnlog "Read only => changes not saved! should : '" + lsProps(18) + "' is : '" + Readonly.GetSelText + "'" - if TabStop.GetSelText <> lsProps(19) then Warnlog "Tab stop => changes not saved! should : '" + lsProps(19) + "' is : '" + TabStop.GetSelText + "'" - if CharacterSet.GetText <> lsProps(20) then Warnlog "Character set => changes not saved! should : '" + lsProps(20) + "' is : '" + CharacterSet.GetText + "'" - if Background.GetSelText <> lsProps(21) then Warnlog "Background => changes not saved! should : '" + lsProps(21) + "' is : '" + Background.GetSelText + "'" - if Border.GetSelText <> lsProps(22) then Warnlog "Border => changes not saved! should : '" + lsProps(22) + "' is : '" + Border.GetSelText + "'" - end if - -'##### FileControl ##### - if instr ( lcase ( sType ), "filecontrol" ) then - if TextText.GetText <> lsProps(13) then Warnlog "Text => changes not saved! should : '" + lsProps(13) + "' is : '" + TextText.GetText + "'" - if Readonly.GetSelText <> lsProps(14) then Warnlog "Read only => changes not saved! should : '" + lsProps(14) + "' is : '" + Readonly.GetSelText + "'" - if TabStop.GetSelText <> lsProps(15) then Warnlog "Tab stop => changes not saved! should : '" + lsProps(15) + "' is : '" + TabStop.GetSelText + "'" - if CharacterSet.GetText <> lsProps(16) then Warnlog "Character set => changes not saved! should : '" + lsProps(16) + "' is : '" + CharacterSet.GetText + "'" - if Background.GetSelText <> lsProps(17) then Warnlog "Background => changes not saved! should : '" + lsProps(17) + "' is : '" + Background.GetSelText + "'" - if Border.GetSelText <> lsProps(18) then Warnlog "Border => changes not saved! should : '" + lsProps(18) + "' is : '" + Border.GetSelText + "'" - end if - - -end function diff --git a/testautomation/global/tools/includes/optional/t_docfuncs.inc b/testautomation/global/tools/includes/optional/t_docfuncs.inc index 75aacf2e11e9..c544db3111fa 100644..100755 --- a/testautomation/global/tools/includes/optional/t_docfuncs.inc +++ b/testautomation/global/tools/includes/optional/t_docfuncs.inc @@ -31,8 +31,6 @@ '* '\****************************************************************************** -private const VERBOSE = FALSE - function hUseImpressAutopilot( bEnable as boolean ) as boolean '///<h3>Enable/disable the Impress Autopilot in Tools/Options</h3> @@ -40,7 +38,7 @@ function hUseImpressAutopilot( bEnable as boolean ) as boolean '///<ul> const CFN = "global::tools::includes::optional::t_docfuncs.inc::hUseImpressAutopilot::" - if ( VERBOSE ) then printlog( CFN & "Enter" ) + if ( GVERBOSE ) then printlog( CFN & "Enter" ) '///+<li>Create a new IMPRESS document</li> gApplication = "IMPRESS" @@ -56,10 +54,10 @@ function hUseImpressAutopilot( bEnable as boolean ) as boolean if ( bEnable ) then mitAutopilotStarten.check() - if ( VERBOSE ) then printlog( CFN & "Enable Impress Autopilot" ) + if ( GVERBOSE ) then printlog( CFN & "Enable Impress Autopilot" ) else mitAutopilotStarten.uncheck() - if ( VERBOSE ) then printlog( CFN & "Disable Impress Autopilot" ) + if ( GVERBOSE ) then printlog( CFN & "Disable Impress Autopilot" ) endif '///+<li>Return Status of Checkbox (checked=TRUE)</li> @@ -73,49 +71,19 @@ function hUseImpressAutopilot( bEnable as boolean ) as boolean '///+<li>Close Tools/Options</li> Kontext "OptionenDlg" - OptionenDlg.OK() - + hCloseDialog( OptionenDlg, "ok" ) + '///+<li>Close IMPRESS document</li> hDestroyDocument() '///+<li>Returncode is undefined</li> - if ( VERBOSE ) then printlog( CFN & "Exit" ) + if ( GVERBOSE ) then printlog( CFN & "Exit" ) '///</ul> end function '******************************************************************************* -function hCloseNavigator() as boolean - - '///<h3>Function to close the navigator</h3> - const CFN = "global::tools::includes::optional::t_docfuncs.inc::hCloseNavigator::" - - if ( VERBOSE ) then printlog( CFN & "Enter" ) - - Kontext "Navigator" - if ( Navigator.Exists() ) then - Navigator.Close() - Navigator.notExists( 2 ) - if ( VERBOSE ) then printlog( CFN & "Closed Navigator" ) - else - if ( VERBOSE ) then printlog( CFN & "Navigator not present" ) - endif - - Kontext "Navigator" - if ( Navigator.exists() ) then - hCloseNavigator() = false - warnlog( CFN & "Failed to close Navigator, it is still open." ) - else - hCloseNavigator() = true - endif - - if ( VERBOSE ) then printlog( CFN & "Exit" ) - -end function - -'******************************************************************************* - function hNumericDocType( doctype as integer ) as string '///<h3>Convert a numeric expression to a gApplication</h3> @@ -132,7 +100,7 @@ function hNumericDocType( doctype as integer ) as string dim sList( 100 ) as string dim iDocTypes as integer - if ( VERBOSE ) then printlog( CFN & "Enter" ) + if ( GVERBOSE ) then printlog( CFN & "Enter" ) '///+<li>Retrieve matching list from file</li> hGetDataFileSection( sFile , sList() , "application" , "" , "" ) @@ -151,7 +119,7 @@ function hNumericDocType( doctype as integer ) as string '///+<li>Set a plain text name as returnvalue for the function</li> hGetDataFileSection( sFile , sList() , "application_names" , "" , "" ) hNumericDocType() = hGetValueForKeyAsString( sList() , gApplication ) - if ( VERBOSE ) then printlog( CFN & "Exit" ) + if ( GVERBOSE ) then printlog( CFN & "Exit" ) '///</ul> end function @@ -184,28 +152,30 @@ function hChangeDoc() as string case "WRITER", "HTML", "MASTERDOCUMENT" Kontext "DocumentWriter" DocumentWriter.TypeKeys "<Return>This doc is changed!" - hChangeDoc() = "Changed WRITER/HTML/MASTERDOC" + hChangeDoc() = "Changed WRITER/HTML/MASTERDOC" '///+<li>CALC: Write some text into the current location (usually A1)</li> case "CALC" : Kontext "DocumentCalc" DocumentCalc.TypeKeys "<Down>This doc is changed!<Return>" - hChangeDoc() = "Changed CALC" + hChangeDoc() = "Changed CALC" '///+<li>DRAW: Draw a rectangle</li> case "DRAW" : Kontext "DocumentDraw" hRechteckErstellen ( 20, 20, 25, 25 ) gMouseClick ( 1, 1 ) - hChangeDoc() = "Changed DRAW" + hChangeDoc() = "Changed DRAW" '///+<li>IMPRESS: Draw a rectangle</li> case "IMPRESS": Kontext "DocumentImpress" hRechteckErstellen ( 20, 20, 25, 25 ) gMouseClick ( 1, 1 ) - hChangeDoc() = "Changed IMPRESS" + hChangeDoc() = "Changed IMPRESS" '///+<li>MATH: Create a simple formaula</li> case "MATH" : SchreibenInMathdok( "b over c" ) - hChangeDoc() = "Changed MATH" + kontext "DocumentMath" + hChangeDoc() = "Changed MATH" + gMouseClick( 50 , 50 ) end select '///</ul> @@ -226,7 +196,7 @@ function hIdentifyWriterDoc( cString as string, bWarn as boolean ) as boolean dim cIdentifier as string dim irc as integer ' some temporary returnvalue - if ( VERBOSE ) then printlog( CFN & "Enter" ) + if ( GVERBOSE ) then printlog( CFN & "Enter" ) '///+<li>Test the function parameter</li> if ( cString = "" ) then @@ -253,26 +223,17 @@ function hIdentifyWriterDoc( cString as string, bWarn as boolean ) as boolean DocumentWriter.typeKeys( "<SHIFT END>" ) '///+<li>copy the string to the clipboard and store it into a variable</li> - try - editcopy - cIdentifier = getClipboardText() - catch - warnlog( "EditCopy failed. Probably the document is empty" ) - cIdentifier = "**** invalid ****" - endcatch - + hUseAsyncSlot( "EditCopy" ) + cIdentifier = getClipboardText() '///+<li>compare the string to the reference (given as parameter)</li> irc = hCompareSubstrings( cIdentifier, cString ) '///+<li>Write the result to the printlog if desired</li> if ( irc = 0 ) then - - if ( bWarn ) then - warnlog ( CFN & "The focus is not on the expected document" ) - else - if ( VERBOSE ) then printlog( CFN & "The focus is not on the expected document" ) - endif + + if ( GVERBOSE ) then printlog( CFN & "The focus is not on the expected document" ) + if ( bWarn ) then warnlog ( CFN & "The focus is not on the expected document" ) printlog( CFN & "Expected: " & cString ) printlog( CFN & "Found...: " & cIdentifier ) @@ -283,7 +244,7 @@ function hIdentifyWriterDoc( cString as string, bWarn as boolean ) as boolean endif '///+<li>Return TRUE only if the current document is the expected one</li> - if ( VERBOSE ) then printlog( CFN & "Exit" ) + if ( GVERBOSE ) then printlog( CFN & "Exit" ) '///</ul> end function @@ -300,12 +261,10 @@ function hCreateDocument() as boolean dim iDocCountAfter as integer iDocCountBefore = getDocumentCount - if ( VERBOSE ) then printlog( CFN & "Number of open documents before: " & iDocCountBefore ) + if ( GVERBOSE ) then printlog( CFN & "Number of open documents before: " & iDocCountBefore ) - if ( ucase( gApplication ) = "BACKGROUND" ) then - do while( getDocumentCount > 0 ) - hCloseDocument() - loop + if ( gApplication = "BACKGROUND" ) then + hFileCloseAll() hCreateDocument() = true else @@ -317,7 +276,7 @@ function hCreateDocument() as boolean hCreateDocument() = false endif endif - if ( VERBOSE ) then printlog( CFN & "New document created. Open: " & iDocCountAfter ) + if ( GVERBOSE ) then printlog( CFN & "New document created. Open: " & iDocCountAfter ) '///</ul> end function @@ -351,10 +310,9 @@ function hDocumentTypeKeys( cString as string ) as boolean '///<ul> const CFN = "global::tools::includes::optional::t_docfuncs.inc::hDocumentTypeKeys::" - dim brc as boolean - brc = true - if ( VERBOSE ) then printlog( CFN & "Enter" ) + if ( GVERBOSE ) then printlog( CFN & "Enter" ) + hDocumentTypeKeys() = true '///+<li>Set focus to the current documenttype determined by gApplication</li> '///+<li>Type the string passed as function parameter</li> @@ -375,15 +333,12 @@ function hDocumentTypeKeys( cString as string ) as boolean DocumentWriter.typeKeys( cString ) case else warnlog( CFN & "Exit: Unknown gApplication: " & gApplication ) - brc = false + hDocumentTypeKeys() = false + exit function end select '///+<li>Print some message to the log on success</li> - if ( brc ) then - printlog( CFN & "Exit: Sent keystroke to " & gApplication ) - endif - - hDocumentTypeKeys() = brc + printlog( CFN & "Exit: Sent keystroke to " & gApplication ) '///</ul> end function @@ -396,26 +351,42 @@ function hDestroyDocument() as boolean const CFN = "global::tools::includes::optional::t_docfuncs.inc::hDestroyDocument: " dim iDocCount as integer : iDocCount = getDocumentCount() hDestroyDocument() = false + + dim method( 3 ) as string + method( 1 ) = "no,optional" + method( 2 ) = "202,optional" + method( 3 ) = "ok,optional" ' This could be a File I/O error + + dim iCurrentMethod as integer + dim bDialogClosed as boolean if ( iDocCount = 0 ) then exit function - if ( VERBOSE ) then printlog( CFN & "In.: Open: " & iDocCount ) + if ( GVERBOSE ) then printlog( CFN & "In.: Open: " & iDocCount ) hUseAsyncSlot( "FileClose" ) - - Kontext "Active" - if ( Active.Exists( 2 ) ) then - printlog( "Msgbox: " & Active.getText() ) - try - Active.No - catch - Active.Click ( 202 ) - endcatch - wait( 1000 ) - end if + + for iCurrentMethod = 1 to 3 + + bDialogClosed = false + + Kontext "Active" + if ( Active.exists( 1 ) ) then + printlog( CFN & "Msgbox: " & Active.getText() ) + if ( GVERBOSE ) then printlog( CFN & "Method: " & method( iCurrentMethod ) ) + bDialogClosed = hCloseDialog( Active, method( iCurrentMethod ) ) + else + exit for + endif + + if ( iCurrentMethod = 3 and bDialogClosed ) then + warnlog( "Unexpected messagebox was handled" ) + endif + + next iCurrentMethod if ( getDocumentCount() = iDocCount ) then hCloseDocument() if ( getDocumentCount() = iDocCount - 1 ) then hDestroyDocument() = true - if ( VERBOSE ) then printlog( CFN & "Out: Open: " & getDocumentCount() ) + if ( GVERBOSE ) then printlog( CFN & "Out: Open: " & getDocumentCount() ) end function @@ -423,100 +394,20 @@ end function 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> + hFileCloseAll() + hCreateDocument() - const CFN = "global::tools::includes::optional::t_docfuncs.inc::hInitSingleDoc::" - dim cOldApplication as string + if ( GVERBOSE ) then printlog( "hInitSingleDoc(): Opening document: " & gApplication ) - '///<u>Description:</u> - '///<ul> - '///+<li>Close all documents until we are on the backing window</li> - hFileCloseAll() - - '///+<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" ) + if ( getDocumentCount = 1 ) then 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 - - '///<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 = "global::tools::includes::optional::t_docfuncs.inc::hInitBackingMode::" - - '///<u>Description:</u> - '///<ul> - '///+<li>Close all documents until we are on the backing window</li> - hFileCloseAll() - - '///+<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 @@ -548,42 +439,37 @@ function hInitWriteDocIdentifier( cString as string ) as boolean '///</ol> const CFN = "global::tools::includes::optional::t_docfuncs.inc::hInitWriteDocIdentifier::" + const RC_TIMEOUT = -1 - '///<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 + if ( getDocumentCount = 1 and gApplication = "WRITER" ) then + + kontext "DocumentWriter" + DocumentWriter.typeKeys( "<MOD1 END>" ) + DocumentWriter.typeKeys( "<MOD1 SHIFT HOME>" ) + DocumentWriter.typeKeys( "<DELETE>" ) + DocumentWriter.typekeys( cString ) + + DocumentWriter.typeKeys( "<MOD1 END>" ) + DocumentWriter.typeKeys( "<MOD1 SHIFT HOME>" ) + + if ( hUseAsyncSlot( "EditCopy" ) <> RC_TIMEOUT ) then + + if ( getClipboardText = cString ) then + printlog( CFN & "Writer document has been successfully modified." ) + hInitWriteDocIdentifier() = true + else + warnlog( CFN & "Could not verify document identification string" ) + hInitWriteDocIdentifier() = false + endif + else + warnlog( CFN & "Unable to copy text to clipboard using <EditCopy>" ) + hInitWriteDocIdentifier() = false + endif else - printlog( CFN & "Could not verify document identification string" ) + warnlog ( CFN & "Only one single writer document may be open" ) + printlog( CFN & "Number of documents: " & getDocumentCount ) + printlog( CFN & "Application........: " & gApplication ) hInitWriteDocIdentifier() = false - endif - '///</ul> + endif end function diff --git a/testautomation/global/tools/includes/optional/t_extension_manager_tools.inc b/testautomation/global/tools/includes/optional/t_extension_manager_tools.inc index ee4d7f55beba..0b530af4a274 100755 --- a/testautomation/global/tools/includes/optional/t_extension_manager_tools.inc +++ b/testautomation/global/tools/includes/optional/t_extension_manager_tools.inc @@ -284,7 +284,7 @@ function hExtensionAddGUI( _path as string, _flags as string ) as integer hExtensionAddGUI() = BrowsePackages.getItemCount() '///+<li>Close the Extension Manager</li> - PackageManager.close() + hCloseDialog( PackageManager , "close" ) if ( bLogs ) then printlog( "********** Installing extension end **********" ) @@ -353,7 +353,7 @@ function hExtensionRemoveGUI( cExtensionName as string ) as integer endcatch kontext "PackageManager" - PackageManager.close() + hCloseDialog( PackageManager , "close" ) else hExtensionRemoveGUI() = 1 endif @@ -460,7 +460,7 @@ function hExtensionGetItemList( cItemList() as string ) as integer hExtensionGetItemList() = iItemCount cItemList( 0 ) = iItemCount - PackageManager.close() + hCloseDialog( PackageManager , "close" ) else @@ -500,7 +500,7 @@ function hSelectExtensionID( iPos as integer ) as string catch hSelectExtensionID() = "" endcatch - PackageManager.close() + hCloseDialog( PackageManager , "close" ) else hSelectExtensionID() = "" endif @@ -545,7 +545,7 @@ function hSelectExtensionName( cName as string ) as integer catch hSelectExtensionName() = 0 endcatch - PackageManager.close() + hCloseDialog( PackageManager , "close" ) else hSelectExtensionName() = -1 endif @@ -695,7 +695,7 @@ function hIsExtensionAlreadyInstalled( cName as string ) as boolean endif next - PackageManager.close() + hCloseDialog( PackageManager , "close" ) end function @@ -745,7 +745,7 @@ function hDisableUserExtensionGUI( extension_name as string ) as integer else hDisableUserExtensionGUI() = 2 endif - PackageManager.close() + hCloseDialog( PackageManager , "close" ) catch hDisableUserExtensionGUI() = 1 endcatch @@ -766,7 +766,7 @@ function hGetExtensionCount() as integer if ( PackageManager.exists( 2 ) ) then try hGetExtensionCount() = BrowsePackages.getItemCount() - PackageManager.close() + hCloseDialog( PackageManager , "close" ) catch hGetExtensionCount() = -2 endcatch diff --git a/testautomation/global/tools/includes/optional/t_filetools.inc b/testautomation/global/tools/includes/optional/t_filetools.inc index 76cbb35b153c..420b14ae9676 100644..100755 --- a/testautomation/global/tools/includes/optional/t_filetools.inc +++ b/testautomation/global/tools/includes/optional/t_filetools.inc @@ -31,8 +31,6 @@ '* '\****************************************************************************** -private const VERBOSE = false - function hHandleActivesOnLoad( iTries as integer , iAdd as integer ) as boolean '///<h3>Handle any dialogs that might pop up when loading a file</h3> @@ -74,7 +72,7 @@ function hHandleActivesOnLoad( iTries as integer , iAdd as integer ) as boolean dim cMessage as string dim bSkip as boolean - if ( VERBOSE ) then printlog( CFN & "Enter" ) + if ( GVERBOSE ) then printlog( CFN & "Enter" ) ' not good but apparently required - else hDestroyDocument will handle the ' dialogs and warn about them. @@ -169,7 +167,7 @@ function hHandleActivesOnLoad( iTries as integer , iAdd as integer ) as boolean printlog( CFN & "Exit: The test closed more dialogs than expected" ) hHandleActivesOnLoad() = false else - if ( VERBOSE ) then printlog( CFN & "Exit" ) + if ( GVERBOSE ) then printlog( CFN & "Exit" ) endif end function @@ -208,7 +206,7 @@ function hHandleInitialDialogs() as integer dim incident as integer incident = 0 - if ( VERBOSE ) then printlog( CFN & "Enter" ) + if ( GVERBOSE ) then printlog( CFN & "Enter" ) try '///+<li>Test for UseOfThisTemplate-dialog</li> @@ -254,7 +252,7 @@ function hHandleInitialDialogs() as integer endcatch hHandleInitialDialogs() = incident - if ( VERBOSE ) then printlog( CFN & "Exit" ) + if ( GVERBOSE ) then printlog( CFN & "Exit" ) '///</ul> @@ -325,7 +323,7 @@ function hGetWorkPath() as string sPath = convertpath( sPath ) '///+<li>Print info to the log and return the path</li> - if ( VERBOSE ) then + if ( GVERBOSE ) then if ( bPathIsFromAPI ) then printlog( CFN & "(From API): " & sPath ) else diff --git a/testautomation/global/tools/includes/optional/t_listfuncs.inc b/testautomation/global/tools/includes/optional/t_listfuncs.inc index 2e9b6e20e1a3..ea8a5d5bec68 100644..100755 --- a/testautomation/global/tools/includes/optional/t_listfuncs.inc +++ b/testautomation/global/tools/includes/optional/t_listfuncs.inc @@ -29,158 +29,8 @@ '* '* short description : Replacements for routines in t_lists.inc adds some '* -'******************************************************************************* -'* -' #1 hListTestUpperBoundary ' Tests upper boundary of arrays -' #1 hListTestLowerBoundary ' Tests lower boundary of arrays -' #1 hListDelete ' Deletes one item from a list by index -' #1 hListAppend ' Append an item to a list -' #1 hManageComparisionList ' quick way to compare/create reference lists -' #1 hListFileGetSize ' find out how big an array has to be to hold the file -' #1 hListCompare ' compare two lists -' #1 hListPrependString ' Insert a string infront of each item in a list -' #1 hListAppendList ' Append one list to another -' #1 hCountMatchesInList ' Return count of occurrences of a string within a list -'* '\****************************************************************************** -' Note: These functions fix some minor bugs and introduce strict boundary -' checking for the arrays we work with. The arrays must be compatible -' to those from the "standard" list-functions. -' Why: Two reasons: -' -' 1) When working with listboxes it might happen that they are empty (bug) -' or contain more items than expected. In this case the tests would -' usually break. This is not desired as many testcases do not rely -' on the content of the listboxes. -' -' 2) This way eases the trouble of debugging huge amounts of arrays -' like those in the installation test or anywhere else where we work -' with reference lists. This is a coding help. - -'******************************************************************************* - -function hListTestUpperBoundary( aList() as string ) as boolean - - '///<h3>Verify that ListCount does not exceed upper boundary</h3> - '///<i>About listfunctions: All listfunctions rely on a special type of - '///+ array. This can be string arrays and - in some cases - numeric - '///+ arrays. What makes the arrays unique is that the first item which - '///+ has the index 0 contains the number of items in the list to be used, - '///+ anything that is stored beyond this number is ignored. This has three - '///+ consequences: 1) all listfunctions that alter an array must update - '///+ the index stored in array(0) and 2) it is possible that the index - '///+ point beyond ubound of the array which will most likely cause a - '///+ runtime error. 3) Means that arrays may only have an upper boundary - '///+ declared, all loops must start with index array(1) and must end with - '///+ index array(val( array(0))</i><br> - '///<u>Input</u>: - '///<ol> - '///+<li>List (string)</li> - '///</ol> - '///<u>Returns</u>: - '///<ol> - '///+<li>Errorstatus (boolean)</li> - '///<ul> - '///+<li>TRUE: Array is ok</li> - '///+<li>FALSE: Array logic has errors</li> - '///</ul> - '///</ol> - '///<u>Description</u>: - '///<ul> - - - const CFN = "hListTestUpperBoundary::" - - dim iUpperBoundary as integer ' size according to UBOUND - dim iListSize as integer ' size according to ListCount - - dim brc as boolean - brc = true - - '///+<li>Determine the size of the array</li> - iUpperBoundary = UBOUND( aList() ) - - '///+<li>Determine the <i>claimed</i> size of the array</li> - iListSize = ListCount( aList() ) - - '///+<li>Verify that val(array(0)) <= array-size</li> - if ( iListSize > iUpperBoundary ) then - warnlog ( CFN & "List points beyound upper array boundary:" ) - printlog( CFN & "ListCount: " & iListSize ) - printlog( CFN & "UBOUND...: " & iUpperBoundary ) - brc = false - endif - - hListTestUpperBoundary() = brc - '///</ul> - -end function - -'******************************************************************************* - -function hListTestLowerBoundary( aList() as string ) as boolean - - '///<h3>Verify that the lower boundaries of an array are ok</h3> - '///<i>Prerequisite: Array compatible with those from t_lists.inc</i> - '///<i>About listfunctions: All listfunctions rely on a special type of - '///+ array. This can be string arrays and - in some cases - numeric - '///+ arrays. What makes the arrays unique is that the first item which - '///+ has the index 0 contains the number of items in the list to be used, - '///+ anything that is stored beyond this number is ignored. This has three - '///+ consequences: 1) all listfunctions that alter an array must update - '///+ the index stored in array(0) and 2) it is possible that the index - '///+ point beyond ubound of the array which will most likely cause a - '///+ runtime error. 3) Means that arrays may only have an upper boundary - '///+ declared, all loops must start with index array(1) and must end with - '///+ index array(val( array(0))</i><br> - '///<u>Input</u>: - '///<ol> - '///+<li>List (string)</li> - '///</ol> - '///<u>Returns</u>: - '///<ol> - '///+<li>Errorstatus (boolean)</li> - '///<ul> - '///+<li>TRUE: Array is ok</li> - '///+<li>FALSE: Array logic has errors</li> - '///</ul> - '///</ol> - '///<u>Description</u>: - '///<ul> - - const CFN = "hListTestLowerBoundary::" - - dim iLowerBoundary as integer ' size according to LBOUND - dim iListSize as integer ' size according to ListCount - - dim brc as boolean - brc = true - - iLowerBoundary = LBOUND( aList() ) - iListSize = ListCount( aList() ) - - '///+<li>Verify that ubound for the array returns 0 (lower boundary)</li> - if ( iLowerBoundary <> 0 ) then - warnlog ( CFN & "Boundary of the array must be 0." ) - printlog( CFN & "Lower boundary is: " & iLowerBoundary ) - brc = false - endif - - '///+<li>Verify that val(array(0)) > 0</li> - if ( iListSize < 0 ) then - warnlog ( CFN & "Defined Listsize (ListCount) may never be negative" ) - printlog( CFN & "ListCount is: " & iListSize ) - brc = false - endif - - hListTestLowerBoundary() = brc - '///</ul> - -end function - -'******************************************************************************* - function hListDelete( aList() as string, iItemToDelete as integer ) as boolean '///<h3>Delete one item from a list specified by index</h3> @@ -196,58 +46,25 @@ function hListDelete( aList() as string, iItemToDelete as integer ) as boolean '///+ runtime error. 3) Means that arrays may only have an upper boundary '///+ declared, all loops must start with index array(1) and must end with '///+ index array(val( array(0))</i><br> - '///<u>Review the code, it has many unused variables</u> - '///<ul> const CFN = "hListDelete::" - - dim iArraySize as integer ' The size of the array, must be large enough - dim iListSizeOld as integer ' The size of the list before deletion - dim iListSizeNew as integer ' The size of the list after deletion + const INDEX_CORRECTION = 1 dim iCurrentItem as integer ' Increment-Variable - dim iOffset as integer ' First item to be "moved down" by index - dim sItemToDelete as string ' The string that will be deleted - dim brc as boolean ' preliminary return value - '///+<li>test array integrity: upper boundary</li> - brc = hListTestUpperBoundary( alist() ) - if ( not brc ) then - hListDelete() = brc - exit function + if ( GVERBOSE ) then + printlog( CFN & "Removing: " & aList( iItemToDelete ) & " at pos " & iItemToDelete ) endif - '///+<li>test array integrity: lower boundary</li> - brc = hListTestLowerBoundary( alist() ) - if ( not brc ) then - hListDelete() = brc - exit function - endif - - '///+<li>Get some data from the arrays to work with.</li> - iArraySize = ubound( aList() ) - iListSizeOld = ListCount( aList() ) - iListSizeNew = iListSizeOld - 1 - sItemToDelete = aList( iItemToDelete ) - iOffset = iItemToDelete + 1 - - ' some output (may be removed as soon the function is thoroughly tested) - 'printlog( CFN & "Removing: " & sItemToDelete & " at pos " & iItemToDelete ) - ' Move all items down by one in the list beginning with the item after ' iItemToDelete - '///+<li>Move all items one up</li> - for iCurrentItem = iOffset to iListSizeOld - aList( iCurrentItem - 1 ) = aList( iCurrentItem ) + for iCurrentItem = ( iItemToDelete + INDEX_CORRECTION ) to ListCount( aList() ) + aList( iCurrentItem - INDEX_CORRECTION ) = aList( iCurrentItem ) next iCurrentItem ' Delete the last entry, it is no longer used and it is duplicate to the item ' at iListSizeOld-1 (iListSizeNew) - '///+<li>Delete the last item from the list</li> - aList( iListSizeOld ) = "" - - '///+<li>Set the new listsize (one smaller than the original list)</li> - aList( 0 ) = iListSizeNew - '///</ul> + aList( iCurrentItem ) = "" + aList( 0 ) = iCurrentItem - INDEX_CORRECTION end function @@ -270,6 +87,7 @@ function hListAppend( sNewString as string, aTargetList() as string ) as integer '///+ index array(val( array(0))</i><br> const CFN = "hListAppend::" + const RC_ARRAY_TOO_SMALL = -1 dim iCurrentListSize as integer dim iNewListSize as integer @@ -284,15 +102,13 @@ function hListAppend( sNewString as string, aTargetList() as string ) as integer warnlog ( CFN & "Cannot append, array too small" ) printlog( CFN & "Array-Size.....: " & iArraySize ) printlog( CFN & "Requested index: " & iNewListSize ) - irc = -1 + hListAppend() = RC_ARRAY_TOO_SMALL else aTargetList( iNewListSize ) = sNewString aTargetList( 0 ) = iNewListSize - irc = iNewListSize + hListAppend() = iNewListSize endif - hListAppend() = irc - end function '******************************************************************************* @@ -324,77 +140,44 @@ function hManageComparisionList( sFileIn as string, sFileOut as string, sListOut '///<ul> const CFN = "hManageComparisionList::" - - '///+<li>The name of the input file may not be empty</li> - if ( sFileIn = "" ) then - warnlog( CFN & "Invalid parameter: Input filename is empty string" ) - hManageComparisionList() = 2 - exit function - endif - - '///+<li>The name of the output-file may not be empty</li> - if ( sFileOut = "" ) then - warnlog( CFN & "Invalid parameter: Output filename is empty string" ) - hManageComparisionList() = 3 - exit function - endif - - '///+<li>the list should not claim to be empty / be empty</li> - if ( listcount( sListOut() ) = 0 ) then - qaerrorlog( CFN & "Invalid parameter: Array claims to be empty" ) - hManageComparisionList() = 4 - exit function - endif - - ' hListFileGetSize will return -1 if the list does not exist or the number - ' of lines in the reference file plus additional 10 lines. - '///+<li>Verify that the reference file exists and is non-empty</li> - dim iFileSize as integer - iFileSize = hListFileGetSize( sFileIn ) - dim brc as boolean - brc = false - - '///+<li>Read the reference list and compare</li> - if ( iFileSize > -1 ) then - - dim aReferenceList( iFileSize ) as string - printlog( CFN & "Reading: " & sFileIn ) - ' disabled hGetDataFileSection because some lists contain a # - ' (hash) as value which is identified as comment by the function. - ' Fixing this for hGetDataFileSection() would break compatibility - ' to other functions both in framework and global module - 'hgetDataFileSection( sFileIn , aReferenceList() , "" , "" , "" ) - listread( aReferenceList(), sFileIn, "utf8" ) - brc = hListCompare( sListOut() , aReferenceList() ) + const FILESIZE = 25000 + const COMPARE_SUCCESS = 0 + const ENCODING_UTF8 = "UTF8" + + dim irc as integer + dim aReferenceList( FILESIZE ) as string + + if ( GVERBOSE ) then printlog( CFN & "Reading: " & sFileIn ) + ' disabled hGetDataFileSection because some lists contain a # + ' (hash) as value which is identified as comment by the function. + ' Fixing this for hGetDataFileSection() would break compatibility + ' to other functions both in framework and global module + 'hgetDataFileSection( sFileIn , aReferenceList() , "" , "" , "" ) + listread( aReferenceList(), sFileIn, ENCODING_UTF8 ) + irc = hListCompare( sListOut() , aReferenceList() ) - endif - ' A this point there are three possible states: ' a) the reference list does not exist ' b) the comparision failed ' c) the comparision succeeded - ' only if hListCompare() returns TRUE the testrun is successful. + ' only if hListCompare() returns 0 the testrun is successful. ' This means that on any error, the ref-list will be written so it can be ' directly reviewed/compared to the "faulty" list without having to run this ' test again (after deleting the ref-file) '///+<li>In case the lists are not identical, write the new one to the local work directory</li> - if ( brc ) then + if ( irc = COMPARE_SUCCESS ) then printlog( CFN & "Comparision succeeded" ) - hManageComparisionList() = 0 + hManageComparisionList() = COMPARE_SUCCESS else - printlog( CFN & "Writing: " & sFileOut ) - listwrite( sListOut(), sFileOut, "UTF8" ) - qaerrorlog ( CFN & "Reference file review required:" ) - printlog( "" ) - printlog( CFN & "Two possible reasons:" ) - printlog( CFN & "1) The reference file does not exist at all" ) - printlog( CFN & "2) Reference and actual UI-Content do not match." ) - printlog( CFN & "Location: " & sFileOut ) - printlog( CFN & "Target..: " & sFileIn ) - printlog( CFn & "Verify the content and copy the file to <Target>" ) - printlog( "" ) - printlog( CFN & "Comparision failed" ) - hManageComparisionList() = 1 + if ( GVERBOSE ) then + printlog( CFN & "The two compared lists differ. There are two likely reasons:" ) + printlog( CFN & "1) The reference file does not exist at all" ) + printlog( CFN & "2) Reference and actual UI-Content do not match." ) + printlog( CFN & "Verify and copy the file: " & sFileOut ) + printlog( CFN & "to this location........: " & sFileIn ) + endif + listwrite( sListOut(), sFileOut, ENCODING_UTF8 ) + hManageComparisionList() = irc endif '///+<li>Return 0 if the lists are identical, 1 if not and 2-4 on any other error</li> @@ -404,69 +187,7 @@ end function '******************************************************************************* -function hListFileGetSize( sFileIn as string ) as integer - - '///<h3>Get the number of lines from a file</h3> - '///<i>Prerequisites: Path to an existing plain text file</i> - '///<i>About listfunctions: All listfunctions rely on a special type of - '///+ array. This can be string arrays and - in some cases - numeric - '///+ arrays. What makes the arrays unique is that the first item which - '///+ has the index 0 contains the number of items in the list to be used, - '///+ anything that is stored beyond this number is ignored. This has three - '///+ consequences: 1) all listfunctions that alter an array must update - '///+ the index stored in array(0) and 2) it is possible that the index - '///+ point beyond ubound of the array which will most likely cause a - '///+ runtime error. 3) Means that arrays may only have an upper boundary - '///+ declared, all loops must start with index array(1) and must end with - '///+ index array(val( array(0))</i><br> - '///<ul> - - const CFN = "hListFileGetSize::" - const I_EXTRA_SIZE = 10 - - '///+<li>Verify that the filename is non-empty</li> - if ( sFileIn = "" ) then - warnlog( CFN & "Invalid parameter: Filename is empty string" ) - hListFileGetSize() = -1 - exit function - endif - - '///+<li>Verify that the file exists</li> - if ( dir( sFileIn ) = "" ) then - warnlog( CFN & "File not found: " & sFileIn ) - hListFileGetSize() = -1 - exit function - endif - - dim iFile as integer - dim sLine as string - dim iLineCount as integer - iLineCount = 0 - - '///+<li>Open the file (standard BASIC calls)</li> - iFile = freefile - open sFileIn for input as iFile - - '///+<li>Read the number of lines from the file</li> - while( not eof( iFile ) ) - - line input #iFile, sLine - iLineCount = iLineCount + 1 - - wend - - '///+<li>Close the file</li> - close #iFile - - '///+<li>Return the number of lines read or -1 on error</li> - hListFileGetSize() = iLineCount + I_EXTRA_SIZE - '///</ul> - -end function - -'******************************************************************************* - -function hListCompare( aListOne() as String, aListTwo() as String ) as boolean +function hListCompare( aListOne() as String, aListTwo() as String ) as integer const CFN = "hListcompare::" @@ -496,14 +217,12 @@ function hListCompare( aListOne() as String, aListTwo() as String ) as boolean dim iListOneSize as integer dim bFound as boolean - dim brc as boolean ' returncode: true only if lists are identical - brc = true '///+<li>Create a copy of list two so we do not change the original list</li> ListCopy( aListTwo() , aTwoOnlyList() ) iTwoOnlyListSize = ListCount( aTwoOnlyList() ) - iListOneSize = ListCount( aListOne() ) + iListOneSize = ListCount( aListOne() ) '///+<li>Step through each item in list one</li> @@ -529,9 +248,7 @@ function hListCompare( aListOne() as String, aListTwo() as String ) as boolean next iListTwoIndex '///+<li>If there is no match, the item exists in list one only -> copy</li> - if ( not bFound ) then - hListAppend( aListOne( iListOneIndex ), aOneOnlyList() ) - end if + if ( not bFound ) then hListAppend( aListOne( iListOneIndex ), aOneOnlyList() ) next iListOneIndex @@ -542,17 +259,16 @@ function hListCompare( aListOne() as String, aListTwo() as String ) as boolean if ( ListCount( aOneOnlyList() ) > 0 ) then printlog( CFN & "Objects have been added to the list" ) hListPrint( aOneOnlyList() , "Items found in list ONE only (NEW)" ) - brc = false + hListCompare() = ListCount( aOneOnlyList() ) end if '///+<li>List all items that exist in List Two only</li> if ( ListCount( aTwoOnlyList() ) > 0 ) then printlog( CFN & "Objects have been removed from the list" ) hListPrint( aTwoOnlyList() , "Items found in list TWO only (MISSING)" ) - brc = false + hListCompare() = ListCount( aOneOnlyList() ) * -1 end if - hListCompare() = brc '///</ul> end function @@ -597,9 +313,7 @@ function hListPrependString( aList() as string, cString as string ) as boolean '///+<li>Cycle through the list and insert a text infront of each item</li> for iCurrentItem = 1 to listcount( aList() ) - aList( iCurrentItem ) = cString & " : " & aList( iCurrentItem ) - next iCurrentItem hListPrependString() = true @@ -701,33 +415,53 @@ function hCountMatchesInList( acItemList() as string, cSearchTerm as string ) as '///</ol> const CFN = "hCountMatchesInList::" - printlog( CFN & "Enter" ) - dim iHitCount as integer - dim iItemCount as integer dim iCurrentItem as integer - '///<u>Description:</u> - '///<ul> - '///+<li>Retrieve the number of items in the list</li> - iItemCount = ListCount( acItemList() ) - - '///+<li>Walk through the list and count the hits</li> - printlog( CFN & "Begin with term: " & cSearchTerm ) - for iCurrentItem = 1 to iItemCount - - printlog( acItemList( iCurrentItem ) ) - + if ( GVERBOSE ) then printlog( CFN & "Begin with term: " & cSearchTerm ) + + for iCurrentItem = 1 to ListCount( acItemList() ) + if ( GVERBOSE ) then printlog( acItemList( iCurrentItem ) ) + if ( instr( acItemList( iCurrentItem ), cSearchTerm ) > 0 ) then iHitCount = iHitCount + 1 endif - next iCurrentItem - printlog( CFN & "End" ) - '///</ul> - - printlog( CFN & "Exit with result: " & iHitCount ) +if ( GVERBOSE ) then printlog( CFN & "Exit with result: " & iHitCount ) hCountMatchesInList() = iHitCount end function + +'******************************************************************************* + +function hListResultEvaluation( i_diffcount as integer, i_allowed_delta as integer ) as boolean + + ' This function evaluates the outcome of hManageComaprisionList() or + ' hListCompare(). This extra step is done because in some cases the + ' program installations might differ slightly - in some CWS (when using the + ' archive) we can end up having a different set of import/export filters. + ' So the evaluation must allow for a specific number of mismatches which is + ' specified in i_allowed_delta. + + hListResultEvaluation() = true + + ' If lists are identical we return directly. + if ( i_diffcount = 0 ) then + printlog( "The lists are identical. Good" ) + exit function + endif + + ' if we have differences we need to have a closer look. + ' Note that the difference is optional. + if ( i_allowed_delta <> 0 ) then + if ( i_diffcount = i_allowed_delta ) then + printlog( "The lists have the allowed delta of " & i_allowed_delta ) + exit function + endif + endif + + warnlog( "The list check failed, please review the test." ) + hListResultEvaluation() = false + +end function diff --git a/testautomation/global/tools/includes/optional/t_macro_tools.inc b/testautomation/global/tools/includes/optional/t_macro_tools.inc index 825a1f98bef2..18d5245e13f7 100644..100755 --- a/testautomation/global/tools/includes/optional/t_macro_tools.inc +++ b/testautomation/global/tools/includes/optional/t_macro_tools.inc @@ -56,53 +56,40 @@ function hInsertMacroFromFile( cMacroId as string, optional cSource as string ) '///<ul> const CFN = "hInsertMacroFromFile::" + const RETVAL_FAILURE = 0 + const MAX_LINES_IN_MACRO_FILE = 10000 '///+<li>Find the path to the source file</li> dim cFile as string - if ( IsMissing( cSource ) ) then - cFile = convertpath( gTesttoolPath & "global/input/macros.txt" ) - else - cFile = convertpath( cSource ) - endif - - '///+<li>Determine the required array size</li> - dim iArraySize as integer - iArraySize = hListFileGetSize( cFile ) - - dim aInstructionList( iArraySize ) as string - + dim aInstructionList( MAX_LINES_IN_MACRO_FILE ) as string dim iInstructionCount as integer dim iCurrentInstruction as integer - - dim brc as boolean - + + if ( IsMissing( cSource ) ) then cFile = gTesttoolPath & "global/input/macros.txt" + '///+<li>retrieve the macro from the file with ID as section</li> - iInstructionCount = hGetDataFileSection( cFile, _ - aInstructionList(), _ - cMacroId, "", "" ) + iInstructionCount = hGetDataFileSection( cFile, aInstructionList(), cMacroId, "", "" ) '///+<li>Delete all content from the BASIC IDE edit window</li> - brc = hDeleteMacro() - '///+<li>Insert the code into the IDE line by line</li> - if ( brc ) then - - for iCurrentInstruction = 1 to iInstructionCount - - EditWindow.TypeKeys( "<HOME>" ) - EditWindow.TypeKeys( aInstructionList( iCurrentInstruction ) ) - EditWindow.TypeKeys( "<RETURN>" ) - - next iCurrentInstruction - printlog( CFN & "Inserted macro: " & cMacroId ) - hInsertMacroFromFile() = iInstructionCount - + kontext "BasicIDE" + if ( EditWindow.exists() ) then + if ( hDeleteMacro() ) then + for iCurrentInstruction = 1 to iInstructionCount + EditWindow.TypeKeys( "<HOME>" ) + EditWindow.TypeKeys( aInstructionList( iCurrentInstruction ) ) + EditWindow.TypeKeys( "<RETURN>" ) + next iCurrentInstruction + printlog( CFN & "Inserted macro: " & cMacroId ) + hInsertMacroFromFile() = iInstructionCount + else + printlog( CFN & "IDE is not empty, will not insert macro" ) + hInsertMacroFromFile() = RETVAL_FAILURE + endif else - - printlog( CFN & "IDE is not empty, will not insert macro" ) - hInsertMacroFromFile() = 0 - - endif + printlog( CFN & "Editwindow is not visible" ) + hInsertMacroFromFile() = RETVAL_FAILURE + endif '///</ul> end function @@ -111,66 +98,78 @@ end function function hMacroOrganizerRunMacro( cMacroName as string ) as integer - '///<h3>Execute a macro by name</h3> - '///<i>Starting point: Any document</i><br> - '///+<i>The function runs silent</i><br> - '///<u>Input</u>: - '///<ol> - '///+<li>Name of the macro to be run (string)</li> - '///<ul> - '///+<li>Any macro that can run by itself (main)</li> - '///</ul> - '///</ol> - '///<u>Returns</u>: - '///<ol> - '///+<li>Position of the macro in the treelist (integer)</li> - '///<ul> - '///+<li>0 = error</li> - '///+<li>1-n = position of macro</li> - '///</ul> - '///</ol> - '///<u>Description</u>: - '///<ul> - - dim irc as integer + ' Run a macro by name. Returnvalues as follows: + ' = 0: any error + ' > 0: position of macro in the list, success. + const CFN = "hMacroOrganizerRunMacro::" + const RETVAL_FAILURE = 0 - '///+<li>Go to Tools/Macros/Organize Macros/OpenOffice.org Basic</li> - printlog( CFN & "Enter with option: " & cMacroName ) - ToolsMacro_uno - - '///+<li>Find the Macro</li> - kontext "Makro" - hExpandAllNodes( MakroAus ) - irc = hSelectNodeByName( MakroAus , cMacroName ) - hExpandNode( MakroAus, irc ) - hSelectNextNode( MakroAus ) + dim iMacroPosition as integer + + ToolsMacro_uno - if ( MakroAus.getSelText() = cMacroName ) then - printlog( CFN & "Matching object found: " & cMacroName ) - else - irc = 0 - endif - - - '///+<li>Run the macro</li> kontext "Makro" - if ( Ausfuehren.exists( 1 ) ) then - if ( Ausfuehren.isEnabled( 1 ) ) then - Ausfuehren.click() + if ( Makro.exists( 2 ) ) then + hExpandAllNodes( MakroAus ) + iMacroPosition = hSelectNodeByName( MakroAus, cMacroName ) + if ( iMacroPosition ) then + iMacroPosition = hSelectNextNode( MakroAus ) + if ( hClickButton( Ausfuehren ) ) then + hMacroOrganizerRunMacro() = iMacroPosition + else + ' run macro button not enabled + warnlog( CFN & "Unable to click <Run macro> button" ) + hMacroOrganizerRunMacro() = RETVAL_FAILURE + endif else - printlog( CFN & "Could not execute macro, button is disabled" ) - Makro.close() - irc = 0 + warnlog( CFN & "Macro was not found" ) + hMacroOrganizerRunMacro() = RETVAL_FAILURE endif else - printlog( CFN & "Control does not exist/context failed" ) - Makro.close() - irc = 0 + warnlog( CFN & "Failed to open Macro Organizer" ) + hMacroOrganizerRunMacro() = RETVAL_FAILURE endif - - hMacroOrganizerRunMacro() = irc - printlog( CFN & "Exit with result: " & irc ) - '///</ul> + end function + +'******************************************************************************* + +function hBasicIDERunMacro( cIdentifier as string ) as boolean + + const CFN = "hBasicIDERunMacro(): " + const MAX_WAIT = 1 + dim cMessage as string : cMessage = "" + + kontext "BasicIDE" + if ( BasicIDE.exists() ) then + + Wait( 2000 ) + + kontext "MacroBar" + if ( MacroBar.exists() ) then + BasicRun.click() + else + warnlog( "MacroBar not accessible" ) + endif + + kontext "Active" + if ( Active.exists( MAX_WAIT ) ) then + cMessage = Active.getText() + hCloseDialog( Active, "ok" ) + endif + + if ( cMessage = cIdentifier ) then + printlog( "The expected macro was executed" ) + hBasicIDERunMacro() = true + else + printlog( CFN & "Incorrect macro executed" ) + hBasicIDERunMacro() = false + endif + else + warnlog( CFN & "BasicIDE is not open" ) + hBasicIDERunMacro() = false + endif + +end function
\ No newline at end of file diff --git a/testautomation/global/tools/includes/optional/t_ole.inc b/testautomation/global/tools/includes/optional/t_ole.inc index 28268ef5394e..63c55705add9 100644..100755 --- a/testautomation/global/tools/includes/optional/t_ole.inc +++ b/testautomation/global/tools/includes/optional/t_ole.inc @@ -31,36 +31,41 @@ '* '\****************************************************************************** -private const VERBOSE = FALSE +function hGetOfficeVersion() as string -'******************************************************************************* + ' The "Insert OLE object" dialog lists the OLE Objects with application name + ' and version number. THe version numbers are tracked in the officeinfo.txt + ' file which must be adjusted each time we change to a new major version. -function hGetOfficeVersion() as string + const CFN = "global::tools::includes::optional::t_ole.inc::hGetOfficeVersion(): " + const DATAFILE = "global/input/officeinfo.txt" + const MAX_LINES_IN_DATAFILE = 20 dim cPath as string - dim aItemList( 20 ) as string + dim aItemList( MAX_LINES_IN_DATAFILE ) as string - const CFN = "global::tools::includes::optional::t_ole.inc::hGetOfficeVersion(): " - ' Path to info file - cPath = convertpath( gTesttoolPath & "global/input/officeinfo.txt" ) - if ( VERBOSE ) then printlog( CFN & "Reading: " & cPath ) + cPath = convertpath( gTesttoolPath & DATAFILE ) + if ( GVERBOSE ) then printlog( CFN & "Reading: " & cPath ) - ' Read the file + ' Read the file, store the list of known office versions hGetDatafileSection( cPath, aItemList(), "", "", "" ) - ' Set global variable + ' Search for the version number matching the product name, store value in global variable gOfficeVersion = hGetValueForKeyAsString( aItemList(), gProductName ) - ' Set returnvalue + ' Return content of the global variable as well hGetOfficeVersion() = gOfficeVersion end function '******************************************************************************* -function hGetOleObjectName( ObjectType as string ) as string +function hGetOleObjectName( cApplication as string ) as string + + ' for cApplication you may pass gApplication. + dim Application_API_Name as string dim oUnoOfficeConnection as object dim oUnoConfigurationAccess as object dim aPropertyValue(1) as new com.sun.star.beans.PropertyValue @@ -69,28 +74,26 @@ function hGetOleObjectName( ObjectType as string ) as string dim cString as string const CFN = "global::tools::includes::optional::t_ole.inc::hGetOleObjectName(): " - - ' Test function parameters. They are <> gApplication as the API is case sensitive - select case ObjectType - case "Writer" - case "Calc" - case "Impress" - case "Draw" - case "Math" - case "Chart" + + ' The application names for the API are case sensitive so we cannot use gApplication + select case ( ucase( cApplication ) ) + case "WRITER" : Application_API_Name = "Writer" + case "CALC" : Application_API_Name = "Calc" + case "IMPRESS": Application_API_Name = "Impress" + case "DRAW" : Application_API_Name = "Draw" + case "MATH" : Application_API_Name = "Math" + case "CHART" : Application_API_Name = "Chart" case else - warnlog( CFN & "Invalid object type passed to function: " & ObjectType ) - warnlog( CFN & "This function is case sensitive." ) - warnlog( CFN & "Supported are: Writer, Calc, Impress, Draw, Math, Chart" ) + warnlog( CFN & "Invalid object type passed to function: " & cApplication ) hGetOleObjectName() = "" exit function end select - if ( VERBOSE ) then printlog( CFN & "Retrieving OLE name for: " & ObjectType ) + if ( GVERBOSE ) then printlog( CFN & "Retrieving OLE name for: " & cApplication ) ' ...Embedding is physical path, ObjectNames the top node aPropertyValue( 0 ).Name = "nodepath" - aPropertyValue( 0 ).Value = "/org.openoffice.Office.Embedding/ObjectNames/" & ObjectType + aPropertyValue( 0 ).Value = "/org.openoffice.Office.Embedding/ObjectNames/" & Application_API_Name ' Connect to remote UNO oUnoOfficeConnection = hGetUnoService( TRUE ) @@ -125,7 +128,7 @@ end function function GetOleDefaultNames() const CFN = "global::tools::includes::optional::t_ole.inc::GetOleDefaultNames(): " - if ( VERBOSE ) then printlog( CFN & "Retrieving OLE names" ) + if ( GVERBOSE ) then printlog( CFN & "Retrieving OLE names" ) hGetOfficeVersion() gOLEWriter = hGetOleObjectName( "Writer" ) diff --git a/testautomation/global/tools/includes/optional/t_proxy_info.inc b/testautomation/global/tools/includes/optional/t_proxy_info.inc deleted file mode 100644 index 90fe1cfe3e48..000000000000 --- a/testautomation/global/tools/includes/optional/t_proxy_info.inc +++ /dev/null @@ -1,138 +0,0 @@ -'encoding UTF-8 Do not remove or change this line! -'************************************************************************** -' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -' -' Copyright 2000, 2010 Oracle and/or its affiliates. -' -' OpenOffice.org - a multi-platform office productivity suite -' -' This file is part of OpenOffice.org. -' -' OpenOffice.org is free software: you can redistribute it and/or modify -' it under the terms of the GNU Lesser General Public License version 3 -' only, as published by the Free Software Foundation. -' -' OpenOffice.org is distributed in the hope that it will be useful, -' but WITHOUT ANY WARRANTY; without even the implied warranty of -' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -' GNU Lesser General Public License version 3 for more details -' (a copy is included in the LICENSE file that accompanied this code). -' -' You should have received a copy of the GNU Lesser General Public License -' version 3 along with OpenOffice.org. If not, see -' <http://www.openoffice.org/license.html> -' for a copy of the LGPLv3 License. -' -'/****************************************************************************** -'* -'* owner : joerg.skottke@sun.com -'* -'* short description : Tools to retrieve auxilary environment information -'* -'******************************************************************************* -'** -' #1 hGetProxyInfo ' Retrieve the names and ports of the proxies -' #0 hPrintProxyInstructions ' print instructions to the log -'** -'\****************************************************************************** - -function hGetProxyInfo( sSection as string, sItem as string ) as string - - - '///<h3>Retrieve the names and ports of the proxies</h3> - '///<i>This function retrieves the names and ports of the proxies used - '///+ in your local network. The data is taken from a textfile that is - '///+ not visible on OpenOffice.org (Sun security policy)<br> - '///+ If the file is not found a message is printed to the log that - '///+ gives instructions on how to create and format such a file and - '///+ what other steps must be taken to make this work for your local - '///+ network (don't panic, it's simple!).</i><br><br> - - '///<u>Input values:</u><br> - '///<ol> - - '///+<li>Section (string). Valid options:</li> - '///<ul> - '///+<li>"http_proxy"</li> - '///+<li>"ftp_proxy"</li> - '///+<li>"socks_proxy"</li> - '///+<li>"no_proxy_for"</li> - '///</ul> - - '///+<li>Item (string). Valid options:</li> - '///<ul> - '///+<li>"Name"</li> - '///+<li>"Port" (not for "no_proxy_for")</li> - '///</ul> - - '///</ol> - - - '///<u>Return Value:</u><br> - '///<ol> - '///+<li>Name or port of an item (string)</li> - '///<ul> - '///+<li>Empty String on error</li> - '///</ul> - '///</ol> - - const CFN = "hGetProxyInfo::" - - dim irc as integer ' some integer returnvalue - dim crc as string ' some string returnvalue - - ' This is the workfile. Make sure it exists and contains valid data - dim cFile as string - cFile = gTesttoolPath & "sun_global\input\proxies.txt" - ' cFile = gTesttoolPath & "global\input\proxies.txt" - cFile = convertpath ( cFile ) - - ' this is a temporary list that holds the workfile - dim acList( 50 ) as string - - '///<u>Description:</u> - '///<ul> - '///+<li>Open the file, read the section, abort on error</li> - irc = hGetDataFileSection( cFile, acList(), sSection , "" , "" ) - if ( irc = 0 ) then - qaerrorlog( CFN & "File or section not found" ) - hGetProxyInfo() = "" - hPrintProxyInstructions() - exit function - endif - - '///+<li>Isolate the key</li> - crc = hGetValueForKeyAsString( acList(), sItem ) - if ( instr( crc , "Error:" ) > 0 ) then - qaerrorlog( CFN & "The requested item could not be found" ) - hGetProxyInfo() = "" - hPrintProxyInstructions() - exit function - endif - - '///+<li>Return the requested item</li> - - '///</ul> - - hGetProxyInfo() = crc - -end function - -'******************************************************************************* - -function hPrintProxyInstructions() - - printlog( "" ) - printlog( "How to configure proxy settings for your local network" ) - printlog( "" ) - printlog( "1. Edit the sample configuration file" ) - printlog( " Location: global/input/proxies.txt" ) - printlog( " Replace servernames and ports with valid entries" ) - printlog( "" ) - printlog( "2. Edit the function hGetProxyInfo" ) - printlog( " Make the first line with cFile = ... a comment" - printlog( " Make the second line with cFile = ... active" - printlog( " Save the file" ) - printlog( "" ) - -end function diff --git a/testautomation/global/tools/includes/optional/t_security_tools.inc b/testautomation/global/tools/includes/optional/t_security_tools.inc index 2306bda01e27..24a718fd7a48 100755 --- a/testautomation/global/tools/includes/optional/t_security_tools.inc +++ b/testautomation/global/tools/includes/optional/t_security_tools.inc @@ -68,35 +68,42 @@ function hSetPasswordRecommendation( bEnable as boolean ) as boolean '///+<li>Click on the "Options..." button</li> kontext "TabSecurity" - Options.click() + if ( hClickButton( Options ) ) then - kontext "TabSecurityOptionsAndWarnings" - if ( TabSecurityOptionsAndWarnings.exists( 1 ) ) then - - '///+<li>Retrieve the current setting for passwor recommendation</li> - if ( RecommendPasswordProtectionOnSaving.isChecked() ) then - hSetPasswordRecommendation() = true + kontext "TabSecurityOptionsAndWarnings" + if ( TabSecurityOptionsAndWarnings.exists( 1 ) ) then + + '///+<li>Retrieve the current setting for passwor recommendation</li> + if ( RecommendPasswordProtectionOnSaving.isChecked() ) then + hSetPasswordRecommendation() = true + else + hSetPasswordRecommendation() = false + endif + + '///+<li>Set the requested state</li> + if ( bEnable ) then + printlog( CFN & "Enabled password recommendation" ) + RecommendPasswordProtectionOnSaving.check() + else + printlog( CFN & "Disabled password recommendation" ) + RecommendPasswordProtectionOnSaving.uncheck() + endif + + hCloseDialog( TabSecurityOptionsAndWarnings, "ok" ) + else + warnlog( "Failed to open security options page" ) hSetPasswordRecommendation() = false endif - - '///+<li>Set the requested state</li> - if ( bEnable ) then - printlog( CFN & "Enabled password recommendation" ) - RecommendPasswordProtectionOnSaving.check() - else - printlog( CFN & "Disabled password recommendation" ) - RecommendPasswordProtectionOnSaving.uncheck() - endif - TabSecurityOptionsAndWarnings.ok() else - warnlog( "Failed to open security options page" ) + warnlog( CFN & "Unable to click options button" ) + hSetPasswordRecommendation() = false endif '///+<li>Close Tools/Options</li> Kontext "ToolsOptionsDlg" - ToolsOptionsDlg.ok() + hCloseDialog( ToolsOptionsDlg, "ok" ) else warnlog( "Failed to open Tools/Options" ) @@ -127,19 +134,23 @@ function hOpenDigitalSignaturesDialog() as boolean '///<u>Description</u>: '///<ul> - dim brc as boolean const CFN = "hOpenDigitalSignaturesDialog::" + const FILE_MENU_POSITION = 1 + const SIGNATURES_MENU_POSITION_OTHER = 15 + const SIGNATURES_MENU_POSITION_MATH = 14 + + hOpenDigitalSignaturesDialog() = false '///+<li>Open the file-menu</li> call hUseMenu() - call hMenuSelectNr( 1 ) + call hMenuSelectNr( FILE_MENU_POSITION ) '///+<li>Select "Digital signatures..."</li> try - if ( ucase( gApplication ) = "MATH" ) then - call hMenuSelectNr( 14 ) + if ( gApplication = "MATH" ) then + call hMenuSelectNr( SIGNATURES_MENU_POSITION_MATH ) else - call hMenuSelectNr( 15 ) + call hMenuSelectNr( SIGNATURES_MENU_POSITION_OTHER ) endif catch warnlog( CFN & "Failed to execute menuitem <Digital Signature...>" ) @@ -155,13 +166,9 @@ function hOpenDigitalSignaturesDialog() as boolean kontext "DigitalSignature" if ( DigitalSignature.exists() ) then printlog( CFN & "Digital signatures is open" ) - brc = true - else - brc = false + hOpenDigitalSignaturesDialog() = true endif - '///</ul> - hOpenDigitalSignaturesDialog() = brc end function @@ -188,18 +195,18 @@ function hAllowMacroExecution() as boolean '///<ul> const CFN = "hAllowMacroExecution::" + const MAX_WAIT_FOR_SECURITY_DIALOG = 5 '///+<li>Verify that the Macro security Warning is displayed</li> kontext "SecurityWarning" - if ( SecurityWarning.exists( 5 ) ) then + if ( SecurityWarning.exists( MAX_WAIT_FOR_SECURITY_DIALOG ) ) then '///+<li>Click "Run" to allow macro execution</li> - SecurityWarning.ok() - hAllowMacroExecution() = true - printlog( CFN & "Allowed macro execution" ) + printlog( CFN & "Allowing macro execution" ) + hAllowMacroExecution() = hCloseDialog( SecurityWarning, "ok" ) else - hAllowMacroExecution() = false printlog( CFN & "Macro dialog not displayed" ) + hAllowMacroExecution() = false endif '///</ul> @@ -234,12 +241,11 @@ function hDenyMacroExecution() as boolean if ( SecurityWarning.exists() ) then '///+<li>Click "Cancel" to deny execution</li> - SecurityWarning.cancel() - hDenyMacroExecution() = true printlog( CFN & "Denied macro execution" ) + hDenyMacroExecution() = hCloseDialog( SecurityWarning, "cancel" ) else - hDenyMacroExecution() = false printlog( CFN & "Macro dialog not displayed" ) + hDenyMacroExecution() = false endif '///</ul> @@ -301,7 +307,6 @@ function hAddTrustedPath( cPath as string ) as boolean const CFN = "hAddTrustedPath::" dim iPathCount as integer - dim brc as boolean '///<u>Description</u>: '///<ul> @@ -313,7 +318,7 @@ function hAddTrustedPath( cPath as string ) as boolean hToolsOptions( "StarOffice" , "Security" ) '///+<li>Click Macro Security</li> - MacroSecurity.click() + hClickButton( MacroSecurity ) '///+<li>Switch to the Trusted Paths tab</li> hSwitchMacroSecurityTab( "trustedpaths" ) @@ -323,34 +328,31 @@ function hAddTrustedPath( cPath as string ) as boolean iPathCount = LocationsListBox.getItemCount() '///+<li>Click the "Add" button</li> - LocationsAdd.click() + hClickButton( LocationsAdd ) '///+<li>Enter a path to some files containing macros</li> kontext "OeffnenDlg" DateiName.setText( cPath ) '///+<li>Click "Select"</li> - Oeffnen.click() + hClickButton( Oeffnen ) '///+<li>Verify that the item has been added to the list</li> kontext "TabTrustedSources" if ( LocationsListBox.getItemCount() <> ( iPathCount + 1 ) ) then warnlog( CFN & "Incorrect number of items in locations listbox" ) - brc = false + hAddTrustedPath() = false else - printlog( CFN & "Added: " & cPath ) - brc = true + printlog( "Added: " & cPath ) + hAddTrustedPath() = true endif '///+<li>Close the dialog</li> - TabTrustedSources.ok() + hCloseDialog( TabTrustedSources, "ok" ) '///+<li>Close Tools/Options</li> Kontext "OptionenDlg" - OptionenDlg.ok() - - hAddTrustedPath() = brc - + hCloseDialog( OptionenDlg, "ok" ) '///</ul> end function @@ -379,8 +381,7 @@ function hRemoveTrustedPath( cPath as string ) as boolean dim iPathCount as integer dim iCurrentPathItem as integer - dim brc as boolean - brc = false + hRemoveTrustedPath() = false '///<u>Description</u>: '///<ul> @@ -392,41 +393,42 @@ function hRemoveTrustedPath( cPath as string ) as boolean hToolsOptions( "StarOffice" , "Security" ) '///+<li>Click Macro Security</li> - MacroSecurity.click() + hClickButton( MacroSecurity ) '///+<li>Switch to the Trusted Paths tab</li> hSwitchMacroSecurityTab( "trustedpaths" ) kontext "TabTrustedSources" - '///+<li>Get the number of currently listed items from the list</li> - iPathCount = LocationsListBox.getItemCount() + if ( TabTrustedSources.exists() ) then - '///+<li>Find the entry in the list</li> - for iCurrentPathItem = 1 to iPathCount + '///+<li>Get the number of currently listed items from the list</li> + iPathCount = LocationsListBox.getItemCount() - '///+<li>If it is there, delete it</li> - LocationsListBox.select( iCurrentPathItem ) - if ( LocationsListBox.getSelText() = cPath ) then - LocationsRemove.click() - printlog( CFN & "Removed item at pos. " & iCurrentPathItem ) - brc = true - exit for - endif + '///+<li>Find the entry in the list</li> + for iCurrentPathItem = 1 to iPathCount - next iCurrentPathItem - - '///+<li>Close the dialog</li> - TabTrustedSources.ok() + '///+<li>If it is there, delete it</li> + LocationsListBox.select( iCurrentPathItem ) + if ( LocationsListBox.getSelText() = cPath ) then + LocationsRemove.click() + printlog( CFN & "Removed item at pos. " & iCurrentPathItem ) + hRemoveTrustedPath() = true + exit for + endif - '///+<li>Close Tools/Options</li> - Kontext "OptionenDlg" - OptionenDlg.ok() + next iCurrentPathItem + + '///+<li>Close the dialog</li> + hCloseDialog( TabTrustedSources, "ok" ) - if ( not brc ) then - printlog( CFN & "The trusted path was not found in the list" ) + else + warnlog( CFN & "Trusted Sources Tab did not open" ) + hRemoveTrustedPath() = false endif - hRemoveTrustedPath() = brc + '///+<li>Close Tools/Options</li> + Kontext "OptionenDlg" + hCloseDialog( OptionenDlg, "ok" ) '///</ul> @@ -468,8 +470,7 @@ function hSecurityEnterPasswordOnSave( cPassword as string ) as boolean '///</ol> const CFN = "hSecurityEnterPasswordOnSave::" - printlog( CFN & "Enter" ) - dim brc as boolean : brc = true + if ( GVERBOSE ) then printlog( CFN & "Enter" ) '///<u>Description:</u> '///<ul> @@ -486,7 +487,7 @@ function hSecurityEnterPasswordOnSave( cPassword as string ) as boolean PasswordConfirm.setText( cPassword & "1" ) '///+<li>Click on OK</li> - PasswordFileSave.ok() + hCloseDialog( PasswordFileSave, "ok" ) '///+<li>There should be a warning about a faulty password confirmation</li> kontext "Active" @@ -498,7 +499,7 @@ function hSecurityEnterPasswordOnSave( cPassword as string ) as boolean Active.notExists( 2 ) else qaerrorlog( CFN & "Warning about faulty password confirmation is missing" ) - brc = false + hSecurityEnterPasswordOnSave() = false endif '///+<li>We should now be back on the password dialog</li> @@ -514,19 +515,20 @@ function hSecurityEnterPasswordOnSave( cPassword as string ) as boolean PasswordConfirm.setText( cPassword ) '///+<li>Click on OK</li> - PasswordFileSave.ok() + hCloseDialog( PasswordFileSave, "ok" ) + hSecurityEnterPasswordOnSave() = true else qaerrorlog( CFN & "The password dialog is missing after confirmation error" ) - brc = false + hSecurityEnterPasswordOnSave() = false endif else qaerrorlog( CFN & "The password dialog did not open" ) - brc = false + hSecurityEnterPasswordOnSave() = false endif @@ -535,12 +537,11 @@ function hSecurityEnterPasswordOnSave( cPassword as string ) as boolean if ( SpeichernDlg.exists() ) then qaerrorlog( CFN & "File Save dialog is open, cancelling." ) SpeichernDlg.cancel() - brc = false + hSecurityEnterPasswordOnSave() = false endif '///</ul> - printlog( CFN & "Exit with result: " & brc ) - hSecurityEnterPasswordOnSave() = brc + if ( GVERBOSE ) then printlog( CFN & "Exit" ) end function @@ -549,8 +550,6 @@ end function function hSecurityEnterPasswordOnLoad( cPassword as string, bValid as boolean ) as boolean - use "global\tools\includes\optional\t_stringtools.inc" - '///<h3>Enter a password while loading a document</h3> '///<i>Enters a valid or invalid password while loading a passworded file</i><br><br> @@ -581,11 +580,12 @@ function hSecurityEnterPasswordOnLoad( cPassword as string, bValid as boolean ) '///</ol> const CFN = "hSecurityEnterPasswordOnLoad::" - printlog( CFN & "Enter with option (Password): " & cPassword ) - printlog( CFN & "Enter with option (Validity): " & bValid ) - dim brc as boolean 'a multi purpose boolean returnvalue - brc = true - dim cMsg as string + if ( GVERBOSE ) then + printlog( CFN & "Enter with option (Password): " & cPassword ) + printlog( CFN & "Enter with option (Validity): " & bValid ) + endif + + hSecurityEnterPasswordOnLoad() = true '///<u>Description:</u> '///<ul> @@ -595,7 +595,7 @@ function hSecurityEnterPasswordOnLoad( cPassword as string, bValid as boolean ) '///+<li>Enter password, click OK</li> PasswortName.setText( cPassword ) - PasswordFileOpen.ok() + hCloseDialog( PasswordFileOpen, "ok" ) '///+<li>If the password was incorrect:</li> '///<ul> @@ -604,61 +604,74 @@ function hSecurityEnterPasswordOnLoad( cPassword as string, bValid as boolean ) '///+<li>Look for a warning message</li> kontext "Active" if ( Active.exists( 1 ) ) then - - cMsg = Active.getText() - cMsg = hRemoveLineBreaks( cMsg ) - if ( bValid ) then - warnlog( CFN & "Message: " & cMsg ) - else - printlog( CFN & "Message: " & cMsg ) - endif + printlog( CFN & "Message: " & Active.getText() ) '///+<li>Close the messagebox</li> - Active.ok() + hCloseDialog( Active, "ok" ) '///+<li>Close the Password dialog with "Cancel"</li> kontext "PasswordFileOpen" if ( PasswordFileopen.exists( 2 ) ) then - - PasswordFileOpen.cancel() - + hCloseDialog( PasswordFileOpen, "cancel" ) else - qaerrorlog( CFN & "Password dialog is not present" ) - brc = false - + hSecurityEnterPasswordOnLoad() = false endif else - qaerrorlog( CFN & "Warning about incorrect password is missing" ) - brc = false - + hSecurityEnterPasswordOnLoad() = false endif else - kontext "Active" if ( Active.exists( 1 ) ) then - - cMsg = Active.getText() - cMsg = hRemoveLIneBreaks( cMsg ) - qaerrorlog( CFN & "Unexpected messagebox: " & cMsg ) - brc = false - + warnlog( CFN & "Unexpected messagebox: " & Active.getText() ) + hSecurityEnterPasswordOnLoad() = false endif - endif '///</ul> else - - qaerrorlog( CFN & "Password dialog is missing" ) - brc = false - + warnlog( CFN & "Password dialog is missing" ) + hSecurityEnterPasswordOnLoad() = false endif '///</ul> + +end function - printlog( CFN & "Exit with result:" & brc ) - hSecurityEnterPasswordOnLoad() = brc +'******************************************************************************* + +function hSelectXMLSecTab( cTab as string ) as boolean + + const CFN = "hSelectXMLSecTab::" + hSelectXMLSecTab() = false + + kontext + + select case ( ucase( cTab ) ) + case "GENERAL" : active.setpage TabXMLSecGeneral + if ( TabXMLSecGeneral.exists() and TabXMLSecGeneral.isVisible() ) then + printlog( CFN & "Switched to General page" ) + hSelectXMLSecTab() = true + exit function + endif + + case "DETAILS" : active.setpage TabXMLSecDetails + if ( TabXMLSecDetails.exists() and TabXMLSecDetails.isVisible() ) then + printlog( CFN & "Switched to Details page" ) + hSelectXMLSecTab() = true + exit function + endif + + case "PATH" : active.setpage TabXMLSecCertPath + if ( TabXMLSecCertPath.exists() and TabXMLSecCertPath.isVisible() ) then + printlog( CFN & "Switched to Certification Path page" ) + hSelectXMLSecTab() = true + exit function + endif + end select + + warnlog( CFN & "Failed to switch XML Security Tabpage" ) end function + diff --git a/testautomation/global/tools/includes/optional/t_server_info.inc b/testautomation/global/tools/includes/optional/t_server_info.inc deleted file mode 100644 index 75ff6ab8a8b4..000000000000 --- a/testautomation/global/tools/includes/optional/t_server_info.inc +++ /dev/null @@ -1,148 +0,0 @@ -'encoding UTF-8 Do not remove or change this line! -'************************************************************************** -' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -' -' Copyright 2000, 2010 Oracle and/or its affiliates. -' -' OpenOffice.org - a multi-platform office productivity suite -' -' This file is part of OpenOffice.org. -' -' OpenOffice.org is free software: you can redistribute it and/or modify -' it under the terms of the GNU Lesser General Public License version 3 -' only, as published by the Free Software Foundation. -' -' OpenOffice.org is distributed in the hope that it will be useful, -' but WITHOUT ANY WARRANTY; without even the implied warranty of -' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -' GNU Lesser General Public License version 3 for more details -' (a copy is included in the LICENSE file that accompanied this code). -' -' You should have received a copy of the GNU Lesser General Public License -' version 3 along with OpenOffice.org. If not, see -' <http://www.openoffice.org/license.html> -' for a copy of the LGPLv3 License. -' -'/****************************************************************************** -'* -'* owner : joerg.skottke@sun.com -'* -'* short description : Tools to retrieve information about available servers -'* -'******************************************************************************* -'** -' #1 hGetServerInfo ' Retrieve names and services of some servers -' #0 hPrintServerInstructions ' print instructions to the log -'** -'\****************************************************************************** - -function hGetServerInfo( sType as string, sItem as string ) as string - - - '///<h3>Retrieve names and services of some servers</h3> - '///<i>This function retrieves some information about available - '///+ servers within the LAN. These services can be anything like - '///+ http-server, ftp etc.<br> - '///+ Please make sure you read the comments in the configuration - '///+ file to fully understand what this thing does.</i><br><br> - - '///<u>Input values:</u><br> - '///<ol> - - '///+<li>Type (string). Valid options:</li> - '///<ul> - '///+<li>"http_internal"</li> - '///+<li>"http_external"</li> - '///+<li>"ftp_internal"</li> - '///+<li>"ftp_external"</li> - '///</ul> - - '///+<li>Item (string). Valid options:</li> - '///<ul> - '///+<li>"Name" to get a name for the server</li> - '///+<li>"Port" to get the server's port</li> - '///+<li>"Protocol" to get the supported protocol</li> - '///+<li>"URL" to get the url (e.g. www.heise.de)</li> - '///+<li>"UseProxy" to find out whether proxies are needed or not</li> - '///+<li>"User" to get a loginname</li> - '///+<li>"Pass" to get a password</li> - '///</ul> - - '///</ol> - - - '///<u>Return Value:</u><br> - '///<ol> - '///+<li>Name, port or other info of an item (string)</li> - '///<ul> - '///+<li>Empty String on error</li> - '///+<li>Unique name for a server (can be NIS name)</li> - '///+<li>Port (optional, e.g. 80 for http, 21 for ftp ...)</li> - '///+<li>Protocol (e.g. "http://" or "ftp://"</li> - '///+<li>URL like www.mydomain.de</li> - '///+<li>UseProxy ("yes"/"no")</li> - '///+<li>User (some username)</li> - '///+<li>Password (some password, plain text!) - '///</ul> - '///</ol> - - const CFN = "hGetServerInfo::" - - dim irc as integer ' some integer returnvalue - dim crc as string ' some string returnvalue - - ' This is the workfile. Make sure it exists and contains valid data - dim cFile as string - cFile = gTesttoolPath & "sun_global\input\servers.txt" - ' cFile = gTesttoolPath & "global\input\servers.txt" - cFile = convertpath ( cFile ) - - ' this is a temporary list that holds the workfile - dim acList( 50 ) as string - - '///<u>Description:</u> - '///<ul> - '///+<li>Open the file, read the section, abort on error</li> - irc = hGetDataFileSection( cFile, acList(), sType , "" , "" ) - if ( irc = 0 ) then - qaerrorlog( CFN & "File or section not found" ) - hGetServerInfo() = "" - hPrintServerInstructions() - exit function - endif - - '///+<li>Isolate the key</li> - crc = hGetValueForKeyAsString( acList(), sItem ) - if ( instr( crc , "Error:" ) > 0 ) then - qaerrorlog( CFN & "The requested item could not be found" ) - hGetServerInfo() = "" - hPrintServerInstructions() - exit function - endif - - '///+<li>Return the requested item</li> - - '///</ul> - - hGetServerInfo() = crc - -end function - -'******************************************************************************* - -function hPrintServerInstructions() - - printlog( "" ) - printlog( "How to configure server settings for your local network" ) - printlog( "" ) - printlog( "1. Edit the sample configuration file" ) - printlog( " Location: global/input/servers.txt" ) - printlog( " Replace servernames, ports etc. with valid entries" ) - printlog( "" ) - printlog( "2. Edit the function hGetServerInfo" ) - printlog( " Make the first line with cFile = ... a comment" - printlog( " Make the second line with cFile = ... active" - printlog( " Save the file" ) - printlog( "" ) - -end function diff --git a/testautomation/global/tools/includes/optional/t_stringtools.inc b/testautomation/global/tools/includes/optional/t_stringtools.inc index 0fc34d89ecf6..914d8b7c6ab4 100644..100755 --- a/testautomation/global/tools/includes/optional/t_stringtools.inc +++ b/testautomation/global/tools/includes/optional/t_stringtools.inc @@ -33,46 +33,11 @@ function hRemoveLineBreaks( cString as string ) as string - '///<h3>Remove linebreaks and tabs from a string</h3> - '///<i>Used to "beautify" content of messageboxes when printed to the log</i><br><br> - '///<u>Parameter(s):</u> - '///<ol> - '///+<li>Content of a messagebox as captured with .getText() (string)</li> - '///</ol> - '///<u>Returns</u>: - '///<ol> - '///+<li>A string without tabs, linebreaks and linefeed (string)</li> - '///</ol> - '///<u>Description</u>: - '///<ul> - '///+<li>Walk through the string, replace linebreaks, tabs etc. with spaces</li> - - ' Function (undocumented) to remove LF and CR from strings. - ' When a messagebox appears with multiple lines of text this usually - ' breaks the output of the printlog into multiple lines making it - ' hard to read. So this function puts the entire text in one line. - - dim iCharPos as integer - dim cCurrentChar as string - dim cNewString as string - - ' walk through the string character by character and replace those - ' characters that break the line. Tabs and linebreaks become spaces - for iCharPos = 1 to len( cString ) - - cCurrentChar = mid( cString , iCharPos , 1 ) - - select case cCurrentChar - case CHR$(13) : cNewString = cNewString & " " ' replace linebreak - case CHR$(10) : ' Simply ignore linefeed - case CHR$(09) : cNewString = cNewString & " " ' replace tab with space - case else : cNewString = cNewString & cCurrentChar ' append char - end select - - next iCharPos - - hRemoveLineBreaks() = cNewString - '///</ul> + dim myString as string : myString = cString + myString = hStringReplaceChar( myString, CHR$(09), " " ) + myString = hStringReplaceChar( myString, CHR$(13), " " ) + myString = hStringReplaceChar( myString, CHR$(10), "" ) + hRemoveLineBreaks() = myString end function @@ -101,35 +66,41 @@ function hCompareSubStrings( cRef as string, cSub as string ) as integer '///<ul> const CFN = "hCompareSubStrings::" + const RETVAL_INVALID_PARAMETER = -1 + const RETVAL_MATCH_NONE = 0 + const RETVAL_MATCH_EXACT = 1 + const RETVAL_MATCH_SUBSTRING = 2 '///+<li>Test function parameters</li> if ( ( cRef = "" ) or ( cSub = "" ) ) then warnlog( CFN & "invalid parameter(s): Empty string passed." ) - hCompareSubStrings() = -1 + hCompareSubStrings() = RETVAL_INVALID_PARAMETER exit function endif dim irc as integer '///+<li>Test if we have a substring</li> - if ( instr( cRef, cSub ) > 0 ) then - irc = 2 + if ( instr( cRef, cSub ) ) then + irc = RETVAL_MATCH_SUBSTRING else - irc = 0 + irc = RETVAL_MATCH_NONE endif '///+<li>Test if we have an exact match</li> - if ( irc = 2 ) then + if ( irc = RETVAL_MATCH_SUBSTRING ) then if ( ( cRef = cSub ) and ( len( cRef ) = len( cSub ) ) ) then - irc = 1 + irc = RETVAL_MATCH_EXACT endif endif - - select case irc - case 0 : printlog( CFN & "No matching substring found" ) - case 1 : printlog( CFN & "Strings are identical" ) - case 2 : printlog( CFN & "String is substring" ) - end select + + if ( GVERBOSE ) then + select case irc + case RETVAL_MATCH_NONE : printlog( CFN & "No matching substring found" ) + case RETVAL_MATCH_EXACT : printlog( CFN & "Strings are identical" ) + case RETVAL_MATCH_SUBSTRING : printlog( CFN & "String is substring" ) + end select + endif hCompareSubStrings() = irc '///</ul> @@ -162,8 +133,7 @@ function hGetDirTreeLevel( cFullPath as string ) as integer dim iCurrentChar as integer dim cCurrentChar as string - dim iSeparatorCount as integer - iSeparatorCount = 0 + dim iSeparatorCount as integer : iSeparatorCount = 0 '///+<li>Walk through the string</li> '///<ul> @@ -173,9 +143,7 @@ function hGetDirTreeLevel( cFullPath as string ) as integer cCurrentChar = mid( cFullPath , iCurrentChar , 1 ) '///+<li>If it is a separtator, increase the counter</li> - if ( cCurrentChar = gPathSigne ) then - iSeparatorCount = iSeparatorCount + 1 - endif + if ( cCurrentChar = gPathSigne ) then iSeparatorCount = iSeparatorCount + 1 next iCurrentChar '///</ul> @@ -232,7 +200,7 @@ function hGetStringFromStaticTextField( oControl as object ) as string dim cCopy as string dim cText as string - printlog( CFN & "Enter" ) + if ( GVERBOSE ) then printlog( CFN & "Enter" ) '///<u>Description:</u> '///<ul> @@ -250,14 +218,14 @@ function hGetStringFromStaticTextField( oControl as object ) as string oControl.typeKeys( cCopy ) cText = getClipboardText() - printlog( CFN & "Exit with result: " & cText ) + if ( GVERBOSE ) then printlog( CFN & "Exit with result: " & cText ) else ctext = "" - qaerrorlog( CFN & "Exit: Control exists but is not visible" ) + warnlog( CFN & "Exit: Control exists but is not visible" ) endif else cText = "" - qaerrorlog( CFN & "Exit: Control does not exist in this context" ) + warnlog( CFN & "Exit: Control does not exist in this context" ) endif '///</ul> @@ -304,17 +272,16 @@ function hConvertStringToLong( cValue as string ) as long '///</ol> const CFN = "hConvertStringToLong::" - printlog( CFN & "Enter with option: " & cValue ) - dim brc as boolean 'a multi purpose boolean returnvalue + const ONE_CHARACTER = 1 - dim iLen as integer - iLen = len( cValue ) + if ( GVERBOSE ) then printlog( CFN & "Enter with option: " & cValue ) + + dim iLen as integer : iLen = len( cValue ) dim iChar as integer dim cChar as string - dim cStringValue as string - cStringValue = "" + dim cStringValue as string : cStringValue = "" '///<u>Description:</u> '///<ul> @@ -323,7 +290,7 @@ function hConvertStringToLong( cValue as string ) as long for iChar = 1 to iLen '///+<li>Get the current character</li> - cChar = mid( cValue , iChar , 1 ) + cChar = mid( cValue , iChar , ONE_CHARACTER ) '///+<li>Copy valid characters to temporary string, drop invalid, exit on first space or other character</li> select case cChar @@ -344,10 +311,45 @@ function hConvertStringToLong( cValue as string ) as long next iChar '///</ul> - printlog( CFN & "Exit with value: " & cStringValue ) + if ( GVERBOSE ) then printlog( CFN & "Exit with value: " & cStringValue ) '///+<li>Convert string to long integer and return to calling function</li> hConvertStringToLong() = val( cStringValue ) '///</ul> end function + +'******************************************************************************* + +function hStringReplace( cString as string, search_string as string, replace_with as string ) as string + + const CFN = "hStringReplace(): " + + dim search_string_position as string + dim search_string_found as boolean : search_string_found = true + dim len_search_string as integer : len_search_string = len( search_string ) + dim len_replace_with as integer : len_replace_with = len( replace_with ) + dim myString as string : myString = cString + + if ( GVERBOSE ) then printlog( CFN & "Replace all <" & search_string & "> with <" & replace_with & "> in <" & myString & ">" ) + + if ( not instr( replace_with, search_string ) and len_search_string >= len_replace_with ) then + do while( search_string_found ) + search_string_position = instr( myString, search_string ) + if ( search_string_position > 0 ) then + mid( myString, search_string_position, len( search_string ), replace_with ) + else + search_string_found = false + endif + loop + else + warnlog( CFN & "Function used incorrectly" ) + warnlog( CFN & "Replace all <" & search_string & "> with <" & replace_with & "> in <" & myString & ">" ) + warnlog( CFN & "The new string must be of equal length or shorter than the string to be replaced" ) + warnlog( CFN & "The new string may not contain the string to be replaced (e.g. replace 'a' with 'ha' is not allowed)" ) + endif + + if ( GVERBOSE ) then printlog( CFN & "Return string is <" & myString & ">" ) + hStringReplace() = myString + +end function diff --git a/testautomation/global/tools/includes/optional/t_toolbar_calc.inc b/testautomation/global/tools/includes/optional/t_toolbar_calc.inc deleted file mode 100644 index 30c2b7e7e11c..000000000000 --- a/testautomation/global/tools/includes/optional/t_toolbar_calc.inc +++ /dev/null @@ -1,300 +0,0 @@ -'encoding UTF-8 Do not remove or change this line! -'************************************************************************** -' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -' -' Copyright 2000, 2010 Oracle and/or its affiliates. -' -' OpenOffice.org - a multi-platform office productivity suite -' -' This file is part of OpenOffice.org. -' -' OpenOffice.org is free software: you can redistribute it and/or modify -' it under the terms of the GNU Lesser General Public License version 3 -' only, as published by the Free Software Foundation. -' -' OpenOffice.org is distributed in the hope that it will be useful, -' but WITHOUT ANY WARRANTY; without even the implied warranty of -' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -' GNU Lesser General Public License version 3 for more details -' (a copy is included in the LICENSE file that accompanied this code). -' -' You should have received a copy of the GNU Lesser General Public License -' version 3 along with OpenOffice.org. If not, see -' <http://www.openoffice.org/license.html> -' for a copy of the LGPLv3 License. -' -'/************************************************************************ -'* -'* owner : helge.delfs@sun.com -'* -'* short description : Toolbar tools - Calc -'* -'*************************************************************************************** -'* -' #0 fGetObjectCalc -'* -'\************************************************************************************* - -'******************************************************* -'* This function will get the location for image button -'* in Commands in Tools/Customize/Toolbars from Calc -'******************************************************* -function fGetObjectCalc(sToolbar as String , sObject as String) as Integer - - Select case sToolbar - case "3D-Settings" - Select case sObject - case "Extrusion On/Off" : fGetObjectCalc = 1 - '----------------- 2 - case "Tilt Down" : fGetObjectCalc = 3 - case "Tilt Up" : fGetObjectCalc = 4 - case "Tilt Left" : fGetObjectCalc = 5 - case "Tilt Right" : fGetObjectCalc = 6 - '----------------- 7 - case "Depth" : fGetObjectCalc = 8 - case "Direction" : fGetObjectCalc = 9 - case "Lighting" : fGetObjectCalc = 10 - case "Surfact" : fGetObjectCalc = 11 - case "3D Color" : fGetObjectCalc = 12 - case else : QAErrorLog "The test does not support Object : " + sObject - fGetObjectCalc = 0 - end select - - case "Align" - Select case sObject - case "Left" : fGetObjectCalc = 1 - case "Centered" : fGetObjectCalc = 2 - case "Right" : fGetObjectCalc = 3 - case "Top" : fGetObjectCalc = 4 - case "Center" : fGetObjectCalc = 5 - case "Bottom" : fGetObjectCalc = 6 - case else : QAErrorLog "The test does not support Object : " + sObject - fGetObjectCalc = 0 - end select - - case "Basic Shapes" - Select case sObject - end select - - case "Block Arrows" - Select case sObject - end select - - case "Callouts" - Select case sObject - end select - - case "Color" - Select case sObject - end select - - case "Controls" - Select case sObject - end select - - case "Drawing" - Select case sObject - case "Select" : fGetObjectCalc = 1 - '----------------- 2 - case "Line" : fGetObjectCalc = 3 - case "Rectangle" : fGetObjectCalc = 4 - case "Ellipse" : fGetObjectCalc = 5 - case "Polygon" : fGetObjectCalc = 6 - case "Curve" : fGetObjectCalc = 7 - case "Freeform Line" : fGetObjectCalc = 8 - case "Arc" : fGetObjectCalc = 9 - case "Ellipse Pie" : fGetObjectCalc = 10 - case "Circle Segment" : fGetObjectCalc = 11 - case "Text" : fGetObjectCalc = 12 - case "Vertical Text" : fGetObjectCalc = 13 - case "Text Animation" : fGetObjectCalc = 14 - case "Callouts" : fGetObjectCalc = 15 - case "Vertical Callouts" : fGetObjectCalc = 16 - '----------------- 17 - case else : QAErrorLog "The test does not support Object : " + sObject - fGetObjectCalc = 0 - end select - - case "Drawing Object Properties" - Select case sObject - case "Display Grid" : fGetObjectCalc = 21 - case "Snap to Grid" : fGetObjectCalc = 22 - case "Guides When Moving" : fGetObjectCalc = 23 - case else : QAErrorLog "The test does not support Object : " + sObject - fGetObjectCalc = 0 - end select - - case "Flowchart" - Select case sObject - end select - - case "Fontwork" - Select case sObject - end select - - case "Fontwork Shape" - Select case sObject - end select - - case "Form Design" - Select case sObject - case "Bring to Front" : fGetObjectCalc = 14 - case "Send to Back" : fGetObjectCalc = 15 - case "Group" : fGetObjectCalc = 17 - case "UnGroup" : fGetObjectCalc = 18 - case "Enter Group" : fGetObjectCalc = 19 - case "Exit Group" : fGetObjectCalc = 20 - case else : QAErrorLog "The test does not support Object : " + sObject - fGetObjectCalc = 0 - end select - - case "Form Filter" - Select case sObject - end select - - case "Form Navigation" - Select case sObject - end select - - case "Form Object" - Select case sObject - end select - - case "Formatting" : - Select case sObject - case "Styles and Formatting" : fGetObjectCalc = 1 - case "Apply Style" : fGetObjectCalc = 2 - '---------------------- 3 - case "Font Name" : fGetObjectCalc = 4 - '---------------------- 5 - case "Font Size" : fGetObjectCalc = 6 - '---------------------- 7 - case "Bold" : fGetObjectCalc = 8 - case "Italic" : fGetObjectCalc = 9 - case "Underline" : fGetObjectCalc = 10 - case "Underline:Double" : fGetObjectCalc = 11 - '---------------------- 12 - case "Align Left" : fGetObjectCalc = 13 - case "Align Center Horizontally" : fGetObjectCalc = 14 - case "Align Right" : fGetObjectCalc = 15 - case "Justified" : fGetObjectCalc = 16 - case "Merge Cells" : fGetObjectCalc = 17 - '---------------------- 18 - case "Left-To-Right" : fGetObjectCalc = 19 - case "Right-To-Left" : fGetObjectCalc = 20 - '---------------------- 21 - case else : QAErrorLog "The test does not support Object : " + sObject - fGetObjectCalc = 0 - end select - - case "Full Screen" - Select case sObject - case "Full Screen" : fGetObjectCalc = 1 - end select - - case "Graphic Filter" - Select case sObject - end select - - case "Insert" - Select case sObject - case "Chart" : fGetObjectCalc = 18 - case "Insert Object" : fGetObjectCalc = 19 - case "Controls" : fGetObjectCalc = 20 - case else : QAErrorLog "The test does not support Object : " + sObject - fGetObjectCalc = 0 - end select - - case "Insert Cell" - Select case sObject - end select - - case "Insert Object" - Select case sObject - end select - - case "Media Playback" - Select case sObject - end select - - case "More Controls" - Select case sObject - end select - - case "Picture" - Select case sObject - end select - - case "Standard" - Select case sObject - case "Load URL" : fGetObjectCalc = 1 - case "New" : fGetObjectCalc = 2 - case "New Document From Template" : fGetObjectCalc = 3 - case "Open" : fGetObjectCalc = 4 - case "Save" : fGetObjectCalc = 5 - case "Save As" : fGetObjectCalc = 6 - case "Document as E-mail" : fGetObjectCalc = 7 - '----------------- 8 - case "Edit File" : fGetObjectCalc = 9 - '----------------- 10 - case "Export Directly as PDF" : fGetObjectCalc = 11 - case "Print File Directly" : fGetObjectCalc = 12 - case "Page Rreview" : fGetObjectCalc = 13 - '----------------- 14 - case "Spellcheck" : fGetObjectCalc = 15 - case "AutoSpellcheck" : fGetObjectCalc = 16 - '----------------- 17 - case "Cut" : fGetObjectCalc = 18 - case "Copy" : fGetObjectCalc = 19 - case "Paste" : fGetObjectCalc = 20 - case "Format Paintbrush" : fGetObjectCalc = 21 - '----------------- 22 - case "Can't Undo" : fGetObjectCalc = 23 - case "Can't Restore" : fGetObjectCalc = 24 - '----------------- 25 - case "Hyperlink" : fGetObjectCalc = 26 - case "Sort Ascending" : fGetObjectCalc = 27 - case "Sort Descending" : fGetObjectCalc = 28 - '----------------- 29 - case "Insert Chart" : fGetObjectCalc = 30 - case "Show Draw Functions" : fGetObjectCalc = 31 - '----------------- 32 - case "Find & Replace" : fGetObjectCalc = 33 - case "Navigator" : fGetObjectCalc = 34 - case "Gallery" : fGetObjectCalc = 35 - case "Data Sources" : fGetObjectCalc = 36 - case "Zoom" : fGetObjectCalc = 37 - '----------------- 38 - case "StarOffice Help" : fGetObjectCalc = 39 - case "What's This?" : fGetObjectCalc = 40 - case else : QAErrorLog "The test does not support Object : " + sObject - fGetObjectCalc = 0 - end select - - case "Standard(Viewing Mode)" - Select case sObject - end select - - case "Stars and Banners" - Select case sObject - end select - - case "Symbol Shapes" - Select case sObject - end select - - case "Text Formatting" - Select case sObject - end select - - case "Tools" - Select case sObject - end select - - case "previewbar" - Select case sObject - end select - - end select - -end function diff --git a/testautomation/global/tools/includes/optional/t_toolbar_impress.inc b/testautomation/global/tools/includes/optional/t_toolbar_impress.inc deleted file mode 100644 index 433c83f23515..000000000000 --- a/testautomation/global/tools/includes/optional/t_toolbar_impress.inc +++ /dev/null @@ -1,290 +0,0 @@ -'encoding UTF-8 Do not remove or change this line! -'************************************************************************** -' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -' -' Copyright 2000, 2010 Oracle and/or its affiliates. -' -' OpenOffice.org - a multi-platform office productivity suite -' -' This file is part of OpenOffice.org. -' -' OpenOffice.org is free software: you can redistribute it and/or modify -' it under the terms of the GNU Lesser General Public License version 3 -' only, as published by the Free Software Foundation. -' -' OpenOffice.org is distributed in the hope that it will be useful, -' but WITHOUT ANY WARRANTY; without even the implied warranty of -' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -' GNU Lesser General Public License version 3 for more details -' (a copy is included in the LICENSE file that accompanied this code). -' -' You should have received a copy of the GNU Lesser General Public License -' version 3 along with OpenOffice.org. If not, see -' <http://www.openoffice.org/license.html> -' for a copy of the LGPLv3 License. -' -'/************************************************************************ -'* -'* owner : helge.delfs@sun.com -'* -'* short description : Toolbar tools - Impress -'* -'*************************************************************************************** -'* -' #0 fGetObjectImpress -'* -'\************************************************************************************* - -'******************************************************* -'* This function will get the location for image button -'* in Commands in Tools/Customize/Toolbars from Impress -'******************************************************* -function fGetObjectImpress(sToolbar as String , sObject as String) as Integer - - Select case sToolbar - case "3D-Objects" - Select case sObject - end select - - case "3D-Settings" - Select case sObject - case "Extrusion On/Off" : fGetObjectImpress = 1 - '----------------- 2 - case "Tilt Down" : fGetObjectImpress = 3 - case "Tilt Up" : fGetObjectImpress = 4 - case "Tilt Left" : fGetObjectImpress = 5 - case "Tilt Right" : fGetObjectImpress = 6 - '----------------- 7 - case "Depth" : fGetObjectImpress = 8 - case "Direction" : fGetObjectImpress = 9 - case "Lighting" : fGetObjectImpress = 10 - case "Surfact" : fGetObjectImpress = 11 - case "3D Color" : fGetObjectImpress = 12 - case else : QAErrorLog "The test does not support Object : " + sObject - fGetObjectImpress = 0 - end select - - case "Align" - Select case sObject - case "Left" : fGetObjectImpress = 1 - case "Centered" : fGetObjectImpress = 2 - case "Right" : fGetObjectImpress = 3 - '----------------- 4 - case "Top" : fGetObjectImpress = 5 - case "Center" : fGetObjectImpress = 6 - case "Bottom" : fGetObjectImpress = 7 - case else : QAErrorLog "The test does not support Object : " + sObject - fGetObjectImpress = 0 - end select - - case "Arrows" - Select case sObject - end select - - case "Basic Shapes" - Select case sObject - end select - - case "Block Arrows" - Select case sObject - end select - - case "Bullets and Numbering" - Select case sObject - end select - - case "Callouts" - Select case sObject - end select - - case "Color" - Select case sObject - end select - - case "Connectors" - Select case sObject - end select - - case "Controls" - Select case sObject - end select - - case "Drawing" - Select case sObject - case "Select" : fGetObjectImpress = 1 - '----------------- 2 - case "Line" : fGetObjectImpress = 3 - case "Rectangle" : fGetObjectImpress = 4 - case "Ellipse" : fGetObjectImpress = 5 - case "Text" : fGetObjectImpress = 6 - case "Vertical Text" : fGetObjectImpress = 7 - '----------------- 8 - case "Curve" : fGetObjectImpress = 9 - case "Connector" : fGetObjectImpress = 10 - case "3D Objects" : fGetObjectImpress = 11 - case "Basic Shapes" : fGetObjectImpress = 12 - case "Symbol Shapes" : fGetObjectImpress = 13 - case "Block Arrows" : fGetObjectImpress = 14 - case "Flowcharts" : fGetObjectImpress = 15 - case "Callouts" : fGetObjectImpress = 16 - case "Stars" : fGetObjectImpress = 17 - '----------------- 18 - case "Points" : fGetObjectImpress = 19 - case "Glue Points" : fGetObjectImpress = 20 - case "To Curve" : fGetObjectImpress = 21 - case "To Polygon" : fGetObjectImpress = 22 - case "To 3D" : fGetObjectImpress = 23 - case "To 3D Rotation Objet" : fGetObjectImpress = 24 - '----------------- 25 - case "Fontwork Gallery" : fGetObjectImpress = 26 - case "From File" : fGetObjectImpress = 27 - case "Gallerty" : fGetObjectImpress = 28 - '----------------- 29 - case "Rotate" : fGetObjectImpress = 30 - case "Rotation and Size" : fGetObjectImpress = 31 - case "Flip" : fGetObjectImpress = 32 - case "Alignment" : fGetObjectImpress = 33 - case "Arrange" : fGetObjectImpress = 34 - '----------------- 35 - case "Insert" : fGetObjectImpress = 36 - case "Controls" : fGetObjectImpress = 37 - '----------------- 38 - case "Extrusion On/Off" : fGetObjectImpress = 39 - case "Custom Animation" : fGetObjectImpress = 40 - case "Interaction" : fGetObjectImpress = 41 - case "Animated Image" : fGetObjectImpress = 42 - case "3D Effects" : fGetObjectImpress = 43 - case else : QAErrorLog "The test does not support Object : " + sObject - fGetObjectImpress = 0 - end select - - case "Edit Points" - Select case sObject - end select - - case "Flowchart" - Select case sObject - end select - - case "Fontwork" - Select case sObject - end select - - case "Fontwork Shape" - Select case sObject - end select - - case "Form Design" - Select case sObject - end select - - case "Form Filter" - Select case sObject - end select - - case "Form Navigation" - Select case sObject - end select - - case "Full Screen" - Select case sObject - end select - - case "Gluepoints" - Select case sObject - end select - - case "Graphic Filter" - Select case sObject - end select - - case "Insert" - Select case sObject - case "Floating Frame" : fGetObjectImpress = 6 - case "Plug-in" : fGetObjectImpress = 8 - case "Applet" : fGetObjectImpress = 9 - case "File" : fGetObjectImpress = 11 - case "Sound" : fGetObjectImpress = 14 - case "Video" : fGetObjectImpress = 15 - end select - - case "OLE-Object" - Select case sObject - case "Wrap Left" : fGetObjectImpress = 11 - case "Wrap Right" : fGetObjectImpress = 12 - case "Optimal Page Wrap" : fGetObjectImpress = 16 - case else : QAErrorLog "The test does not support Object : " + sObject - fGetObjectImpress = 0 - end select - - case "Standard" - Select case sObject - case "Load URL" : fGetObjectImpress = 1 - case "New" : fGetObjectImpress = 2 - case "New Document From Template" : fGetObjectImpress = 3 - case "Open" : fGetObjectImpress = 4 - case "Save" : fGetObjectImpress = 5 - case "Save As" : fGetObjectImpress = 6 - case "Document as E-mail" : fGetObjectImpress = 7 - '----------------- 8 - case "Edit File" : fGetObjectImpress = 9 - '----------------- 10 - case "Export Directly as PDF" : fGetObjectImpress = 11 - case "Print File Directly" : fGetObjectImpress = 12 - '----------------- 13 - case "Spellcheck" : fGetObjectImpress = 14 - case "AutoSpellcheck" : fGetObjectImpress = 15 - '----------------- 16 - case "Cut" : fGetObjectImpress = 17 - case "Copy" : fGetObjectImpress = 18 - case "Paste" : fGetObjectImpress = 19 - case "Format Paintbrush" : fGetObjectImpress = 20 - '----------------- 21 - case "Can't Undo" : fGetObjectImpress = 22 - case "Can't Restore" : fGetObjectImpress = 23 - '----------------- 24 - case "Chart" : fGetObjectImpress = 25 - case "CALC" : fGetObjectImpress = 26 - case "Hyperlink" : fGetObjectImpress = 27 - '----------------- 28 - case "Display Grid" : fGetObjectImpress = 29 - '----------------- 30 - case "Navigator" : fGetObjectImpress = 31 - case "Zoom" : fGetObjectImpress = 32 - '----------------- 33 - case "StarOffice Help" : fGetObjectImpress = 34 - case "What's This?" : fGetObjectImpress = 35 - case else : QAErrorLog "The test does not support Object : " + sObject - fGetObjectImpress = 0 - end select - - case "Table" - Select case sObject - case "Table" : fGetObjectImpress = 22 - case "Columns" : fGetObjectImpress = 23 - case "Rows" : fGetObjectImpress = 24 - end select - - case "Text Object" - Select case sObject - case "Line Spacing 1" : fGetObjectImpress = 16 - case "Line Spacing 1.5" : fGetObjectImpress = 17 - case "Line Spacing 2" : fGetObjectImpress = 18 - case "Font Color" : fGetObjectImpress = 20 - case "Left-To-Right" : fGetObjectImpress = 22 - case "Right-To-Left" : fGetObjectImpress = 23 - end select - - case "XML Form Design" - Select case sObject - case "Bring to Front" : fGetObjectImpress = 14 - case "Send to Back" : fGetObjectImpress = 15 - case "Group" : fGetObjectImpress = 17 - case "UnGroup" : fGetObjectImpress = 18 - case "Enter Group" : fGetObjectImpress = 19 - case "Exit Group" : fGetObjectImpress = 20 - end select - - end select - -end function diff --git a/testautomation/global/tools/includes/optional/t_treelist_tools.inc b/testautomation/global/tools/includes/optional/t_treelist_tools.inc index 36cfe7370901..0c1d17e62c91 100755 --- a/testautomation/global/tools/includes/optional/t_treelist_tools.inc +++ b/testautomation/global/tools/includes/optional/t_treelist_tools.inc @@ -31,8 +31,6 @@ '* '\****************************************************************************** -private const DEBUG_ENABLE = false - function hGetNodeCount( oControl as object ) as integer '///<h3>Retrieve the number of visible (open) nodes from a treelist</h3> @@ -56,6 +54,7 @@ function hGetNodeCount( oControl as object ) as integer const CFN = "hGetNodeCount::" + const RETVAL_FAILURE = 0 dim iCount as integer '///+<li>Verify that the control exists</li> @@ -64,15 +63,13 @@ function hGetNodeCount( oControl as object ) as integer '///+<li>Verify that the control is enabled</li> if ( oControl.isEnabled() ) then - if ( DEBUG_ENABLE ) then - printlog( CFN & "Regular access, control available and enabled" ) - endif + if ( GVERBOSE ) then printlog( CFN & "Regular access, control available and enabled" ) '///+<li>get the number of items from the control</li> iCount = oControl.getItemCount() else printlog( CFN & "Failure: Control claims to be disabled." ) - iCount = 0 + iCount = RETVAL_FAILURE endif else try @@ -80,12 +77,12 @@ function hGetNodeCount( oControl as object ) as integer iCount = oControl.getItemCount() catch printlog( CFN & "Failure: Control not available." ) - iCount = 0 + iCount = RETVAL_FAILURE endcatch endif - if ( DEBUG_ENABLE ) then - printlog( CFN & "Exit with nodecount = " & iCount ) - endif + + if ( GVERBOSE ) then printlog( CFN & "Exit with nodecount = " & iCount ) + hGetNodeCount = iCount '///</ul> @@ -111,9 +108,7 @@ function hSelectTopNode( oControl as object ) as boolean hSelectTopNode() = false endcatch - if ( DEBUG_ENABLE ) then - printlog( CFN & "Selected Node: " & oControl.getText() ) - endif + if ( GVERBOSE ) then printlog( CFN & "Selected Node: " & oControl.getText() ) end function @@ -137,13 +132,9 @@ function hSelectNextNode( oControl as object ) as integer iPosAfter = oControl.getSelIndex() - if ( iPosAfter = iPosBefore ) then - hSelectNextNode() = 0 - endif + if ( iPosAfter = iPosBefore ) then hSelectNextNode() = 0 - if ( iPosAfter = ( iPosBefore + 1 ) ) then - hSelectnextNode() = iPosAfter - endif + if ( iPosAfter = ( iPosBefore + 1 ) ) then hSelectNextNode() = iPosAfter printlog( CFN & "Selected node: " & oControl.getText() ) @@ -179,19 +170,19 @@ function hExpandNode( oControl as object, iNode as integer ) as integer '///<ul> '///+<li>Returns new nodecount or 0 on error</li> '///</ul> - + const RC_FAILURE = 0 const CFN = "hExpandNode::" dim iOldNodeCount as integer - if ( DEBUG_ENABLE ) then + if ( GVERBOSE ) then printlog( CFN & "Enter with option (Control): " & oControl.name() ) printlog( CFN & "Enter with option (iNode): " & iNode ) endif iOldNodeCount = hGetNodeCount( oControl ) if ( iNode <= iOldNodeCount ) then - if ( iNode > 0 ) then + if ( iNode > RC_FAILURE ) then oControl.select( iNode ) endif try @@ -199,10 +190,10 @@ function hExpandNode( oControl as object, iNode as integer ) as integer hExpandNode() = hGetNodeCount( oControl ) catch warnlog( "#i84194# Treelist access failed (Keyboard navigation)" ) - hExpandNode() = 0 + hExpandNode() = RC_FAILURE endcatch else - hExpandNode() = 0 + hExpandNode() = RC_FAILURE endif end function @@ -229,7 +220,7 @@ function hExpandAllNodes( oControl as object ) as integer iNodeRefCount = -1 iIteration = 0 - if ( DEBUG_ENABLE ) then + if ( GVERBOSE ) then printlog( CFN & "Initial iNodeCurCount: " & iNodeCurCount ) printlog( CFN & "Initial iNodeRefCount: " & iNodeRefCount ) endif @@ -245,7 +236,7 @@ function hExpandAllNodes( oControl as object ) as integer iNodeCurCount = hGetNodeCount( oControl ) - if ( DEBUG_ENABLE ) then + if ( GVERBOSE ) then printlog( "" ) printlog( CFN & "Exit iteration....: " & iIteration ) printlog( CFN & "Exit iNodeCurCount: " & iNodeCurCount ) @@ -254,7 +245,7 @@ function hExpandAllNodes( oControl as object ) as integer loop - if ( DEBUG_ENABLE ) then + if ( GVERBOSE ) then printlog( CFN & "Exit with " & iNodeCurCount & _ " items after " & iIteration & " iterations" ) endif @@ -282,7 +273,7 @@ function hGetVisibleNodeNames( oControl as object , lsList() as string ) as inte dim iNodeCount as integer dim iThisNode as integer - printlog( CFN & "Enter" ) + if ( GVERBOSE ) then printlog( CFN & "Enter" ) iNodeCount = hGetNodeCount( oControl ) @@ -298,7 +289,7 @@ function hGetVisibleNodeNames( oControl as object , lsList() as string ) as inte endif hGetVisibleNodeNames() = listcount( lsList() ) - printlog( CFN & "Exit" ) + if ( GVERBOSE ) then printlog( CFN & "Exit" ) end function @@ -327,6 +318,7 @@ function hSelectNodeByName( oControl as object , _name as string ) as integer '///</ul> const CFN = "hSelectNodeByName::" + const RETVAL_FAILURE = 0 dim iThisNode as integer dim iCurrentNode as integer @@ -334,9 +326,9 @@ function hSelectNodeByName( oControl as object , _name as string ) as integer dim cNodeName as string - printlog( CFN & "Enter with option (NodeName): " & _name ) + if ( GVERBOSE ) then printlog( CFN & "Enter with option (NodeName): " & _name ) - iThisNode = 0 + iThisNode = RETVAL_FAILURE ' First we try to jump to the node directly, if this fails we use the ' slower but safer method (expand all nodes and step through) @@ -369,10 +361,10 @@ function hSelectNodeByName( oControl as object , _name as string ) as integer next iCurrentNode endcatch - if ( iThisNode = 0 ) then + if ( iThisNode = RETVAL_FAILURE ) then printlog( CFN & "Exit: Node not found." ) else - printlog( CFN & "Exit: Node selected at pos: " & iThisNode ) + if ( GVERBOSE ) then printlog( CFN & "Exit: Node selected at pos: " & iThisNode ) endif hSelectNodeByName() = iThisNode @@ -393,23 +385,17 @@ function hSelectTheLastNode( oControl as object ) as integer const CFN = "hSelectTheLastNode::" dim iCurrentNodeCount as integer - printlog( CFN & "Enter with option (control): " & oControl.name() ) - - iCurrentNodeCount = -1 - - do while( iCurrentNodeCount < hGetNodeCount( oControl ) ) - - iCurrentNodeCount = hGetNodeCount( oControl ) - hExpandNode( oControl, iCurrentNodeCount ) - - if ( DEBUG_ENABLE ) then + iCurrentNodeCount = hExpandAllNodes( oControl ) + if ( iCurrentNodeCount > 0 ) then + oControl.select( iCurrentNodeCount ) + if ( GVERBOSE ) then printlog( CFN & "Nodename.....: " & oControl.getText() ) printlog( CFN & "Node position: " & iCurrentNodeCount ) endif - - loop + else + iCurrentNodeCount = -1 + endif - printlog( CFN & "Exit with result: " & iCurrentNodeCount ) hSelectTheLastNode() = iCurrentNodeCount end function @@ -428,51 +414,6 @@ function hVerifyNodeName( oControl as object , cName as string ) as boolean end function -'******************************************************************************* - -function hWaitForTreelist( oTreeList as object, cContext as string, iItemCount as integer ) as boolean - - '///<h3>Wait for a treelist to get populated (java related delay)</h3> - '///<b>IMPORTANT: Do not use unless absolutely necessary</b> - '///+<p>Retrieve the number of items from the treelist until a specified - '///+ number has been reached.</p> - - const CFN = "hWaitForTreelist::" - dim iTry as integer - dim iObjects as integer - dim brc as boolean - - brc = false - iTry = 0 - - kontext cContext - - qaerrorlog( CFN & "Stupid function, do not use" ) - - iObjects = 0 - do while ( iObjects < iItemCount ) - - iTry = iTry + 1 - iObjects = hGetNodeCount( oTreeList ) - - if ( iObjects >= iItemCount ) then - brc = true - exit do - endif - - ' Failsafe mechanism - if ( iTry = 10 ) then - qaerrorlog( CFN & "Requested number of items never reached" ) - brc = false - exit do - endif - - loop - - hWaitForTreelist() = brc - -end function - '****************************************************************************** function hGetListItems( oControl as object, aList() as string ) as integer @@ -484,8 +425,9 @@ function hGetListItems( oControl as object, aList() as string ) as integer '///</ul> const CFN = "hGetListItems::" + const RETVAL_FAILURE = 0 - printlog( CFN & "Enter with option (control): " & oControl.name() ) + if ( GVERBOSE ) then printlog( CFN & "Enter with option (control): " & oControl.name() ) dim iItemCount as integer dim iCurrentItem as integer @@ -494,7 +436,7 @@ function hGetListItems( oControl as object, aList() as string ) as integer iItemCount = oControl.getItemCount() if ( iItemCount > ubound( aList() ) ) then printlog( CFN & "Array too small, needed: " & iItemCount ) - hGetListItems() = 0 + hGetListItems() = RETVAL_FAILURE exit function endif @@ -506,8 +448,29 @@ function hGetListItems( oControl as object, aList() as string ) as integer next iCurrentItem - printlog( CFN & "Exit with number of items: " & iItemCount ) + if ( GVERBOSE ) then printlog( CFN & "Exit with number of items: " & iItemCount ) hGetListItems() = iItemCount end function +'******************************************************************************* + +function hFindInList( oControl as object, cObject as string ) as integer + + const RETVAL_FAILURE = 0 + dim iCurrentObject as integer + + for iCurrentObject = 1 to oControl.getItemCount() + + oControl.select( iCurrentObject ) + + if ( oControl.getSelText() = cObject ) then + hFindInList() = iCurrentObject + exit function + endif + + next iCurrentObject + + hFindInList() = RETVAL_FAILURE + +end function
\ No newline at end of file diff --git a/testautomation/global/tools/includes/optional/t_ui_filters.inc b/testautomation/global/tools/includes/optional/t_ui_filters.inc index 0b22b8a94141..b76765e05069 100644 --- a/testautomation/global/tools/includes/optional/t_ui_filters.inc +++ b/testautomation/global/tools/includes/optional/t_ui_filters.inc @@ -99,8 +99,7 @@ function hGetFilterGroup( api_filters() as string, ui_filters() as string ) dim iCurrentFilter as integer - dim iFilterCount as integer - iFilterCount = ubound( api_filters() ) + dim iFilterCount as integer : iFilterCount = ubound( api_filters() ) dim iAPIfilterList as integer @@ -115,9 +114,11 @@ function hGetFilterGroup( api_filters() as string, ui_filters() as string ) if ( oFilter( iAPIFilterList ).Name = "UIName" ) then ui_filters( iCurrentFilter ) = oFilter( iAPIFilterList ).Value() - 'printlog( CFN & "DEBUG: Index (iCurrentFilter): " & iCurrentFilter ) - 'printlog( CFN & "DEBUG: API Filter: " & api_filters( iCurrentFilter ) ) - 'printlog( CFN & "DEBUG: UI Filter.: " & ui_filters( iCurrentFilter ) ) + if ( GVERBOSE ) then + 'printlog( CFN & "DEBUG: Index (iCurrentFilter): " & iCurrentFilter ) + 'printlog( CFN & "DEBUG: API Filter: " & api_filters( iCurrentFilter ) ) + 'printlog( CFN & "DEBUG: UI Filter.: " & ui_filters( iCurrentFilter ) ) + endif endif next iAPIFilterList diff --git a/testautomation/global/tools/includes/optional/t_user_info.inc b/testautomation/global/tools/includes/optional/t_user_info.inc index eed58aa7d530..7ad00b9e539e 100644 --- a/testautomation/global/tools/includes/optional/t_user_info.inc +++ b/testautomation/global/tools/includes/optional/t_user_info.inc @@ -34,7 +34,8 @@ function hCheckForAdministratorPermissions() as boolean ' this function returns TRUE if the user can create files in the office - ' program directory + ' program directory. This is relevant for macro security (VBA compatibility) + ' and extension manager behavior (access to shared installations).S dim iFile as integer dim cProbeFile as string @@ -42,13 +43,14 @@ function hCheckForAdministratorPermissions() as boolean cProbeFile = convertpath( gNetzOfficePath & "program/tt_probe_file" ) try iFile = FreeFile - open cProbeFile for output as iFile : close iFile - kill cProbeFile + open cProbeFile for output as iFile + close( iFile ) + kill( cProbeFile ) hCheckForAdministratorPermissions() = true - printlog( "Current user has administrator rights" ) + printlog( "Current user has administrator permissions" ) catch hCheckForAdministratorPermissions() = false - printlog( "Current user does not have administrator rights" ) + printlog( "Current user does not have administrator permissions" ) endcatch end function diff --git a/testautomation/global/tools/includes/required/t_dir.inc b/testautomation/global/tools/includes/required/t_dir.inc index 0c7d887825f7..04c4bd8956f9 100644..100755 --- a/testautomation/global/tools/includes/required/t_dir.inc +++ b/testautomation/global/tools/includes/required/t_dir.inc @@ -31,55 +31,6 @@ '* '\************************************************************************ -function hFileExists ( Dat as String ) as Boolean - '/// Checks if a file exists - '/// <u>Input</u>: Filename with complete path - '/// <u>Return</u>: TRUE or FALSE if the file exists. - if app.Dir ( Dat ) = "" then - hFileExists = FALSE - else - hFileExists = TRUE - end if -end function -' -'------------------------------------------------------------------------------- -' -function hDirectoryExists ( Verz as String ) as Boolean - '/// Checks if a directory exists - '/// <u>Input</u>: Directory with complete path - '/// <u>Return</u>: TRUE or FALSE if the directory exists. - ' at the end of the string has to be teh path seperator, else the dir-command doesn't work - if right ( Verz, 1 ) <> gPathSigne then Verz = Verz + gPathsigne - if app.Dir ( Verz, 16 ) = "" then - hDirectoryExists = FALSE - else - hDirectoryExists = TRUE - end if -end function -' -'------------------------------------------------------------------------------- -' -function hKillFile ( Dat as String ) as Boolean - '/// Delete a file - '/// <u>Input</u>: File with complete path - '/// <u>Return</u>: TRUE or FALSE success on deleting? - if app.Dir ( Dat ) <> "" then - try - app.kill ( Dat ) - catch - endcatch - if app.Dir ( Dat ) <> "" then - hKillFile = FALSE - else - hKillFile = TRUE - end if - else - hKillFile = TRUE - end if -end function -' -'------------------------------------------------------------------------------- -' function DirNameList (ByVal sPfad$ , lsDirName() as String ) as Integer '/// seperate a path in its parts '/// <u>Input</u>: Path to seperate; Empty list, because it get's reset in this function!; @@ -293,45 +244,8 @@ end function ' '------------------------------------------------------------------------------- ' -function PfadExtract ( sFiledat$ ) as string - '/// Get the path from a file - '/// <u>Input</u>: file with path - '/// <u>Return</u>: path without the filename - Dim s$ : Dim i% : Dim k% - dim ls(25) as String - - s$ = "" - i% = DirNameList( sFileDat$, ls() ) - k% = 2 - do until K%>=i% - ls( 1 ) = ls( 1 ) + ls(k%) - k% = k% +1 - loop - PfadExtract = Left( ls(1), Len(ls( 1 ))-1) -end function -' -'------------------------------------------------------------------------------- -' -function hPfadname (Dateipfad$) as string - '/// Get the path from a file - '/// <u>Input</u>: file with path - '/// <u>Return</u>: path without the filename - dim wh as integer - - for wh = len(Dateipfad$) to 1 step -1 - if mid(Dateipfad$,wh,1) = gPathSigne then - hpfadname = left(Dateipfad$,wh) - exit for - else - hpfadname = Dateipfad$ - end if - next wh -end function -' -'------------------------------------------------------------------------------- -' function DateiExtract ( sFileDat$ ) - '/// Get the filename from a path + '/// Get the filename from a path '/// <u>Input</u>: path with file '/// <u>Return</u>: filename without the path Dim i% diff --git a/testautomation/global/tools/includes/required/t_dirloc.inc b/testautomation/global/tools/includes/required/t_dirloc.inc deleted file mode 100644 index d8bef397c74b..000000000000 --- a/testautomation/global/tools/includes/required/t_dirloc.inc +++ /dev/null @@ -1,288 +0,0 @@ -'************************************************************************** -' 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 : functions for directories and files; execution happens in the testtool -'* -'\************************************************************************ - -function hFileExistsLocal ( Dat as String ) as Boolean - '/// Checks if a file exists - '/// <u>Input</u>: Filename with complete path - '/// <u>Return</u>: TRUE or FALSE if the file exists. - if Dir ( Dat ) = "" then - hFileExistsLocal = FALSE - else - hFileExistsLocal = TRUE - end if -end function -' -'------------------------------------------------------------------------------- -' -function hDirectoryExistsLocal ( Verz as String ) as Boolean - '/// Checks if a directory exists - '/// <u>Input</u>: Directory with complete path - '/// <u>Return</u>: TRUE or FALSE if the directory exists. - ' at the end of the string has to be teh path seperator, else the dir-command doesn't work - if right ( Verz, 1 ) <> gPathSigne then Verz = Verz + gPathSigne - if Dir ( Verz, 16 ) = "" then - hDirectoryExistsLocal = FALSE - else - hDirectoryExistsLocal = TRUE - end if -end function -' -'------------------------------------------------------------------------------- -' -function hKillFileLocal ( Dat as String ) as Boolean - '/// Delete a file - '/// <u>Input</u>: File with complete path - '/// <u>Return</u>: TRUE or FALSE success on deleting? - if Dir ( Dat ) <> "" then - try - kill ( Dat ) - catch - endcatch - if Dir ( Dat ) <> "" then - hKillFileLocal = FALSE - else - hKillFileLocal = TRUE - end if - else - hKillFileLocal = TRUE - end if -end function -' -'------------------------------------------------------------------------------- -' -function DirNameListLocal (ByVal sPfad$ , lsDirName() as String ) as Integer - '/// seperate a path in its parts - '/// <u>Input</u>: Path to seperate; Empty list, because it get's reset in this function!; - '/// <u>Return</u>: Number on entries in the list; list with entries - Dim i% - Dim Pos% - - lsDirName(0) = 0 - do - Pos% = InStr(1, sPfad$, "\") ' got a path - i% = Val(lsDirName(0) ) + 1 - lsDirName(0) = i% - lsDirName( i% ) = Left( sPfad$, Pos% ) ' .. put in list - sPfad = Mid( sPfad$, Pos% + 1 ) ' ...cut off - loop while Pos%>0 - lsDirName( i% ) = sPfad$ - DirNameListLocal = i% ' count of -end function -' -'------------------------------------------------------------------------------- -' -function GetFileNameListLocal ( sPath$, sMatch$ ,lsFile() as String ) as integer - '/// Get files from a directory that match the pattern and append them to a list (without 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 Datname as String - - Count% = 0 - - if right ( sPath$, 1 ) <> gPathSigne then sPath$ = sPath$ + gPathSigne - ' at the end of the string has to be teh path seperator, else the dir-command doesn't work - Datname = Dir( sPath$ + sMatch$ , 0) - - do until Len(Datname) = 0 - Count% = Count% + 1 - lsFile(Count%) = Datname ' append - lsFile(0) = Count% - Datname = Dir - loop - - GetFileNameListLocal = Count% ' all files -end function -' -'------------------------------------------------------------------------------- -' -function GetFileListLocal ( sPath$, sMatch$ ,lsFile() as String ) as integer - '/// Get files from a directory that match the pattern 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 Datname as String - - Count% = 0 - - if right ( sPath$, 1 ) <> gPathSigne then sPath$ = sPath$ + gPathSigne - ' at the end of the string has to be teh path seperator, else the dir-command doesn't work - Datname = Dir( sPath$ + sMatch$ , 0) - - do until Len(Datname) = 0 - lsFile(0) = Val(lsFile(0)) + 1 - lsFile( lsFile(0) ) =sPath$ + Datname - Count% = Count% + 1 - Datname = Dir - loop - GetFileListLocal = Count% -end function -' -'------------------------------------------------------------------------------- -' -function GetDirListLocal ( 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 Verzeichnis as String - - if right ( sPath$, 1 ) <> gPathSigne then sPath$ = sPath$ + gPathSigne - ' at the end of the string has to be teh path seperator, else the dir-command doesn't work - Verzeichnis = Dir( sPath$ + sMatch$ , 16) - Count% = 0 - - do until Len(Verzeichnis) = 0 - if Verzeichnis <>"." AND Verzeichnis <> ".." then - lsFile(0) = Val(lsFile(0)) + 1 - lsFile( lsFile(0) ) = sPath$ + Verzeichnis + gPathSigne - Count% = Count% + 1 - end if - Verzeichnis = Dir - loop - - GetDirListLocal = Count% -end function -' -'------------------------------------------------------------------------------- -' -function GetAllDirListLocal ( byVal sPath$, byVal sMatch$ ,lsFile() as String ) as integer - '/// Get all directorys recursiv that match the pattern and append them to a list - '/// <u>Input</u>: Directory with complete path; Search Pattern, e.g *; Empty list, because it get's reset in this function!; - '/// <u>Return</u>: Count of appended entries (1. entry is the whole path); updated list - Dim Count% : Dim DirCount% - - DirCount% = 1 ' dummy - Count% = 1 - lsFile(0) = 1 'new list - lsFile(1) = sPath$ 'first path is the calling path - - do until Count%>Val(lsFile(0)) ' get first generation - DirCount% = GetDirListLocal ( lsFile(Count%) , sMatch$, lsFile() ) ' append all subdirectories - Count% = Count% +1 - loop - - GetAllDirListLocal = Count% - 1 ' count of listelements -end function -' -'------------------------------------------------------------------------------- -' -function GetAllFileListLocal ( byVal sPath$, byVal sMatch$ ,lsFile() as String ) as integer - '/// Get all Files recursiv (including in subdirectories) that match the pattern and append them to a list - '/// <u>Input</u>: Directory with complete path; Search Pattern, e.g *.*; Empty list, because it get's reset in this function!; - '/// <u>Return</u>: Count of appended entries (1. entry is the whole path); updated list - Dim DirCount% : Dim FileCount% : Dim Count% - Dim lsDir(1000) as String - - DirCount% = GetAllDirListLocal ( sPath$, "*", lsDir() ) ' just all directories - FileCount% = 0 - lsFile(0) = 1 - lsFile(1) = sPath$ - - For Count% = 1 to Val( lsDir(0) ) - FileCount% = FileCount% + GetFileListLocal ( lsDir( Count% ), sMatch$, lsFile() ) - next Count% - - GetAllFileListLocal = FileCount% ' count of files -end function -' -'------------------------------------------------------------------------------- -' -function KillFileListLocal ( lsList() as String ) as Boolean - '/// Delete all files in the list - '/// <u>Input</u>: List with files - '/// <u>Return</u>: TRUE or FALSE if files are killed; modified list with not deleted files. - Dim i as Integer - Dim FehlerListe ( 1000 ) as String - - FehlerListe ( 0 ) = 0 - for i=1 to ListCount ( lsList() ) - try - kill ( lsList(i) ) - catch - ListAppend ( FehlerListe (), lsList(i) ) - endcatch - next i - - lsList(0) = 0 ' delete old list - KillFileListLocal = TRUE - for i=1 to ListCount ( FehlerListe () ) - KillFileListLocal = FALSE - ListAppend ( lsList(), FehlerListe (i) ) - next i -end function -' -'------------------------------------------------------------------------------- -' -function KillDirListLocal ( lsList() as String ) as Boolean - '/// Delete all directories in the list - '/// <u>Input</u>: List with directories - '/// <u>Return</u>: TRUE or FALSE if directories are killed; modified list with not deleted directories. - Dim i as Integer - Dim FehlerListe ( 1000 ) as String - - FehlerListe ( 0 ) = 0 - for i=1 to ListCount ( lsList() ) - try - rmDir ( lsList(i) ) - catch - ListAppend ( FehlerListe (), lsList(i) ) - endcatch - next i - - lsList(0) = 0 ' delete old list - KillDirListLocal = TRUE - for i=1 to ListCount ( FehlerListe () ) - KillDirListLocal = FALSE - ListAppend ( lsList(), FehlerListe (i) ) - next i -end function -' -'------------------------------------------------------------------------------- -' -function GetFileSizesLocal ( lsList() as String ) as long - '/// Computes the total Filesize of the files in the list - '/// <u>Input</u>: List with files - '/// <u>Return</u>: Filesize in bytes - Dim iSum - Dim i as Integer - - iSum = 0 - for i=1 to ListCount ( lsList() ) - try - iSum = iSum + FileLen ( lsList(i) ) - catch - endcatch - next i - - GetFileSizesLocal = iSum -end function diff --git a/testautomation/global/tools/includes/required/t_doc1.inc b/testautomation/global/tools/includes/required/t_doc1.inc index ed74336dfc72..61c6afadab03 100644 --- a/testautomation/global/tools/includes/required/t_doc1.inc +++ b/testautomation/global/tools/includes/required/t_doc1.inc @@ -34,7 +34,6 @@ sub hNewDocument ( optional bANewDoc ) '/// hNewDocument : open a new document dependent on 'gApplication' ///' dim sTemp as string - gApplication = gApplication if IsMissing ( bANewDoc ) <> TRUE then if bANewDoc = TRUE then @@ -52,10 +51,10 @@ sub hNewDocument ( optional bANewDoc ) else FileOpen "FileName", "private:factory/swriter", "FrameName", "_default", "SynchronMode", TRUE end if - if ( DocumentWriter.IsMax() = false ) then - DocumentWriter.Maximize() - Wait( 2000 ) - end if + if ( DocumentWriter.IsMax() = false ) then + DocumentWriter.Maximize() + Wait( 2000 ) + end if case "CALC" Kontext "DocumentCalc" if gNoNewDoc = TRUE then @@ -63,10 +62,10 @@ sub hNewDocument ( optional bANewDoc ) else FileOpen "FileName", "private:factory/scalc", "FrameName", "_default", "SynchronMode", TRUE end if - if ( DocumentCalc.IsMax() = false ) then - DocumentCalc.Maximize() - Wait( 2000 ) - end if + if ( DocumentCalc.IsMax() = false ) then + DocumentCalc.Maximize() + Wait( 2000 ) + end if case "IMPRESS" Kontext "DocumentImpress" if gNoNewDoc = TRUE then @@ -84,10 +83,10 @@ sub hNewDocument ( optional bANewDoc ) end if Kontext "DocumentImpress" Sleep 2 - if ( DocumentImpress.IsMax() = false ) then - DocumentImpress.Maximize() - Wait( 2000 ) - end if + if ( DocumentImpress.IsMax() = false ) then + DocumentImpress.Maximize() + Wait( 2000 ) + end if end if case "DRAW" Kontext "DocumentDraw" @@ -96,10 +95,10 @@ sub hNewDocument ( optional bANewDoc ) else FileOpen "FileName", "private:factory/sdraw", "FrameName", "_default", "SynchronMode", TRUE end if - if ( DocumentDraw.IsMax() = false ) then - DocumentDraw.Maximize() - Wait( 2000 ) - end if + if ( DocumentDraw.IsMax() = false ) then + DocumentDraw.Maximize() + Wait( 2000 ) + end if case "MASTERDOCUMENT" Kontext "DocumentMasterDoc" if gNoNewDoc = TRUE then @@ -111,10 +110,10 @@ sub hNewDocument ( optional bANewDoc ) sleep (1) if Navigator.Exists(5) then Navigator.Close Kontext "DocumentMasterDoc" - if ( DocumentMasterDoc.IsMax() = false ) then - DocumentMasterDoc.Maximize() - Wait( 2000 ) - end if + if ( DocumentMasterDoc.IsMax() = false ) then + DocumentMasterDoc.Maximize() + Wait( 2000 ) + end if case "MATH" Kontext "DocumentMath" if gNoNewDoc = TRUE then @@ -123,10 +122,10 @@ sub hNewDocument ( optional bANewDoc ) FileOpen "FileName", "private:factory/smath", "FrameName", "_default", "SynchronMode", TRUE end if Kontext "DocumentMath" - if ( DocumentMath.IsMax() = false ) then - DocumentMath.Maximize() - Wait( 2000 ) - end if + if ( DocumentMath.IsMax() = false ) then + DocumentMath.Maximize() + Wait( 2000 ) + end if case "HTML" Kontext "DocumentWriterWeb" if gNoNewDoc = TRUE then @@ -135,10 +134,10 @@ sub hNewDocument ( optional bANewDoc ) FileOpen "FileName", "private:factory/swriter/web", "FrameName", "_default", "SynchronMode", TRUE end if Kontext "DocumentWriterWeb" - if ( DocumentWriterWeb.IsMax() = false ) then - DocumentWriterWeb.Maximize() - Wait( 2000 ) - end if + if ( DocumentWriterWeb.IsMax() = false ) then + DocumentWriterWeb.Maximize() + Wait( 2000 ) + end if case "DATABASE" FileOpen "FileName", "private:factory/sdatabase?Interactive", "FrameName", "_default", "SynchronMode", TRUE Kontext "DatabaseWizard" @@ -189,37 +188,55 @@ end sub '------------------------------------------------------------------------------- ' function hCreateLabels() as Boolean - '/// hCreateLabels : open the tab-dialog for making a new lable (file/new/lable) ///' - FileOpen "FileName", "private:factory/swriter?slot=21051", "FrameName", "_default", "SynchronMode", TRUE - Sleep (2) + + hCreateLabels() = false + + FileOpen( "FileName", "private:factory/swriter?slot=21051", "FrameName", "_default", "SynchronMode", TRUE ) + Kontext - Active.Setpage TabEtiketten - Kontext "TabEtiketten" - if Not TabEtiketten.Exists then - Warnlog "Dialog for Labels is not up!" - hCreateLabels = False + if ( Active.exists( 5 ) ) then + Active.setPage TabEtiketten + + if ( TabEtiketten.exists( 1 ) ) then + if ( Tabetiketten.isVisible() ) then + hCreateLabels() = true + else + warnlog( "<TabEtiketten> is not visible" ) + endif + else + warnlog( "<TabEtiketten> not open" ) + endif else - hCreateLabels = True + warnlog( "Failed to open <TabEtiketten>" ) endif - Sleep (2) + end function ' '------------------------------------------------------------------------------- ' function hCreateBusinessCards() as Boolean - '/// hCreateBusinessCards : open the tab-dialog for making a new business card (file/new/business cards) ///' - FileOpen "FileName", "private:factory/swriter?slot=21052", "FrameName", "_default", "SynchronMode", TRUE - Sleep (2) + + hCreateBusinessCards() = false + + FileOpen( "FileName", "private:factory/swriter?slot=21052", "FrameName", "_default", "SynchronMode", TRUE ) + Kontext - Active.Setpage TabEtikettenMedium - Kontext "TabEtikettenMedium" - if Not TabEtikettenMedium.Exists then - Warnlog "Dialog for BusinessCards is not up!" - hCreateBusinessCards = False + if ( Active.exists( 5 ) ) then + Active.setPage TabEtikettenMedium + + if ( TabEtikettenMedium.exists( 1 ) ) then + if ( TabetikettenMedium.isVisible() ) then + hCreateBusinessCards() = true + else + warnlog( "<TabEtikettenMedium> is not visible" ) + endif + else + warnlog( "<TabEtikettenMedium> not open" ) + endif else - hCreateBusinessCards = True + warnlog( "Failed to open <TabEtikettenMedium>" ) endif - Sleep (2) + end function ' '------------------------------------------------------------------------------- @@ -231,301 +248,206 @@ function hCloseDocument() '/// Accept to lose changes' Kontext "Active" - if Active.Exists(2) then + if ( Active.Exists( 2 ) ) then try Active.No catch - Active.Click ( 202 ) + Active.Click( 202 ) endcatch end if - + '/// Wait for FileClose to complete' WaitSlot( 2000 ) - + end function ' '------------------------------------------------------------------------------- ' -sub gMouseClick ( X%, Y%, optional mb% ) - '/// gMouseClick ( x_Position, y-Position ) : make a mouseclick on the document (dependent on 'gApplication') ///' - '/// default left mousebutton will be used otherwise you can optionally give the mousebutton to press - '/// 1 = left mouse button - '/// 2 = left mouse button - '/// 3 = left mouse button +sub gMouseClick ( X%, Y%, optional _mousebutton ) - gApplication = gApplication + dim oDocument as object + dim mousebutton as integer - if IsMissing(mb%) then mb% = 1 + ' Handle infamous optional parameter + if ( IsMissing( _mousebutton ) ) then + mousebutton = 1 + else + mousebutton = _mousebutton + endif - select case gApplication - case "BACKGROUND" - Kontext "BACKGROUND" - autoexecute = false - Desktop.MouseDown ( X%, Y%, mb% ) - Desktop.MouseUp ( X%, Y%, mb% ) - autoexecute = true - case "CALC" - Kontext "DocumentCalc" - autoexecute = false - DocumentCalc.MouseDown ( X%, Y%, mb% ) - DocumentCalc.MouseUp ( X%, Y%, mb% ) - autoexecute = true - case "DRAW" - Kontext "DocumentDraw" - autoexecute=false - DocumentDraw.MouseDown ( X%, Y%, mb% ) - DocumentDraw.MouseUp ( X%, Y%, mb% ) - autoexecute=true - case "WRITER" - Kontext "DocumentWriter" - autoexecute=false - DocumentWriter.MouseDown ( X%, Y%, mb% ) - DocumentWriter.MouseUp ( X%, Y%, mb% ) - autoexecute=true - case "HTML" - Kontext "DocumentWriterWeb" - autoexecute=false - DocumentWriterWeb.MouseDown ( X%, Y%, mb% ) - DocumentWriterWeb.MouseUp ( X%, Y%, mb% ) - autoexecute=true - case "MASTERDOCUMENT" - Kontext "DocumentMasterDoc" - autoexecute=false - DocumentMasterDoc.MouseDown ( X%, Y%, mb% ) - DocumentMasterDoc.MouseUp ( X%, Y%, mb% ) - autoexecute=true - case "IMPRESS" - Kontext "DocumentImpress" - autoexecute=false - DocumentImpress.MouseDown ( X%, Y%, mb% ) - DocumentImpress.MouseUp ( X%, Y%, mb% ) - autoexecute=true - case "MATH" - Kontext "DocumentMath" - autoexecute=false - DocumentMath.MouseDown ( X%, Y%, mb% ) - DocumentMath.MouseDown ( X%, Y%, mb% ) - autoexecute=true - case "CHART" - Kontext "DocumentChart" - autoexecute=false - DocumentChart.MouseDown ( X%, Y%, mb% ) - DocumentChart.MouseUp ( X%, Y%, mb% ) - autoexecute=true - end select - sleep (2) + hSetDocumentContext() ' set kontext to current document type + oDocument = hSetDocumentObject() ' get the current document object + + autoexecute = false + oDocument.MouseDown ( X%, Y%, mousebutton ) + oDocument.MouseUp ( X%, Y%, mousebutton ) + autoexecute = true + wait( 1000 ) + end sub ' '------------------------------------------------------------------------------- ' sub gMouseDoubleClick ( X%, Y% ) - '/// gMouseDoubleClick ( x_Position, y-Position ) : make a mouse-doubleclick on the document ( dependent on 'gApplication' ) ///' - gApplication = gApplication - select case gApplication - case "CALC" - Kontext "DocumentCalc" - DocumentCalc.MouseDoubleClick ( X%, Y% ) - case "DRAW" - Kontext "DocumentDraw" - DocumentDraw.MouseDoubleClick ( X%, Y% ) - case "BACKGROUND" - Kontext "BACKGROUND" - Desktop.MouseDoubleClick ( X%, Y% ) - case "WRITER" - Kontext "DocumentWriter" - DocumentWriter.MouseDoubleClick ( X%, Y% ) - case "HTML" - Kontext "DocumentWriterWeb" - DocumentWriterWeb.MouseDoubleClick ( X%, Y% ) - case "MASTERDOCUMENT" - Kontext "DocumentMasterDoc" - DocumentMasterDoc.MouseDoubleClick ( X%, Y% ) - case "IMPRESS" - Kontext "DocumentImpress" - DocumentImpress.MouseDoubleClick ( X%, Y% ) - case "MATH" - Kontext "DocumentMath" - DocumentMath.MouseDoubleClick ( X%, Y% ) - end select - Sleep (2) + dim oDocument as object + + hSetDocumentContext() ' set kontext to current document type + oDocument = hSetDocumentObject() ' get the current document object + oDocument.MouseDoubleClick ( X%, Y% ) + wait( 1000 ) + end sub ' '------------------------------------------------------------------------------- ' sub gMouseMove ( BeginX%, BeginY%, EndX%, EndY% ) - '/// gMouseMove ( BeginX, BeginY, EndX, EndY ) : make a mousemove trom Bx,By to Ex,Ey on the document ( dependent on 'gApplication' ) ///' - gApplication = gApplication - select case gApplication - case "CALC" - Kontext "DocumentCalc" - DocumentCalc.MouseDown ( BeginX%, BeginY% ) - DocumentCalc.MouseMove ( EndX%, EndY%) - DocumentCalc.MouseUp ( EndX%, EndY% ) - case "DRAW" - Kontext "DocumentDraw" - DocumentDraw.MouseDown ( BeginX%, BeginY% ) - DocumentDraw.MouseMove ( EndX%, EndY% ) - DocumentDraw.MouseUp ( EndX%, EndY% ) - case "WRITER" - Kontext "DocumentWriter" - DocumentWriter.MouseDown ( BeginX%, BeginY% ) - DocumentWriter.MouseMove ( EndX%, EndY%) - DocumentWriter.MouseUp ( EndX%, EndY% ) - case "HTML" - Kontext "DocumentWriterWeb" - DocumentWriterWeb.MouseDown ( BeginX%, BeginY% ) - DocumentWriterWeb.MouseMove ( EndX%, EndY%) - DocumentWriterWeb.MouseUp ( EndX%, EndY% ) - case "MASTERDOCUMENT" - Kontext "DocumentMasterDoc" - DocumentMasterDoc.MouseDown ( BeginX%, BeginY% ) - DocumentMasterDoc.MouseMove ( EndX%, EndY%) - DocumentMasterDoc.MouseUp ( EndX%, EndY% ) - case "IMPRESS" - Kontext "DocumentImpress" - DocumentImpress.MouseDown ( BeginX%, BeginY% ) - DocumentImpress.MouseMove ( EndX%, EndY%) - DocumentImpress.MouseUp ( EndX%, EndY% ) - case "MATH" - Kontext "DocumentMath" - DocumentMath.MouseDown ( BeginX%, BeginY% ) - DocumentMath.MouseMove ( EndX%, EndY%) - DocumentMath.MouseDown ( EndX%, EndY% ) - end select - Sleep (2) + dim oDocument as object + + hSetDocumentContext() ' set kontext to current document type + oDocument = hSetDocumentObject() ' get the current document object + oDocument.MouseDown ( BeginX%, BeginY% ) + oDocument.MouseMove ( EndX%, EndY%) + oDocument.MouseUp ( EndX%, EndY% ) + wait( 1000 ) + end sub ' '------------------------------------------------------------------------------- ' sub gMouseDown ( BeginX%, BeginY% ) - '/// gMouseDown ( x_Position, y-Position ) : make a mousedown on the document (dependent on 'gApplication') ///' - '///+ DON'T FORGETT to call gMouseUp ! ///' - gApplication = gApplication - select case gApplication - case "CALC" - Kontext "DocumentCalc" - DocumentCalc.MouseDown ( BeginX%, BeginY% ) - case "DRAW" - Kontext "DocumentDraw" - DocumentDraw.MouseDown ( BeginX%, BeginY% ) - case "WRITER" - Kontext "DocumentWriter" - DocumentWriter.MouseDown ( BeginX%, BeginY% ) - case "HTML" - Kontext "DocumentWriterWeb" - DocumentWriterWeb.MouseDown ( BeginX%, BeginY% ) - case "MASTERDOCUMENT" - Kontext "DocumentMasterDoc" - DocumentMasterDoc.MouseDown ( BeginX%, BeginY% ) - case "IMPRESS" - Kontext "DocumentImpress" - DocumentImpress.MouseDown ( BeginX%, BeginY% ) - case "MATH" - Kontext "DocumentMath" - DocumentMath.MouseDown ( BeginX%, BeginY% ) - end select - Sleep (2) + dim oDocument as object + + hSetDocumentContext() ' set kontext to current document type + oDocument = hSetDocumentObject() ' get the current document object + oDocument.MouseDown ( BeginX%, BeginY% ) + wait( 300 ) + end sub ' '------------------------------------------------------------------------------- ' sub gMouseMove2 ( EndX%, EndY% ) - '/// gMouseMove2 ( x_Position, y-Position ) : move the pointer to position on the document (dependent on 'gApplication') ///' - gApplication = gApplication - select case gApplication - case "CALC" - Kontext "DocumentCalc" - DocumentCalc.MouseMove ( EndX%, EndY%) - case "DRAW" - Kontext "DocumentDraw" - DocumentDraw.MouseMove ( EndX%, EndY% ) - case "WRITER" - Kontext "DocumentWriter" - DocumentWriter.MouseMove ( EndX%, EndY%) - case "HTML" - Kontext "DocumentWriterWeb" - DocumentWriterWeb.MouseMove ( EndX%, EndY%) - case "MASTERDOCUMENT" - Kontext "DocumentMasterDoc" - DocumentMasterDoc.MouseMove ( EndX%, EndY%) - case "IMPRESS" - Kontext "DocumentImpress" - DocumentImpress.MouseMove ( EndX%, EndY%) - case "MATH" - Kontext "DocumentMath" - DocumentMath.MouseMove ( EndX%, EndY%) - end select - Sleep (2) + dim oDocument as object + + hSetDocumentContext() ' set kontext to current document type + oDocument = hSetDocumentObject() ' get the current document object + oDocument.MouseMove ( EndX%, EndY%) + wait( 300 ) + end sub ' '------------------------------------------------------------------------------- ' sub gMouseUp ( EndX%, EndY% ) - '/// gMouseUp ( x_Position, y-Position ) : make a release button on the document (dependent on 'gApplication') ///' - gApplication = gApplication - select case gApplication - case "CALC" - Kontext "DocumentCalc" - DocumentCalc.MouseUp ( EndX%, EndY% ) - case "DRAW" - Kontext "DocumentDraw" - DocumentDraw.MouseUp ( EndX%, EndY% ) - case "WRITER" - Kontext "DocumentWriter" - DocumentWriter.MouseUp ( EndX%, EndY% ) - case "HTML" - Kontext "DocumentWriterWeb" - DocumentWriterWeb.MouseUp ( EndX%, EndY% ) - case "MASTERDOCUMENT" - Kontext "DocumentMasterDoc" - DocumentMasterDoc.MouseUp ( EndX%, EndY% ) - case "IMPRESS" - Kontext "DocumentImpress" - DocumentImpress.MouseUp ( EndX%, EndY% ) - case "MATH" - Kontext "DocumentMath" - DocumentMath.MouseUp ( EndX%, EndY% ) - end select - Sleep (2) + dim oDocument as object + + hSetDocumentContext() ' set kontext to current document type + oDocument = hSetDocumentObject() ' get the current document object + oDocument.MouseUp ( EndX%, EndY% ) + wait( 300 ) + end sub ' '------------------------------------------------------------------------------- ' -sub hTypeKeys ( OutputText , optional iLoop as Integer ) - '/// hTypeKeys ( OutputText , optional iLoop as Integer ): type the keys in 'outputtext' 'iLoop' times ///' - Dim i as integer - - If IsMissing(iLoop) = True then iLoop = 1 - For i = 1 to iLoop - Select Case Ucase(gApplication) - Case "WRITER" - Kontext "DocumentWriter" - DocumentWriter.TypeKeys OutputText - Case "MASTERDOCUMENT" - Kontext "DocumentMasterDoc" - DocumentMasterDoc.TypeKeys OutputText - Case "HTML" - Kontext "DocumentWriterWeb" - DocumentWriterWeb.TypeKeys OutputText - case "CALC" - Kontext "DocumentCalc" - DocumentCalc.TypeKeys OutputText - case "DRAW" - Kontext "DocumentDraw" - DocumentDraw.TypeKeys OutputText - case "IMPRESS" - Kontext "DocumentImpress" - DocumentImpress.TypeKeys OutputText - case "MATH" - Kontext "DocumentMath" - DocumentMath.TypeKeys OutputText - end select - wait 500 - next i +sub hTypeKeys ( OutputText , optional _iLoop as Integer ) + + dim iRepeat as integer + dim iLoop as integer + dim oDocument as object + + ' Handle infamous optional parameter + If ( IsMissing( _iLoop ) ) then + iLoop = 1 + else + iLoop = _iLoop + endif + + hSetDocumentContext() ' set kontext to current document type + oDocument = hSetDocumentObject() ' Get the document object we want to write to + + for iRepeat = 1 to iLoop + oDocument.TypeKeys( OutputText ) + wait( 200 ) + next iRepeat + end sub +'******************************************************************************* + +function hSetDocumentContext() as string + + ' link gApplication to its document kontext + + dim cDocumentContext as string + + select case( gApplication ) + case "DRAW" : cDocumentContext = "DocumentDraw" + case "IMPRESS" : cDocumentContext = "DocumentImpress" + case "WRITER" : cDocumentContext = "DocumentWriter" + case "CALC" : cDocumentContext = "DocumentCalc" + case "MATH" : cDocumentContext = "DocumentMath" + case "HTML" : cDocumentContext = "DocumentWriterWeb" + case "MASTERDOCUMENT" : cDocumentContext = "DocumentMasterDoc" + case "CHART" : cDocumentContext = "DocumentChart" + case "BACKGROUND" : cDocumentContext = "Background" + case else : warnlog( "Unknown gApplication: " & gApplication ) + end select + + kontext cDocumentContext : hSetDocumentContext() = cDocumentContext + +end function + +'******************************************************************************* + +function hSetDocumentObject() as object + + ' link gApplication to its document object + + dim oDocumentObject as object + + select case( gApplication ) + Case "WRITER" : oDocumentObject = DocumentWriter + Case "MASTERDOCUMENT" : oDocumentObject = DocumentMasterDoc + Case "HTML" : oDocumentObject = DocumentWriterWeb + case "CALC" : oDocumentObject = DocumentCalc + case "DRAW" : oDocumentObject = DocumentDraw + case "IMPRESS" : oDocumentObject = DocumentImpress + case "MATH" : oDocumentObject = DocumentMath + case "CHART" : oDocumentObject = DocumentChart + case "BACKGROUND" : oDocumentObject = Desktop + case else : warnlog( "Unknown gApplication: " & gApplication ) + end select + + hSetDocumentObject() = oDocumentObject + +end function + +'******************************************************************************* + +function hSetDocumentFactory() as string + + ' link gApplication to its factory as used by FileOpen slot + + dim cDocumentFactory as string + + select case( gApplication ) + case "DRAW" : cDocumentFactory = "private:factory/sdraw" + case "IMPRESS" : cDocumentFactory = "private:factory/simpress" + case "WRITER" : cDocumentFactory = "private:factory/swriter" + case "CALC" : cDocumentFactory = "private:factory/scalc" + case "MATH" : cDocumentFactory = "private:factory/smath" + case "HTML" : cDocumentFactory = "private:factory/swriter/web" + case "MASTERDOCUMENT" : cDocumentFactory = "private:factory/swriter/GlobalDocument" + case "DATABASE" : cDocumentFactory = "private:factory/sdatabase?Interactive" + case else : warnlog( "Unknown gApplication: " & gApplication ) + end select + + hSetDocumentFactory() = cDocumentFactory + +end function
\ No newline at end of file diff --git a/testautomation/global/tools/includes/required/t_doc2.inc b/testautomation/global/tools/includes/required/t_doc2.inc index efd2d2799a0e..4941d0fcf7ad 100755 --- a/testautomation/global/tools/includes/required/t_doc2.inc +++ b/testautomation/global/tools/includes/required/t_doc2.inc @@ -31,35 +31,34 @@ '* '\*********************************************************************** -private const VERBOSE = TRUE - sub hTabelleEinfuegen '/// <b>WRITER only </b>///' '/// hTabelleEinfuegen hInsertTable ///' '/// insert a dummy table in writer/writerweb/masterdocument ///' TableInsertTable - sleep(2) + Kontext "TabelleEinfuegenWriter" - wait 500 - TabelleEinfuegenWriter.OK - sleep(1) - - Kontext "TableObjectbar" - sleep(1) - if TableObjectbar.NotExists then - Kontext "TextObjectbar" - TextObjectbar.SetNextToolBox - end if + if ( TabelleEinfuegenWriter.exists( 2 ) ) then + + hCloseDialog( TabelleEinfuegenWriter, "ok" ) + + Kontext "TableObjectbar" + if ( TableObjectbar.exists( 1 ) ) then + ' We are happy then, do nothing + else + Kontext "TextObjectbar" + TextObjectbar.SetNextToolBox + end if + + select case ( gApplication ) + Case "WRITER" : Kontext "DocumentWriter" + Case "MASTERDOCUMENT" : Kontext "DocumentMasterDoc" + Case "HTML" : Kontext "DocumentWriterWeb" + end select + else + warnlog( "hTabelleEinfuegen: Failed to open <TabelleEinfuegenWriter> dialog" ) + endif - select case uCASE(gApplication) - Case "WRITER" - Kontext "DocumentWriter" - Case "MASTERDOCUMENT" - Kontext "DocumentMasterDoc" - Case "HTML" - Kontext "DocumentWriterWeb" - end select - sleep(1) end sub ' '------------------------------------------------------------------------------- @@ -109,14 +108,48 @@ sub SchreibenInMathdok ( Eingabe as String ) warnlog "--No Clipboard available :-(--" printlog "---ClipTest--- should: "+Eingabe +", is: "+GetClipboard endif - EditPaste - sleep(3) + hUseAsyncSlot( "EditPaste" ) end sub ' '------------------------------------------------------------------------------- ' +function hEnableDocumentEditMode() as boolean + + hEnableDocumentEditMode() = false + + dim iTry as integer + + printlog( "Try to switch document to edit mode" ) + for iTry = 1 to 20 + try + kontext "Standardbar" + if ( Bearbeiten.getState( 2 ) <> 1 ) then + Bearbeiten.click() + + kontext "Active" + if ( Active.exists( 1 ) ) then + printlog( "Handle <Use copy message>" ) + hCloseDialog( Active, "yes" ) + wait( 2000 ) + printlog( "Successfully switched to edit mode" ) + hEnableDocumentEditMode() = true + exit for + endif + endif + catch + wait( 200 ) + endcatch + next iTry + +end function + +'******************************************************************************* + function sMakeReadOnlyDocumentEditable() as boolean + sMakeReadOnlyDocumentEditable() = hEnableDocumentEditMode() + exit function + ' Function returns TRUE if document has been made editable and FALSE if ' no action was required (that is: Document was not read-only) @@ -124,22 +157,22 @@ function sMakeReadOnlyDocumentEditable() as boolean dim iWait as integer dim rc as integer const CFN = "sMakeReadOnlyDocumentEditable::" - - if ( VERBOSE ) then printlog( CFN & "Making document editable (create a copy) if it is readonly" ) - + + if ( GVERBOSE ) then printlog( CFN & "Making document editable (create a copy) if it is readonly" ) + ' We still run into synchronization problems with the "Make document editable" feature - ' because we do not know when this button becomes available and ready for use: The + ' because we do not know when this button becomes available and ready for use: The ' document has to be loaded, then we have to wait for the toolbar to get populated. ' One thing appears to work though: Try to execute the slot using hUseAsyncSlot. ' This is a little bit tricky because the state of the document is altered but if ' the slot has been executed once we know for sure that the button on the toolbar is ' available and can check its state and - if need be - chenge the document state back. - + ' ========== Workaround begin ========== hUseAsyncSlot( "EditDoc" ) kontext "Active" if ( Active.exists() ) then - if ( VERBOSE ) then printlog( "Handling create copy message" ) + if ( GVERBOSE ) then printlog( "Handling create copy message" ) Active.yes() wait( 1000 ) endif @@ -153,12 +186,12 @@ function sMakeReadOnlyDocumentEditable() as boolean exit do endif catch - if ( VERBOSE ) then printlog "Attempt " & iWait & " to make document readable failed" + if ( GVERBOSE ) then printlog "Attempt " & iWait & " to make document readable failed" iWait = iWait + 1 wait ( 1000 ) endcatch else - if ( VERBOSE ) then printlog "Attempt " & iWait & " to make document readable failed" + if ( GVERBOSE ) then printlog "Attempt " & iWait & " to make document readable failed" iWait = iWait + 1 wait ( 1000 ) end if @@ -166,26 +199,26 @@ function sMakeReadOnlyDocumentEditable() as boolean Loop if ( Bearbeiten.IsEnabled() ) then - + if ( Bearbeiten.getState( 2 ) = 0 ) then - + rc = hUseAsyncSlot("editdoc") if ( rc >= 0 ) then for iTry = 1 to 2 - - + + Kontext "Active" if ( Active.exists( 5 ) ) then - + printlog( CFN & "Messagebox: " & Active.getText() ) - + try - if ( VERBOSE ) then printlog( CFN & "Document was read-only. A copy will be used." ) + if ( GVERBOSE ) then printlog( CFN & "Document was read-only. A copy will be used." ) Active.Yes() - if ( VERBOSE ) then printlog( CFN & "Closed 'use copy' message" ) + if ( GVERBOSE ) then printlog( CFN & "Closed 'use copy' message" ) catch - if ( VERBOSE ) then printlog( CFN & "Probing for unexpected messagebox..." ) + if ( GVERBOSE ) then printlog( CFN & "Probing for unexpected messagebox..." ) active.ok() qaerrorlog( "#i100701 - Object not found message" ) endcatch @@ -198,13 +231,13 @@ function sMakeReadOnlyDocumentEditable() as boolean printlog( CFN & "Document appears to be editable" ) endif else - if ( VERBOSE ) then printlog( CFN & "Button <Bearbeiten> is pressed, document is editable" ) + if ( GVERBOSE ) then printlog( CFN & "Button <Bearbeiten> is pressed, document is editable" ) sMakeReadOnlyDocumentEditable() = FALSE endif else - if ( VERBOSE ) then printlog( CFN & "Control <Bearbeiten> is not enabled" ) + if ( GVERBOSE ) then printlog( CFN & "Control <Bearbeiten> is not enabled" ) endif - + end function ' '------------------------------------------------------------------------------- @@ -215,16 +248,20 @@ function fSelectFirstOLE() as integer '+ 0 := Sucess '- 1 := unknown application - dim bNavigatorWasVisible as boolean - bNavigatorWasVisible = FALSE - dim iIndex + const RETVAL_SUCCESS = 0 + const RETVAL_UNKNOWN_APPLICATION = -1 + + const MAX_WAIT_FOR_NAVIGATOR = 10 + + dim bNavigatorWasVisible as boolean : bNavigatorWasVisible = FALSE + dim iIndex as integer - fSelectFirstOLE = -1 + fSelectFirstOLE() = RETVAL_UNKNOWN_APPLICATION - select case uCASE(gApplication) + select case ( gApplication ) case "CALC" : Kontext "NavigatorCalc" 'First check if Navigator is visible and remember result - if NavigatorCalc.exists (10) then + if NavigatorCalc.exists ( MAX_WAIT_FOR_NAVIGATOR ) then bNavigatorWasVisible = TRUE else try @@ -240,7 +277,7 @@ function fSelectFirstOLE() as integer endcatch end if Kontext "NavigatorCalc" - if NavigatorCalc.exists (10) then + if NavigatorCalc.exists ( MAX_WAIT_FOR_NAVIGATOR ) then 'Select first OLE in list Liste.TypeKeys "<HOME>" for iIndex = 1 to 8 @@ -252,12 +289,12 @@ function fSelectFirstOLE() as integer Liste.select(6) Liste.TypeKeys "+" Liste.TypeKeys "<DOWN><RETURN>" - fSelectFirstOLE = 0 + fSelectFirstOLE() = RETVAL_SUCCESS else QAErrorLog "Navigator couldn't be opened!" end if case "DRAW" , "IMPRESS" : Kontext "NavigatorDraw" - if NavigatorDraw.Exists(10) then + if NavigatorDraw.Exists( MAX_WAIT_FOR_NAVIGATOR ) then bNavigatorWasVisible = TRUE else try @@ -272,21 +309,21 @@ function fSelectFirstOLE() as integer ViewNavigator endcatch Kontext "NavigatorDraw" - if NavigatorDraw.exists(10) then + if NavigatorDraw.exists( MAX_WAIT_FOR_NAVIGATOR ) then 'Select first OLE in list Liste.TypeKeys "<HOME>" Liste.select(1) Liste.TypeKeys "+<DOWN><RETURN>" - fSelectFirstOLE = 0 + fSelectFirstOLE() = RETVAL_SUCCESS else - QAErrorLog "Navigator did not occoured!" + QAErrorLog "Navigator did not open!" end if end if case "WRITER" , "HTML" , "MASTERDOCUMENT" : - select case uCASE(gApplication) + select case ( gApplication ) case "MASTERDOCUMENT" : Kontext "NavigatorGlobalDoc" - if NavigatorGlobalDoc.Exists(10) then + if NavigatorGlobalDoc.Exists( MAX_WAIT_FOR_NAVIGATOR ) then bNavigatorWasVisible = TRUE else ViewNavigator @@ -299,7 +336,7 @@ function fSelectFirstOLE() as integer endif case else : Kontext "NavigatorWriter" 'First check if Navigator is visible and remember result - if NavigatorWriter.Exists (10) then + if NavigatorWriter.Exists ( MAX_WAIT_FOR_NAVIGATOR ) then bNavigatorWasVisible = TRUE else try @@ -317,7 +354,7 @@ function fSelectFirstOLE() as integer end if end select Kontext "NavigatorWriter" - if NavigatorWriter.Exists(10) then + if NavigatorWriter.Exists( MAX_WAIT_FOR_NAVIGATOR ) then ' Check if all content is visible if Auswahlliste.GetItemCount < 2 then Inhaltsansicht.Click @@ -329,7 +366,7 @@ function fSelectFirstOLE() as integer next iIndex Auswahlliste.select(5) Auswahlliste.TypeKeys "+<DOWN><RETURN>" - fSelectFirstOLE = 0 + fSelectFirstOLE() = RETVAL_SUCCESS else QAErrorLog "Navigator did not occoured!" end if @@ -340,7 +377,7 @@ function fSelectFirstOLE() as integer if bNavigatorWasVisible = TRUE then printlog "Leaving navigator open as initially found" else - if fSelectFirstOLE = 0 then + if ( fSelectFirstOLE = RETVAL_SUCCESS ) then ViewNavigator printlog "Closing navigator as initially found" else diff --git a/testautomation/global/tools/includes/required/t_files.inc b/testautomation/global/tools/includes/required/t_files.inc index 0736de15debf..42b575c1187a 100644..100755 --- a/testautomation/global/tools/includes/required/t_files.inc +++ b/testautomation/global/tools/includes/required/t_files.inc @@ -31,328 +31,125 @@ '* '\****************************************************************************** -private const VERBOSE = FALSE ' set to TRUE for debugging +function hGrafikEinfuegen( cFile as string ) as Boolean -function hGrafikEinfuegen ( Grafik$ ) as Boolean - '/// hGrafikEinfuegen hGraphicInsert - '/// A graphic will be inserted (not linked). - '/// <u>Input</u>: Filename with complete path - '/// <u>Return</u>: TRUE or FALSE if the graphic could be inserted or not. + hGrafikEinfuegen() = hInsertGraphic( cFile, "Static" ) + exit function + +end function - Dim DieDatei as String - Dim IsActive as Boolean +'******************************************************************************* - DieDatei = ConvertPath ( Grafik$ ) +function hGrafikVerknuepftEinfuegen( cFile as string ) as Boolean - InsertGraphicsFromFile - WaitSlot() + hGrafikVerknuepftEinfuegen() = hInsertGraphic( cFile, "Linked" ) + exit function - Kontext - If Active.Exists(1) then - warnlog " Hinweis: " & Active.GetText - Active.Ok - End If +end function +'******************************************************************************* - Kontext "GrafikEinfuegenDlg" - if ( GrafikEinfuegenDlg.exists( 2 ) ) then +function hInsertGraphic( byval cFile as string, byval cMode as string ) as boolean - Vorschau.Uncheck - if gApplication <> "HTML" then - Verknuepfen.UnCheck - end if + ' Insert a graphic file to the current document either linked or static + ' cFile: Fully qualified path to the file to be inserted + ' cMode: Supply "Linked" to link, empty string or anything else is static - Dateiname.SetText DieDatei - DateiTyp.Select 1 ' set the filter to 'all formats' - Oeffnen.Click + ' In difference to the older functions (GrafikEinfuegen etc.) this function + ' does provide a working returnvalue and does not secretly hide warnings and + ' errors. It does not set the file type. - Kontext "Active" - if Active.Exists(2) then - Warnlog " Hinweis: " & Active.GetText - try - Active.OK - catch - try - Active.Yes - catch - Active.Cancel - endcatch - endcatch - Kontext "GrafikEinfuegenDlg" - if GrafikEinfuegenDlg.Exists then - GrafikEinfuegenDlg.Cancel - GarfikEinfuegenDlg.notExists( 4 ) - endif - else - hGrafikEinfuegen = IsImageLoaded - end if - else - warnlog( "Insert graphics dialog not open" ) - endif - -end function -' -'------------------------------------------------------------------------------- -' -function hGrafikVerknuepftEinfuegen ( Grafik$ ) as Boolean - '/// hGrafikEinfuegenEinfuegen hGraphicInsertLinked - '/// A graphic will be inserted <b>LINKED</b> - '/// <u>Input</u>: Filename with complete path - '/// <u>Return</u>: TRUE or FALSE if the graphic could be inserted or not. - Dim DieDatei as String - Dim IsActive as Boolean - - DieDatei = ConvertPath ( Grafik$ ) - - InsertGraphicsFromFile - WaitSlot() - - Kontext - If Active.Exists(1) then - warnlog " Hinweis: " & Active.GetText - Active.Ok - End If - Kontext "GrafikEinfuegenDlg" - if ( GrafikEinfuegenDlg.exists( 1 ) ) then - - Vorschau.UnCheck - if gApplication <> "HTML" AND gApplication <> "HTML" then - Verknuepfen.Check - end if + ' Make hFileWait() complain about any messageboxes + const SHOW_WARNINGS = true - Dateiname.SetText DieDatei - DateiTyp.Select 1 ' set the filter to 'all formats' - Oeffnen.Click + ' Find out whether we link the file or not + dim bLinked as boolean : bLinked = false + if ( lcase( cMode ) = "linked" ) then bLinked = true - Kontext "Active" - if Active.Exists(2) then - Warnlog " Hinweis: " + Active.GetText - try - Active.OK - catch - Active.Yes - endcatch - Kontext "GrafikEinfuegenDlg" - if GrafikEinfuegenDlg.Exists then - GrafikEinfuegenDlg.Cancel + hInsertGraphic() = false + cFile = convertpath( cFile ) + + if ( FileExists( cFile ) ) then + InsertGraphicsFromFile + + kontext "GrafikEinfuegenDlg" + if ( GrafikEinfuegenDlg.exists( 3 ) ) then + + Vorschau.unCheck() + if ( Verknuepfen.isEnabled() ) then + if ( bLinked ) then + Verknuepfen.check() + else + Verknuepfen.unCheck() + endif endif + + DateiName.setText( cFile ) + Oeffnen.click() + + if ( hFileWait( SHOW_WARNINGS ) >= 0 ) then hInsertGraphic() = true + else - hGrafikVerknuepftEinfuegen = IsImageLoaded - end if + warnlog( "hInsertGraphic(): Failed to open <Insert Graphics> dialog" ) + endif else - 'GrafikEinfuegenDlg not open + warnlog( "hInsertGraphic(): File does not exist: " & cFile ) endif + end function -' -'------------------------------------------------------------------------------- -' -function IsItSaved as boolean - '/// IsItSaved - '/// Wait until document is saved. - Dim iLoop as integer - IsItSaved = FALSE - sleep(3) - for iLoop =1 to 20 - try - 'Calling slot 'IsDocSaving' - IsItSaved = IsDocSaving - catch - IsItSaved = FALSE - endcatch +'******************************************************************************* - if IsItSaved = TRUE then - exit for - end if - sleep(1) - next iLoop - sleep(2) -end function -' -'------------------------------------------------------------------------------- -' -function IsItLoaded as boolean - '/// IsItLoaded - '/// Wait until document is loaded - Dim iLoop as integer +function hIsNamedDocLoaded( cFileName as string ) as boolean - IsItLoaded = FALSE - sleep(3) - for iLoop =1 to 20 - try - 'Calling slot 'IsDocLoading' - IsItLoaded = IsDocLoading - catch - IsItLoaded = FALSE - endcatch + ' Retrieve the current filename from the document properties - which in + ' comparision to the old approach to retrive the name from the file save + ' dialog - gives us the file including its extension. So we only need + ' to compare the last characters from a full path to be relatively + ' certain that we work with the correct file. There is some small margin of + ' error, though. - if IsItLoaded = TRUE then - exit for - end if - sleep(1) - next iLoop - sleep(2) -end function -' -'------------------------------------------------------------------------------- -' -function hIsNamedDocLoaded (ShouldFile as String, optional bSilent as boolean) as Boolean - dim sTemp as string - '/// hIsNamedDocLoaded ///' - '/// !fails always if a template is loaded, because you have to set a new filename in the save-dialog -> not usable in this case ! ///' - '/// Input: name of loaded file; Output: True/False ///' - '///+' if a doc got loaded, the filename in a 'SaveAs' Dlg is different from "" /// - '///+' usually the file name of the loaded document with an changed extension chosen from SO /// - - if (isMissing(bSilent)) then - bSilent = False - endif + const CFN = "global::tools::includes::required::hIsNamedDocumentLoaded(): " + const RC_FAILURE = -1 - hIsNamedDocLoaded = FALSE ' Let's start WorstCase :-( - FileSaveAs - Kontext "SpeichernDlg" - If DateiOhneExt(DateiExtract(Dateiname.GetSelText)) = DateiOhneExt(DateiExtract(ShouldFile)) Then - hIsNamedDocLoaded = True - Else - sTemp = left(right(ShouldFile,2),1) ' get the 2nd last character ' vor;dot;sti;pot;std;xlt - if (((sTemp="o") or (sTemp="t") or (sTemp="l")) and ((left(right(ShouldFile,4),1)=".") or (left(right(ShouldFile,5),1)="."))) then - hIsNamedDocLoaded = TRUE ' exception! for linux! and MS-Office Templates - else - if ((Dateiname.GetSeltext = "") and not bSilent) then - Warnlog "Default filename is empty!"+left(right(ShouldFile,3),1) + dim cDocumentName as string + dim iDocumentNameLength as integer + + hIsNamedDocLoaded() = false + + if ( hUseAsyncSlot( "FileProperties" ) <> RC_FAILURE ) then + + kontext "TabDokument" + if ( TabDokument.exists( 2 ) ) then + + cDocumentName = DokumentName.getText() + iDocumentNameLength = len( cDocumentName ) + + if ( GVERBOSE ) then + printlog( CFN & "Expected file: " & cFileName ) + printlog( CFN & "Current file.: " & cDocumentName ) + printlog( CFN & "Comparing last " & iDocumentNameLength & " characters" ) endif - endif - End If - SpeichernDlg.Cancel -end function -' -'------------------------------------------------------------------------------- -' -function IsImageLoaded - '/// IsImageLoaded - '/// Wait until images in document are loaded - Dim i% : Dim Herbert as Boolean - Sleep 3 - for i%=1 to 20 - try - Herbert = IsDocImageLoading - catch - Herbert = FALSE - endcatch - if Herbert = TRUE then - i%=100 + if ( right( cFileName, iDocumentNameLength ) = cDocumentName ) then + if ( GVERBOSE ) then printlog( CFN & "This is the expected file" ) + hIsNamedDocLoaded() = true + else + if ( GVERBOSE ) then printlog( CFN & "This is *not* the expected file" ) + endif + + hCloseDialog( TabDokument, "cancel" ) + else + warnlog( CFN & "Unable to open dialog <Document Properties>" ) endif - Sleep (1) - next i% - if i<100 then - IsImageLoaded = FALSE - else - IsImageLoaded = TRUE - end if -end function -' -'------------------------------------------------------------------------------- -' -sub hIsWebPageLoaded as boolean - 'Author: Joerg Sievers - '/// If a document in StarOffice Writer is loaded all 9 items in the - '///+ statusbar are visible otherwise not. - '///+ This sub checks the state of these items. - Dim i as integer - Dim iGibtdenStatusraus as integer - printlog "- global::tools::inc::tfiles.inc::hIsWebPageLoaded" - hIsWebPageLoaded = FALSE - for i = 1 to 20 - Kontext "DocumentWriter" - if DocumentWriter.Exists(3) then - 'Count the items on the status bar. - iGibtdenStatusraus = DocumentWriter.StatusGetItemCount - 'There are nine items on the status bar if the web page has been loaded. - if iGibtdenStatusraus = 9 then - hIsWebPageLoaded = TRUE - exit for - end If - end if - WaitSlot( 3000 ) - next i -end sub -' -'------------------------------------------------------------------------------- -' -sub hSys2IntDlg - '/// Change from system to StarOffice-internal file-dialog (only for Win32) - if gPlatgroup <> "unx" then - Call hhSysToInt ( TRUE ) - endif - gUseSysDlg = FALSE -end sub -' -'------------------------------------------------------------------------------- -' -sub hInt2SysDlg - '/// Change from StarOffice-internal to system file-dialog (only for Win32) - if gPlatgroup <> "unx" then - Call hhSysToInt ( FALSE ) - endif - gUseSysDlg = TRUE -end sub -' -'------------------------------------------------------------------------------- -' -sub hhSysToInt ( bwhats as Boolean ) - '/// subroutine for <i>hSys2IntDlg</i> and </i>hInt2SysDlg</i> - ToolsOptions - hToolsOptions ( "StarOffice", "General" ) - if bwhats = TRUE then - StarOfficeDialogeBenutzen.Check else - StarOfficeDialogeBenutzen.Uncheck - end if - Sleep 1 - Kontext "OptionenDlg" - OptionenDlg.OK - WaitSlot( 3000 ) -end sub -' -'------------------------------------------------------------------------------- -' -function hGetUsedFilter () as string - '/// Get used filter for loaded file. - try - FileSaveAs - Kontext "SpeichernDlg" - hGetUsedFilter = dateityp.getseltext - SpeichernDlg.Cancel - catch - hGetUsedFilter = "Not possible; try/catch fail in function" - endcatch -end function -' -'------------------------------------------------------------------------------- -' -function hFileExport (sName as string, sFilter as string) as boolean - '/// Wrapper function to simplify the use of the export functions, just give a filename and export format. - '///+ INPUT:<ul><li>sName: filename</li><li>sFilter: "PDF": call export for PDF</li></ul> - '///+ RETURN: execution success? - select case sFilter - case "PDF" : '/// use the function 'hExportAsPDF' with RECOMMENDED values /// ' - hFileExport = hExportAsPDFmulti (3, TRUE, sName, FALSE, TRUE, 1, 1) - end select - kontext - if active.exists(5) then - try - printlog active.getText - active.ok - warnLog "i26820 - errormessage about saving" - catch - printlog "pdf unexpected error in hFileExport()" - endcatch + warnlog( CFN & "Unable to execute slot <FileProperties>" ) endif + end function -' -'------------------------------------------------------------------------------- -' + +'******************************************************************************* + function hExportAsPDFmulti (iTypeOfCall as integer, bExecute as boolean, sFileName as string, bAutoExtension as boolean, bOverwriteFile as boolean, iRange as integer, iConpression as integer, optional sRange as string) as boolean '/// Export a document to PDF with various options. '///+ INPUT @@ -633,6 +430,12 @@ end function ' '------------------------------------------------------------------------------- ' +function hFileDelete( cFileOrig as string ) as boolean + hFileDelete() = hDeleteFile( cFileOrig ) +end function +' +'------------------------------------------------------------------------------- +' function hDeleteFile( cFileOrig as string ) as boolean const CFN = "global::tools::includes::required::t_files.inc::hDeleteFile():" @@ -665,7 +468,7 @@ function hDeleteFile( cFileOrig as string ) as boolean warnlog( CFN & "File was not deleted: " & cFile ) hDeleteFile() = false else - if ( VERBOSE ) then printlog( CFN & "File successfully deleted: " & cFile ) + if ( GVERBOSE ) then printlog( CFN & "File successfully deleted: " & cFile ) hDeleteFile() = true endif catch @@ -698,8 +501,8 @@ function hFileOpen( cFile as string ) as boolean dim sFile as string : sFile = convertToURL( convertpath( cFile ) ) hFileOpen() = FALSE - const CFN = "global::tools::inc::t_files.inc::hFileOpen():" - if ( VERBOSE ) then printlog( CFN & "Load: " & sFile ) + const CFN = "global::tools::inc::t_files.inc::hFileOpen(): " + if ( GVERBOSE ) then printlog( CFN & "Load: " & sFile ) FileOpen( "URL", sFile, "FrameName", "_default" ) if ( hFileWait( FALSE ) >= 0 ) then hFileOpen() = TRUE @@ -715,9 +518,9 @@ function hFileOpenSpecial( cFile as string, cFlag as string ) as boolean ' cFlag = <Any other string> treats string as password dim sFile as string : sFile = convertToURL( convertpath( cFile ) ) - const CFN = "global::tools::inc::t_files.inc::hFileOpenSpecial():" + const CFN = "global::tools::inc::t_files.inc::hFileOpenSpecial(): " hFileOpenSpecial() = FALSE - if ( VERBOSE ) then printlog( "Load (Flag): " & sFile & " (" & cFlag & ")" ) + if ( GVERBOSE ) then printlog( "Load (Flag): " & sFile & " (" & cFlag & ")" ) select case( lcase( cFlag ) ) case "readonly" @@ -740,9 +543,9 @@ end function function hFileOpenWithFilter( cFile as string, cFilter as string ) dim sFile as string : sFile = convertToURL( convertpath( cFile ) ) - const CFN = "global::tools::inc::t_files.inc::hFileOpenWithFilter():" + const CFN = "global::tools::inc::t_files.inc::hFileOpenWithFilter(): " hFileOpenWithFilter() = FALSE - if ( VERBOSE ) then printlog( CFN & "Load (Filter): " & sFile & " (" & cFilter & ")" ) + if ( GVERBOSE ) then printlog( CFN & "Load (Filter): " & sFile & " (" & cFilter & ")" ) FileOpen( "URL", sFile, "FrameName", "_default", "FilterName", cFilter ) if ( hFileWait( FALSE ) >= 0 ) then hFileOpenWithFilter() = TRUE @@ -752,9 +555,9 @@ end function ' function hFileSave() as boolean - const CFN = "global::tools::inc::t_files.inc::hFileSave():" + const CFN = "global::tools::inc::t_files.inc::hFileSave(): " hFileSave() = FALSE - if ( VERBOSE ) then printlog( CFN & "Save file." ) + if ( GVERBOSE ) then printlog( CFN & "Save file." ) FileSave( "SynchronMode", TRUE ) if ( hFileWait( TRUE ) >= 0 ) then hFileSave() = TRUE @@ -765,9 +568,9 @@ end function function hFileSaveAs( cFile as string ) as boolean dim sFile as string : sFile = convertToURL( convertpath( cFile ) ) - const CFN = "global::tools::inc::t_files.inc::hFileSaveAs():" + const CFN = "global::tools::inc::t_files.inc::hFileSaveAs(): " hFileSaveAs() = FALSE - if ( VERBOSE ) then printlog( CFN & "Save: " & sFile ) + if ( GVERBOSE ) then printlog( CFN & "Save: " & sFile ) FileSaveAs( "URL", sFile, "Overwrite", FALSE ) if ( hFileWait( TRUE ) >= 0 ) then hFileSaveAs() = TRUE @@ -778,9 +581,9 @@ end function function hFileSaveAsKill( cFile as string ) as boolean dim sFile as string : sFile = convertToURL( convertpath( cFile ) ) - const CFN = "global::tools::inc::t_files.inc::hFileSaveAsKill():" + const CFN = "global::tools::inc::t_files.inc::hFileSaveAsKill(): " hFileSaveAsKill() = FALSE - if ( VERBOSE ) then printlog( CFN & "Save, replacing: " & sFile ) + if ( GVERBOSE ) then printlog( CFN & "Save, replacing: " & sFile ) FileSaveAs( "URL", sFile, "Overwrite", TRUE ) if ( hFileWait( TRUE ) >= 0 ) then hFileSaveAsKill() = TRUE @@ -791,9 +594,9 @@ end function function hFileSaveAsKillWithPassword( cFile as string, cPassword as string ) as boolean dim sFile as string : sFile = convertToURL( convertpath( cFile ) ) - const CFN = "global::tools::inc::t_files.inc::hFileSaveAsKillWithPassword():" + const CFN = "global::tools::inc::t_files.inc::hFileSaveAsKillWithPassword(): " hFileSaveAsKillWithPassword() = FALSE - if ( VERBOSE ) then printlog( CFN & "Save with password, replacing: " & sFile & "::" & cPassword ) + if ( GVERBOSE ) then printlog( CFN & "Save with password, replacing: " & sFile & "::" & cPassword ) FileSaveAs( "URL", sFile, "Overwrite", TRUE, "Password", cPassword ) if ( hFileWait( TRUE ) >= 0 ) then hFileSaveAsKillWithPassword() = TRUE @@ -804,9 +607,9 @@ end function function hFileSaveAsWithFilter( cFile as string, cFilter as string ) as boolean dim sFile as string : sFile = convertToURL( convertpath( cFile ) ) - const CFN = "global::tools::inc::t_files.inc::hFileSaveAsWithFilter():" + const CFN = "global::tools::inc::t_files.inc::hFileSaveAsWithFilter(): " hFileSaveAsWithFilter() = FALSE - if ( VERBOSE ) then printlog( CFN & "Save with filter: " & sFile & "::" & cFilter ) + if ( GVERBOSE ) then printlog( CFN & "Save with filter: " & sFile & "::" & cFilter ) FileSaveAs( "URL", sFile, "FilterName", cFilter, "Overwrite", FALSE ) if ( hFileWait( TRUE ) >= 0 ) then hFileSaveAsWithFilter() = TRUE @@ -817,9 +620,9 @@ end function function hFileSaveAsWithFilterKill( cFile as string, cFilter as string ) as boolean dim sFile as string : sFile = convertToURL( convertpath( cFile ) ) - const CFN = "global::tools::inc::t_files.inc::hFileSaveAsWithFilterKill():" + const CFN = "global::tools::inc::t_files.inc::hFileSaveAsWithFilterKill(): " hFileSaveAsWithFilterKill() = FALSE - if ( VERBOSE ) then printlog( CFN & "Save with filter, replacing: " & sFile & "::" & cFilter ) + if ( GVERBOSE ) then printlog( CFN & "Save with filter, replacing: " & sFile & "::" & cFilter ) FileSaveAs( "URL", sFile, "FilterName", cFilter, "Overwrite", TRUE ) if ( hFileWait( TRUE ) >= 0 ) then hFileSaveAsWithFilterKill() = TRUE @@ -833,7 +636,7 @@ function hFileWait( optional bWarn as boolean ) as integer ' Returns the time it took the slot to finish ' Negative returnvalues are given on timeout or any blocking dialog - const CFN = "global::tools::inc::t_files.inc::hFileWait():" + const CFN = "global::tools::inc::t_files.inc::hFileWait(): " const MAX_WAIT = 10 dim iWait as integer : iWait = 0 dim bWarnlog as boolean @@ -924,7 +727,7 @@ function hFileWait( optional bWarn as boolean ) as integer loop - if ( VERBOSE ) then + if ( GVERBOSE ) then select case iWait case -1 : printlog( CFN & "Timeout reached, rc = " & iWait ) case -2 : printlog( CFN & "Macro security warning displayed, rc = " & iWait ) diff --git a/testautomation/global/tools/includes/required/t_filters.inc b/testautomation/global/tools/includes/required/t_filters.inc index 21ba12af5363..f6a2beca6eb0 100644..100755 --- a/testautomation/global/tools/includes/required/t_filters.inc +++ b/testautomation/global/tools/includes/required/t_filters.inc @@ -516,4 +516,19 @@ function hGetSection( lsList() as string , iSectionBegin as integer , iSectionEn end function +'******************************************************************************* + +function hGetUsedFilter () as string + + ' used in math and graphics modules + '/// Get used filter for loaded file. + try + FileSaveAs + Kontext "SpeichernDlg" + hGetUsedFilter = dateityp.getseltext + SpeichernDlg.Cancel + catch + hGetUsedFilter = "Not possible; try/catch fail in function" + endcatch +end function diff --git a/testautomation/global/tools/includes/required/t_lists.inc b/testautomation/global/tools/includes/required/t_lists.inc index 3819a21097b0..f32db2f29277 100644..100755 --- a/testautomation/global/tools/includes/required/t_lists.inc +++ b/testautomation/global/tools/includes/required/t_lists.inc @@ -595,31 +595,5 @@ function hListClearBlank( lsList() as string ) as integer end function -'******************************************************************************* - -function hListIntegrityTest( sList() as string ) as boolean - - const CFN = "global::tools::inc::t_list.inc::hListIntegrityTest:" - - '///<h3>Verify that listcount( array ) < ubound( array )</h3> - ' NOTE: some listfunctions fail if ubound = listcount - - dim iListCount as integer - dim iUbound as integer - - iListCount = listcount( sList() ) - iUbound = ubound( sList() ) - - if ( iListCount >= iUbound ) then - warnlog( CFN & "ListCount points beyond array boundary" ) - warnlog( CFN & "ListCount: " & iListCount ) - warnlog( CFN & "UBOUND...: " & iUbound ) - hListIntegrityTest() = false - exit function - end if - - hListIntegrityTest() = true - -end function diff --git a/testautomation/global/tools/includes/required/t_menu.inc b/testautomation/global/tools/includes/required/t_menu.inc index d8b1288c3e04..a7c64b37865d 100755 --- a/testautomation/global/tools/includes/required/t_menu.inc +++ b/testautomation/global/tools/includes/required/t_menu.inc @@ -585,37 +585,57 @@ function hUseMenu () '///<b> function hUseMenu () </b>///' '///+ very global function: depends on 'gApplication' just activates the menu-bar ///' - Select Case Ucase(gApplication) - Case "WRITER" - Kontext "DocumentWriter" - DocumentWriter.UseMenu - Case "MASTERDOCUMENT" - Kontext "DocumentMasterDoc" - DocumentMasterDoc.UseMenu - Case "HTML" - Kontext "DocumentWriterWeb" - DocumentWriterWeb.UseMenu - case "CALC" ' there are 2 entries over :-( usually only one, html 0 :-(((( - Kontext "DocumentCalc" - DocumentCalc.UseMenu - case "DRAW" - Kontext "DocumentDraw" - DocumentDraw.UseMenu - case "IMPRESS" - Kontext "DocumentImpress" - DocumentImpress.UseMenu - case "MATH" : - Kontext "DocumentMath" - DocumentMath.UseMenu - case "DATABASE" : - Kontext "DATABASE" - Database.UseMenu - case "BASIC" : - Kontext "BasicIde" - BasicIde.UseMenu - case "NONE" : - Kontext "DocumentBackground" - DocumentBackground.UseMenu + Select Case ( gApplication ) + Case "WRITER" + + Kontext "DocumentWriter" + DocumentWriter.UseMenu + + Case "MASTERDOCUMENT" + + Kontext "DocumentMasterDoc" + DocumentMasterDoc.UseMenu + + Case "HTML" + + Kontext "DocumentWriterWeb" + DocumentWriterWeb.UseMenu + + case "CALC" ' there are 2 entries over :-( usually only one, html 0 :-(((( + + Kontext "DocumentCalc" + DocumentCalc.UseMenu + + case "DRAW" + + Kontext "DocumentDraw" + DocumentDraw.UseMenu + + case "IMPRESS" + + Kontext "DocumentImpress" + DocumentImpress.UseMenu + + case "MATH" : + + Kontext "DocumentMath" + DocumentMath.UseMenu + + case "DATABASE" : + + Kontext "DATABASE" + Database.UseMenu + + case "BASIC" : + + Kontext "BasicIde" + BasicIde.UseMenu + + case "NONE" : + + Kontext "DocumentBackground" + DocumentBackground.UseMenu + end select end function @@ -625,47 +645,64 @@ end function function hOpenContextMenu() '/// very global function: depends on 'gApplication' just opens the Context Menu ///' - Select Case Ucase(gApplication) - Case "WRITER" - Kontext "DocumentWriter" - DocumentWriter.openContextMenu - Case "MASTERDOCUMENT" - Kontext "DocumentMasterDoc" - DocumentMasterDoc.openContextMenu - Case "HTML" - Kontext "DocumentWriterWeb" - DocumentWriterWeb.openContextMenu - case "CALC" - Kontext "DocumentCalc" - DocumentCalc.openContextMenu - case "DRAW" - Kontext "DocumentDraw" - DocumentDraw.openContextMenu - case "IMPRESS" - Kontext "DocumentImpress" - DocumentImpress.openContextMenu - case "MATH" : - Kontext "DocumentMath" - DocumentMath.openContextMenu + Select Case ( gApplication ) + Case "WRITER" + + Kontext "DocumentWriter" + DocumentWriter.openContextMenu + + Case "MASTERDOCUMENT" + + Kontext "DocumentMasterDoc" + DocumentMasterDoc.openContextMenu + + Case "HTML" + + Kontext "DocumentWriterWeb" + DocumentWriterWeb.openContextMenu + + case "CALC" + + Kontext "DocumentCalc" + DocumentCalc.openContextMenu + + case "DRAW" + + Kontext "DocumentDraw" + DocumentDraw.openContextMenu + + case "IMPRESS" + + Kontext "DocumentImpress" + DocumentImpress.openContextMenu + + case "MATH" : + + Kontext "DocumentMath" + DocumentMath.openContextMenu + end select end function '******************************************************************************* -function hGetWindowCaption(sApplication as string, optional bAll as boolean) +function hGetWindowCaption( sApplication as string, optional bAll as boolean ) '///<b> function hGetWindowCaption () </b>///' '///+ just returns the string from the application main window ///' '///+ If optional parameter = true, thenn go throught all applications and get caption; return array ///' + ' BEWARE: THIS FUNCTION MODIFIES ITS FUNCTION PARAMETER UNDER CERTAIN + ' CONDITIONS! + dim sTemp as string dim aApplication() as string dim aTemp(10) as string dim iTimes as integer dim i as integer - aApplication = array("SWRITER","SGLOBAL","SWEB","SCALC","SDRAW","SIMPRESS","SMATH","BASIC","BACK") + aApplication = array("SWRITER","SGLOBAL","SWEB","SCALC","SDRAW","SIMPRESS","SMATH","BASIC","DATABASE","SOFFICE") if (isMissing(bAll) OR (NOT bAll)) then iTimes = 0 else @@ -722,7 +759,13 @@ function hGetWindowCaption(sApplication as string, optional bAll as boolean) sTemp = BasicIDE.caption catch endcatch - Case "BACK" + Case "DATABASE" + Kontext "DATABASE" + try + sTemp = DataBase.caption + catch + endcatch + Case "SOFFICE" Kontext "DocumentBackground" try sTemp = DocumentBackground.caption @@ -748,7 +791,7 @@ end function '******************************************************************************* -function fSplitWindowTitle(sInString as string) +function fSplitWindowTitle( sInString as string ) dim a, b, x, i, iProductname as integer dim sTemp() as string @@ -811,35 +854,33 @@ function fSplitWindowTitle(sInString as string) ' sanity checks, to warn if assumptions are not met! select case x - case 1: - if ((bTestToolCommunication) OR (bDebugVersion)) then - qaErrorLog "t_menu.inc::fSplitWindowTitle: Unknown count of Window Title Strings! 1" - bError = TRUE - endif - case 2: - if ((bTestToolCommunication) OR (NOT bDebugVersion)) then - qaErrorLog "t_menu.inc::fSplitWindowTitle: Unknown count of Window Title Strings! 2" - bError = TRUE - endif - case 3: - if ((NOT bTestToolCommunication) OR (bDebugVersion)) then - qaErrorLog "t_menu.inc::fSplitWindowTitle: Unknown count of Window Title Strings! 3" - bError = TRUE - endif - case 4: - if ((NOT bTestToolCommunication) OR (NOT bDebugVersion)) then - qaErrorLog "t_menu.inc::fSplitWindowTitle: Unknown count of Window Title Strings! 4" - bError = TRUE - endif - case else: - qaErrorLog "t_menu.inc::fSplitWindowTitle: Unknown count of Window Title Strings! 0" + case 1: + if ((bTestToolCommunication) OR (bDebugVersion)) then + qaErrorLog "t_menu.inc::fSplitWindowTitle: Unknown count of Window Title Strings! 1" + bError = TRUE + endif + case 2: + if ((bTestToolCommunication) OR (NOT bDebugVersion)) then + qaErrorLog "t_menu.inc::fSplitWindowTitle: Unknown count of Window Title Strings! 2" + bError = TRUE + endif + case 3: + if ((NOT bTestToolCommunication) OR (bDebugVersion)) then + qaErrorLog "t_menu.inc::fSplitWindowTitle: Unknown count of Window Title Strings! 3" bError = TRUE + endif + case 4: + if ((NOT bTestToolCommunication) OR (NOT bDebugVersion)) then + qaErrorLog "t_menu.inc::fSplitWindowTitle: Unknown count of Window Title Strings! 4" + bError = TRUE + endif + case else: + qaErrorLog "t_menu.inc::fSplitWindowTitle: Unknown count of Window Title Strings! 0" + bError = TRUE end select - if bError then - printlog sInString - endif - + if bError then printlog sInString + if (x > 1) then ' there is more to evaluate ' save the current computed values for i=0 to 2 @@ -849,7 +890,6 @@ function fSplitWindowTitle(sInString as string) redim sTempReturn(4) as string ' copy data back for i=0 to 2 - '***** Warning: Indention error ***** sTempReturn(i) = sTempReturn2(i) next i ' set remaining values, if exist diff --git a/testautomation/global/tools/includes/required/t_option2.inc b/testautomation/global/tools/includes/required/t_option2.inc index 174048985c59..2b10f50ce00a 100644 --- a/testautomation/global/tools/includes/required/t_option2.inc +++ b/testautomation/global/tools/includes/required/t_option2.inc @@ -196,6 +196,9 @@ function hSetMacroSecurity( iLevel as integer ) as integer '///Switch between macro security levels in Tools/Options '///<ul> const CFN = "hSetMacroSecurity::" + const RETVAL_FAILURE = -1 + const DEFAULT_WAIT_TIME = 2 + dim iOldSecurityLevel as integer dim caLevel( 3 ) as string @@ -206,7 +209,7 @@ function hSetMacroSecurity( iLevel as integer ) as integer if ( ( iLevel < GC_MACRO_SECURITY_LEVEL_LOW ) or ( iLevel > GC_MACRO_SECURITY_LEVEL_VERYHIGH ) ) then warnlog( CFN & "Invalid index (0...3) passed to function: " & ilevel ) - hSetMacroSecurity() = -1 + hSetMacroSecurity() = RETVAL_FAILURE exit function end if @@ -216,12 +219,12 @@ function hSetMacroSecurity( iLevel as integer ) as integer '///+<li>Click on the macro security button</li> Kontext "TabSecurity" - if ( MacroSecurity.exists( 2 ) ) then + if ( MacroSecurity.exists( DEFAULT_WAIT_TIME ) ) then MacroSecurity.click() '///+<li>Ensure we are on the Security Level page</li> kontext "Active" - if ( Active.exists( 2 ) ) then + if ( Active.exists( DEFAULT_WAIT_TIME ) ) then Kontext active.setpage TabSecurityLevel @@ -241,12 +244,12 @@ function hSetMacroSecurity( iLevel as integer ) as integer else printlog( CFN & "Security Tabpage not available. Aborting." ) kontext "OptionenDlg" - if ( OptionenDlg.exists( 2 ) ) then + if ( OptionenDlg.exists( DEFAULT_WAIT_TIME ) ) then OptionenDlg.cancel() else warnlog( CFN & "Unrecoverable error, status unknown." ) endif - hSetMacroSecurity() = -1 + hSetMacroSecurity() = RETVAL_FAILURE exit function endif @@ -263,12 +266,12 @@ function hSetMacroSecurity( iLevel as integer ) as integer else printlog( CFN & "Macro Security Dialog did not open. Aborting." ) kontext "OptionenDlg" - if ( OptionenDlg.exists( 2 ) ) then + if ( OptionenDlg.exists( DEFAULT_WAIT_TIME ) ) then OptionenDlg.cancel() else warnlog( CFN & "Unrecoverable error, status unknown." ) endif - hSetMacroSecurity() = -1 + hSetMacroSecurity() = RETVAL_FAILURE exit function endif @@ -276,7 +279,7 @@ function hSetMacroSecurity( iLevel as integer ) as integer TabSecurityLevel.ok() else warnlog( CFN & "The Macro Security Button is not available" ) - iOldSecurityLevel = -1 + iOldSecurityLevel = RETVAL_FAILURE end if Kontext "OptionenDLG" OptionenDLG.OK() @@ -312,6 +315,7 @@ function hGetMacroSecurityAPI() as integer '///</ol> const CFN = "hGetMacroSecurityAPI::" + const RETVAL_FAILURE = -1 dim oUnoOfficeConnection as object dim oUnoConfigurationAccess as object @@ -336,7 +340,7 @@ function hGetMacroSecurityAPI() as integer catch warnlog( CFN & "Failed to retrieve macro security Level via API" ) - iLevel = -1 + iLevel = RETVAL_FAILURE endcatch diff --git a/testautomation/global/tools/includes/required/t_tools1.inc b/testautomation/global/tools/includes/required/t_tools1.inc index a908af39e5af..7242d1c3653d 100644..100755 --- a/testautomation/global/tools/includes/required/t_tools1.inc +++ b/testautomation/global/tools/includes/required/t_tools1.inc @@ -35,8 +35,6 @@ private SLEEP_TIME_REQUESTED as integer private SLEEP_CALLS_SUM as integer private SLEEP_TIME_USED as integer -private const VERBOSE = FALSE - function GetClipboardText as string '/// Returns the correct clipboard text (also if there is a 'RETURN' at it's end. @@ -318,7 +316,7 @@ function Sleep( optional _iSeconds as integer ) as integer printlog( CFN & "Zero time. Please consider removing Sleep() statement" ) endif - if ( VERBOSE ) then + if ( GVERBOSE ) then SLEEP_CALLS_SUM = SLEEP_CALLS_SUM + 1 SLEEP_TIME_USED = SLEEP_TIME_USED + iTimeDiff / 1000 ' good enough SLEEP_TIME_REQUESTED = SLEEP_TIME_REQUESTED + iSeconds @@ -412,10 +410,10 @@ sub DialogTest( Window, optional iNumber as integer) 'save with respect to application and language sCapturePath = ConvertPath (gOfficePath + "user\work\screenshots"+iSprache+"\") sPicName = sCapturePath + lCase(gApplication) + 'create directory if it doesn't exist - if hDirectoryExists(sPicName) <> TRUE then - mkdir (sPicName) - end if + if ( not FileExists(sPicName) ) then mkdir sPicName + sPicName = sPicName + sName try sleep 1 @@ -697,28 +695,6 @@ end function '******************************************************************************* -sub ErgebnisSchreiben ( Window, Name$ ) - - '/// ErgebnisSchreiben - '///+ Used in context with making screenshots. - - Dim FileNum% : Dim i% - Dim Datei$ - Dim Text$ : Dim Text2$ - - Datei$ = sCapturePath + "Ergebis.txt" - Text2$ = Window.Name - Text$ = Text2$ + " => " + Name$ - - FileNum% = FreeFile - Open Datei$ for Append as #FileNum% - Print #FileNum%, Text$ - Close #FileNum% - -end sub - -'******************************************************************************* - sub TextInDatei ( TextText$, Datei$ ) '/// TextInDatei @@ -860,16 +836,14 @@ function ActiveDeactivateAsianSupport ( WhatState as Boolean ) as Boolean gAsianSup = WhatState ' Set the global variable Kontext "ExtrasOptionenDlg" - ExtrasOptionenDlg.OK - Sleep (3) + hCloseDialog( ExtrasOptionenDlg, "ok" ) else ActiveDeactivateAsianSupport = TRUE If WhatState = FALSE then warnlog "Deactivating of asian language support is not possible, because it is disabled in cjk versions" end if Kontext "ExtrasOptionenDlg" - ExtrasOptionenDlg.OK - Sleep (3) + hCloseDialog( ExtrasOptionenDlg, "ok" ) end if end function @@ -899,16 +873,14 @@ function ActiveDeactivateCTLSupport ( WhatState as Boolean ) as Boolean gCTLSup = WhatState ' Set the global variable Kontext "ExtrasOptionenDlg" - ExtrasOptionenDlg.OK - Sleep (3) + hCloseDialog( ExtrasOptionenDlg, "ok" ) else ActiveDeactivateCTLSupport = TRUE If WhatState = FALSE then warnlog "Deactivating of CTL language support is not possible, because it is disabled in ctl versions" end if Kontext "ExtrasOptionenDlg" - ExtrasOptionenDlg.OK - Sleep (3) + hCloseDialog( ExtrasOptionenDlg, "ok" ) end if end function @@ -1147,183 +1119,30 @@ end sub sub raiseApplication ' Try to solve focus problem on MacOS X; After calling this function, OOo should be most front; - Dim i as integer - Dim a as integer - Dim b as integer - Dim tBundle as string - Dim aPath + dim iCurrentDir as integer + dim iNumberOfHits as integer : iNumberOfHits = 0 + dim iDirPosition as integer + dim tBundle as string + dim aPath ' string array with dynamic itemcount, intended. ' Calling just the .app with open on MacOS X via shell command if ( lcase( gPlatform ) = "osx" ) then - + + ' Split the path into its components aPath = split(gNetzOfficePath, gPathSigne) - a=0 + ' make sure 'Contents' is just one time in path - for i=0 to uBound(aPath) - - if "Contents" = aPath(i) then - a=a+1 - endif - - next i + for iCurrentDir = 0 to uBound(aPath) + if "Contents" = aPath( iCurrentDir ) then iNumberOfHits = iNumberOfHits + 1 + next iCurrentDir ' exit if not - if a<>1 then - exit sub - end if + if ( iNumberOfHits <> 1 ) then exit sub - i=inStr(gNetzOfficePath, "Contents") - tBundle=left(gNetzOfficePath, i-2) - shell("open",1 ,tBundle, true) + iDirPosition = inStr( gNetzOfficePath, "Contents" ) + tBundle = left( gNetzOfficePath, iDirPosition - 2 ) + + shell( "open", 1, tBundle, true ) end if end sub - -'******************************************************************************* - -function hUseAsyncSlot( cSlot as string ) as integer - - dim iWait as integer - dim iTime as integer : iTime = 0 - const MAX_WAIT = 100 - const DELAY = 100 - const CFN = "global::tools::includes::required::hUseAsyncSlot():" - - if ( VERBOSE ) then printlog( CFN & "Using slot: " & cSlot ) - WaitSlot() - for iWait = 1 to MAX_WAIT - try - select case ( lcase( cSlot ) ) - case "fileclose" : FileClose - case "filesaveas" : FileSaveAs( "SynchronMode", TRUE ) - case "filesaveall" : FileSaveAll( "SynchronMode", TRUE ) - case "fileexport" : FileExport - case "filereload" : FileReload( "SynchronMode", TRUE ) - case "fileopen" : FileOpen - - case "editdoc" : EditDoc - case "editcopy" : EditCopy - case "editchangesrecord" : EditChangesRecord - case "editchangesshow" : EditChangesShow - case "editchangesprotecttrace" : EditChangesProtectTrace - case "editchangescomment" : EditChangesComment - - case "editpaste" : EditPaste - case "editcopy" : EditCopy - case "editcut" : EditCut - case "editselectall" : EditSelectAll - case "editselectallmath" : EditSelectAllMath - case "editselectionmodeblock" : EditSelectionModeBlock - case "editselectionmodestandard" : EditSelectionModeStandard - case "editdeletecontents" : EditDeleteContents - case "editundo" : EditUndo - case "editredo" : EditRedo - case "editrepeat" : EditRepeat - case "editpastespecial" : EditPasteSpecial - case "editpastespecialwriter" : EditPasteSpecialWriter - case "editsearchandreplace" : EditSearchAndReplace - case "editduplicate" : EditDuplicate - case "editgluepoints" : EditGluePoints - case "editdeleteslide" : EditDeleteSlide - case "editobjectproperties" : EditObjectProperties - case "editobjectedit" : EditObjectEdit - case "editobjectsavecopyas" : EditObjectSaveCopyAs - - case "formatcharttype" : FormatChartType - case "formatcontrol" : FormatControl - case "formateditpoints" : FormatEditPoints - case "formatsections" : FormatSections - case "formatchangecaseupper" : FormatChangeCaseUpper - case "formatchangecaselower" : FormatChangeCaseLower - case "formatarea" : FormatArea - case "formatarrangebringtofrontcalc" : FormatArrangeBringToFrontCalc - case "formatflipvertically" : FormatFlipVertically - case "formatfliphorizontally" : FormatFlipHorizontally - case "formatline" : FormatLine - case "formatpositionandsize" : FormatPositionAndSize - case "formatfontwork" : FormatFontwork - case "formatparagraph" : FormatParagraph - case "formatstylebold" : FormatStyleBold - case "formatungroupdraw" : FormatUngroupDraw - case "formatexitgroupdraw" : FormatExitGroupDraw - case "formatgroupgroup" : FormatGroupGroup - case "formatgroupeditgroupcalc" : FormatGroupEditGroupCalc - case "formatalignmentlefttext" : FormatAlignmentLeftText - case "formatgraphics" : FormatGraphics - case "formatanchortopage" : FormatAnchorToPage - case "formatwrapcontour" : FormatWrapContour - case "formatwrapeditcontour" : FormatWrapEditContour - case "formatpagewriter" : FormatPageWriter - - case "insertindexesbibliographyentry" : InsertIndexesBibliographyEntry - case "insertobjectchart" : InsertObjectChart - case "inserttablewriter" : InsertTableWriter - case "insertobjectformulawriter" : InsertObjectFormulaWriter - case "insertfloatingframe" : InsertFloatingFrame - - case "contextpositionandsize" : ContextPositionAndSize - - case "toolslanguagehyphenate" : ToolsLanguageHyphenate - case "toolsupdateallindexes" : ToolsUpdateAllIndexes - case "toolsupdatefields" : ToolsUpdateFields - case "toolsupdatelinks" : ToolsUpdateLinks - case "toolslanguagehangulhanjaconversion" : ToolsLanguageHangulHanjaConversion - - ' This is the property browser in the BASIC IDE - case "contextproperties" : ContextProperties - - case else : warnlog( "Unknown slot called: " & cSlot ) - end select - - exit for - catch - wait( DELAY ) - iTime = iWait * DELAY - endcatch - next iWait - - ' Timeout is -1 - if ( iTime = MAX_WAIT * DELAY ) then - iTime = -1 - endif - if ( VERBOSE ) then printlog( CFN & "Exit with rc=" & iTime ) - hUseAsyncSlot() = iTime - - -end function - -'******************************************************************************* - -function hClickButton( oButton as object ) as integer - - dim iWait as integer - dim iTime as integer : iTime = 0 - const MAX_WAIT = 50 - const CFN = "global::tools::includes::required::hClickButton():" - - if ( VERBOSE ) then printlog( CFN & "Click button: " & oButton.name() ) - WaitSlot() - for iWait = 1 to MAX_WAIT - try - if ( oButton.exists() ) then - if ( VERBOSE ) then printlog( CFN & "Button exists" ) - if ( oButton.isEnabled() ) then - if ( VERBOSE ) then printlog( "Button is enabled" ) - oButton.click() - endif - endif - exit for - catch - wait( 100 ) - iTime = iWait * 100 - endcatch - next iWait - if ( iTime = 5000 ) then - iTime = -1 - endif - if ( VERBOSE ) then printlog( CFN & "Exit with rc=" & iTime ) - hClickButton() = iTime - -end function - - diff --git a/testautomation/global/tools/includes/required/t_tools2.inc b/testautomation/global/tools/includes/required/t_tools2.inc index 2301c2e5648f..449977d9329d 100644..100755 --- a/testautomation/global/tools/includes/required/t_tools2.inc +++ b/testautomation/global/tools/includes/required/t_tools2.inc @@ -96,69 +96,6 @@ function hSetLocaleStrings (fLocale as String, TBOstringLocale() as String ) as hSetLocaleStrings = bFoundLanguage end function -'------------------------------------------------------------------------- - -sub GetHTMLCharSet as String -'///function to get the Character Set for HTML export -'///+(tools/options/load&save/HTML compatibility -> Character Set) - ToolsOptions - hToolsOptions ( "LoadSave", "HTMLCompatibility" ) - GetHTMLCharSet = Zeichensatz.GetSelText - Kontext "ExtrasOptionenDlg" - ExtrasOptionenDlg.OK -end sub - -'------------------------------------------------------------------------- - -sub SetHTMLCharSet ( CharSet as String ) -'///routine to set the Character Set for HTML export -'///+( tools/options/load&save/HTML compatibility -> Character Set ) - ToolsOptions - hToolsOptions ( "LoadSave", "HTMLCompatibility" ) - Zeichensatz.Select CharSet - Kontext "ExtrasOptionenDlg" - ExtrasOptionenDlg.OK -end sub - -'------------------------------------------------------------------------- - -sub SetHTMLCharSetToUTF8 as Boolean -'///function to set the Character Set for HTML export to 'Unicode UTF8' -'///+( tools/options/load&save/HTML compatibility -> Character Set ) - Dim i as Integer - Dim sDum as String - - ToolsOptions - hToolsOptions ( "LoadSave", "HTMLCompatibility" ) - - for i=1 to Zeichensatz.GetItemCount - sDum = Zeichensatz.GetItemText (i) - if Instr ( lcase (sDum), "utf-8" ) <> 0 then - Zeichensatz.Select (i) - i=1000 - else - if Instr ( lcase (sDum), "utf8" ) <> 0 then - Zeichensatz.Select (i) - i=1000 - else - if Instr ( lcase (sDum), "utf 8" ) <> 0 then - Zeichensatz.Select (i) - i=1000 - end if - end if - end if - next i - if i<1000 then - SetHTMLCharSetToUTF8 = FALSE - else - SetHTMLCharSetToUTF8 = TRUE - end if - Kontext "ExtrasOptionenDlg" - ExtrasOptionenDlg.OK -end sub - -'------------------------------------------------------------------------- - function dec(Ref as integer) '/// decrement variable, call it like 'dec variable' ///' ' reference or value .-) an excursion :-)) @@ -177,235 +114,11 @@ end function '------------------------------------------------------------------------- -function ActivateAutoPilot ( sWhichOne as String ) as Boolean -'Author: TZ -'///Routine to activate (WebPage Autopilot, Form Autopilot, Documentconverter and Euroconveter) -'///Open via menu items (not via SlotID or Macro URL) -'///<u>input</u>: Which Autopilot (<i>webpage</i>, <i>form</i>, <i>documentconverter</i>, <i>euroconverter</i>,<i>addressdatasource</i>) -'///<u>output</u>:<ul><li>TRUE: Autopilot is open</li><li>FALSE: Autopilot can not be opened</li></ul> - Dim bIsLoaded as boolean, LoadTime as integer, PrintTime as Integer - - bIsLoaded = FALSE - LoadTime = 0 - - select case gApplication - case "WRITER" - Kontext "DocumentWriter" - DocumentWriter.UseMenu - case "HTML" - Kontext "DocumentWriterWeb" - DocumentWriterWeb.UseMenu - case "MASTERDOCUMENT" - Kontext "DocumentMasterDoc" - DocumentMasterDoc.UseMenu - case "CALC" - Kontext "DocumentCalc" - DocumentCalc.UseMenu - case "IMPRESS" - Kontext "DocumentImpress" - DocumentImpress.UseMenu - case "DRAW" - Kontext "DocumentDraw" - DocumentDraw.UseMenu - case "MATH" - Kontext "DocumentMath" - DocumentMath.UseMenu - case else - Kontext "DocumentWriter" - DocumentWriter.UseMenu - end select - sleep(2) - hMenuSelectNr(1) - sleep(2) - hMenuSelectNr(4) - sleep(2) - - select case lcase (sWhichOne) - case "webpage" : hMenuSelectNr(5) - case "documentconverter" : hMenuSelectNr(6) - case "euroconverter" : hMenuSelectNr(7) - case "addressdatasource" : hMenuSelectNr(8) - end select - sleep(5) - - while bIsLoaded = False - while LoadTime < 20 - PrintTime = LoadTime * 3 - select case lcase ( sWhichOne ) - case "webpage" : Kontext "AutopilotWebPage" - if AutopilotWebPage.Exists(1) then - bIsLoaded = true - printlog "Autopilot is loaded in " + PrintTime + " seconds!" - LoadTime = 20 - ActivateAutoPilot = TRUE - end if - case "report" : Kontext "AutoPilotReport" - if AutoPilotReport.Exists(1) then - bIsLoaded = true - printlog "Autopilot is loaded in " + PrintTime + " seconds!" - LoadTime = 20 - ActivateAutoPilot = TRUE - end if - case "form" : Kontext "ChooseDatabase" - if ChooseDatabase.Exists(1) then - bIsLoaded = true - printlog "Autopilot is loaded in " + PrintTime + " seconds!" - LoadTime = 20 - ActivateAutoPilot = TRUE - end if - case "documentconverter" : Kontext "DocumentConverter" - if DocumentConverter.Exists(1) then - bIsLoaded = true - printlog "Autopilot is loaded in " + PrintTime + " seconds!" - LoadTime = 20 - ActivateAutoPilot = TRUE - end if - case "euroconverter" : Kontext "AutoPilotEuroKonverter" - if AutoPilotEuroKonverter.Exists(1) then - bIsLoaded = true - printlog "Autopilot is loaded in " + PrintTime + " seconds!" - LoadTime = 20 - ActivateAutoPilot = TRUE - end if - case "addressdatasource" : Kontext "AddressSourceAutopilot" - if AddressSourceAutopilot.Exists(1) then - bIsLoaded = true - printlog "Autopilot is loaded in " + PrintTime + " seconds!" - LoadTime = 20 - ActivateAutoPilot = TRUE - end if - - end select - 'NOTE: Maybe a messagebox occurs. - Kontext "Active" - if Active.Exists (1) then - warnlog Active.GetText - try - Active.OK - catch - Active.Cancel - endcatch - ActivateAutoPilot = FALSE - end if - sleep(1) - LoadTime = LoadTime + 1 - if LoadTime = 20 and bIsLoaded = False then - warnlog "Autopilot has not been loaded!" - ActivateAutoPilot = FALSE - bIsLoaded = TRUE - end if - wend - wend -end function - -'------------------------------------------------------------------------- - -function SetURL ( sURL as String ) -'Author: TZ -'/// Routine to open a special URL with <i>file open</i>-dialog -'/// <u>input</u>: The URL as string - FileOpen - Kontext "OeffnenDlg" - Dateiname.SetText sURL - Oeffnen.Click - wait 500 -end function - -'------------------------------------------------------------------------- - -function fGetFileText (sFilename as string, iCount as long) as string -'/// This function is for getting the first or last n characters of a file -'///+<u>Input</u>:<ul><li>filename</li><li>number</li></ul>If the number greater 0 then get n characters from start. -'///+A number smaller 0 get from end of file. -'///+<u>Output</u>:<ul><li>string with <b><i>n</i></b> characters</li></ul> - - dim iFile as integer ' filehandle - dim iTem as integer ' get 2 bytes of the file - dim iTemByte(2) as integer ' move 1 byte from iTem in each item - dim sTemp as string ' string of file - dim iSize as long ' size in bytes of file - dim i as long ' runner :-) - - iFile = FreeFile -' Printlog "FreeFile: " + iFile - if (dir (sFilename) <> "") then -' Printlog "FileLen: " + FileLen(sFile) - Open sFilename For binary access read shared As #iFile -' Printlog "Loc: " + Loc(#iFile) ' LONG! where am i in the file? - - iSize = Lof(#iFile) ' get size in bytes of file - if (iSize > 65530) then '65536 = 64kB - 'Warnlog "fGetFileText: file '" + sFilename + "' might get problems on reading it? size is > 65530 Byte: '" + iSize + "'" - else -' printlog "iSize: " + iSize - endif - - sTemp = "" - if (iCount >= 0) then ' get bytes from file start - get iFile,1,sTemp ' get max 64kByte; but not the 1st 2 bytes :-( - get iFile,1,iTem ' get the first 2 bytes of the file - iTemByte(2) = (iTem AND &H0000FF00) \ &H100 ' and seperate the bytes - iTemByte(1) = (iTem AND &H000000FF) - sTemp = chr(iTemByte(1)) + chr(iTemByte(2)) + sTemp ' put them together - else ' get bytes from file end - if ((iSize+iCount) > 0) then - select case (iSize+iCount) - case 1: get iFile,1,sTemp ' take bytes from the end of the file - get iFile,1,iTem ' get the first 2 bytes of the file - sTemp = chr(iTemByte(2)) + sTemp ' put them together - case else: get iFile,(iSize+iCount)-1,sTemp ' take bytes from the end of the file - end select - else - get iFile,1,sTemp ' take bytes from the end of the file - get iFile,1,iTem ' get the first 2 bytes of the file - iTemByte(2) = (iTem AND &H0000FF00) \ &H100 ' and seperate the bytes - iTemByte(1) = (iTem AND &H000000FF) - sTemp = chr(iTemByte(1)) + chr(iTemByte(2)) + sTemp ' put them together - endif - endif -' printlog "'"+left(sTemp,iSize)+"'" ' gotcha! - - if (iSize-(Abs(iCount)) >= 0) then - fGetFileText = left(sTemp,Abs(iCount)) - else - 'Warnlog "fGetFileText: file '" + sFilename + "' isn't as big as expected; will only return '" + iSize+ "' bytes fom: " + iCount - fGetFileText = left(sTemp,iSize) - endif - - ' debugging routine -------------------------------------- - ' iSize = Lof(#iFile) - ' printlog "iSize: " + iSize - ' sTemp = "" - ' if iSize > 0 then - ' printlog "iSize \ 2: " + (iSize \ 2) - ' for i = 0 to ((iSize \ 2)-1) - ' get iFile,(i*2)+1,iTem - ' Printlog "i: " + i + ": 0x" + hex(iTem) - ' iTemByte(2) = (iTem AND &H0000FF00) \ &H100 - ' iTemByte(1) = (iTem AND &H000000FF) - ' sTemp = sTemp + chr(iTemByte(1)) + chr(iTemByte(2)) - ' next i - ' if (iSize MOD 2) = 1 then - ' get iFile,iSize,iTem - ' Printlog "i: " + iSize + ": 0x" + hex(iTem) - ' iTemByte(1) = (iTem AND &H000000FF) - ' sTemp = sTemp + chr(iTemByte(1)) - ' endif - ' endif - ' printlog "'"+sTemp+"'" - ' debugging routine -------------------------------------- - Close #iFile - else ' does file exist - Warnlog "fGetFileText: file '" + sFilename + "' doesn't exist" - fGetFileText = "" - endif -end function -' -'------------------------------------------------------------------------- -' function fSetMeasurementToCM() as string '/// Sets the measurement unit to centimeter (cm) and returns the unit. Dim i as integer + + const LANGUAGE_CODE_JAPANESE = 81 Call hNewDocument ToolsOptions @@ -413,7 +126,7 @@ function fSetMeasurementToCM() as string case "WRITER" Call hToolsOptions("WRITER","GENERAL") Masseinheit.Select(2) - if iSprache = 81 then + if iSprache = LANGUAGE_CODE_JAPANESE then fSetMeasurementToCM = Right$( Tabulatorenabstand.Gettext, 3 ) else fSetMeasurementToCM = Right$( Tabulatorenabstand.Gettext, 2 ) @@ -421,7 +134,7 @@ function fSetMeasurementToCM() as string case "CALC" Call hToolsOptions("CALC","GENERAL") Masseinheit.Select(2) - if iSprache = 81 then + if iSprache = LANGUAGE_CODE_JAPANESE then fSetMeasurementToCM = Right$( Tabulator.Gettext , 3 ) else fSetMeasurementToCM = Right$( Tabulator.Gettext , 2 ) @@ -429,7 +142,7 @@ function fSetMeasurementToCM() as string case "IMPRESS" Call hToolsOptions("IMPRESS","GENERAL") Masseinheit.Select(2) - if iSprache = 81 then + if iSprache = LANGUAGE_CODE_JAPANESE then fSetMeasurementToCM = Right$( Tabulatorabstand.Gettext, 3 ) else fSetMeasurementToCM = Right$( Tabulatorabstand.Gettext, 2 ) @@ -437,7 +150,7 @@ function fSetMeasurementToCM() as string case "DRAW" Call hToolsOptions("DRAW","GENERAL") Masseinheit.Select(2) - if iSprache = 81 then + if iSprache = LANGUAGE_CODE_JAPANESE then fSetMeasurementToCM = Right$( Tabulatorabstand.Gettext, 3 ) else fSetMeasurementToCM = Right$( Tabulatorabstand.Gettext, 2 ) @@ -445,7 +158,7 @@ function fSetMeasurementToCM() as string case "MASTERDOCUMENT" Call hToolsOptions("WRITER","GENERAL") Masseinheit.Select(2) - if iSprache = 81 then + if iSprache = LANGUAGE_CODE_JAPANESE then fSetMeasurementToCM = Right$( Tabulatorenabstand.Gettext, 3 ) else fSetMeasurementToCM = Right$( Tabulatorenabstand.Gettext, 2 ) @@ -457,7 +170,7 @@ function fSetMeasurementToCM() as string 'because .sdw, .sxw etc. export to HTML depends on it. Call hToolsOptions("WRITER","GENERAL") Masseinheit.Select(2) - if iSprache = 81 then + if iSprache = LANGUAGE_CODE_JAPANESE then fSetMeasurementToCM = Right$( Tabulatorenabstand.Gettext, 3 ) else fSetMeasurementToCM = Right$( Tabulatorenabstand.Gettext, 2 ) @@ -498,12 +211,6 @@ End Function '------------------------------------------------------------------------- -function fRemoveDoubleSpace(stringToChange as string) As String - fRemoveDoubleSpace = fRemoveDoubleCharacter(stringToChange, " ") -End Function - -'------------------------------------------------------------------------- - function writeCrashRepFile() '/// Creates a file <i>(gOfficePath)</i>/user/work/crashrep.txt with two lines: '///+ <ol><li>name of .bas file</li> @@ -559,7 +266,7 @@ function hGetUNOService(optional bSilent as boolean, optional byRef sUnoPortExte ' To not to change the old behaviour, set variable if parameter is not given if (isMissing(bSilent)) then - bSilent = FALSE + bSilent = TRUE end if ' master.inc::sStartUpOffice needs just the Port Numberr from UNO, to pass it to first start up diff --git a/testautomation/global/tools/includes/required/t_tools3.inc b/testautomation/global/tools/includes/required/t_tools3.inc index b55546edd8d6..27ac128437ee 100644..100755 --- a/testautomation/global/tools/includes/required/t_tools3.inc +++ b/testautomation/global/tools/includes/required/t_tools3.inc @@ -29,8 +29,7 @@ '* '* short description : Global Tools III '* -'\************************************************************************************* - +'\****************************************************************************** sub hToolbarSelect( sType as string, sOpen as boolean, optional SetToDefault as boolean ) Dim sDefault as integer, sKontext as string, sPosition as integer @@ -916,6 +915,7 @@ sub hCloseAllToolbars endif end sub +'******************************************************************************* function hIsAccessbridgeInstalled() as boolean '/// created by HDE @@ -942,7 +942,7 @@ function hIsAccessbridgeInstalled() as boolean sAccessBridgeFolder = "Java Access Bridge" sCompareString = sProgramFiles & "\" & sAccessBridgeFolder & "\AccessBridgeTester.class" sAccessibilityCompare = "with accessibility support" - if hFileExists(sCompareString) = True then + if ( FileExists( sCompareString ) ) then AccessbridgeIsInstalled = True else ToolsOptions @@ -965,7 +965,7 @@ function hIsAccessbridgeInstalled() as boolean endif endif Kontext "OptionenDlg" - OptionenDlg.Cancel + hCloseDialog( OptionenDlg, "Cancel" ) endif end select endif @@ -973,3 +973,284 @@ function hIsAccessbridgeInstalled() as boolean hIsAccessbridgeInstalled = AccessbridgeIsInstalled end function + +'******************************************************************************* + +function hUseAsyncSlot( cSlot as string ) as integer + + ' These are a selection of slots that take time to get enabled after + ' actions have been performed on a document. Although they might appear + ' to be ready in the UI we still need to probe them. + + dim iRetries as integer : iRetries = 0 + dim iTime as integer : iTime = 0 + + dim slot as string : slot = lcase( cSlot ) + + const MAX_RETRIES = 100 ' Number of time we try to call the slot + const DELAY = 100 ' 100ms delay to wait between retries + const RC_TIMEOUT = -1 ' Returnvalue if slot is not available + const CFN = "global::tools::includes::required::hUseAsyncSlot(): " + + if ( GVERBOSE ) then printlog( CFN & "Execute <" & cSlot & ">" ) + WaitSlot() + + for iRetries = 1 to MAX_RETRIES + try + select case ( slot ) + case "fileclose" : FileClose + case "filesave" : FileSave + case "filesaveas" : FileSaveAs( "SynchronMode", TRUE ) + case "filesaveall" : FileSaveAll( "SynchronMode", TRUE ) + case "fileexport" : FileExport + case "filereload" : FileReload( "SynchronMode", TRUE ) + case "fileopen" : FileOpen + case "fileprint" : FilePrint + case "fileprintersettings" : FilePrintersettings + case "fileproperties" : FileProperties + + case "editdoc" : EditDoc + case "editcopy" : EditCopy + case "editchangesrecord" : EditChangesRecord + case "editchangesshow" : EditChangesShow + case "editchangesprotecttrace" : EditChangesProtectTrace + case "editchangescomment" : EditChangesComment + + case "editpaste" : EditPaste + case "editcut" : EditCut + case "editselectall" : EditSelectAll + case "editselectallmath" : EditSelectAllMath + case "editselectionmodeblock" : EditSelectionModeBlock + case "editselectionmodestandard" : EditSelectionModeStandard + case "editdeletecontents" : EditDeleteContents + case "editundo" : EditUndo + case "editredo" : EditRedo + case "editrepeat" : EditRepeat + case "editpastespecial" : EditPasteSpecial + case "editpastespecialwriter" : EditPasteSpecialWriter + case "editsearchandreplace" : EditSearchAndReplace + case "editduplicate" : EditDuplicate + case "editgluepoints" : EditGluePoints + case "editdeleteslide" : EditDeleteSlide + case "editobjectproperties" : EditObjectProperties + case "editobjectedit" : EditObjectEdit + case "editobjectsavecopyas" : EditObjectSaveCopyAs + case "edithyperlink" : EditHyperlink + case "editlinkswriter" : EditLinksWriter + case "editfields" : EditFields + + case "formatframe" : FormatFrame + case "formatcharttype" : FormatChartType + case "formatcontrol" : FormatControl + case "formateditpoints" : FormatEditPoints + case "formatsections" : FormatSections + case "formatchangecaseupper" : FormatChangeCaseUpper + case "formatchangecaselower" : FormatChangeCaseLower + case "formatarea" : FormatArea + case "formatarrangebringtofrontcalc" : FormatArrangeBringToFrontCalc + case "formatflipvertically" : FormatFlipVertically + case "formatfliphorizontally" : FormatFlipHorizontally + case "formatline" : FormatLine + case "formatpositionandsize" : FormatPositionAndSize + case "formatfontwork" : FormatFontwork + case "formatpagewriter" : FormatPageWriter + case "formatparagraph" : FormatParagraph + case "formatruby" : FormatRuby + case "formatstylebold" : FormatStyleBold + case "formatungroupdraw" : FormatUngroupDraw + case "formatexitgroupdraw" : FormatExitGroupDraw + case "formatgroupgroup" : FormatGroupGroup + case "formatgroupeditgroupcalc" : FormatGroupEditGroupCalc + case "formatalignmentlefttext" : FormatAlignmentLeftText + case "formatgraphics" : FormatGraphics + case "formatanchortopage" : FormatAnchorToPage + case "formatwrapcontour" : FormatWrapContour + case "formatwrapeditcontour" : FormatWrapEditContour + case "formatpagewriter" : FormatPageWriter + case "formatautoformatapply" : FormatAutoformatApply + + case "insertslide" : InsertSlide + case "insertfieldsother" : InsertFieldsOther + case "insertgraphicsfromfile" : InsertGraphicsFromFile + case "insertindexesbibliographyentry" : InsertIndexesBibliographyEntry + + case "contextpositionandsize" : ContextPositionAndSize + case "contextproperties" : ContextProperties + + case "toolslanguagehyphenate" : ToolsLanguageHyphenate + case "toolsupdateallindexes" : ToolsUpdateAllIndexes + case "toolsupdatefields" : ToolsUpdateFields + case "toolsupdatelinks" : ToolsUpdateLinks + case "toolslanguagehangulhanjaconversion" : ToolsLanguageHangulHanjaConversion + + case "viewslide" : ViewSlide + case "viewdrawing" : ViewDrawing + case "viewnotes" : ViewNotes + case "viewhandout" : ViewHandout + case "viewzoom" : ViewZoom + case "viewnormal" : ViewNormal + case "viewworkspacedrawingview" : ViewWorkspaceDrawingView + case "viewworkspaceoutlineview" : ViewWorkspaceOutlineView + case "viewworkspaceslideview" : ViewWorkspaceSlidesView + case "viewworkspacenotesview" : ViewWorkspaceNotesView + case "viewworkspacehandoutview" : ViewWorkspaceHandoutView + + case else : warnlog( "Unknown slot called: " & cSlot ) + end select + + exit for ' This is only executed if the slot was called successfully + catch + wait( DELAY ) + endcatch + next iRetries + + ' Total time used + iTime = iRetries * DELAY + + ' Timeout is -1 + if ( iRetries = MAX_RETRIES ) then iTime = RC_TIMEOUT + + if ( GVERBOSE ) then printlog( CFN & "Exit with rc=" & iTime ) + hUseAsyncSlot() = iTime + +end function + +'******************************************************************************* + +function hClickButton( oButton as object ) as integer + + dim iRetries as integer : iRetries = 0 + dim iTime as integer : iTime = 0 + + const MAX_RETRIES = 50 ' Try to click the button max 50 times + const DELAY = 100 ' 100ms wait between retries + const RC_TIMEOUT = -1 ' Return -1 if the button is not available + const CFN = "global::tools::includes::required::hClickButton(): " + + if ( GVERBOSE ) then printlog( "Click <" & oButton.name() & ">" ) + WaitSlot() + + for iRetries = 1 to MAX_RETRIES + try + oButton.click() + exit for + catch + wait( DELAY ) + endcatch + next iRetries + + ' Total time used + iTime = iRetries * DELAY + + if ( iRetries = MAX_RETRIES ) then iTime = RC_TIMEOUT + + if ( GVERBOSE ) then printlog( CFN & "Exit with rc=" & iTime ) + hClickButton() = iTime + +end function + +'******************************************************************************* + +function hCloseDialog( oDialog as object, sUserFlags as string ) as boolean + + ' this function closes a dialog providing three different methods while + ' removing the need for static sleep statements + + const CFN = "global::tools::includes::required::t_tools3.inc::hCloseDialog(): " + const METHOD_CLOSE = 1 + const METHOD_CANCEL = 2 + const METHOD_OK = 3 + const METHOD_202 = 4 + const METHOD_YES = 5 + const METHOD_NO = 6 + const TIMEOUT = 2 ' Maximum time to wait for a dialog to close + + dim sFlags as string : sFlags = lcase( sUserFlags ) + dim iClosingMethod as integer + dim bDialogMustExist as boolean : bDialogMustExist = TRUE + + hCloseDialog() = FALSE ' Set default returnvalue, assume failure + + ' Find out which closing method was provided, "close" ist the default + if ( instr( sFlags, "cancel" ) ) then + iClosingMethod = METHOD_CANCEL + elseif ( instr( sFlags, "202" ) ) then + iClosingMethod = METHOD_202 + elseif ( instr( sFlags, "yes" ) ) then + iClosingMethod = METHOD_YES + elseif ( instr( sFlags, "ok" ) ) then + iClosingMethod = METHOD_OK + elseif ( instr( sFlags, "no" ) ) then + iClosingMethod = METHOD_NO + else + iClosingMethod = METHOD_CLOSE + endif + + ' Find out whether the dialog must exist (default) or is just closed as a precaution ("optional") + if ( instr( sFlags, "optional") ) then bDialogMustExist = FALSE + + if ( GVERBOSE ) then + printlog( "Closing dialog <" & oDialog.name() & "> using the flags <" & sFlags & ">.") + endif + + if ( oDialog.exists() ) then + try + select case( iClosingMethod ) + case METHOD_CLOSE : oDialog.close() + case METHOD_CANCEL : oDialog.cancel() + case METHOD_202 : oDialog.click( 202 ) + case METHOD_YES : oDialog.yes() + case METHOD_NO : oDialog.no() + case METHOD_OK : oDialog.ok() + case else : + warnlog( CFN & " Script error: Allowed closing methods are cancel, close, ok, yes, no and 202" ) + end select + catch + warnlog( CFN & "This dialog does not provide the requested closing method" ) + hCloseDialog() = FALSE + exit function + endcatch + else + if ( bDialogMustExist ) then + warnlog( CFN & "The requested dialog is not available, no action taken" ) + hCloseDialog() = FALSE + exit function + endif + endif + + ' Any other outcome until now returned FALSE. If we get here, we have a success. + if ( oDialog.notExists( TIMEOUT ) ) then hCloseDialog() = TRUE + +end function + +'******************************************************************************* + +function hWaitForObject( oControl as object, iTime as integer ) as integer + + const CFN = "global::tools::includes::required::t_tools3.inc::hWaitForObject(): " + const RC_TIMEOUT = -1 + + dim iWait as integer + + if ( GVERBOSE ) 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() = iWait + exit function + else + if ( GVERBOSE ) then printlog( "Waiting..." ) + endif + catch + wait( 1 ) + endcatch + next iWait + + printlog( CFN & "Control not found or not enabled, timeout reached" ) + hWaitForObject() = RC_TIMEOUT + +end function diff --git a/testautomation/global/tools/record_macro.bas b/testautomation/global/tools/record_macro.bas deleted file mode 100755 index d4d7095e9efc..000000000000 --- a/testautomation/global/tools/record_macro.bas +++ /dev/null @@ -1,54 +0,0 @@ -'encoding UTF-8 Do not remove or change this line! -'************************************************************************** -' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -' -' Copyright 2000, 2010 Oracle and/or its affiliates. -' -' OpenOffice.org - a multi-platform office productivity suite -' -' This file is part of OpenOffice.org. -' -' OpenOffice.org is free software: you can redistribute it and/or modify -' it under the terms of the GNU Lesser General Public License version 3 -' only, as published by the Free Software Foundation. -' -' OpenOffice.org is distributed in the hope that it will be useful, -' but WITHOUT ANY WARRANTY; without even the implied warranty of -' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -' GNU Lesser General Public License version 3 for more details -' (a copy is included in the LICENSE file that accompanied this code). -' -' You should have received a copy of the GNU Lesser General Public License -' version 3 along with OpenOffice.org. If not, see -' <http://www.openoffice.org/license.html> -' for a copy of the LGPLv3 License. -' -'/************************************************************************ -'* -'* owner : thorsten.bosbach@sun.com -'* -'* short description : Records your actions in the Office at the cursorposition in the TestTool window -'* -'\************************************************************************************* - -sub main -' start with <F5>; wait until it got runned, -' open a new window in testtool, -' perform some actions in the office, -' take a look into the testtool window - - RecordMacro true - -' if you're done, comment the above line and uncomment the following line, -' run it <F5> and the macromodus is left - -' RecordMacro false - -end sub - -sub LoadIncludeFiles - use "global\system\includes\declare.inc" - use "global\system\includes\gvariabl.inc" - Call GetUseFiles() -end sub - diff --git a/testautomation/global/win/bars.win b/testautomation/global/win/bars.win index 525be7d897ca..f2c40134d964 100755 --- a/testautomation/global/win/bars.win +++ b/testautomation/global/win/bars.win @@ -804,7 +804,7 @@ ManageBreakpoints .uno:ManageBreakPoints Modules SID_BASICIDE_MODULEDLG ObjectCatalog SID_BASICIDE_OBJCAT ProcedureStep .uno:BasicStepOver -SaveSourceTest .uno:SaveBasicAs +SaveSourceText .uno:SaveBasicAs SingleStep .uno:BasicStepInto StepBack .uno:BasicStepOut '------------------------------------------------------------------------- |