diff options
48 files changed, 899 insertions, 2558 deletions
diff --git a/testautomation/framework/optional/includes/basic_macros.inc b/testautomation/framework/optional/includes/basic_macros.inc index 0d5e2a451d60..30c0f47ed473 100644 --- a/testautomation/framework/optional/includes/basic_macros.inc +++ b/testautomation/framework/optional/includes/basic_macros.inc @@ -64,7 +64,8 @@ testcase tMakro_In_All_Apps brc = hCloseBasicIde() printlog( "Close the navigator (Master-doc)" ) - brc = hCloseNavigator() + kontext "Navigator" + hCloseDialog( Navigator, "close,optional" ) printlog( "Close the document" ) FileClose @@ -88,12 +89,6 @@ endcase testcase tMakro_Dialog - if ( gBuild < 9305 ) then - warnlog( "#i87457# - Application macros assigned to userlayer" ) - goto endsub - endif - - dim brc as boolean dim cMsg as string diff --git a/testautomation/framework/optional/includes/extras_file_open.inc b/testautomation/framework/optional/includes/extras_file_open.inc index 680afdd77197..874012f6bad1 100644 --- a/testautomation/framework/optional/includes/extras_file_open.inc +++ b/testautomation/framework/optional/includes/extras_file_open.inc @@ -173,7 +173,8 @@ testcase tOpenObjectsWithFileDialog( cCategory as string ) else printlog( "Close navigator, if open" ) - hCloseNavigator() + kontext "Navigator" + hCloseDialog( Navigator, "close,optional" ) sFileOut = cCategory & "_" & iCurrentTemplate sFileOut = convertpath( sPathOut & sFileOut ) @@ -196,7 +197,8 @@ testcase tOpenObjectsWithFileDialog( cCategory as string ) hHandleActivesOnLoad( 0 , 2 ) printlog( "Close navigator, if open" ) - hCloseNavigator() + kontext "Navigator" + hCloseDialog( Navigator, "close,optional" ) printlog( "Close document" ) hDestroyDocument() diff --git a/testautomation/framework/optional/includes/extras_modify_objects.inc b/testautomation/framework/optional/includes/extras_modify_objects.inc index b8cf23170942..70695d6341a0 100644 --- a/testautomation/framework/optional/includes/extras_modify_objects.inc +++ b/testautomation/framework/optional/includes/extras_modify_objects.inc @@ -143,12 +143,14 @@ testcase tModifyObjects( iMode as integer, cCategory as string, sVer as string ) else printlog( "Build filename; save, reload and delete" ) sFile = sPath & cCategory & iObjectFolder & "_" & iObject - hCloseNavigator() + kontext "Navigator" + hCloseDialog( Navigator, "close,optional" ) hFileSaveAsKill( sFile ) hDestroyDocument() hFileOpen( sFile ) hHandleActivesOnLoad( 1 , 2 ) - hCloseNavigator() + kontext "Navigator" + hCloseDialog( Navigator, "close,optional" ) hDestroyDocument() hDeleteFile( sFile ) printlog( "Test cycle done, going for next object." ) diff --git a/testautomation/framework/optional/includes/filedlg_cjk_files.inc b/testautomation/framework/optional/includes/filedlg_cjk_files.inc index 19f508193a8d..a2bcc2230ec0 100644 --- a/testautomation/framework/optional/includes/filedlg_cjk_files.inc +++ b/testautomation/framework/optional/includes/filedlg_cjk_files.inc @@ -71,7 +71,8 @@ testcase tSaveLoadDelFilesCJK() hDeleteFile( hGetWorkPath() & cStrangeName ) printlog( "Close navigator, if it exists" ) - hCloseNavigator() + kontext "Navigator" + hCloseDialog( Navigator, "close,optional" ) next iCounter diff --git a/testautomation/framework/optional/includes/filedlg_passwords.inc b/testautomation/framework/optional/includes/filedlg_passwords.inc index c8dd68effe83..b921b1a831e0 100644 --- a/testautomation/framework/optional/includes/filedlg_passwords.inc +++ b/testautomation/framework/optional/includes/filedlg_passwords.inc @@ -58,7 +58,8 @@ testcase tFiledlgPasswords() hCreateDocument() - hCloseNavigator() + kontext "Navigator" + hCloseDialog( Navigator, "close,optional" ) call hChangeDoc() @@ -164,13 +165,15 @@ testcase tFiledlgPasswords() warnlog( "File Open dislog did not come up" ) endif - hCloseNavigator() + kontext "Navigator" + hCloseDialog( Navigator, "close,optional" ) hDestroyDocument() hDeleteFile( workpath & workfile ) - hCloseNavigator() + kontext "Navigator" + hCloseDialog( Navigator, "close,optional" ) next iCurrentFileFormat diff --git a/testautomation/framework/optional/includes/options_ls_2.inc b/testautomation/framework/optional/includes/options_ls_2.inc deleted file mode 100644 index f3e9cee13250..000000000000 --- a/testautomation/framework/optional/includes/options_ls_2.inc +++ /dev/null @@ -1,307 +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 : (functionality test for load/save group) -'* -'\****************************************************************************** - -testcase func_LoadSaveGeneral_1 - - warnlog( "#i95523# - cannot access custom tabpage on document info dialog" ) - goto endsub - - Dim bSave as boolean, bPromptSave as boolean - Dim sSaveTime as String - Dim sFilename, sFilebak as String - Dim i as Integer - - gApplication = "WRITER" - - - sFilename = ConvertPath ( gOfficePath + "user\work\o_save.sxw" ) - sFilebak = ConvertPath ( gOfficePath + "user\backup\o_save.bak" ) - - if app.Dir ( sFilename ) <> "" then app.kill ( sFilename ) - if app.Dir ( sFilebak ) <> "" then app.kill ( sFilebak ) - - printlog " - save" - printlog " - document properties before saving" - printlog " open a new document" - hNewDocument - - Kontext "DocumentWriter" - DocumentWriter.TypeKeys "tools/options/load-save/general: save-> edit document properties before saving<Return>" - printlog " open tools / options / load & save / general" - ToolsOptions - hToolsOptions ( "LoadSave", "General" ) - - printlog " check 'document properties before saving'" - bSave = DokumenteigenschaftenBearbeiten.IsChecked - DokumenteigenschaftenBearbeiten.Check - - Kontext "ExtrasOptionenDlg" - ExtrasOptionenDlg.OK - Sleep (2) - printlog " save the document" - - FileSaveAs - Kontext "SpeichernDlg" - Dateiname.SetText sFilename - Sleep (1) - Speichern.Click - Sleep (1) - kontext - 'overwrite warning on rerun - if active.exists(3) then - active.yes - endif - - printlog " activate all tabpages on properties dialog and cancel it" - try - Kontext - active.SetPage( TabDokument) - active.SetPage TabDokumentinfo - active.SetPage TabBenutzer - active.SetPage TabInternet - active.SetPage TabStatistik - Kontext "TabStatistik" - TabStatistik.Cancel - catch - Warnlog "Perhaps the document properties aren't active after saving => the dialog come not up after file save!" - endcatch - - printlog " - always create backup copy" - Kontext "DocumentWriter" - DocumentWriter.TypeKeys "tools/options/load-save/general: save-> always create backup copy<Return>" - printlog " open tools / options / load & save / general" - ToolsOptions - hToolsOptions ( "LoadSave", "General" ) - - if bSave = TRUE then DokumenteigenschaftenBearbeiten.Check else DokumenteigenschaftenBearbeiten.UnCheck - bSave = Sicherungskopie.IsChecked - Sicherungskopie.Check - Kontext "ExtrasOptionenDlg" - ExtrasOptionenDlg.OK - Sleep (3) - - if app.Dir ( sFilebak ) <> "" then Warnlog "Before saving the document the backup-file exists!" - hFileSave - if app.Dir ( sFilebak ) = "" then Warnlog "After saving the document the backup-file doesn't exists => BUG!" - - printlog " - autosave : after 1 min, with prompt" - Kontext "DocumentWriter" - DocumentWriter.TypeKeys "tools/options/load-save/general: save-> autosave after 1 min with prompt<Return>" - ToolsOptions - hToolsOptions ( "LoadSave", "General" ) - - if bSave = TRUE then Sicherungskopie.Check else Sicherungskopie.UnCheck - bSave = AutomatischSpeichern.IsChecked - AutomatischSpeichern.Check - sSaveTime = 15 'debug - - Minuten.SetText "2" - - Kontext "ExtrasOptionenDlg" - ExtrasOptionenDlg.OK - Sleep (130) - - for i=1 to 2 - Kontext "Active" - if Active.Exists (3) then - Active.Yes - Kontext "SpeichernDlg" - if SpeichernDlg.Exists then SpeichernDlg.Cancel - Sleep (2) - printlog "Active came up :-) " + i - else - printlog "Active didn't come up :-( " + i - end if - next i - - printlog " - close the document and check the saved data" - hCloseDocument ' closes the document with 'discard' - hFileOpen ( sFilename ) -kontext -if active.exists(5) then -warnlog active.gettext -goto endsub -endif - ' This part compares the content of the file after reload with text entered - ' during the entire test. It should contain three lines of text. - printlog( " - Compare the content of the file with the text entered during the test." ) - printlog( " First line..." ) - Kontext "DocumentWriter" - DocumentWriter.TypeKeys "<Up>", 5 - DocumentWriter.TypeKeys "<Home>" - DocumentWriter.TypeKeys "<Shift End>" - EditCopy - WaitSlot() - if lcase ( GetClipboardText ) <> "tools/options/load-save/general: save-> edit document properties before saving" then Warnlog "The first sentence is wrong!" - - printlog( " Second line..." ) - DocumentWriter.TypeKeys "<Down>" - DocumentWriter.TypeKeys "<Home>" - DocumentWriter.TypeKeys "<Shift End>" - EditCopy - WaitSlot() - if lcase ( GetClipboardText ) <> "tools/options/load-save/general: save-> always create backup copy" then Warnlog "The second sentence is wrong!" - - printlog( " Third line..." ) - DocumentWriter.TypeKeys "<Down>" - DocumentWriter.TypeKeys "<Home>" - DocumentWriter.TypeKeys "<Shift End>" - EditCopy - WaitSlot() - if lcase ( GetClipboardText ) <> "tools/options/load-save/general: save-> autosave after 1 min with prompt" then Warnlog "The third sentence is wrong!" - - hCloseDocument - - printlog " - load the backup-file" - hOpenFile ( sFilebak ) - - Kontext "Filterauswahl" - if Filterauswahl.Exists(2) then - warnlog "Is bugId 107399 present? => Detection of our own fileformar fails when the extension is not the standard extension!" - Filterauswahl.Close - else - Kontext "DocumentWriter" - DocumentWriter.TypeKeys "<Up>", 5 - DocumentWriter.TypeKeys "<Home>" - DocumentWriter.TypeKeys "<Shift End>" - EditCopy - - WaitSlot() - - if GetClipboardText <> "" then - call hCloseDocument - else - warnlog "Perhaps the bak-file was not loaded. => Verify BugID 86607!" - end if - end if - - printlog " - reset options" - ToolsOptions - hToolsOptions ( "LoadSave", "General" ) - AutomatischSpeichern.Check - Minuten.SetText sSaveTime - if bSave = TRUE then AutomatischSpeichern.Check else AutomatischSpeichern.UnCheck - Kontext "ExtrasOptionenDlg" - ExtrasOptionenDlg.OK - -endcase - -' > * > * > * > * > * > * > * > * > * > * > * > * > * > * > * > * -' > * > * > * > * > * > * > * > * > * > * > * > * > * > * > * > * -testcase func_LoadSaveGeneral_2 - Dim bSave as Boolean - Dim sFilename, sFilename2, sCharSet as String - - const ICWAIT as integer = 1 - - - sFilename = ConvertPath ( gOfficePath + "user\work\o_save_1.html" ) - sFilename2 = ConvertPath ( gOfficePath + "user\work\o_save_2.html" ) - - if app.dir ( sFilename ) <> "" then app.kill ( sFilename ) - if app.dir ( sFilename2 ) <> "" then app.kill ( sFilename2 ) - - printlog " - save" - printlog " - save URL relative to" - - if bAsianLan = TRUE then - sCharSet = GetHTMLCharSet - if SetHTMLCharSetToUTF8 = FALSE then - Warnlog "The test cannot find the UTF8 Character Set for HTML-Export. The test can have many errors at saving HTML-Files!" - else - printlog "The Character Set for HTML-Export is now Unicode UTF8!" - end if - end if - - gApplication = "HTML" - hNewDocument - - if gNetzInst = TRUE then - hGrafikEinfuegen ( ConvertPath ( gNetzOfficePath + "share\gallery\photos\desert1.jpg" ) ) - else - hGrafikEinfuegen ( ConvertPath ( gOfficePath + "share\gallery\photos\desert1.jpg" ) ) - end if - - printlog " - relative to filesystem" - ToolsOptions - hToolsOptions ( "LoadSave", "General" ) - - bSave = URLimDateisystem.IsChecked - URLimDateisystem.Check - Kontext "ExtrasOptionenDlg" - ExtrasOptionenDlg.OK - Sleep (2) - - printlog " save the HTML file" - hFileSaveAs ( sFilename ) - - printlog " check the relativ path in source code of HTML file" - Call URLGraphicCheck ( TRUE, sFilename ) - - printlog " - relative to filesystem ( unchecked )" - ToolsOptions - hToolsOptions ( "LoadSave", "General" ) - - URLimDateisystem.UnCheck - Kontext "ExtrasOptionenDlg" - ExtrasOptionenDlg.OK - Sleep (2) - - printlog " save the HTML file" - hFileSaveAs ( sFilename2 ) - - printlog " check the hard coded path in source code of HTML file" - Call URLGraphicCheck ( FALSE, sFilename2 ) - - hCloseDocument - - printlog " - reset the options" - ToolsOptions - hToolsOptions ( "LoadSave", "General" ) - - if bSave = TRUE then URLimDateisystem.Check else URLimDateisystem.UnCheck - Kontext "ExtrasOptionenDlg" - ExtrasOptionenDlg.OK - Sleep (2) - - printlog "No test for 'relative to internet'" - - if bAsianLan = TRUE then - printlog Chr(13 ) + "Reset the Character Set back to default : " + sCharSet - SetHTMLCharSet ( sCharSet ) - end if - - gApplication = "WRITER" -endcase - - diff --git a/testautomation/framework/optional/includes/options_ooo_general.inc b/testautomation/framework/optional/includes/options_ooo_general.inc index 8197a4fe54d9..998820e5f683 100644 --- a/testautomation/framework/optional/includes/options_ooo_general.inc +++ b/testautomation/framework/optional/includes/options_ooo_general.inc @@ -1,5 +1,5 @@ '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. @@ -23,41 +23,21 @@ ' <http://www.openoffice.org/license.html> ' for a copy of the LGPLv3 License. ' -'/************************************************************************ +'/****************************************************************************** '* -'* owner : thorsten.bosbach@sun.com +'* owner : joerg.skottke@sun.com '* -'* short description : Grid Layout for CJK test in Writer +'* short description : 1. test for general group userdata '* -'\*********************************************************************** +'\****************************************************************************** -private const SOURCE_PATH = "framework\optional\input\CJK\" +testcase tOOoGeneral -testcase tTextGridDialog_1 + dim lsSave (4) as String + dim lbSave (3) as Boolean - '/// Check if tabpage 'Text Grid' disappears when "Asian Language support" is NOT checked - if iSystemSprache <> 81 AND iSystemSprache <> 82 AND iSystemSprache <> 86 AND iSystemSprache <> 88 then - Call CheckAsianLanguageSupport("Off") - hNewDocument() - FormatPageWriter - try - Kontext - Active.SetPage TabGrid - Kontext "TabGrid" - TabGrid.Cancel - warnlog "Shouldn't get Tabpage: Grid Text" - catch - Kontext - Active.SetPage TabSeite - Kontext "TabSeite" - TabSeite.Cancel - endcatch - endif + hNewDocument - '/// Check if tabpage 'Text Grid' appears when "Asian Language support" is checked - Call CheckAsianLanguageSupport("On") - - hNewDocument ToolsOptions hToolsOptions ( "StarOffice", "General" ) @@ -81,503 +61,70 @@ testcase tTextGridDialog_1 StyleSheet.Select 3 Kontext "ExtrasOptionenDlg" - ExtrasOptionenDlg.OK - if ( ExtrasOptionenDlg.notExists( 3 ) ) then - printlog( "Options closed" ) - endif - hCloseDocument() -endcase - -'------------------------------------------------------------------------- - -testcase tTextGridDialog_2 - '/// No grid is active, no changes to existing version - Dim testFile , sCorrectResult as String - - testFile = "gridtest.sxw" - sCorrectResult = "1" - - Call hNewDocument - - '/// open a test file , and check No Grid checkbox - Call hFileOpen ( gTesttoolPath + SOURCE_PATH + testFile ) - sMakeReadOnlyDocumentEditable - - FormatPageWriter - Kontext - if active.exists(5) then - Active.SetPage TabGrid - endif - Kontext "TabGrid" - NoGrid.Check - Sleep 1 - TabGrid.OK - Sleep 1 - - '/// Active navigator dialogue , set page to '2' and wait for a while - Kontext - ViewNavigator - Kontext "NavigatorWriter" - - Seitennummer.SetText "2" - Sleep 5 - hCloseNavigator - - '/// In No Grid mode, there should be only 1 page, the focus is before the first line - Kontext "DocumentWriter" - Call DocumentWriter.TypeKeys "<End>" - Sleep 1 - Call DocumentWriter.TypeKeys "<Shift Left>" - hUseAsyncSlot( "EditCopy" ) - - if GetClipboardText <> sCorrectResult then Warnlog "Something wrong when choosing NoGrid option!" - - Call hCloseDocument -endcase - -'------------------------------------------------------------------------- - -testcase tTextGridDialog_3 - '/// Grid (lines only): The page is set up with a defined number of lines - Dim testFile , sCorrectResult , sLinesPerPage as String - - testFile = "gridtest.sxw" - sCorrectResult = "G" - sLinesPerPage = "10" - - Call hNewDocument - - '/// open a test file and check Grid(lines onle) checkbox , - '/// + set 10 line/page - Call hFileOpen ( gTesttoolPath + SOURCE_PATH + testFile ) - sMakeReadOnlyDocumentEditable - FormatPageWriter - Kontext - if active.exists(5) then - Active.SetPage TabGrid - endif - Kontext "TabGrid" - LinesGrid.Check - LinesPerPage.SetText sLinesPerPage - Sleep 1 - TabGrid.OK - Sleep 1 - - '/// Active navigator dialogue , set page to '2' and wait for a while - Kontext - ViewNavigator - Kontext "NavigatorWriter" - - Seitennummer.SetText "2" - Sleep 5 - hCloseNavigator - - Kontext "DocumentWriter" - Call DocumentWriter.TypeKeys "<End>" - Sleep 1 - Call DocumentWriter.TypeKeys "<Shift Left>" - hUseAsyncSlot( "EditCopy" ) - - if GetClipboardText <> sCorrectResult then Warnlog "Something wrong when choosing Grid(lines only) option!" - - Call hCloseDocument -endcase - -'------------------------------------------------------------------------- - -testcase tTextGridDialog_4 - '/// Grid (lines and characters): The page is set up with a defined number of lines and a defined number of characters in each line - Dim testFile , sCorrectResult as String - Dim sLinesPerPage , sCharsPerLine as String - - testFile = "gridtest.sxw" - sCorrectResult = "E" - sLinesPerPage = "10" - sCharsPerLine = "9" - - Call hNewDocument - - '/// open a test file and check Grid(lines and characters) checkbox - '/// + set 10 line/page and 9 characters/line - Call hFileOpen ( gTesttoolPath + SOURCE_PATH + testFile ) - sMakeReadOnlyDocumentEditable - FormatPageWriter - Kontext - if active.exists(5) then - Active.SetPage TabGrid - endif - Kontext "TabGrid" - CharsGrid.Check - LinesPerPage.SetText sLinesPerPage - CharsPerLine.SetText sCharsPerLine - Sleep 1 - TabGrid.OK - Sleep 1 - - '/// Active navigator dialogue , set page to '2' and wait for a while - Kontext - ViewNavigator - Kontext "NavigatorWriter" - - Seitennummer.SetText "2" - Sleep 5 - hCloseNavigator - - Kontext "DocumentWriter" - Call DocumentWriter.TypeKeys "<End>" - Sleep 1 - Call DocumentWriter.TypeKeys "<Shift Left>" - hUseAsyncSlot( "EditCopy" ) - - if GetClipboardText <> sCorrectResult then Warnlog "Something wrong when choosing Grid(lines and characters) option!" - - Call hCloseDocument -endcase - -'------------------------------------------------------------------------- - -testcase tGridDisplay_1 - '/// Print grid: The grid lines will be printed. Inactive if "Display grid" is inactive. - Call hNewDocument - - '/// format / page / tabpage Text grid - '/// + check "display grid" and check "print grid" - FormatPageWriter - Kontext - if active.exists(5) then - Active.SetPage TabGrid - endif - Kontext "TabGrid" - CharsGrid.Check - Display.Check - Sleep 1 - PrintGrid.Check - Sleep 1 - TabGrid.OK - Sleep 1 - - '/// Print to printer - FilePrint - Kontext "Active" - if ( Active.Exists( 5 ) ) then - if Active.GetRT() = 304 then - Active.Ok() - QAErrorLog "No Default-Printer!" - Kontext "Printing" - if ( Printing.exists( 1 )) then - Printing.Cancel - endif - endif - else - Kontext "Printing" - if ( Printing.exists( 2 )) then - Printing.OK() - Printing.notExists( 5 ) - endif - - kontext "Active" - if active.exists(5) then - qaErrorLog active.getText() - active.ok() - endif - endif - - '/// format / page / tabpage Text grid - '/// + check "display grid" and uncheck "print grid" - FormatPageWriter - Kontext - if active.exists(5) then - Active.SetPage TabGrid - endif - Kontext "TabGrid" - CharsGrid.Check - Display.Check - Sleep 1 - PrintGrid.UnCheck - Sleep 1 - TabGrid.OK - Sleep 1 - - '/// Print to printer - FilePrint - Kontext "Active" - if ( Active.Exists( 5 ) )then - if Active.GetRT() = 304 then - Active.Ok() - QAErrorLog "No Default-Printer!" - Kontext "Printing" - if ( Printing.exists( 1 )) then - Printing.Cancel() - endif - endif - else - Kontext "Printing" - if( Printing.exists( 1 )) then - Printing.OK - Printing.notExists( 5 ) - endif - kontext - if ( active.exists( 2 ) ) then - qaErrorLog active.getText - active.ok - endif - endif - - Call hCloseDocument -endcase - -'------------------------------------------------------------------------- - -testcase tUserDefineLayout_1 - '/// Decrease characters per line will cause lines per page decrease accordingly - Dim sLinesPerPage , sCharsPerLine as String - Dim sExpectLinesPerPage , sExpectLinesPerPage1 as String - - sLinesPerPage = "20" - sCharsPerLine = "2" - sExpectLinesPerPage = "2" - sExpectLinesPerPage1 = "3" - - Call hNewDocument - - '/// Format/page , set lines per page to 20, and set charsets per line to 2 - '/// + wait for a moment , then check the the number of lines per page. - FormatPageWriter - Kontext - if active.exists(5) then - Active.SetPage TabGrid - endif - Kontext "TabGrid" - CharsGrid.Check - - LinesPerPage.SetText sLinesPerPage - Sleep 2 - CharsPerLine.SetText sCharsPerLine - Sleep 2 - - 'This step is no use, just let the LinesPerPage change the number - CharsGrid.Check - - if LinesPerPage.GetText <> sExpectLinesPerPage AND LinesPerPage.GetText <> sExpectLinesPerPage1 then - Warnlog "The lines per page should be" + sExpectLinesPerPage + " OR " + sExpectLinesPerPage1 +" but get " +LinesPerPage.GetText - endif - - TabGrid.Cancel + hCloseDialog( ExtrasOptionenDlg, "ok" ) + hCloseDocument - Call hCloseDocument -endcase - -'------------------------------------------------------------------------- - -testcase tFontSizeChanges_1 - '/// Change the font size to bigger enough will change the layout - Dim testFile , sCorrectResult as String - Dim sLinesPerPage , sCharsPerLine as String - dim sTemp as string - - testFile = "FontSizeChanges_1.sxw" - sCorrectResult = "1" - sLinesPerPage = "2" - sCharsPerLine = "9" - - Call hFileOpen ( gTesttoolPath + SOURCE_PATH + testFile ) - sMakeReadOnlyDocumentEditable - Kontext "DocumentWriter" - Call DocumentWriter.TypeKeys "<Shift Right>" - - Kontext "FormatObjectbar" - Schriftgroesse.Select "60" - Schriftgroesse.TypeKeys "<Return>" - Sleep 1 - - Kontext "DocumentWriter" - FormatPageWriter - Kontext - if active.exists(5) then - Active.SetPage TabGrid - endif - Kontext "TabGrid" - if TabGrid.exists(5) then - sTemp = LinesPerPage.GetText - if sTemp <> sLinesPerPage then - Warnlog "The lines per page should be: '" + sLinesPerPage + "'; but get: '" + sTemp + "'" - endif - sTemp = CharsPerLine.GetText - if sTemp <> sCharsPerLine then - Warnlog "The chars per line should be: '" + sCharsPerLine + "'; but get: '" +sTemp + "'" - endif - TabGrid.Cancel - else - warnlog "TabGrid is not available." - endif - - Kontext - ViewNavigator - Kontext "NavigatorWriter" - if NavigatorWriter.exists(5) then - Seitennummer.SetText "2" - Sleep 5 - else - warnlog "Navigator not available" - endif - hCloseNavigator - - Kontext "DocumentWriter" - sleep 3 - Call DocumentWriter.TypeKeys "<Shift Right>" - - hUseAsyncSlot( "EditCopy" ) - sTemp = GetClipboardText - if sTemp <> sCorrectResult then - Warnlog "Don't get the expected result , hope to be: '" + sCorrectResult + "'; but get: '" + sTemp + "'" - endif - - Call hCloseDocument -endcase - -'------------------------------------------------------------------------- - -testcase tRubyText_1 - '/// If Ruby Text is applied and longer than its Base Text it will stretch over more grid cells than the base text itself. - Dim testFile , sRubyText as String - - testFile = "rubytest.sxw" - sRubyText = "Ruby Test Text ....................." - - Call hNewDocument - - '/// open a test file , and insert long ruby test text - Call hFileOpen ( gTesttoolPath + SOURCE_PATH + testFile ) - sMakeReadOnlyDocumentEditable - Kontext "DocumentWriter" - Call DocumentWriter.TypeKeys "<Shift Right>" - Sleep 1 - - FormatRuby - Kontext "RubyDialog" - Sleep 3 - RubyText1.setText sRubyText - Sleep 2 - RubyDialog.OK - Sleep 2 - DialogClose.Click - Sleep 1 - - Kontext "DocumentWriter" - FormatAutoformatApply - Sleep 2 - Call DocumentWriter.TypeKeys "<End>" - Sleep 2 - Call DocumentWriter.TypeKeys "<Shift Left>" - hUseAsyncSlot( "EditCopy" ) - - if NOT(GetClipboardText = "5" OR GetClipboardText = "6") then - Warnlog "Don't get the correct result after inserting ruby text! Get " + GetClipboardText - endif - - Call hCloseDocument -endcase - -'------------------------------------------------------------------------- - -testcase tIndentsTest_1 - '/// Indents should work and always indenting as close as possible to their measurements by snapping to the appropriate grid cell. Tabs therefore will be ignored. - Dim testFile , sCorrectPage1 , sCorrectPage2 as String - - testFile = "IndentsTest.sxw" - sCorrectPage1 = "1" - sCorrectPage2 = "2" - - Call hNewDocument - - '/// open a test file , and press TAB in second line - Call hFileOpen ( gTesttoolPath + SOURCE_PATH + testFile ) - sMakeReadOnlyDocumentEditable - Kontext "DocumentWriter" - Call DocumentWriter.TypeKeys "<Down>" - Sleep 1 - Call DocumentWriter.TypeKeys "<Tab>" - Sleep 1 - Call DocumentWriter.TypeKeys "<End>" - Sleep 1 + printlog " - exit/restart StarOffice" + ExitRestartTheOffice - '/// Active navigator dialogue , check if the page number is 1 - Kontext - ViewNavigator - Kontext "NavigatorWriter" - if Seitennummer.GetText <> sCorrectPage1 then Warnlog "First test :Something wrong in indents test!" - hCloseNavigator - - '/// press TAB in second line again - Kontext "DocumentWriter" - Call DocumentWriter.TypeKeys "<Home>" - Sleep 1 - Call DocumentWriter.TypeKeys "<Tab>" - Sleep 1 - Call DocumentWriter.TypeKeys "<End>" - Sleep 1 - - '/// Active navigator dialogue , check if the page number is 2 - Kontext - ViewNavigator - Kontext "NavigatorWriter" - if Seitennummer.GetText <> sCorrectPage2 then Warnlog "Second test :Something wrong in indents test!" - hCloseNavigator - - Call hCloseDocument -endcase - -'------------------------------------------------------------------------- - -testcase tObjectsTest_1 - '/// If objects are anchored to text they will "wander" with its surrounding text. - '/// If they are anchored as character they will snap to the appropriate grid cell (since they are a character). - Dim testFile , sCorrectPage1 , sCorrectPage2 as String + printlog " - check data" + ToolsOptions + hToolsOptions ( "StarOffice", "General" ) - testFile = "objectsTest.sxw" - sCorrectPage1 = "1" - sCorrectPage2 = "2" + if Zweistellig.GetText <> "1950" then Warnlog "Year ( 2 digits ) => changes not saved: '" + Zweistellig.GetText +"' #i29810" + if Aktivieren.IsChecked <> TRUE then Warnlog "Enable HelpAgent => changes not saved" + Zuruecksetzen.Click + if gPlatgroup = "w95" then + if StarOfficeDialogeBenutzen.IsChecked = lbSave (2) then Warnlog "Use StarOffice dialogs => changes not saved!" + end if + If DruckenStatus.IsChecked = lbSave ( 3 ) then Warnlog "Printing sets 'Document modified' status => changes not saved!" - Call hNewDocument + printlog " - 2. change data" + Zweistellig.SetText "1800" + DruckenStatus.UnCheck - '/// open a test file , and press TAB in second line - Call hFileOpen ( gTesttoolPath + SOURCE_PATH + testFile ) + Kontext "ExtrasOptionenDlg" + hCloseDialog( ExtrasOptionenDlg, "ok" ) - '/// If object is anchored as Character , check if it will snap to the appropriate grid cell - fStartupNavigator( "OLEObject" , 1 ) - Sleep 1 - Auswahlliste.TypeKeys "<Return>" - Sleep 1 - hCloseNavigator + printlog " - check data" + ToolsOptions + hToolsOptions ( "StarOffice", "General" ) - Kontext - FormatAnchorAsCharacter - WaitSlot() + if Zweistellig.GetText <> "1800" then Warnlog "Year ( 2 digits ) => changes not saved : '" + Zweistellig.GetText +"'" + If DruckenStatus.IsChecked <> FALSE then Warnlog "Printing sets 'Document modified' status => changes not saved!" + if StyleSheet.GetSelIndex <> 3 then Warnlog "Style sheet for StarOffice Help => changes not saved!" + printlog " - reset to saved data" + Zweistellig.SetText lsSave ( 1 ) + Aktivieren.Check + Zuruecksetzen.Click + if lbSave (1) = TRUE then Aktivieren.Check else Aktivieren.Uncheck + if gPlatgroup = "w95" then + if lbSave (2) = TRUE then StarOfficeDialogeBenutzen.Check else StarOfficeDialogeBenutzen.UnCheck + end if + If lbSave(3)= TRUE then DruckenStatus.Check else DruckenStatus.UnCheck + StyleSheet.Select lsSave(3) - ViewNavigator - Kontext "NavigatorWriter" - Seitennummer.SetText sCorrectPage2 - Sleep 5 - if Seitennummer.GetText <> sCorrectPage2 then Warnlog "Something wrong when object is anchored as Character!" - hCloseNavigator + Kontext "ExtrasOptionenDlg" + hCloseDialog( ExtrasOptionenDlg, "ok" ) - '/// If object is anchored to Character , check if it will NOT snap to the appropriate grid cell - fStartupNavigator( "OLEObject" , 1 ) - Auswahlliste.TypeKeys "<Return>" - hCloseNavigator + ToolsOptions + hToolsOptions ( "StarOffice", "General" ) - Kontext - FormatAnchorToCharacter + printlog " - check the reset data" + if Zweistellig.GetText <> lsSave ( 1 ) then Warnlog "Year ( 2 digits ) => changes not saved" + if Aktivieren.IsChecked <> lbSave (1) then Warnlog "Enable HelpAgent => changes not saved" + Aktivieren.Check + Zuruecksetzen.Click + if lbSave (1) = TRUE then Aktivieren.Check else Aktivieren.Uncheck + if gPlatgroup = "w95" then + if StarOfficeDialogeBenutzen.IsChecked <> lbSave (2) then Warnlog "Use StarOffice dialogs => changes not saved!" + end if + If DruckenStatus.IsChecked <> lbSave(3) then Warnlog "Printing sets 'Document modified' status => changes not saved!" + if StyleSheet.GetSelText <> lsSave (3) then Warnlog "Style sheet for StarOffice Help => changes not saved!" - ViewNavigator - Kontext "NavigatorWriter" - Seitennummer.SetText sCorrectPage2 - Sleep 5 - if Seitennummer.GetText <> sCorrectPage1 then Warnlog "Something wrong when object is anchored to Character!" - hCloseNavigator - Kontext + Kontext "ExtrasOptionenDlg" + hCloseDialog( ExtrasOptionenDlg, "ok" ) - Call hCloseDocument endcase diff --git a/testautomation/framework/optional/includes/scripting_organizers.inc b/testautomation/framework/optional/includes/scripting_organizers.inc index b9b7dcebde7a..d5159cd383ee 100644 --- a/testautomation/framework/optional/includes/scripting_organizers.inc +++ b/testautomation/framework/optional/includes/scripting_organizers.inc @@ -178,7 +178,7 @@ testcase tScriptingOrganizers( iDialog as integer ) endif kontext "ScriptOrganizer" - brc = hCloseScriptOrganizer() + hCloseDialog( ScriptOrganizer, "close" ) printlog( "" ) printlog( "Test 3: Script storage in documents (save/load)" ) @@ -225,7 +225,7 @@ testcase tScriptingOrganizers( iDialog as integer ) endif kontext "ScriptOrganizer" - brc = hCloseScriptOrganizer() + hCloseDialog( ScriptOrganizer, "close" ) try hFileSave @@ -250,7 +250,8 @@ testcase tScriptingOrganizers( iDialog as integer ) iItemCount = hGetNodeCount( ScriptTreeList ) if ( iItemCount <> IDOCPOS ) then warnlog( "Treelist not populated, the test cannot continue" ) - brc = hCloseScriptOrganizer() + kontext "ScriptOrganizer" + hCloseDialog( ScriptOrganizer, "close" ) brc = hDestroyDocument() goto endsub endif @@ -260,9 +261,11 @@ testcase tScriptingOrganizers( iDialog as integer ) warnlog( "Not all libraries/scripts have been deleted" ) endif - brc = hCloseScriptOrganizer() + kontext "ScriptOrganizer" + hCloseDialog( ScriptOrganizer, "close" ) - brc = hCloseNavigator() + kontext "Navigator" + hCloseDialog( Navigator, "close,optional" ) brc = hDestroyDocument() diff --git a/testautomation/framework/optional/includes/standardbar2.inc b/testautomation/framework/optional/includes/standardbar2.inc index a4252179b198..3d2b87f33b7b 100644 --- a/testautomation/framework/optional/includes/standardbar2.inc +++ b/testautomation/framework/optional/includes/standardbar2.inc @@ -90,9 +90,10 @@ testcase tStandardBar_2 sleep( 1 ) hMenuselectNr ( iNewButtonItem ) - sleep( 3 ) + hFileWait() ' was sleep( 3 ) - hCloseNavigator() + kontext "Navigator" + hCloseDialog( Navigator, "close,optional" ) select case iNewButtonItem case 1 : Kontext "DocumentWriter" diff --git a/testautomation/framework/optional/includes/w_grid_layout1.inc b/testautomation/framework/optional/includes/w_grid_layout1.inc index 737cf850ad65..da339422ee8f 100644 --- a/testautomation/framework/optional/includes/w_grid_layout1.inc +++ b/testautomation/framework/optional/includes/w_grid_layout1.inc @@ -39,7 +39,7 @@ testcase tTextGridDialog_1 if iSystemSprache <> 81 AND iSystemSprache <> 82 AND iSystemSprache <> 86 AND iSystemSprache <> 88 then Call CheckAsianLanguageSupport("Off") hNewDocument() - FormatPageWriter + hUseAsyncSlot( "FormatPageWriter" ) try Kontext Active.SetPage TabGrid @@ -57,25 +57,32 @@ testcase tTextGridDialog_1 '/// Check if tabpage 'Text Grid' appears when "Asian Language support" is checked Call CheckAsianLanguageSupport("On") - sleep 5 - FormatPageWriter - Kontext - if Active.exists (10) then - try - Kontext - Active.SetPage TabGrid - Kontext "TabGrid" - TabGrid.Cancel - catch - Kontext - Active.SetPage TabSeite - Kontext "TabSeite" - TabSeite.Cancel - warnlog "Couldn't get Tabpage: Grid Text" - endcatch - else - warnlog "FormatPageWriter didn't bring up ndialog" - endif + hNewDocument + ToolsOptions + hToolsOptions ( "StarOffice", "General" ) + + printlog " - save old data" + lsSave ( 1 ) = Zweistellig.GetText + lbSave ( 1 ) = Aktivieren.IsChecked + Aktivieren.Check + if gPlatgroup = "w95" then + lbSave (2) = StarOfficeDialogeBenutzen.IsChecked + end if + lbSave ( 3 ) = DruckenStatus.IsChecked + lsSave ( 3 ) = StyleSheet.GetSelText + + printlog " - invert/change data" + Zweistellig.SetText "1950" + Zuruecksetzen.Click + if gPlatgroup = "w95" then + if lbSave (2) = TRUE then StarOfficeDialogeBenutzen.Uncheck else StarOfficeDialogeBenutzen.Check + end if + If lbSave ( 3 ) = TRUE then DruckenStatus.Uncheck else DruckenStatus.Check + StyleSheet.Select 3 + + Kontext "ExtrasOptionenDlg" + hCloseDialog( ExtrasOptionenDlg, "ok" ) + hCloseDocument() endcase @@ -94,25 +101,22 @@ testcase tTextGridDialog_2 Call hFileOpen ( gTesttoolPath + SOURCE_PATH + testFile ) sMakeReadOnlyDocumentEditable - FormatPageWriter + hUseAsyncSlot( "FormatPageWriter" ) Kontext if active.exists(5) then Active.SetPage TabGrid endif Kontext "TabGrid" NoGrid.Check - Sleep 1 - TabGrid.OK - Sleep 1 + hCloseDialog( TabGrid, "ok" ) + '/// Active navigator dialogue , set page to '2' and wait for a while Kontext ViewNavigator Kontext "NavigatorWriter" - Seitennummer.SetText "2" - Sleep 5 - hCloseNavigator + hCloseDialog( Navigator, "close" ) '/// In No Grid mode, there should be only 1 page, the focus is before the first line Kontext "DocumentWriter" @@ -142,7 +146,7 @@ testcase tTextGridDialog_3 '/// + set 10 line/page Call hFileOpen ( gTesttoolPath + SOURCE_PATH + testFile ) sMakeReadOnlyDocumentEditable - FormatPageWriter + hUseAsyncSlot( "FormatPageWriter" ) Kontext if active.exists(5) then Active.SetPage TabGrid @@ -150,18 +154,14 @@ testcase tTextGridDialog_3 Kontext "TabGrid" LinesGrid.Check LinesPerPage.SetText sLinesPerPage - Sleep 1 - TabGrid.OK - Sleep 1 + hCloseDialog( TabGrid, "ok" ) '/// Active navigator dialogue , set page to '2' and wait for a while Kontext ViewNavigator Kontext "NavigatorWriter" - Seitennummer.SetText "2" - Sleep 5 - hCloseNavigator + hCloseDialog( Navigator, "close" ) Kontext "DocumentWriter" Call DocumentWriter.TypeKeys "<End>" @@ -192,7 +192,7 @@ testcase tTextGridDialog_4 '/// + set 10 line/page and 9 characters/line Call hFileOpen ( gTesttoolPath + SOURCE_PATH + testFile ) sMakeReadOnlyDocumentEditable - FormatPageWriter + hUseAsyncSlot( "FormatPageWriter" ) Kontext if active.exists(5) then Active.SetPage TabGrid @@ -201,18 +201,14 @@ testcase tTextGridDialog_4 CharsGrid.Check LinesPerPage.SetText sLinesPerPage CharsPerLine.SetText sCharsPerLine - Sleep 1 - TabGrid.OK - Sleep 1 + hCloseDialog( TabGrid, "ok" ) '/// Active navigator dialogue , set page to '2' and wait for a while Kontext ViewNavigator Kontext "NavigatorWriter" - Seitennummer.SetText "2" - Sleep 5 - hCloseNavigator + hCloseDialog( Navigator, "close" ) Kontext "DocumentWriter" Call DocumentWriter.TypeKeys "<End>" @@ -233,7 +229,7 @@ testcase tGridDisplay_1 '/// format / page / tabpage Text grid '/// + check "display grid" and check "print grid" - FormatPageWriter + hUseAsyncSlot( "FormatPageWriter" ) Kontext if active.exists(5) then Active.SetPage TabGrid @@ -241,14 +237,12 @@ testcase tGridDisplay_1 Kontext "TabGrid" CharsGrid.Check Display.Check - Sleep 1 PrintGrid.Check - Sleep 1 - TabGrid.OK - Sleep 1 + hCloseDialog( TabGrid, "ok" ) + '/// Print to printer - FilePrint + hUseAsyncSlot( "FilePrint" ) Kontext "Active" if ( Active.Exists( 5 ) ) then if Active.GetRT() = 304 then @@ -262,7 +256,7 @@ testcase tGridDisplay_1 else Kontext "Printing" if ( Printing.exists( 2 )) then - printing.cancel() + Printing.OK() Printing.notExists( 5 ) endif @@ -283,11 +277,8 @@ testcase tGridDisplay_1 Kontext "TabGrid" CharsGrid.Check Display.Check - Sleep 1 PrintGrid.UnCheck - Sleep 1 - TabGrid.OK - Sleep 1 + hCloseDialog( TabGrid, "ok" ) '/// Print to printer FilePrint @@ -304,7 +295,7 @@ testcase tGridDisplay_1 else Kontext "Printing" if( Printing.exists( 1 )) then - printing.cancel() + Printing.OK Printing.notExists( 5 ) endif kontext @@ -333,7 +324,7 @@ testcase tUserDefineLayout_1 '/// Format/page , set lines per page to 20, and set charsets per line to 2 '/// + wait for a moment , then check the the number of lines per page. - FormatPageWriter + hUseAsyncSlot( "FormatPageWriter" ) Kontext if active.exists(5) then Active.SetPage TabGrid @@ -342,16 +333,13 @@ testcase tUserDefineLayout_1 CharsGrid.Check LinesPerPage.SetText sLinesPerPage - Sleep 2 CharsPerLine.SetText sCharsPerLine - Sleep 2 'This step is no use, just let the LinesPerPage change the number CharsGrid.Check if LinesPerPage.GetText <> sExpectLinesPerPage AND LinesPerPage.GetText <> sExpectLinesPerPage1 then - Warnlog( "#i106381# - LInes per page changed" ) - printlog( "The lines per page should be" + sExpectLinesPerPage & " OR " & sExpectLinesPerPage1 & " but get " &LinesPerPage.GetText ) + Warnlog "The lines per page should be" + sExpectLinesPerPage + " OR " + sExpectLinesPerPage1 +" but get " +LinesPerPage.GetText endif TabGrid.Cancel @@ -362,7 +350,6 @@ endcase '------------------------------------------------------------------------- testcase tFontSizeChanges_1 - '/// Change the font size to bigger enough will change the layout Dim testFile , sCorrectResult as String Dim sLinesPerPage , sCharsPerLine as String @@ -381,10 +368,9 @@ testcase tFontSizeChanges_1 Kontext "FormatObjectbar" Schriftgroesse.Select "60" Schriftgroesse.TypeKeys "<Return>" - Sleep 1 Kontext "DocumentWriter" - FormatPageWriter + hUseAsyncSlot( "FormatPageWriter" ) Kontext if active.exists(5) then Active.SetPage TabGrid @@ -393,11 +379,11 @@ testcase tFontSizeChanges_1 if TabGrid.exists(5) then sTemp = LinesPerPage.GetText if sTemp <> sLinesPerPage then - Warnlog "The lines per page should be: '" & sLinesPerPage & "'; but get: '" & sTemp & "'" + Warnlog "The lines per page should be: '" + sLinesPerPage + "'; but get: '" + sTemp + "'" endif sTemp = CharsPerLine.GetText if sTemp <> sCharsPerLine then - Warnlog "The chars per line should be: '" & sCharsPerLine & "'; but get: '" &sTemp & "'" + Warnlog "The chars per line should be: '" + sCharsPerLine + "'; but get: '" +sTemp + "'" endif TabGrid.Cancel else @@ -409,11 +395,11 @@ testcase tFontSizeChanges_1 Kontext "NavigatorWriter" if NavigatorWriter.exists(5) then Seitennummer.SetText "2" - Sleep 5 + kontext "Navigator" + hCloseDialog( Navigator, "close" ) else - warnlog "Navigator not available" + warnlog( "Navigator not open" ) endif - hCloseNavigator Kontext "DocumentWriter" sleep 3 @@ -422,7 +408,7 @@ testcase tFontSizeChanges_1 hUseAsyncSlot( "EditCopy" ) sTemp = GetClipboardText if sTemp <> sCorrectResult then - Warnlog "Don't get the expected result , hope to be: '" & sCorrectResult & "'; but get: '" & sTemp & "'" + Warnlog "Don't get the expected result , hope to be: '" + sCorrectResult + "'; but get: '" + sTemp + "'" endif Call hCloseDocument @@ -444,28 +430,27 @@ testcase tRubyText_1 sMakeReadOnlyDocumentEditable Kontext "DocumentWriter" Call DocumentWriter.TypeKeys "<Shift Right>" - Sleep 1 - FormatRuby + hUseAsyncSlot( "FormatRuby" ) Kontext "RubyDialog" - Sleep 3 - RubyText1.setText sRubyText - Sleep 2 - RubyDialog.OK - Sleep 2 - DialogClose.Click - Sleep 1 + if ( RubyDialog.exists( 3 ) ) then + RubyText1.setText sRubyText + RubyDialog.OK + DialogClose.Click + else + warnlog( "Ruby dialog not open" ) + endif Kontext "DocumentWriter" - FormatAutoformatApply - Sleep 2 + hUseAsyncSlot( "FormatAutoformatApply" ) + WaitSlot( 3000 ) Call DocumentWriter.TypeKeys "<End>" Sleep 2 Call DocumentWriter.TypeKeys "<Shift Left>" hUseAsyncSlot( "EditCopy" ) if NOT(GetClipboardText = "5" OR GetClipboardText = "6") then - Warnlog "Don't get the correct result after inserting ruby text! Get " & GetClipboardText + Warnlog "Don't get the correct result after inserting ruby text! Get " + GetClipboardText endif Call hCloseDocument @@ -499,7 +484,8 @@ testcase tIndentsTest_1 ViewNavigator Kontext "NavigatorWriter" if Seitennummer.GetText <> sCorrectPage1 then Warnlog "First test :Something wrong in indents test!" - hCloseNavigator + kontext "Navigator" + hCloseDialog( Navigator, "cancel" ) '/// press TAB in second line again Kontext "DocumentWriter" @@ -515,7 +501,8 @@ testcase tIndentsTest_1 ViewNavigator Kontext "NavigatorWriter" if Seitennummer.GetText <> sCorrectPage2 then Warnlog "Second test :Something wrong in indents test!" - hCloseNavigator + kontext "Navigator" + hCloseDialog( Navigator, "cancel" ) Call hCloseDocument endcase @@ -541,7 +528,8 @@ testcase tObjectsTest_1 Sleep 1 Auswahlliste.TypeKeys "<Return>" Sleep 1 - hCloseNavigator + kontext "Navigator" + hCloseDialog( Navigator, "close" ) Kontext FormatAnchorAsCharacter @@ -551,14 +539,16 @@ testcase tObjectsTest_1 ViewNavigator Kontext "NavigatorWriter" Seitennummer.SetText sCorrectPage2 - Sleep 5 + WaitSlot( 5000 ) ' Sleep 5 if Seitennummer.GetText <> sCorrectPage2 then Warnlog "Something wrong when object is anchored as Character!" - hCloseNavigator + kontext "Navigator" + hCloseDialog( Navigator, "close" ) '/// If object is anchored to Character , check if it will NOT snap to the appropriate grid cell fStartupNavigator( "OLEObject" , 1 ) Auswahlliste.TypeKeys "<Return>" - hCloseNavigator + kontext "Navigator" + hCloseDialog( Navigator, "close" ) Kontext FormatAnchorToCharacter @@ -566,10 +556,10 @@ testcase tObjectsTest_1 ViewNavigator Kontext "NavigatorWriter" Seitennummer.SetText sCorrectPage2 - Sleep 5 + WaitSlot( 5000 ) ' Sleep 5 if Seitennummer.GetText <> sCorrectPage1 then Warnlog "Something wrong when object is anchored to Character!" - hCloseNavigator - Kontext + kontext "Navigator" + hCloseDialog( Navigator, "close" ) Call hCloseDocument endcase diff --git a/testautomation/framework/required/includes/basic_dialog_i18n.inc b/testautomation/framework/required/includes/basic_dialog_i18n.inc index bb1f0cf496ce..4db17d90a15e 100644 --- a/testautomation/framework/required/includes/basic_dialog_i18n.inc +++ b/testautomation/framework/required/includes/basic_dialog_i18n.inc @@ -37,7 +37,8 @@ testcase tUpdtBasicDialogI18n dim brc as boolean - hCloseNavigator() + kontext "Navigator" + hCloseDialog( Navigator, "close,optional" ) hCreateDocument()' brc = hInitFormControls( "tDialogI18n" ) diff --git a/testautomation/framework/required/includes/standard_toolbar_6.inc b/testautomation/framework/required/includes/standard_toolbar_6.inc index a72d8df3a36f..c3ff6be6e849 100644 --- a/testautomation/framework/required/includes/standard_toolbar_6.inc +++ b/testautomation/framework/required/includes/standard_toolbar_6.inc @@ -116,10 +116,12 @@ testcase tStandardBar_6 kontext "documentwriter" DocumentWriter.TypeKeys( "Hallo" ) - hCloseNavigator() + kontext "Navigator" + hCloseDialog( Navigator, "close,optional" ) hDestroyDocument() - hCloseNavigator() + kontext "Navigator" + hCloseDialog( Navigator, "close,optional" ) hDestroyDocument() printlog " - Math" diff --git a/testautomation/framework/tools/includes/fileoperations.inc b/testautomation/framework/tools/includes/fileoperations.inc index b8040eb5fbfb..6c679097d30e 100644 --- a/testautomation/framework/tools/includes/fileoperations.inc +++ b/testautomation/framework/tools/includes/fileoperations.inc @@ -64,7 +64,8 @@ function hSaveLoadDelSuccess( cFile as string ) as integer printlog( CFN & "Enter with option: " & cFile & "/" & cFileExt ) '///+<li>Close the navigator if it exists</li> - hCloseNavigator() + kontext "Navigator" + hCloseDialog( Navigator, "close,optional" ) '///+<li>Save the current file, overwriting existing</li> brc = hSaveFileExpectSuccess( cFile , TRUE ) ' save and overwrite diff --git a/testautomation/framework/tools/includes/pbrowser_tools.inc b/testautomation/framework/tools/includes/pbrowser_tools.inc index 47eb5e933985..e07304bb69b7 100644 --- a/testautomation/framework/tools/includes/pbrowser_tools.inc +++ b/testautomation/framework/tools/includes/pbrowser_tools.inc @@ -122,9 +122,6 @@ function hClosePropertyBrowser() as boolean '///<u>Description</u>: '///<ul> - - const CFN = "hClosePropertyBrowser::" - '///+<li>Verify that the property browser is open</li> kontext "ControlPropertiesTabControl" if ( ControlPropertiesTabControl.exists( 1 ) ) then @@ -145,7 +142,7 @@ function hClosePropertyBrowser() as boolean hClosePropertyBrowser() = false endif '///</ul> - + end function '******************************************************************************* diff --git a/testautomation/framework/tools/includes/scriptorganizer_tools.inc b/testautomation/framework/tools/includes/scriptorganizer_tools.inc index e141448b5b79..59d4df0dbbce 100644 --- a/testautomation/framework/tools/includes/scriptorganizer_tools.inc +++ b/testautomation/framework/tools/includes/scriptorganizer_tools.inc @@ -347,43 +347,6 @@ end function '******************************************************************************* -function hCloseScriptOrganizer() as boolean - - '///<h3>Close a Script Organizer (Cancel)</h3> - '///<i>Starting point: Any open Script Organizer</i><br> - '///<u>Input</u>: - '///<ol> - '///+<li>Nothing</li> - '///</ol> - '///<u>Returns</u>: - '///<ol> - '///+<li>Errorcondition (boolean)</li> - '///<ul> - '///+<li>TRUE if the Script Organizer was closed</li> - '///+<li>FALSE if the Script Organizer is still open</li> - '///</ul> - '///</ol> - '///<u>Description</u>: - '///<ul> - - - const CFN = "hCloseScriptOrganizer::" - - hCloseScriptOrganizer() = false - - '///+<li>Try to close the script </li> - kontext "ScriptOrganizer" - if ( ScriptOrganizer.exists( 5 ) ) then - ScriptOrganizer.cancel() - hCloseScriptOrganizer() = true - endif - - '///</ul> - -end function - -'******************************************************************************* - function hOpenRunMacroDialog() as boolean '///<h3>Open the "Run Macro" dialog</h3> diff --git a/testautomation/framework/tools/includes/toolbar_tools.inc b/testautomation/framework/tools/includes/toolbar_tools.inc index e0952bfd9a2e..5ea50f862289 100644 --- a/testautomation/framework/tools/includes/toolbar_tools.inc +++ b/testautomation/framework/tools/includes/toolbar_tools.inc @@ -73,7 +73,8 @@ function hAccessStandardBar() as boolean endif '///+<li>Close the navigator</li> - hCloseNavigator() + kontext "Navigator" + hCloseDialog( Navigator, "close,optional" ) '///+<li>Close the document</li> hDestroyDocument() diff --git a/testautomation/global/system/includes/inivalue.inc b/testautomation/global/system/includes/inivalue.inc index e73aa240fef5..88848c4fd61e 100644 --- a/testautomation/global/system/includes/inivalue.inc +++ b/testautomation/global/system/includes/inivalue.inc @@ -242,7 +242,7 @@ sub DateiSperren( Datei$ ) '///+ OUTPUT: - ///' Dim i% - if hFileExists ( Datei$ ) <> TRUE then + if FileExists ( Datei$ ) <> TRUE then Warnlog "File '" + Datei$ + "' doesn't exist; exiting now!" exit sub end if @@ -264,7 +264,7 @@ sub DateiFreigeben( Datei$ ) '///+ OUTPUT: - ///' Dim i% - if hFileExists ( Datei$ ) <> TRUE then + if FileExists ( Datei$ ) <> TRUE then Warnlog "File '" + Datei$ + "' doesn't exist; exiting now!" exit sub end if diff --git a/testautomation/global/system/includes/master.inc b/testautomation/global/system/includes/master.inc index bd750c4a4d21..6e5dc7e9d2af 100644 --- a/testautomation/global/system/includes/master.inc +++ b/testautomation/global/system/includes/master.inc @@ -310,7 +310,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> @@ -562,11 +561,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 '------------------------------------------------------------------------- @@ -700,15 +699,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 '------------------------------------------------------------------------- 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_docfuncs.inc b/testautomation/global/tools/includes/optional/t_docfuncs.inc index 75aacf2e11e9..9f88dbbe8ca2 100644 --- a/testautomation/global/tools/includes/optional/t_docfuncs.inc +++ b/testautomation/global/tools/includes/optional/t_docfuncs.inc @@ -73,8 +73,8 @@ function hUseImpressAutopilot( bEnable as boolean ) as boolean '///+<li>Close Tools/Options</li> Kontext "OptionenDlg" - OptionenDlg.OK() - + hCloseDialog( OptioneDlg, "ok" ) + '///+<li>Close IMPRESS document</li> hDestroyDocument() @@ -86,36 +86,6 @@ 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> @@ -253,14 +223,8 @@ 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 ) @@ -302,10 +266,8 @@ function hCreateDocument() as boolean iDocCountBefore = getDocumentCount if ( VERBOSE ) 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 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 c231e6a798e6..eeb040e1cd0b 100644 --- a/testautomation/global/tools/includes/optional/t_extension_manager_tools.inc +++ b/testautomation/global/tools/includes/optional/t_extension_manager_tools.inc @@ -280,7 +280,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 **********" ) @@ -349,7 +349,7 @@ function hExtensionRemoveGUI( cExtensionName as string ) as integer endcatch kontext "PackageManager" - PackageManager.close() + hCloseDialog( PackageManager , "close" ) else hExtensionRemoveGUI() = 1 endif @@ -456,7 +456,7 @@ function hExtensionGetItemList( cItemList() as string ) as integer hExtensionGetItemList() = iItemCount cItemList( 0 ) = iItemCount - PackageManager.close() + hCloseDialog( PackageManager , "close" ) else @@ -496,7 +496,7 @@ function hSelectExtensionID( iPos as integer ) as string catch hSelectExtensionID() = "" endcatch - PackageManager.close() + hCloseDialog( PackageManager , "close" ) else hSelectExtensionID() = "" endif @@ -541,7 +541,7 @@ function hSelectExtensionName( cName as string ) as integer catch hSelectExtensionName() = 0 endcatch - PackageManager.close() + hCloseDialog( PackageManager , "close" ) else hSelectExtensionName() = -1 endif @@ -691,7 +691,7 @@ function hIsExtensionAlreadyInstalled( cName as string ) as boolean endif next - PackageManager.close() + hCloseDialog( PackageManager , "close" ) end function @@ -741,7 +741,7 @@ function hDisableUserExtensionGUI( extension_name as string ) as integer else hDisableUserExtensionGUI() = 2 endif - PackageManager.close() + hCloseDialog( PackageManager , "close" ) catch hDisableUserExtensionGUI() = 1 endcatch @@ -762,7 +762,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/required/t_dir.inc b/testautomation/global/tools/includes/required/t_dir.inc index 0c7d887825f7..04c4bd8956f9 100644 --- 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_files.inc b/testautomation/global/tools/includes/required/t_files.inc index 0736de15debf..6b6cafff6c51 100644 --- a/testautomation/global/tools/includes/required/t_files.inc +++ b/testautomation/global/tools/includes/required/t_files.inc @@ -143,56 +143,7 @@ function hGrafikVerknuepftEinfuegen ( Grafik$ ) as Boolean 'GrafikEinfuegenDlg not open 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 - - IsItLoaded = FALSE - sleep(3) - for iLoop =1 to 20 - try - 'Calling slot 'IsDocLoading' - IsItLoaded = IsDocLoading - catch - IsItLoaded = FALSE - endcatch - if IsItLoaded = TRUE then - exit for - end if - sleep(1) - next iLoop - sleep(2) -end function ' '------------------------------------------------------------------------------- ' @@ -229,6 +180,11 @@ end function '------------------------------------------------------------------------------- ' function IsImageLoaded + +' used by: +' - hGrafikEinfuegen = IsImageLoaded +' - hGrafikVerknuepftEinfuegen = IsImageLoaded + '/// IsImageLoaded '/// Wait until images in document are loaded Dim i% : Dim Herbert as Boolean @@ -254,70 +210,9 @@ 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 + + ' used in math and graphics modules '/// Get used filter for loaded file. try FileSaveAs @@ -331,28 +226,6 @@ 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 - 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 diff --git a/testautomation/global/tools/includes/required/t_lists.inc b/testautomation/global/tools/includes/required/t_lists.inc index 3819a21097b0..f32db2f29277 100644 --- 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_tools1.inc b/testautomation/global/tools/includes/required/t_tools1.inc index 21f268b027a7..715f181eda78 100644 --- a/testautomation/global/tools/includes/required/t_tools1.inc +++ b/testautomation/global/tools/includes/required/t_tools1.inc @@ -412,10 +412,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 +697,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 @@ -1196,144 +1174,3 @@ sub raiseApplication 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 "contextpositionandsize" : ContextPositionAndSize - - case "toolslanguagehyphenate" : ToolsLanguageHyphenate - case "toolsupdateallindexes" : ToolsUpdateAllIndexes - case "toolsupdatefields" : ToolsUpdateFields - case "toolsupdatelinks" : ToolsUpdateLinks - case "toolslanguagehangulhanjaconversion" : ToolsLanguageHangulHanjaConversion - - 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 8ea2ed6315ee..8d6a962c2cb2 100644 --- a/testautomation/global/tools/includes/required/t_tools2.inc +++ b/testautomation/global/tools/includes/required/t_tools2.inc @@ -142,69 +142,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 :-)) @@ -223,232 +160,6 @@ 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 @@ -544,12 +255,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> diff --git a/testautomation/global/tools/includes/required/t_tools3.inc b/testautomation/global/tools/includes/required/t_tools3.inc index b55546edd8d6..25b85559b117 100644 --- a/testautomation/global/tools/includes/required/t_tools3.inc +++ b/testautomation/global/tools/includes/required/t_tools3.inc @@ -29,7 +29,9 @@ '* '* short description : Global Tools III '* -'\************************************************************************************* +'\****************************************************************************** + +private const VERBOSE = FALSE sub hToolbarSelect( sType as string, sOpen as boolean, optional SetToDefault as boolean ) @@ -942,7 +944,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 @@ -973,3 +975,206 @@ function hIsAccessbridgeInstalled() as boolean hIsAccessbridgeInstalled = AccessbridgeIsInstalled end function + +'******************************************************************************* + +function hUseAsyncSlot( cSlot as string ) as integer + + dim iWait as integer : iWait = 0 + dim iTime as integer : iTime = 0 + + const MAX_RETRIES = 100 ' Number of time we try to call the slot + const DELAY = 100 ' 100ms delay to wait between retries + const RETVAL_TIMEOUT = -1 ' Returnvalue if slot is not available + const CFN = "global::tools::includes::required::hUseAsyncSlot(): " + + if ( VERBOSE ) then printlog( CFN & "Using slot: " & cSlot ) + WaitSlot() + + for iWait = 1 to MAX_RETRIES + 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 "fileprint" : FilePrint + + 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 "edithyperlink" : EditHyperlink + case "editlinkswriter" : EditLinksWriter + + 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 "insertindexesbibliographyentry" : InsertIndexesBibliographyEntry + + case "contextpositionandsize" : ContextPositionAndSize + + case "toolslanguagehyphenate" : ToolsLanguageHyphenate + case "toolsupdateallindexes" : ToolsUpdateAllIndexes + case "toolsupdatefields" : ToolsUpdateFields + case "toolsupdatelinks" : ToolsUpdateLinks + case "toolslanguagehangulhanjaconversion" : ToolsLanguageHangulHanjaConversion + + 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 iWait + + ' Total time used + iTime = iWait * DELAY + + ' Timeout is -1 + if ( iTime = MAX_RETRIES * DELAY ) then iTime = RETVAL_TIMEOUT + + if ( VERBOSE ) then printlog( CFN & "Exit with rc=" & iTime ) + hUseAsyncSlot() = iTime + +end function + +'******************************************************************************* + +function hClickButton( oButton as object ) as integer + + dim iWait as integer : iWait = 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 RETVAL_TIMEOUT = -1 ' Return -1 if the button is not available + const CFN = "global::tools::includes::required::hClickButton(): " + + if ( VERBOSE ) then printlog( CFN & "Click button: " & oButton.name() ) + WaitSlot() + + for iWait = 1 to MAX_RETRIES + try + oButton.click() + exit for + catch + wait( DELAY ) + endcatch + next iWait + + ' Total time used + iTime = iWait * DELAY + + if ( iTime = MAX_RETRIES * DELAY ) then iTime = RETVAL_TIMEOUT + + if ( VERBOSE ) 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 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" ) > 0 ) then + iClosingMethod = METHOD_CANCEL + elseif ( instr( sFlags, "ok" ) > 0 ) then + iClosingMethod = METHOD_OK + 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") > 0 ) then bDialogMustExist = FALSE + + printlog( CFN & "Closing dialog <" & oDialog.name() & "> using flags <" & sFlags & ">.") + + if ( oDialog.exists() ) then + select case( iClosingMethod ) + case METHOD_CLOSE : oDialog.close() + case METHOD_CANCEL : oDialog.cancel() + case METHOD_OK : oDialog.ok() + case else : + warnlog( CFN & " Script error: Allowed closing methods are <cancel>, <close> and <ok>." ) + end select + 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 diff --git a/testautomation/graphics/optional/includes/global/export_graphic_2.inc b/testautomation/graphics/optional/includes/global/export_graphic_2.inc index 6c6efd04b830..c2c73ad828e4 100644 --- a/testautomation/graphics/optional/includes/global/export_graphic_2.inc +++ b/testautomation/graphics/optional/includes/global/export_graphic_2.inc @@ -1416,3 +1416,91 @@ testcase tWMF endcase 'tWMF '------------------------------------------------------------------------- + +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 diff --git a/testautomation/graphics/optional/includes/global/g_autocorrection.inc b/testautomation/graphics/optional/includes/global/g_autocorrection.inc index b0a0326a6f3f..04996fcb3ad6 100644 --- a/testautomation/graphics/optional/includes/global/g_autocorrection.inc +++ b/testautomation/graphics/optional/includes/global/g_autocorrection.inc @@ -147,7 +147,7 @@ testcase tToolsAutocorrectCustomQuotes(bSimple as boolean) sFileName = (ConvertPath ( gTesttoolPath + "graphics\required\input\rightfont." + ExtensionString)) endif - if hFileExists ( sFileName ) = FALSE then + if FileExists ( sFileName ) = FALSE then warnlog "The language-file was not found or accessible! The test ends." goto endsub endif diff --git a/testautomation/graphics/optional/includes/global/id_006.inc b/testautomation/graphics/optional/includes/global/id_006.inc index a32bbd962ad5..e6d98d799c42 100644 --- a/testautomation/graphics/optional/includes/global/id_006.inc +++ b/testautomation/graphics/optional/includes/global/id_006.inc @@ -104,7 +104,7 @@ testcase tiToolsThesaurus else sFileName = (ConvertPath (gTesttoolPath + "graphics\required\input\engtext.odg")) end if - if hFileExists ( sFileName ) = FALSE then + if FileExists ( sFileName ) = FALSE then warnlog "The language-file was not found or accessible! The test ends." goto endsub end if diff --git a/testautomation/graphics/required/includes/global/id_006.inc b/testautomation/graphics/required/includes/global/id_006.inc index 0a8359c1efef..5bf7d7ed679b 100644 --- a/testautomation/graphics/required/includes/global/id_006.inc +++ b/testautomation/graphics/required/includes/global/id_006.inc @@ -120,7 +120,7 @@ testcase tiToolsThesaurus else sFileName = (ConvertPath (gTesttoolPath + "graphics\required\input\engtext.odg")) end if - if hFileExists ( sFileName ) = FALSE then + if FileExists ( sFileName ) = FALSE then warnlog "The language-file was not found or accessible! The test ends." goto endsub end if diff --git a/testautomation/math/optional/includes/m_101_.inc b/testautomation/math/optional/includes/m_101_.inc index e529119e0bfc..2fc34b5c1f01 100644 --- a/testautomation/math/optional/includes/m_101_.inc +++ b/testautomation/math/optional/includes/m_101_.inc @@ -429,7 +429,7 @@ testcase tFilePrint DokumentWriter.MouseUp 99,99 sFileName = convertpath( gOfficePath + "user/work/math/level1/ftc_a.odt") - if (hFileExists(sFileName)) then + if (FileExists(sFileName)) then '/// goto end of page; insert page break ///' kontext "DokumentWriter" DokumentWriter.typeKeys "<mod1 end>" @@ -660,20 +660,12 @@ function hSpeichernUnterMitFilterKillTBO (sFileName as String, sFilterName, opti Dim bAlienNotAllowed as boolean sDerName = ConvertPath (sFileName) - - if hFileExists (sDerName) = TRUE then - try - app.kill (sDerName) - catch - Exceptlog - endcatch - end if - - if FileExists(sDerName) then - warnlog "file '" & sDerName & "' couldn't be deleted. Exiting function now..." + if ( not hDeleteFile( sDerName ) ) then + warnlog( "Aborting function because the file could not be deleted: " & sDerName ) + hSpeichernUnterMitFilterKillTBO() = FALSE exit function - end if - + endif + sleep (1) FileSaveAs Kontext "SpeichernDlg" diff --git a/testautomation/spreadsheet/optional/includes/import_general/c_import_general.inc b/testautomation/spreadsheet/optional/includes/import_general/c_import_general.inc index c8cc9ddb308f..87c6d899b7bb 100644 --- a/testautomation/spreadsheet/optional/includes/import_general/c_import_general.inc +++ b/testautomation/spreadsheet/optional/includes/import_general/c_import_general.inc @@ -55,6 +55,31 @@ end sub ' '------------------------------------------------------------------------------- ' +function IsItLoaded as boolean + '/// IsItLoaded + '/// Wait until document is loaded + Dim iLoop as integer + + IsItLoaded = FALSE + sleep(3) + for iLoop =1 to 20 + try + 'Calling slot 'IsDocLoading' + IsItLoaded = IsDocLoading + catch + IsItLoaded = FALSE + endcatch + + if IsItLoaded = TRUE then + exit for + end if + sleep(1) + next iLoop + sleep(2) +end function +' +'------------------------------------------------------------------------------- +' testcase tLoadSpreadsheetDocument (SourceFile) Dim sOnlyFileName as string Dim sOnlyFileExtension as string @@ -115,7 +140,7 @@ function fCalcFileOpen (sDocName as string, optional bLinked as boolean) as bool sSourceFile = ConvertPath ( sDocName ) fCalcFileOpen = TRUE - if hFileExists (sSourceFile) = FALSE then + if FileExists (sSourceFile) = FALSE then warnlog "fCalcFileOpen: '" + sSourceFile + "' does not exists!" fCalcFileOpen = FALSE else diff --git a/testautomation/writer/optional/includes/drawing/w_drawing_tools1.inc b/testautomation/writer/optional/includes/drawing/w_drawing_tools1.inc index 8ffdb8afe37e..1b2579ee0aaf 100644 --- a/testautomation/writer/optional/includes/drawing/w_drawing_tools1.inc +++ b/testautomation/writer/optional/includes/drawing/w_drawing_tools1.inc @@ -925,7 +925,7 @@ testcase tLine_6 soeFile = ConvertPath(gOfficePath + "user\work\standard_reserver.soe") soeDefaultFile = ConvertPath(gOfficePath + "user\config\standard.soe") - if hFileExists ( soeFile ) then app.kill ( soeFile ) + if FileExists ( soeFile ) then app.kill ( soeFile ) PrintLog "- check the attributes in format/line/arrow styles" @@ -1007,7 +1007,7 @@ testcase tLine_6 Kontext Kontext "TabLinienenden" - if hFileExists ( soeDefaultFile ) then app.kill ( soeDefaultFile ) + if FileExists ( soeDefaultFile ) then app.kill ( soeDefaultFile ) Speichern.Click Kontext diff --git a/testautomation/writer/optional/includes/drawing/w_drawing_tools2.inc b/testautomation/writer/optional/includes/drawing/w_drawing_tools2.inc index f0f6e458b8b4..0207a177c706 100644 --- a/testautomation/writer/optional/includes/drawing/w_drawing_tools2.inc +++ b/testautomation/writer/optional/includes/drawing/w_drawing_tools2.inc @@ -610,7 +610,7 @@ testcase tGroup_12 PrintLog "- Edit object group via Menu Format/Group/Edit Group" sDocument = ConvertPath ( gOfficePath +"user\work\tGroup_12.odt") - if hFileExists ( sDocument ) then app.kill ( sDocument ) + if FileExists ( sDocument ) then app.kill ( sDocument ) Call hNewDocument diff --git a/testautomation/writer/optional/includes/fields/w_fields2.inc b/testautomation/writer/optional/includes/fields/w_fields2.inc index 826d9ec769b9..6991a2c2ec53 100644 --- a/testautomation/writer/optional/includes/fields/w_fields2.inc +++ b/testautomation/writer/optional/includes/fields/w_fields2.inc @@ -401,7 +401,7 @@ testcase tDocumentFilename ' document has to be copied to local file system to avoid opening a read-only file ' because all field data gets lost if documents write-protection is removed via 'sMakeReadOnlyDocumentEditable' FileCopy (sOriginalFile, sTestFile) - if hFileExists ( sTestFile ) = false then + if FileExists ( sTestFile ) = false then Warnlog "Test document couldn't be copied to local file system. Test aborted!" goto endsub end if diff --git a/testautomation/writer/optional/includes/fields/w_fields4.inc b/testautomation/writer/optional/includes/fields/w_fields4.inc index 446d5b458f0f..b8742ab35610 100644 --- a/testautomation/writer/optional/includes/fields/w_fields4.inc +++ b/testautomation/writer/optional/includes/fields/w_fields4.inc @@ -277,7 +277,7 @@ testcase tDocInformationUserDefined ' document has to be copied to local file system to avoid opening a read-only file ' because all field data gets lost if documents write-protection is removed via 'sMakeReadOnlyDocumentEditable' FileCopy (sOriginalFile, sTestFile) - if hFileExists ( sTestFile ) = false then + if FileExists ( sTestFile ) = false then Warnlog "Test document couldn't be copied to local file system. Test aborted!" goto endsub end if @@ -361,7 +361,7 @@ testcase tDocInformationCreated ' document has to be copied to local file system to avoid opening a read-only file ' because all field data gets lost if documents write-protection is removed via 'sMakeReadOnlyDocumentEditable' FileCopy (sOriginalFile, sTestFile) - if hFileExists ( sTestFile ) = false then + if FileExists ( sTestFile ) = false then Warnlog "Test document couldn't be copied to local file system. Test aborted!" goto endsub end if @@ -475,7 +475,7 @@ testcase tDocInformationModified ' document has to be copied to local file system to avoid opening a read-only file ' because all field data gets lost if documents write-protection is removed via 'sMakeReadOnlyDocumentEditable' FileCopy (sOriginalFile, sTestFile) - if hFileExists ( sTestFile ) = false then + if FileExists ( sTestFile ) = false then Warnlog "Test document couldn't be copied to local file system. Test aborted!" goto endsub end if @@ -491,7 +491,7 @@ testcase tDocInformationModified printlog "Doc Information - Modified" '/// <b> Doc Information - Modified </b> - if hFileExists ( sSaveAsFile ) then app.kill ( sSaveAsFile ) + if FileExists ( sSaveAsFile ) then app.kill ( sSaveAsFile ) Call hNewDocument @@ -585,7 +585,7 @@ testcase tDocInformationModified endcatch end if - if hFileExists ( sSaveAsFile ) then app.kill ( sSaveAsFile ) + if FileExists ( sSaveAsFile ) then app.kill ( sSaveAsFile ) endcase @@ -612,7 +612,7 @@ testcase tDocInformationModifiedSavefile ' document has to be copied to local file system to avoid opening a read-only file ' because all field data gets lost if documents write-protection is removed via 'sMakeReadOnlyDocumentEditable' FileCopy (sOriginalFile, sTestFile) - if hFileExists ( sTestFile ) = false then + if FileExists ( sTestFile ) = false then Warnlog "Test document couldn't be copied to local file system. Test aborted!" goto endsub end if @@ -625,7 +625,7 @@ testcase tDocInformationModifiedSavefile sFixResult(1) = "08/18/2000" sFixResult(2) = "11:40:11" - if hFileExists ( sSaveAsFile ) then app.kill ( sSaveAsFile ) + if FileExists ( sSaveAsFile ) then app.kill ( sSaveAsFile ) printlog "Doc Information - Modified (save file)" '/// <b> Doc Information - Modified (save file)</b> @@ -707,7 +707,7 @@ testcase tDocInformationModifiedSavefile endcatch end if - if hFileExists ( sSaveAsFile ) then app.kill ( sSaveAsFile ) + if FileExists ( sSaveAsFile ) then app.kill ( sSaveAsFile ) endcase @@ -731,7 +731,7 @@ testcase tDocInformationPrinted ' document has to be copied to local file system to avoid opening a read-only file ' because all field data gets lost if documents write-protection is removed via 'sMakeReadOnlyDocumentEditable' FileCopy (sOriginalFile, sTestFile) - if hFileExists ( sTestFile ) = false then + if FileExists ( sTestFile ) = false then Warnlog "Test document couldn't be copied to local file system. Test aborted!" goto endsub end if @@ -860,13 +860,13 @@ testcase tDocInformationRevisionnumber ' document has to be copied to local file system to avoid opening a read-only file ' because all field data gets lost if documents write-protection is removed via 'sMakeReadOnlyDocumentEditable' FileCopy (sOriginalFile, sTestFile) - if hFileExists ( sTestFile ) = false then + if FileExists ( sTestFile ) = false then Warnlog "Test document couldn't be copied to local file system. Test aborted!" goto endsub end if sSaveasFile = ConvertPath (gOfficePath + "user\work\tDocInformationRevisionnumber.sxw" ) - if hFileExists ( sSaveAsFile ) then app.kill ( sSaveAsFile ) + if FileExists ( sSaveAsFile ) then app.kill ( sSaveAsFile ) printlog "Doc Information - Revision number" '/// <b> Doc Information - Revision number</b> @@ -939,7 +939,7 @@ testcase tDocInformationRevisionnumber endcatch end if - if hFileExists ( sSaveAsFile ) then app.kill ( sSaveAsFile ) + if FileExists ( sSaveAsFile ) then app.kill ( sSaveAsFile ) endcase @@ -959,13 +959,13 @@ testcase tDocInformationTotaleditingtime ' document has to be copied to local file system to avoid opening a read-only file ' because all field data gets lost if documents write-protection is removed via 'sMakeReadOnlyDocumentEditable' FileCopy (sOriginalFile, sTestFile) - if hFileExists ( sTestFile ) = false then + if FileExists ( sTestFile ) = false then Warnlog "Test document couldn't be copied to local file system. Test aborted!" goto endsub end if sSaveasFile = ConvertPath (gOfficePath + "user\work\tDocInformationRevisionnumber.sxw" ) - if hFileExists ( sSaveAsFile ) then app.kill ( sSaveAsFile ) + if FileExists ( sSaveAsFile ) then app.kill ( sSaveAsFile ) printlog "Doc Information - Tatal editing time" '/// <b> Doc Information - Tatal editing time </b> @@ -1027,7 +1027,7 @@ testcase tDocInformationTotaleditingtime endcatch end if - if hFileExists ( sSaveAsFile ) then app.kill ( sSaveAsFile ) + if FileExists ( sSaveAsFile ) then app.kill ( sSaveAsFile ) endcase diff --git a/testautomation/writer/optional/includes/fields/w_fields5.inc b/testautomation/writer/optional/includes/fields/w_fields5.inc index 2f4e3b0b9ecb..85a693c851c7 100644 --- a/testautomation/writer/optional/includes/fields/w_fields5.inc +++ b/testautomation/writer/optional/includes/fields/w_fields5.inc @@ -685,7 +685,7 @@ testcase tVariablesDDEFieldManual printlog "DDE field - manual" '/// <b> DDE field - manual </b> - if hFileExists ( sDDEFile ) then app.kill ( sDDEFile ) + if FileExists ( sDDEFile ) then app.kill ( sDDEFile ) Call hNewDocument @@ -753,7 +753,7 @@ testcase tVariablesDDEFieldManual Call hCloseDocument - if hFileExists ( sDDEFile ) then app.kill ( sDDEFile ) + if FileExists ( sDDEFile ) then app.kill ( sDDEFile ) endcase @@ -778,7 +778,7 @@ testcase tVariablesDDEFieldAutomatic printlog "DDE field - automatic" '/// <b> DDE field - automatic </b> - if hFileExists ( sDDEFile ) then app.kill ( sDDEFile ) + if FileExists ( sDDEFile ) then app.kill ( sDDEFile ) Call hNewDocument @@ -832,7 +832,7 @@ testcase tVariablesDDEFieldAutomatic Call hCloseDocument - if hFileExists ( sDDEFile ) then app.kill ( sDDEFile ) + if FileExists ( sDDEFile ) then app.kill ( sDDEFile ) endcase diff --git a/testautomation/writer/optional/includes/fields/w_fields7.inc b/testautomation/writer/optional/includes/fields/w_fields7.inc index fdec55afb9ce..70dfedc62085 100644 --- a/testautomation/writer/optional/includes/fields/w_fields7.inc +++ b/testautomation/writer/optional/includes/fields/w_fields7.inc @@ -220,7 +220,7 @@ testcase tL10NtestDate ' document has to be copied to local file system to avoid opening a read-only file ' because all field data gets lost if documents write-protection is removed via 'sMakeReadOnlyDocumentEditable' FileCopy (sOriginalFile, sTestFile) - if hFileExists ( sTestFile ) = false then + if FileExists ( sTestFile ) = false then Warnlog "Test document couldn't be copied to local file system. Test aborted!" goto endsub end if @@ -343,7 +343,7 @@ testcase tL10NtestTime ' document has to be copied to local file system to avoid opening a read-only file ' because all field data gets lost if documents write-protection is removed via 'sMakeReadOnlyDocumentEditable' FileCopy (sOriginalFile, sTestFile) - if hFileExists ( sTestFile ) = false then + if FileExists ( sTestFile ) = false then Warnlog "Test document couldn't be copied to local file system. Test aborted!" goto endsub end if diff --git a/testautomation/writer/optional/includes/loadsave/w_loadsave.inc b/testautomation/writer/optional/includes/loadsave/w_loadsave.inc index 62c997927ab6..57d1be96d871 100644 --- a/testautomation/writer/optional/includes/loadsave/w_loadsave.inc +++ b/testautomation/writer/optional/includes/loadsave/w_loadsave.inc @@ -448,7 +448,7 @@ testcase tExportTop5FormatsIntoTop5 Call hCloseDocument Loop printlog " - check if file exists" - if hFileExists (sCurrentSaveFile) then + if FileExists (sCurrentSaveFile) then printlog " - success" printlog " - reload previously saved file" if hFileOpenWithFilter(sCurrentSaveFile, sCurrentSaveFilter) = true then diff --git a/testautomation/writer/optional/includes/section/w_section_4.inc b/testautomation/writer/optional/includes/section/w_section_4.inc index 3d8acb4a9cd5..03a59b567f18 100644 --- a/testautomation/writer/optional/includes/section/w_section_4.inc +++ b/testautomation/writer/optional/includes/section/w_section_4.inc @@ -1190,11 +1190,11 @@ testcase tScenarioSection_1 j = UBound(SectionName) - if hFileExists ( MasterDoc ) then app.kill ( MasterDoc ) + if FileExists ( MasterDoc ) then app.kill ( MasterDoc ) For i = 0 to j tempFile = Convertpath( gOfficePath + "user\work\" + SectionName(i) ) - if hFileExists ( tempFile ) then app.kill ( tempFile ) + if FileExists ( tempFile ) then app.kill ( tempFile ) next i '/// open testdocument (tScenarioSection_1.sxw) /// @@ -1310,11 +1310,11 @@ testcase tScenarioSection_2 j = UBound(SectionName) - if hFileExists ( MasterDoc ) then app.kill ( MasterDoc ) + if FileExists ( MasterDoc ) then app.kill ( MasterDoc ) For i = 0 to j tempFile = Convertpath( gOfficePath + "user\work\" + SectionName(i) ) - if hFileExists ( tempFile ) then app.kill ( tempFile ) + if FileExists ( tempFile ) then app.kill ( tempFile ) next i '/// open testdocument (tScenarioSection_2.sxw) /// diff --git a/testautomation/writer/optional/includes/spellcheck/w_spellcheck.inc b/testautomation/writer/optional/includes/spellcheck/w_spellcheck.inc index e4818c34029f..80b613563dda 100644 --- a/testautomation/writer/optional/includes/spellcheck/w_spellcheck.inc +++ b/testautomation/writer/optional/includes/spellcheck/w_spellcheck.inc @@ -52,7 +52,7 @@ testcase tToolsSpellcheckWithShortcut '/// Check if Spellcheck dialog comes up with shortcut 'F7' printlog " Open document where the formatting is set to the language we wish to test." TheFile = Convertpath (gTesttoolpath + "writer\optional\input\spellcheck\spellcheck_" + iSprache + ".odt") - if hFileExists ( TheFile ) <> TRUE then + if FileExists ( TheFile ) <> TRUE then Warnlog "Found no Document for the language you're testing in, Please inform the Test-Developer." exit sub end if @@ -120,7 +120,7 @@ testcase tToolsSpellcheckCorrect Dim FFText as String TheFile = Convertpath (gTesttoolpath + "writer\optional\input\spellcheck\spellcheck_" + iSprache + ".odt") - if hFileExists ( TheFile ) <> TRUE then + if FileExists ( TheFile ) <> TRUE then Warnlog "Found no Document for the language you're testing in, Please inform the Test-Developer." exit sub end if @@ -219,7 +219,7 @@ testcase tToolsSpellcheck1Mistake Dim TheFile as String TheFile = Convertpath (gTesttoolpath + "writer\optional\input\spellcheck\spellcheck_" + iSprache + ".odt") - if hFileExists ( TheFile ) <> TRUE then + if FileExists ( TheFile ) <> TRUE then Warnlog "Found no Document for the language you're testing in, Please inform the Test-Developer." exit sub end if @@ -726,7 +726,7 @@ testcase tToolsSpellcheckAutomatic Dim TheFile as String TheFile = Convertpath (gTesttoolpath + "writer\optional\input\spellcheck\spellcheck_" + iSprache + ".odt") - if hFileExists ( TheFile ) <> TRUE then + if FileExists ( TheFile ) <> TRUE then Warnlog "Found no Document for the language you're testing in, Please inform the Test-Developer." exit sub end if @@ -1238,7 +1238,7 @@ testcase tToolsThesaurus printlog " Open document where the formatting is set to the language we wish to test." TheFile = Convertpath (gTesttoolpath + "writer\optional\input\spellcheck\spellcheck_" + iSprache + ".odt") - if hFileExists ( TheFile ) <> TRUE then + if FileExists ( TheFile ) <> TRUE then Warnlog "Found no Document for the language you're testing in, Please inform the Test-Developer." exit sub end if diff --git a/testautomation/writer/required/includes/w_002_.inc b/testautomation/writer/required/includes/w_002_.inc index 1c86e8f01a47..9d124ebaa775 100644 --- a/testautomation/writer/required/includes/w_002_.inc +++ b/testautomation/writer/required/includes/w_002_.inc @@ -1,5 +1,5 @@ '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. @@ -23,13 +23,13 @@ ' <http://www.openoffice.org/license.html> ' for a copy of the LGPLv3 License. ' -'/************************************************************************ -'* ** -'* owner : helge.delfs@sun.com ** -'* ** -'* short description : ** -'* ** -'\****************************************************************** +'/****************************************************************************** +'* ** +'* owner : helge.delfs@sun.com ** +'* ** +'* short description : ** +'* ** +'\****************************************************************************** sub w_002_ @@ -60,11 +60,6 @@ sub w_002_ Call tEditImageMap Call tEditObjectEdit - 'Writer Web - gApplication = "HTML" - Call tHtmlDocEditFields - gApplication = "WRITER" - 'Writer Master Document gApplication = "MASTERDOCUMENT" Call tMasterDocEditNavigator @@ -82,6 +77,7 @@ testcase tEditUndoRedo PrintLog "Insert table" Call hTabelleEinfuegen + PrintLog "Edit / Undo" hUseAsyncSlot( "EditUndo" ) @@ -93,13 +89,14 @@ testcase tEditUndoRedo PrintLog "File / Close" hUseAsyncSlot( "FileClose" ) - Kontext - if ( Active.Exists ) then - if Active.GetRT = 304 then - WarnLog ( "Messagebox: '" & Active.Gettext & "' should not appear" ) - Active.No - end if + + Kontext "Active" + if ( Active.Exists( 1 ) ) then + warnlog( "No messagebox was expected upon file close" ) + printlog( Active.getText ) + Active.no() end if + endcase '---------------------------------------------------- @@ -172,64 +169,62 @@ testcase tEditPasteSpecial PrintLog "Open new document" Call hNewDocument - if gSamePC = TRUE then - PrintLog " - External Clipboard" - PrintLog "Enter some text in external clipboard" - SetClipboard "Text from external clipboard!" + PrintLog " - External Clipboard" + PrintLog "Enter some text in external clipboard" + SetClipboard "Text from external clipboard!" - PrintLog "Paste from external clipboard with Edit / Paste in Office" - hUseAsyncSlot( "EditPaste" ) + PrintLog "Paste from external clipboard with Edit / Paste in Office" + hUseAsyncSlot( "EditPaste" ) - Call wTypeKeys("<Mod1 A>") - Wait(200) - hUseAsyncSlot( "EditCopy" ) + Call wTypeKeys("<Mod1 A>") + Wait(200) + hUseAsyncSlot( "EditCopy" ) - if GetClipboardText <> "Text from external clipboard!" then - Warnlog "External Clipboard not available!" - Warnlog "Is: " & GetClipboardText - end if - Call wTypeKeys("<End><Return>") - SetClipboard "" - SetClipboard "2nd Text from external clipboard!" - try - PrintLog "Edit / Paste / Special" - hUseAsyncSlot( "EditPasteSpecialWriter" ) - - Kontext "InhaltEinfuegen" - if ( InhaltEinfuegen.Exists( 2 ) ) then - try - Auswahl.Select 1 - catch - Warnlog "Unable to select entry in format list !" - InhaltEinfuegen.Close - Call hCloseDocument - goto endsub - endcatch - InhaltEinfuegen.OK - Wait(200) - Kontext "Active" - if Active.Exists then - if Active.GetRT = 304 then - Warnlog "Maybe Bug#109331" - Warnlog Active.Gettext - try - Active.Ok - catch - Active.No - endcatch - end if - else - Call wTypeKeys("<Home><Shift End>") - hUseAsyncSlot( "EditCopy" ) - if GetClipboardText <> "2nd Text from external clipboard!" then Warnlog "Wrong Text inserted! Is: " & GetClipboardText + if GetClipboardText <> "Text from external clipboard!" then + Warnlog "External Clipboard not available!" + Warnlog "Is: " & GetClipboardText + end if + Call wTypeKeys("<End><Return>") + SetClipboard "" + SetClipboard "2nd Text from external clipboard!" + try + PrintLog "Edit / Paste / Special" + hUseAsyncSlot( "EditPasteSpecialWriter" ) + + Kontext "InhaltEinfuegen" + if ( InhaltEinfuegen.Exists( 2 ) ) then + try + Auswahl.Select 1 + catch + Warnlog "Unable to select entry in format list !" + InhaltEinfuegen.Close + Call hCloseDocument + goto endsub + endcatch + InhaltEinfuegen.OK + Wait(200) + Kontext "Active" + if Active.Exists then + if Active.GetRT = 304 then + Warnlog "Maybe Bug#109331" + Warnlog Active.Gettext + try + Active.Ok + catch + Active.No + endcatch end if else - Warnlog "Dialog 'Paste Special' is not up!" + Call wTypeKeys("<Home><Shift End>") + hUseAsyncSlot( "EditCopy" ) + if GetClipboardText <> "2nd Text from external clipboard!" then Warnlog "Wrong Text inserted! Is: " & GetClipboardText end if - catch - Exceptlog - endcatch - end if + else + Warnlog "Dialog 'Paste Special' is not up!" + end if + catch + Exceptlog + endcatch PrintLog " - Internal Clipboard with StarOffice Writer-Text" PrintLog "Enter some text in writer and copy it" @@ -316,11 +311,7 @@ testcase tEditChanges PrintLog "Passwort-dialog has to come up, cancel it" Kontext "Passwort" - if ( Passwort.Exists( 1 ) ) then - Passwort.Close - else - Warnlog "Password-dialog is not up!" - end if + hCloseDialog( Passwort, "close" ) PrintLog "Edit / Changes / Accept or Reject" EditChangesAcceptOrReject @@ -368,52 +359,67 @@ endcase '---------------------------------------------------- testcase tEditCompareDocument + PrintLog "- Edit/Compare Document" - Select Case gApplication - Case "WRITER" - Call hNewDocument - PrintLog "Open new document" - EditCompareDocumentCalc - PrintLog "Edit / Compare document" - Case "MASTERDOCUMENT" - printlog "Comparing documents not in Masterdocument!" - goto endsub - Case "HTML" - printlog "Comparing documents not in WriterWeb!" + + dim sFile as string + sFile = gTesttoolPath & "writer\required\input\bt.sxw" + + if ( gApplication <> "WRITER" ) then + printlog( "Test only designed for WRITER, skipping" ) goto endsub - end select + endif - if gUseSysDlg = False then - Kontext "OeffnenDlg" - Dateiname.SetText ConvertPath ( gTesttoolPath & "writer\required\input\bt.sxw" ) - PrintLog "in File-Open-dialog load ..\writer\required\input\bt.sxw" - Oeffnen.Click - end if - Kontext "FilterAuswahl" - if Filterauswahl.Exists then Filterauswahl.OK - Sleep 1 - Kontext "Active" - if Active.Exists then - Warnlog Active.Gettext - Active.Ok - end if + call hNewDocument() + + printlog( "Open test document") + EditCompareDocumentCalc + + Kontext "OeffnenDlg" + printlog( "File Open dialog" ) + if ( OeffnenDlg.exists( 2 ) ) then + + printlog( "Load file: " & sFile ) + Dateiname.SetText ConvertPath ( sFile ) + Oeffnen.Click() + + Kontext "FilterAuswahl" + printlog( "Check for filterselection dialog (comes up e.g. if file is broken)" ) + if Filterauswahl.Exists( 2 ) then + warnlog( "Dialog <Filterauswahl> was not expected at this point" ) + Filterauswahl.OK() + else + printlog( "No dialog <Filterauswahl>, good" ) + endif + + Kontext "Active" + if Active.Exists( 1 ) then + warnlog( "Unexpected messagebox displayed:" ) + printlog( Active.getText() ) + Active.Ok() + else + printlog( "No unexpected messageboxes, good." ) + endif - Kontext "Redlining" - PrintLog "Dialog 'Accept and Reject changes' has to come up" - if Redlining.Exists then - TabControl.SetPage TabListe - wait 200 - Kontext "Redlining" - TabControl.SetPage TabFilter Kontext "Redlining" - Redlining.Close - PrintLog "Close dialog" + PrintLog "Dialog 'Accept and Reject changes' has to come up" + if Redlining.Exists( 1 ) then + TabControl.SetPage TabListe + wait 200 + Kontext "Redlining" + TabControl.SetPage TabFilter + Kontext "Redlining" + hCloseDialog( Redlining, "close" ) + else + Warnlog "- Dialog 'Redlining' does not exist!" + endif else - Warnlog "- Dialog 'Redlining' does not exist!" - end if + warnlog( "Dialog <FileOpen> did not open") + endif - Call hCloseDocument PrintLog "Close active document" + Call hCloseDocument + endcase '---------------------------------------------------- @@ -529,24 +535,15 @@ testcase tViewNavigator Kontext "NavigatorWriter" Umschalten.Click - Kontext "NavigatorGlobalDoc" - Sleep (1) - printlog " - Bearbeiten" - try - Bearbeiten.Click - catch - Sleep (2) - try - Bearbeiten.Click - catch - Warnlog " Either taking more than three seconds to switch Navigator-modes, or something has gone wrong." - endcatch - endcatch - wait (300) + Kontext "NavigatorGlobalDoc" + printlog( "Click <Edit>" ) + if ( hClickButton( Bearbeiten ) = -1 ) then + warnlog( "Unable to click <Edit> button, cannot switch Navigator-Mode" ) + endif Kontext "Navigator" - Navigator.Close + hCloseDialog( Navigator, "close" ) Call hCloseDocument PrintLog "Close active document" goto endsub @@ -679,9 +676,9 @@ testcase tEditAutotext PrintLog "Click Categories" Bereiche.Click - Sleep 1 + Kontext "BereicheBearbeitenAutoText" - if BereicheBearbeitenAutoText.Exists then + if BereicheBearbeitenAutoText.Exists( 2 ) then DialogTest ( BereicheBearbeitenAutoText ) PrintLog "Create a new categorie" Bereich.SetText "Hallo" @@ -694,12 +691,11 @@ testcase tEditAutotext if Neu.IsEnabled then Neu.Click Wait (200) - if Loeschen.IsEnabled then - PrintLog "Delete created categorie" - Loeschen.Click - else - Warnlog "- Not able to delete new category. Button disabled!" - end if + + printlog( "Click <Delete>" ) + if ( hClickButton( Loeschen ) = -1 ) then + warnlog( "Unable to delete category, the button is disabled" ) + endif else if gNetzInst = False then Warnlog "- Category cannot be created!" @@ -719,20 +715,19 @@ testcase tEditAutotext Kontext "PfadeAuswaehlen" PrintLog "On 'Select Paths' dialog click 'add'" Hinzufuegen.Click - wait 200 + Kontext "OeffnenDlg" - if OeffnenDlg.Exists then + if OeffnenDlg.Exists( 2 ) then PrintLog "Cancel File-Open dialog" - OeffnenDlg.Cancel + hCloseDialog( OeffnenDlg, "cancel" ) else Warnlog "Dialog ' Select Paths' not up!" end if - wait 200 + Kontext "PfadeAuswaehlen" PrintLog "Cancel dialog 'Select Paths'" - PfadeAuswaehlen.Cancel + hCloseDialog( PfadeAuswaehlen, "cancel" ) - Wait (300) Kontext "AutoText" PrintLog "We have to create an autotext first" PrintLog "to assure the 'Autotext'-Button enabled" @@ -787,6 +782,7 @@ testcase tEditAutotext Call hCloseDocument goto endsub end if + printlog "Select created autotext" EditAutotext WaitSlot (2000) @@ -855,14 +851,16 @@ testcase tEditAutotext exit do end if Loop + ' Dialog needs some time to be opened Kontext "MakroZuweisen" - if NOT MakroZuweisen.Exists(5) then - warnlog "AutoText-Macro - Assign Macro took longer than 5 seconds to load. Check why." + printlog( "Close <MakroZuweisen> dialog" ) + if ( MakroZuweisen.exists( 5 ) ) then + call Dialogtest( MakroZuweisen ) + hCloseDialog( MakroZuweisen, "close" ) else - PrintLog "Cancel 'Macro' dialog" - MakroZuweisen.Cancel - end if + warnlog "AutoText-Macro - Assign Macro took longer than 5 seconds to load. Check why." + endif catch Warnlog "Menu Autotext->'Macro' disabled !" Call hMenuClose @@ -914,8 +912,7 @@ testcase tEditAutotext if wDeleteAutotext("DummyAutotext") = false then Warnlog "Unable to delete created autotext" end if - Kontext "Autotext" - if Autotext.Exists then Autotext.Close + endcatch PrintLog "Close active document" @@ -926,50 +923,58 @@ endcase testcase tEditHyperlink Printlog "- Edit / Hyperlink" - Call hNewDocument + PrintLog "Open new document" - InsertHyperlink + Call hNewDocument + PrintLog "Insert / Hyperlink" - WaitSlot(5000) - Kontext "Hyperlink" + InsertHyperlink - Call wEinfuegenHyperlink(1) - Kontext "TabHyperlinkInternet" - Internet.Check - ZielUrl.Settext "http://www.sonor.de" - PrintLog "Enter URL " Kontext "Hyperlink" - PrintLog "Click 'Apply'" - Uebernehmen.Click - PrintLog "Close Hyperlink dialog" - Hyperlink.Close + if ( Hyperlink.exists( 2 ) ) then + + Call wEinfuegenHyperlink(1) + Kontext "TabHyperlinkInternet" + + printlog( "Check <Internet>" ) + Internet.Check() + + PrintLog "Enter URL " + ZielUrl.Settext "http://www.sonor.de" + + Kontext "Hyperlink" + PrintLog "Click 'Apply'" + Uebernehmen.Click + + PrintLog "Close Hyperlink dialog" + hCloseDialog( Hyperlink, "close" ) + else + warnlog( "Dialog <Hyperlink> did not open" ) + hCloseDocument() + goto endsub + endif Call wDocSetContext - try - PrintLog "Check if correct URL has been set to document" - hUseAsyncSlot( "EditCopy" ) + + PrintLog "Check if correct URL has been set to document" + if ( hUseAsyncSlot( "EditCopy" ) > -1 ) then if GetClipBoardtext = "" then Warnlog "No Hyperlink or wrong hyperlink in document!" & GetClipBoardtext end if - catch - Warnlog "No Hyperlink in document!" - goto endsub - endcatch + else + warnlog( "Slot <EditCopy> could not be executed. Most likely the hyperlink was not selected" ) + endif PrintLog "Set cursor into link" Call wTypeKeys("<Left>") - try - PrintLog "Edit / Hyperlink has to be enabled" - EditHyperlink + + PrintLog "Edit / Hyperlink has to be enabled" + if ( hUseAsyncSlot( "EditHyperlink" ) > -1 ) then Kontext "Hyperlink" - if Hyperlink.Exists then - Hyperlink.Close - else - Warnlog "- Hyperlinkdialog not up" - end if - catch - Warnlog "- Not able to edit Hyperlink!" - endcatch + hCloseDialog( Hyperlink, "close" ) + else + warnlog( "Slot <EditHyperlink> could not be called" ) + endif PrintLog "Close active document" Call hCloseDocument @@ -978,148 +983,72 @@ endcase '---------------------------------------------------------------- testcase tEditFields - PrintLog "- Edit/Fields" - PrintLog "Open new document" - Call hNewDocument + PrintLog( "Edit/Fields: Edit Fields dialog: " & gApplication ) - PrintLog "Select Insert / Fields Other" + PrintLog( "Open new document" ) + Call hNewDocument() + + printlog( "Insert->Field->Other" ) InsertFieldsOther - Kontext - Active.Setpage TabDokumentFeldbefehle - Kontext "TabDokumentFeldbefehle" - Sleep 1 - PrintLog "Insert Field 'Sender -> Company'" - Select Case gApplication - Case "HTML" - Select case iSprache - case 01 : Feldtyp.Select 5 'Sender - Auswahl.Select 1 'Company - case 03 : Feldtyp.Select 8 - Auswahl.Select 1 - case 07 : Feldtyp.Select 5 - Auswahl.Select 1 - case 31 : Feldtyp.Select 1 - Auswahl.Select 1 - case 33 : Feldtyp.Select 2 - Auswahl.Select 1 - case 34 : Feldtyp.Select 6 - Auswahl.Select 1 - case 36 : Feldtyp.Select 3 - Auswahl.Select 1 - case 39 : Feldtyp.Select 3 - Auswahl.Select 1 - case 45 : Feldtyp.Select 1 - Auswahl.Select 1 - case 46 : Feldtyp.Select 2 - Auswahl.Select 1 - case 48 : Feldtyp.Select 3 - Auswahl.Select 1 - case 49 : Feldtyp.Select 1 - Auswahl.Select 1 - case 51 : Feldtyp.Select 5 - Auswahl.Select 1 - case 52 : Feldtyp.Select 5 - Auswahl.Select 1 - case 55 : Feldtyp.Select 7 - Auswahl.Select 1 - case 81 : Feldtyp.Select 4 - Auswahl.Select 1 - case 82 : Feldtyp.Select 2 - Auswahl.Select 1 - case 84 : Feldtyp.Select 3 - Auswahl.Select 1 - case 86 : Feldtyp.Select 1 - Auswahl.Select 1 - case 88 : Feldtyp.Select 2 - Auswahl.Select 1 - - case else : Warnlog "Missing language support!" - TabDokumentFeldbefehle.Cancel - PrintLog "Close active document" - Call hCloseDocument - goto endsub - end select - Case else - Select case iSprache - case 01 : Feldtyp.Select 6 'Sender - Auswahl.Select 1 'Company - case 03 : Feldtyp.Select 9 - Auswahl.Select 1 - case 07 : Feldtyp.Select 6 - Auswahl.Select 1 - case 31 : Feldtyp.Select 1 - Auswahl.Select 1 - case 33 : Feldtyp.Select 3 - Auswahl.Select 1 - case 34 : Feldtyp.Select 8 - Auswahl.Select 1 - case 36 : Feldtyp.Select 4 - Auswahl.Select 1 - case 39 : Feldtyp.Select 4 - Auswahl.Select 1 - case 45 : Feldtyp.Select 1 - Auswahl.Select 1 - case 46 : Feldtyp.Select 2 - Auswahl.Select 1 - case 48 : Feldtyp.Select 3 - Auswahl.Select 1 - case 49 : Feldtyp.Select 1 - Auswahl.Select 1 - case 51 : Feldtyp.Select 6 - Auswahl.Select 1 - case 52 : Feldtyp.Select 6 - Auswahl.Select 1 - case 55 : Feldtyp.Select 9 - Auswahl.Select 1 - case 81 : Feldtyp.Select 5 - Auswahl.Select 1 - case 82 : Feldtyp.Select 2 - Auswahl.Select 2 - case 84 : Feldtyp.Select 5 - Auswahl.Select 1 - case 86 : Feldtyp.Select 1 - Auswahl.Select 1 - case 88 : Feldtyp.Select 2 - Auswahl.Select 1 - - case else : Warnlog "Missing language support!" - TabDokumentFeldbefehle.Cancel - PrintLog "Close active document" - Call hCloseDocument - goto endsub - end select - end select - - Einfuegen.Click - Wait (400) - PrintLog "Close Fields dialog" - Schliessen.Click - - PrintLog "Put cursor in front of field" - Call wTypeKeys("<Home>") - - PrintLog "Edit / Fields" - EditFields - WaitSlot (2000) - Kontext "FeldbefehlBearbeitenDokument" - Call DialogTest ( FeldbefehlBearbeitenDokument ) + ' Note that the tabdialog does not have a unique ID yet, so we treat it as "Active" + kontext + if ( Active.exists( 2 ) ) then + + printlog( "Switch to <Document> tab" ) + Active.setPage( TabDokumentFeldbefehle ) + + kontext "TabDokumentFeldbefehle" + printlog( "Select any item from the user data, insert the field, close the dialog" ) + if ( TabDokumentFeldbefehle.isVisible() ) then + Feldtyp.select( 1 ) + Auswahl.select( 1 ) + Einfuegen.click() + hCloseDialog( TabDokumentFeldbefehle , "close" ) + + PrintLog( "Move cursor infront of field (start of document)" ) + Call wTypeKeys("<Home>") + + PrintLog( "Edit / Fields" ) + EditFields + + Kontext "FeldbefehlBearbeitenDokument" + if ( FeldbefehlBearbeitenDokument.exists( 2 ) ) then + Call DialogTest ( FeldbefehlBearbeitenDokument ) + + PrintLog( "In 'Edit Fields' dialog select 'Edit'" ) + if ( Bearbeiten.IsVisible() and Bearbeiten.IsEnabled() ) then + Bearbeiten.Click() + + Kontext "TabBenutzerdaten" + if ( TabBenutzerdaten.exists( 2 ) ) then + printlog( "<TabBenutzerdaten> is open. Good." ) + call DialogTest( TabBenutzerdaten ) + hCloseDialog( TabBenutzerdaten, "cancel" ) + else + warnlog( "<TabBenutzerdaten> did not open" ) + endif + else + Warnlog( "Button 'Edit' in Dialog disabled!" ) + endif + else + warnlog( "<TabDokumentFeldbefehle> is not visible" ) + endif - PrintLog "In 'Edit Fields' dialog select 'Edit'" - if Bearbeiten.IsVisible and Bearbeiten.IsEnabled then - Bearbeiten.Click - Kontext "TabBenutzerdaten" - TabBenutzerdaten.Cancel - Kontext "FeldbefehlBearbeitenDokument" + PrintLog( "Close dialog" ) + Kontext "FeldbefehlBearbeitenDokument" + hCloseDialog( FeldbefehlBearbeitenDokument, "cancel" ) + else + warnlog( "<FeldbefehlBearbeitenDokument> did not open" ) + endif else - Warnlog "Button 'Edit' in Dialog disabled!" - end if + warnlog( "Unable to open <InsertFieldsOther>") + endif + + PrintLog( "Close active document" ) + Call hCloseDocument() - PrintLog "Close dialog" - FeldbefehlBearbeitenDokument.Cancel - PrintLog "Close active document" - Call hCloseDocument endcase '---------------------------------------------------------------- @@ -1207,9 +1136,7 @@ endcase '---------------------------------------------------------------- testcase tEditIndexEntry - qaErrorLog "#158646# - Insert Indexes Entry causes crash." - goto endsub - + PrintLog "- Edit/Index Entry" if gApplication = "HTML" then printlog "Not in WriterWeb!" @@ -1253,53 +1180,66 @@ endcase testcase tEditLinks PrintLog "- Edit/Links" - if gApplication = "HTML" then + + dim sFile as string + sFile = gTesttoolPath & "writer\required\input\graphics\jolink.jpg" + + if ( gApplication = "HTML" ) then printlog "Not in WriterWeb!" goto endsub end if + printlog( "Open a new document" ) Call hNewDocument - Call hGrafikVerknuepftEinfuegen ( gTesttoolPath & "writer\required\input\graphics\jolink.jpg" ) - Wait 200 - try - EditLinksWriter - catch + + printlog( "Insert graphic file (linked): " & sFile ) + Call hGrafikVerknuepftEinfuegen ( sFile ) + + printlog( "Edit->Links" ) + if ( hUseAsyncSlot( "EditLinksWriter" ) = -1 ) then Warnlog "Error on calling Edit / Links ! (disabled)" Call hCloseDocument goto endsub - endcatch + endif Kontext "VerknuepfungenBearbeiten" - if VerknuepfungenBearbeiten.Exists then + if ( VerknuepfungenBearbeiten.Exists( 1 ) ) then Call DialogTest ( VerknuepfungenBearbeiten ) - Wait 200 - try - Aendern.Click + + Kontext "VerknuepfungenBearbeiten" + printlog( "Click <Change>" ) + if ( hClickButton( Aendern ) > -1 ) then Kontext "GrafikEinfuegenDlg" - GrafikEinfuegenDlg.Cancel - catch + call DialogTest( GrafikEinfuegenDlg ) + hCloseDialog( GrafikEinfuegenDlg, "cancel" ) + else Warnlog "Error modifying the link!" - endcatch + endif Kontext "VerknuepfungenBearbeiten" - Wait 200 - try - Aktualisieren.Click - catch + printlog( "Click <Update>" ) + if ( hClickButton( Aktualisieren ) = -1 ) then Warnlog "Error on updating the link!" - endcatch - Wait 200 + endif - try - Loesen.Click + Kontext "VerknuepfungenBearbeiten" + printlog( "Click <Release>" ) + if ( hClickButton( Loesen ) > -1 ) then Kontext "Active" - if Active.Exists then Active.No - catch - Warnlog "- Error on breaking the link!" - endcatch + printlog( "Check for confirmation message" ) + if ( Active.Exists( 1 ) ) then + printlog( "Message displayed, good. Closing with <No>" ) + printlog( Active.getText() ) + Active.No + else + Warnlog( "The <Are you sure you want to remove the selected link?> message is missing" ) + endif + else + Warnlog( "Unable to break the link to the file" ) + endif Kontext "VerknuepfungenBearbeiten" - VerknuepfungenBearbeiten.Close + hCloseDialog( VerknuepfungenBearbeiten, "close" ) else Warnlog "Dialog Edit / Links not opened!" end if @@ -1325,23 +1265,41 @@ endcase '------------------------------------------------------ testcase tEditImageMap - PrintLog "- Edit / ImageMap" + PrintLog "- Edit / ImageMap" + + dim sFile as string + sFile = gTesttoolPath & "writer\required\input\graphics\jolink.jpg" + PrintLog "Open new document" Call hNewDocument - if hGrafikEinfuegen ( gTesttoolPath & "writer\required\input\graphics\jolink.jpg" )=true then + printlog( "Insert graphics file: " & sFile ) + if ( hGrafikEinfuegen( sFile ) ) then + + printlog( "Edit->Imagemap" ) + EditImageMap + Kontext "ImageMapEditor" - if ImageMapEditor.Exists then ImageMapEditor.Close - try - EditImageMap - Kontext "ImageMapEditor" + if ( ImageMapEditor.exists( 1 ) ) then Call DialogTest (ImageMapEditor) - Sleep 1 - ImageMapEditor.Close - catch - Warnlog "Edit/ImageMap disabled!" - endcatch + hCloseDialog( ImageMapEditor, "close" ) + + printlog( "Check for <Imagemap changed> messagebox (should not appear)" ) + kontext "Active" + if ( Active.exists( 1 ) ) then + qaerrorlog( "#i109605# - <imagemap changed> message displayed." ) + printlog( Active.getText ) + Active.no() + else + printlog( "No messagebox on close, good." ) + endif + + else + warnlog( "Dialog <ImageMapEditor> did not open" ) + endif + else + warnlog( "Insert graphics failed" ) end if PrintLog "Close active document" @@ -1374,103 +1332,6 @@ endcase '---------------------------------------------------------------- -testcase tHtmlDocEditFields - PrintLog "- Edit/Fields" - - gApplication = "HTML" - PrintLog "Open new document" - Call hNewDocument - - PrintLog "Select Insert / Fields Other" - InsertFieldsOther - Kontext - Active.Setpage TabDokumentFeldbefehle - Kontext "TabDokumentFeldbefehle" - Sleep 1 - PrintLog "Insert Field 'Sender -> Company'" - Select case iSprache - case 01 : Feldtyp.Select 5 'Sender - Auswahl.Select 1 'Company - case 03 : Feldtyp.Select 8 - Auswahl.Select 1 - case 07 : Feldtyp.Select 5 - Auswahl.Select 1 - case 31 : Feldtyp.Select 1 - Auswahl.Select 1 - case 33 : Feldtyp.Select 2 - Auswahl.Select 1 - case 34 : Feldtyp.Select 6 - Auswahl.Select 1 - case 36 : Feldtyp.Select 3 - Auswahl.Select 1 - case 39 : Feldtyp.Select 3 - Auswahl.Select 1 - case 45 : Feldtyp.Select 1 - Auswahl.Select 1 - case 46 : Feldtyp.Select 2 - Auswahl.Select 1 - case 48 : Feldtyp.Select 3 - Auswahl.Select 1 - case 49 : Feldtyp.Select 1 - Auswahl.Select 1 - case 51 : Feldtyp.Select 5 - Auswahl.Select 1 - case 52 : Feldtyp.Select 5 - Auswahl.Select 1 - case 55 : Feldtyp.Select 7 - Auswahl.Select 1 - case 81 : Feldtyp.Select 4 - Auswahl.Select 1 - case 82 : Feldtyp.Select 2 - Auswahl.Select 1 - case 84 : Feldtyp.Select 3 - Auswahl.Select 1 - case 86 : Feldtyp.Select 1 - Auswahl.Select 1 - case 88 : Feldtyp.Select 2 - Auswahl.Select 1 - - case else : Warnlog "Missing language support!" - TabDokumentFeldbefehle.Cancel - PrintLog "Close active document" - Call hCloseDocument - goto endsub - end select - - Einfuegen.Click - Wait (400) - PrintLog "Close Fields dialog" - Schliessen.Click - - PrintLog "Put cursor in front of field" - Call wTypeKeys("<Home>") - - PrintLog "Edit / Fields" - EditFields - WaitSlot (2000) - - Kontext "FeldbefehlBearbeitenDokument" - Call DialogTest ( FeldbefehlBearbeitenDokument ) - - PrintLog "In 'Edit Fields' dialog select 'Edit'" - if Bearbeiten.IsVisible and Bearbeiten.IsEnabled then - Bearbeiten.Click - Kontext "TabBenutzerdaten" - TabBenutzerdaten.Cancel - Kontext "FeldbefehlBearbeitenDokument" - else - Warnlog "Button 'Edit' in Dialog disabled!" - end if - - PrintLog "Close dialog" - FeldbefehlBearbeitenDokument.Cancel - PrintLog "Close active document" - Call hCloseDocument - gApplication = "WRITER" -endcase - -'---------------------------------------------------------------- - testcase tMasterDocEditNavigator printlog "- View/Navigator" Dim ToolboxOk as boolean diff --git a/testautomation/writer/required/includes/w_007_.inc b/testautomation/writer/required/includes/w_007_.inc index 57c83706029f..3a93dfae45db 100644 --- a/testautomation/writer/required/includes/w_007_.inc +++ b/testautomation/writer/required/includes/w_007_.inc @@ -80,7 +80,7 @@ testcase tToolsSpellcheck printlog " Open document where the formatting is set to the language we wish to test." TheFile = Convertpath (gTesttoolpath + "writer\optional\input\spellcheck\spellcheck_" + iSprache + ".odt") - if ( not hFileExists ( TheFile ) ) then + if ( not FileExists ( TheFile ) ) then Warnlog "Found no Document for the language you're testing in, Please inform the Test-Developer." goto endsub end if @@ -243,7 +243,7 @@ testcase tToolsThesaurus printlog " Open document where the formatting is set to the language we wish to test." TheFile = Convertpath (gTesttoolpath + "writer\optional\input\spellcheck\spellcheck_" + iSprache + ".odt") - if ( not hFileExists ( TheFile ) ) then + if ( not FileExists ( TheFile ) ) then Warnlog "Found no Document for the language you're testing in, Please inform the Test-Developer." goto endsub end if @@ -339,7 +339,7 @@ testcase tToolsHyphenation LingFile = str$(iSprache) + "-hyph.dat" end select - if ( not hFileExists( DieDatei ) ) then + if ( not FileExists( DieDatei ) ) then Warnlog "No defined Errortext for language: " + isprache + "! Exit!" goto endsub end if @@ -1232,7 +1232,7 @@ testcase tMasterDocToolsHyphenation end select sTestFile = convertpath( sTestFile ) - if ( not hFileExists( sTestFile ) )then + if ( not FileExists( sTestFile ) )then Warnlog "No defined Errortext for language: " + isprache + "! Exit!" goto endsub end if diff --git a/testautomation/writer/tools/includes/w_tool4.inc b/testautomation/writer/tools/includes/w_tool4.inc index 78cee6ca3042..8b8c52e12627 100644 --- a/testautomation/writer/tools/includes/w_tool4.inc +++ b/testautomation/writer/tools/includes/w_tool4.inc @@ -143,7 +143,7 @@ function wGetSpellcheckDocumentName(xCategory as integer) as string end select if sReturn <> "None" then - if hFileExists(sTemp) then + if FileExists(sTemp) then sReturn = sTemp else sReturn = "Empty" diff --git a/testautomation/xml/optional/includes/docbook_001.inc b/testautomation/xml/optional/includes/docbook_001.inc index f79f4fd36c4a..d26a60025de6 100644 --- a/testautomation/xml/optional/includes/docbook_001.inc +++ b/testautomation/xml/optional/includes/docbook_001.inc @@ -43,7 +43,7 @@ sub tDocBookXMLtestdocs exit sub end if 'Calculating how many documents are in that directory (max. 500) - if hDirectoryExists(sSourcePath) then + if FileExists(sSourcePath) then 'Get the file list and put it in a list (max. 500 per directory!) call GetAllFileList(sSourcePath, "*.xml" , sSourceDocuments()) iNumberOfDocuments = ListCount(sSourceDocuments()) diff --git a/testautomation/xml/tools/includes/xmltool1.inc b/testautomation/xml/tools/includes/xmltool1.inc index e0356be2076c..e25a5d03506e 100644 --- a/testautomation/xml/tools/includes/xmltool1.inc +++ b/testautomation/xml/tools/includes/xmltool1.inc @@ -43,7 +43,7 @@ sub CreateWorkXMLExportDir ( DirName as string ) Dim Isliste(200) as string Dim i, BornToKill printlog "Checking work-dir & creating '" & gOfficePath & ConvertPath(DirName) & "'." - if hDirectoryExists ( gOfficePath & ConvertPath(DirName) ) = TRUE then + if ( FileExists( gOfficePath & ConvertPath( DirName) ) then OutputPath = gOfficePath & ConvertPath(DirName) IsListe(0) = 0 GetFileList ( OutputPath , "*", IsListe() ) |