diff options
Diffstat (limited to 'testautomation/global/required')
-rw-r--r-- | testautomation/global/required/includes/g_001.inc | 149 | ||||
-rw-r--r-- | testautomation/global/required/includes/g_009.inc | 178 | ||||
-rw-r--r-- | testautomation/global/required/includes/g_customize.inc | 331 | ||||
-rw-r--r-- | testautomation/global/required/includes/g_numberformatter1.inc | 797 | ||||
-rw-r--r-- | testautomation/global/required/includes/g_option.inc | 852 | ||||
-rw-r--r-- | testautomation/global/required/includes/g_option_application.inc | 664 | ||||
-rw-r--r-- | testautomation/global/required/includes/g_printing.inc | 518 |
7 files changed, 3489 insertions, 0 deletions
diff --git a/testautomation/global/required/includes/g_001.inc b/testautomation/global/required/includes/g_001.inc new file mode 100644 index 000000000000..3d22b6b8a1df --- /dev/null +++ b/testautomation/global/required/includes/g_001.inc @@ -0,0 +1,149 @@ +'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 : Global resource tests for the menu: File +'* +'************************************************************************* +'* +' #1 tFileExportAsPDF +' #1 tExportAsPDFButton +'* +'\************************************************************************ + +testcase tFileExportAsPDF + dim sPDF as string + dim sTemp as string + + sPDF = "PDF - Portable Document Format (.pdf)" + + '/// open application ///' + Call hNewDocument + + '/// choose File->Export As PDF ... ///' + FileExportAsPDF + ' The file dialog has to come up + Kontext "SpeichernDlg" + if SpeichernDlg.exists(5) then + '/// the selected file type should be: 'PDF - Portable Document Format (.pdf)' ///' + sTemp = Dateityp.GetSelText + if (sTemp <> sPDF) then + Warnlog "filter for PDF export is missing :-( should: '" + sPDF + "'; is: '" + sTemp + "'" + endif + '///+ - set Textbox 'File name' to "abc" ///' + Dateiname.SetText "abc" + speichern.click + kontext + if active.exists(5) then + ' catch active about already existing file name + if active.getrt = 304 then + active.yes + endif + endif + else + ' changed with SRC680m210 - first options, then file dialog... + ' kept for testcase backwards compatibility + 'warnlog "Export dialog didn't come up." + endif + kontext + '/// dialog 'PDF Options' comes up ///' + if active.exists(5) then + '/// select the tab page 'General' ///' + active.setPage PDFOptions + kontext "PDFOptions" + if PDFOptions.exists(5) then + dialogTest(PDFOptions) + else + warnlog "Tab page 'PDF Options - General' isn't available." + endif + else + warnlog "Dialog 'PDF Options' didn't come up" + endif + kontext + if active.exists(5) then + '/// select the tab page 'Initial View' ///' + active.setPage PDFOptionsInitialView + kontext "PDFOptionsInitialView" + if PDFOptionsInitialView.exists(5) then + dialogTest(PDFOptionsInitialView) + else + warnlog "Tab page 'PDF Options - Initial View' isn't available." + endif + endif + kontext + if active.exists(5) then + '/// select the tab page 'User Interface' ///' + active.setPage PDFOptionsUserInterface + kontext "PDFOptionsUserInterface" + if PDFOptionsUserInterface.exists(5) then + dialogTest(PDFOptionsUserInterface) + else + warnlog "Tab page 'PDF Options - User Interface' isn't available." + endif + endif + kontext + if active.exists(5) then + '/// select the tab page 'General' ///' + active.setPage PDFOptions + kontext "PDFOptions" + '/// close the dialog with 'Cancel' ///' + if PDFOptions.exists(5) then + PDFOptions.cancel + else + warnlog "Tab page 'PDF Options - General' isn't available." + endif + endif + '/// close application ///' + Call hCloseDocument +endcase +' +'------------------------------------------------------------------------------- +' +testcase tExportAsPDFButton + Dim sTemp as string + '/// Create new document + Call hNewDocument + '/// Click the button 'Export Directly as PDF' on the standard toolbar. + Kontext "Standardbar" + ExportAsPDF.click + '/// The 'Export as PDF' dialog has to come up, with the only 'File type' 'PDF - Portable Document Format' + Kontext "SpeichernDlg" + if SpeichernDlg.exists(1) then + sTemp = Dateityp.GetSelText + if InStr(sTemp, "PDF") = 0 then + warnlog "Filter for PDF export seems to be wrong or is missing in selection." + endif + '/// Leave dialog with CANCEL button + SpeichernDlg.Cancel + else + warnlog "SaveAsPDF dialog did not come up." + endif + '/// Close spreadsheet document. + Call hCloseDocument +endcase + diff --git a/testautomation/global/required/includes/g_009.inc b/testautomation/global/required/includes/g_009.inc new file mode 100644 index 000000000000..1e6372bbdb7f --- /dev/null +++ b/testautomation/global/required/includes/g_009.inc @@ -0,0 +1,178 @@ +'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 : Global resource tests for the menu: Help +'* +'************************************************************************* +'* +' #1 tHelpCheckForUpdates +'* +'\************************************************************************ + +testcase tHelpCheckForUpdates + dim sTemp as string + dim sIniFile as string + dim i,a as integer + dim bProxy as boolean + dim bOnceAgain as boolean + dim sProxyFile as string + dim iOldProxy as integer + + bProxy = FALSE + bOnceAgain = TRUE + + '/// open application ///' + Call hNewDocument + + if gPlatGroup = "unx" then + sIniFile = convertPath(gNetzOfficePath+"program/versionrc") + else + sIniFile = convertPath(gNetzOfficePath+"program\version.ini") + endif + sTemp = GetIniValue (sIniFile, "Version", "UpdateURL") + if (sTemp <> "" AND NOT gOOO) then + '/// choose Help -> Check for Updates... ///' + while (bOnceAgain) + if bProxy AND bOnceAgain then + bOnceAgain = FALSE + endif + try + HelpCheckForUpdates + catch + bOnceAgain = FALSE + if (gtplatform = "sol") OR (gtplatform = "x86") or gOOO then + printlog "This could be a (patched) installation on Solaris Sparc/Intel or OOo - No Online Update Feature available." + hCloseDocument + else + warnlog "Help->Check for Updates failed" + hCloseDocument + endif + goto endsub + endcatch + ' The dialog has to come up: 'Check for Updates' + Kontext "CheckForUpdates" +' if CheckForUpdates.exists(10) then ' id not in build for dialog workaround: ' not working due to i 80859 + if Status.exists(10) then + if sTemp <> "" then + printlog "'Check for Updates' came up" + else + warnlog "'Check for Updates' came up, but the feature is disabled and the dialog hasn't to come up" + bOnceAgain = FALSE + endif + 'dialogTest(CheckForUpdates) ' not working due to i 80859 + '/// A messagebox comes up with either CANCEL and/or OK -> press CANCEL or the only available button. ///' + ' And will be overlayed soon by an 'active' + Kontext + if active.exists(6) then + printlog "Active text: '" + active.getText + "'" + try + active.cancel + printlog "Pressed CANCEL" + catch + active.ok + printlog "Pressed OK" + endcatch + bOnceAgain = FALSE + else + bOnceAgain = FALSE + Kontext "CheckForUpdates" + try + CheckForUpdates.cancel + catch + 'cancel button is no more availabale + printlog "cancel wasnt possible" + try + 'CheckForUpdates.close + ' close method doesn't work + printlog "1:"+status.gettext + printlog "2:"+description.gettext + closebtn.click + catch + printlog "close wasnt possible" + ' last fallback + 'printlog resetapplication + 'hNewDocument + printlog "1:"+status.gettext + printlog "2:"+description.gettext + cancel.click + endcatch + endcatch + endif + else + bOnceAgain = FALSE + if sTemp <> "" then + if (gtplatform = "sol") OR (gtplatform = "x86") or gOOO then + printlog "This could be a (patched) installation on Solaris Sparc/Intel or OOo - No Online Update Feature available." + else + warnlog "Dialog didn't came up: 'Check for Updates'; URL that was called is: '" + sTemp + "'" + endif + else + warnlog "Online Update Feature isn't available in this build, but calling Help -> Check for Updates is possible? (no 'UpdateURL' in file: '"+sIniFile+"')" + endif + endif + ' Set proxy to get connection to update server + if bProxy then + ToolsOptions + hToolsOptions("INTERNET","PROXY") + Kontext "TabProxyServer" + a = ProxyServer.getItemCount + for i = 1 to a + printlog "(" + i + "/" + a + "): '" + ProxyServer.getItemText(i) + "'" + next i + ProxyServer.select(a) ' should be always manual + if HttpProxy.isEnabled AND (privateProxyServer <> "") then + HttpProxy.setText privateProxyServer + HttpPort.setText cStr(privateProxyPort) + if bOnceAgain then + iOldProxy = ProxyServer.getSelIndex + else + ProxyServer.select(iOldProxy) + endif + Kontext "OptionenDlg" + OptionenDlg.OK + else + if privateProxyServer <> "" then + warnLog "Wrong assumption that last entry is 'manual'! " + ProxyServer.getItemText(a) + else + qaErrorLog "Maybe you need to use a proxy server to connect to the internet." + endif + Kontext "OptionenDlg" + OptionenDlg.Cancel + bOnceAgain = FALSE + endif + endif + bOnceAgain = FALSE + wend + else + qaErrorlog "Test disabled, because it is OOo build and UpdateURL is empty and calling the slot would succeed" + endif + '/// close application ///' + Call hCloseDocument +endcase + diff --git a/testautomation/global/required/includes/g_customize.inc b/testautomation/global/required/includes/g_customize.inc new file mode 100644 index 000000000000..f2df48f3c552 --- /dev/null +++ b/testautomation/global/required/includes/g_customize.inc @@ -0,0 +1,331 @@ +'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 : update and resouce test for tools/customize +'* +'************************************************************************ +'* +' #1 tToolsCustomize +'* +'\*********************************************************************** + +testcase tToolsCustomize + + Dim iCountMsgBox as integer + '/// open application ///' + Call hNewDocument + sleep 2 + '/// Tools->Customize... ///' + ToolsCustomize + sleep 3 + Kontext + '/// switch to tabpage 'Menus' ///' + try + Active.SetPage TabCustomizeMenu ' 1 ------------------ + catch + warnlog "couldn't switch to tabpage 'Menus'" + endcatch + Kontext "TabCustomizeMenu" + if TabCustomizeMenu.exists(5) then + Call DialogTest ( TabCustomizeMenu ) + '/// Go in 'Menu' list-box one item down + Menu.typeKeys("<down>") + '/// Go in 'Entries' list-box one item down + Entries.typeKeys("<down>") + sleep(2) + '/// click button 'new' ///' + BtnNew.Click + sleep(1) + '/// 'New Menu' dialog comes up ///' + Kontext "MenuOrganiser" + Call DialogTest ( MenuOrganiser ) + '/// Cancel dialog 'New Menu' ///' + MenuOrganiser.cancel + sleep(2) + + Kontext "TabCustomizeMenu" + '/// In 'Menu' list-box select one item up + Menu.Select(1) + sleep(1) + '/// Click on button 'Menu' ///' + MenuBtn.openMenu + printlog "opened first one" + sleep(1) + '/// Select the first entry 'Move' ///' + hMenuSelectNr(1) + '/// Dialog 'Move Menu' comes up ///' + Kontext "MenuOrganiser" + Call DialogTest ( MenuOrganiser ) + '/// Click on the 'Up'-button ///' + ButtonUp.click + '/// Click on the 'Down'-button ///' + ButtonDown.click + '/// Cancel Dialog 'Move Menu' ///' + MenuOrganiser.cancel + + Kontext "TabCustomizeMenu" + '/// Click Button 'Add Commands' ///' + AddCommands.click + '/// Dialog 'Add Commands' comes up ///' + Kontext "ScriptSelector" + call DialogTest(ScriptSelector) + LibraryTreeList.typeKeys ("<down>") + ScriptList.typeKeys ("<down>") + '/// Close Dialog 'Add Commands' ///' + ScriptSelector.cancel + + Kontext "TabCustomizeMenu" + '/// Click button 'Command' ///' + sleep(1) + Command.click + printlog "opened second one" + WaitSlot() + '/// Select the first entry 'Add Submenu' ///' + hMenuSelectNr(1) + '/// Dialog 'Name' comes up ///' + Kontext "CustomizeMenuName" + call DialogTest (CustomizeMenuName) + Eingabefeld.typeKeys ("A") + '/// Cancel Dialog 'Name' ///' + CustomizeMenuName.cancel + + WaitSlot() + Kontext "TabCustomizeMenu" + '/// Click button 'Command' ///' + sleep(1) + Command.click + printlog "opened third one" + WaitSlot() + '/// Select the third entry 'Rename' ///' + hMenuSelectNr(3) + '/// Dialog 'Name' comes up ///' + Kontext "CustomizeMenuReName" + call DialogTest (CustomizeMenuReName) + Eingabefeld.typeKeys ("A") + '/// Cancel Dialog 'Name' ///' + CustomizeMenuReName.cancel + + Kontext "TabCustomizeMenu" + '/// click button 'downwards' ///' + BtnDown.Click + '/// click button 'upwards' ///' + BtnUp.Click + '/// click button 'Reset' ///' + ResetBtn.Click + kontext + printlog "survived all menu comands" + if Messagebox.exists (5) then + if Messagebox.GetRT = 304 then + printlog "Messagebox: Menu configuration will be reset...: '"+Messagebox.getText+"'" + call DialogTest(Messagebox, 50) + Messagebox.yes + endif + endif + endif + + Kontext + '/// switch to tabpage 'Toolbars' ///' + try + Messagebox.SetPage TabCustomizeToolbars ' 4 ------------------ + catch + warnlog "couldn't switch to tabpage 'Toolbars'" + endcatch + Kontext "TabCustomizeToolbars" + if TabCustomizeToolbars.exists(5) then + Call DialogTest ( TabCustomizeToolbars ) + Menu.typeKeys("<down>") + ToolbarContents.typeKeys("<down>") + SaveIn.typeKeys("<down>") + '/// click button 'new' ///' + BtnNew.Click + waitslot + '/// Dialog 'Name' comes up ///' + Kontext "NewToolbar" + Call DialogTest ( NewToolbar ) + ToolbarName.typeKeys("<down>") + SaveIn.typeKeys("<down>") + '/// Cancel dialog 'Name' ///' + NewToolbar.cancel + waitslot + + Kontext "TabCustomizeToolbars" + '/// Click Button 'Add Commands...' ///' + SaveIn.typeKeys("<up>") + AddCommands.click + '/// Dialog 'Add Commands' comes up ///' + Kontext "ScriptSelector" + call DialogTest (ScriptSelector) + LibraryTreeList.typeKeys("<down>") + ScriptList.typeKeys("<down>") + '/// Close Dialog 'Add Commands' ///' + ScriptSelector.cancel + + waitslot + Kontext "TabCustomizeToolbars" + sleep(1) + '/// Click button 'Command' ///' + Command.click + waitslot + '/// Select the firste entry 'Rename' ///' + hMenuSelectNr(1) + '/// Dialog 'Name' comes up ///' + Kontext "CustomizeToolbarsReName" + if NOT CustomizeToolbarsReName.exists(2) then + Kontext "TabCustomizeToolbars" + ToolbarContents.typeKeys("<down>") + else + CustomizeToolbarsReName.cancel() + endif + + Kontext "TabCustomizeToolbars" + sleep(1) + Command.click + waitslot + hMenuSelectNr(1) + Kontext "CustomizeToolbarsReName" + call DialogTest (CustomizeToolbarsReName) + Eingabefeld.typeKeys ("A") + '/// Cancel Dialog 'Name' ///' + CustomizeToolbarsReName.close + + waitslot + Kontext "TabCustomizeToolbars" + '/// Click button 'Command' ///' + sleep(1) + Command.click + waitslot + '/// Select the fifth entry 'Change Icon' ///' + hMenuSelectNr(5) + '/// Dialog 'Change Icon' comes up ///' + Kontext "ChangeIcon" + call DialogTest (ChangeIcon) + '/// Click button 'Import...' on dialog Change 'Icon' ///' + Import.click + '/// Dialog 'Open' comes up ///' + Kontext "GeneralFileDialog" + '/// Cancel dialog 'Open' ///' + GeneralFileDialog.cancel + '/// Cancel Dialog 'Change Icon' ///' + Kontext "ChangeIcon" + ChangeIcon.cancel + + Kontext "TabCustomizeToolbars" + '/// click button 'downwards' ///' + BtnDown.Click + '/// click button 'upwards' ///' + BtnUp.Click + '/// click button 'Reset' ///' + ResetBtn.Click + kontext + if Messagebox.exists (5) then + if Messagebox.GetRT = 304 then + printlog "Messagebox: Menu configuration will be reset...: '"+Messagebox.getText+"'" + call DialogTest(Messagebox, 50) + Messagebox.no + endif + endif + + WaitSlot() + Kontext "TabCustomizeToolbars" + '/// On Tab Page 'Customize Menus' click on Button 'Toolbar' ///' + sleep(1) + MenuBtn.openMenu + WaitSlot() + hMenuSelectNr(1) + kontext + sleep 3 + if Messagebox.exists (5) then + if Messagebox.GetRT = 304 then + printlog "Messagebox: Toolbar configuration will be reset...: '"+Messagebox.getText+"'" + call DialogTest(Messagebox, 50) + Messagebox.no + endif + endif + endif + Kontext + '/// switch to tabpage 'Events' ///' + try + Messagebox.SetPage TabCustomizeEvents ' 5 ------------------ + catch + warnlog "couldn't switch to tabpage 'Events'" + endcatch + Kontext "TabCustomizeEvents" + if TabCustomizeEvents.exists(5) then + Call DialogTest ( TabCustomizeEvents ) + SaveIn.typeKeys("<down>") + EventListbox.typeKeys("<down>") + WaitSlot() + '/// click button 'Assign Macro' ///' + AssignMacro.Click + WaitSlot() + ' If Java is not [correctly] installed a messagebox will be shown + Kontext "Messagebox" + if Messagebox.Exists(2) then + for iCountMsgBox = 1 to 20 + Kontext "Messagebox" + if MessageBox.Exists(2) then + if MessageBox.GetRT = 304 then + if iCountMsgBox = 1 then + warnlog "Java runtime is defective. Detection failed!" + endif + '.getRT is need because otherwise the operation will be done + 'on the opened tab control behind the message box + QAErrorLog "Dialog (" & iCountMsgBox & "): " & Messagebox.GetText + if iCountMsgBox > 15 then + warnlog "Now the message box occours " & iCountMsgBox & " instead of 15 times!" + endif + Messagebox.OK + endif + else + exit for + endif + next iCountMsgBox + endif + '/// Dialog 'MacroSelector' comes up ///' + Kontext "ScriptSelector" + call DialogTest (ScriptSelector) + LibraryTreeList.typeKeys("<down>") + ScriptList.typeKeys("<down>") + '/// Cancel Dialog 'MacroSelector' ///' + ScriptSelector.cancel + '/// click button 'Remove Macro' ///' + Kontext "TabCustomizeEvents" + RemoveMacro.Click + WaitSlot() + '/// Press Button 'Reset' ///' + ResetBtn.click + '/// cancel dialog 'Customize' ///' + Kontext "TabCustomizeEvents" + TabCustomizeEvents.cancel + endif + + '/// close application ///' + Call hCloseDocument +endcase + diff --git a/testautomation/global/required/includes/g_numberformatter1.inc b/testautomation/global/required/includes/g_numberformatter1.inc new file mode 100644 index 000000000000..6eb8191c4367 --- /dev/null +++ b/testautomation/global/required/includes/g_numberformatter1.inc @@ -0,0 +1,797 @@ +'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 : wolfram.garten@sun.com +'* +'* short description : update and resouce test for numberformatter +'* +'************************************************************************ +'* +'#1 tNumberformatterGetLanguage +'#1 sNumberformatterPreconditions +'#1 sNumberformatterOpenDialog +'#1 tNumberformatterPre +'#1 tNumberformatter +'#1 tUserDefinedNumberformatter +'#1 tButtonsNumberformatter +'* +'\*********************************************************************** + +'///Setting Variables.. + + dim sSeperatorCurr as string ' which kind of Separator is used + dim iCategoryCount as integer ' number of Category entries + dim sCategoryText as string ' names of Category entries + dim sFormatText as string ' variable for format string text + dim sFormatCode as string ' variable for format code text line + dim iLanguageCount as integer ' number of language entries + dim sLanguageText as string ' name sof language entries + dim iCount as integer ' count variable for/next + dim sCell as string ' Cell-Content + +'------------------------------------------------------------------------------- + +'///Setting Preconditions for tests +sub sNumberformatterPreconditions + + printlog "Setting up some preconditions for starting the testcases now.." + + select case gApplication + case "WRITER" : + '/// Case Writer: + Kontext "DocumentWriter" + printlog "Application is " & gApplication + '/// Press CTRL+F12 to insert via shortcut a table + DocumentWriter.TypeKeys "<MOD1 F12>", true + Kontext "TabelleEinfuegenWriter" + '/// Leave the insert table dialog with OK + TabelleEinfuegenWriter.OK + printlog "Table inserted" + Kontext "DocumentWriter" + '/// Type 0 in the first cell + DocumentWriter.TypeKeys "0", true + Call sNumberformatterOpenDialog 'opening Dialog + + case "CALC" : + '/// Case Calc: + '/// Calc with Chart in inplace mode: + Kontext "DokumentChart" + if DokumentChart.Exists(1) then + printlog "Application is " & gApplication & " with inserted Chart." + DokumentChart.TypeKeys "<TAB>",2,true 'selecting data serie + '/// Opening Number Formatter Dialog using Menu + DokumentChart.UseMenu + hMenuSelectNr(5) + hMenuSelectNr(1) + Kontext + '/// Selecting correct Tab page + active.SetPage TabDataSeriesLabels + Kontext "TabDataSeriesLabels" + AsPercentage.Check + PercentageFormat.Click + Kontext "TabChartAxisNumbers" + Sourceformat.uncheck + '/// fLocaleString function gets English from t_locale_strings1.inc + Language.Select (fLocaleString ("LocaleNumFormLanEng")) + + else + '/// Calc without Chart: + Kontext "DocumentCalc" 'just Calc without Chart + printlog "Application is " & gApplication + '/// Inserting 0 in first cell + DocumentCalc.TypeKeys "0", true + DocumentCalc.TypeKeys "<RETURN>", true + DocumentCalc.TypeKeys "<UP>", true + Call sNumberformatterOpenDialog 'opening Dialog + endif + + case else : warnlog "This testcase can only be tested in Writer,Calc or Chart!" + end select +end sub + +'------------------------------------------------------------------------------- + +sub sNumberformatterOpenDialog + +select case gApplication + case "WRITER" : + '/// Case Writer: + Kontext "DocumentWriter" + '///Open Context Menu + DocumentWriter.TypeKeys "<SHIFT F10>", true + sleep (1) + '///Open Number Formatter + DocumentWriter.TypeKeys "<DOWN>",11, true + sleep (1) + DocumentWriter.TypeKeys "<RETURN>", true + sleep (1) + printlog "Opening number formatter dialog." + Kontext "TabChartAxisNumbers" + Language.Select (fLocaleString ("LocaleNumFormLanEng")) + + case "CALC" : + '/// Calc with Chart in inplace mode + Kontext "DokumentChart" + if DokumentChart.Exists(1) then + printlog "Application is " & gApplication & " with inserted Chart." + '/// Opening Numberformatter using menu + DocumentCalc.TypeKeys "<TAB>",2,true 'selecting data serie + DocumentCalc.UseMenu + hMenuSelectNr(5) + hMenuSelectNr(1) + Kontext "TabDataSeriesLabels" + AsPercentage.Check + PercentageFormat.Click + Kontext "TabChartAxisNumbers" + Sourceformat.uncheck + Language.Select (fLocaleString ("LocaleNumFormLanEng")) + + else + '/// Calc + Kontext "DocumentCalc" + '///Open Context Menu + DocumentCalc.TypeKeys "<SHIFT F10>", true + '///Open Number Format + DocumentCalc.TypeKeys "<DOWN>",3, true + DocumentCalc.TypeKeys "<RETURN>", true + Kontext + Active.SetPage TabChartAxisNumbers + printlog "Opening number formatter dialog." + Kontext "TabChartAxisNumbers" + '/// fLocaleString function gets English from t_locale_strings1.inc + Language.Select (fLocaleString ("LocaleNumFormLanEng")) + endif + + case else : warnlog "This testcase can only be tested in Writer and Calc!" + end select +end sub + +'------------------------------------------------------------------------------ + +testcase tNumberformatterPre + '/// Setting some preconditions for the testcases: + '/// Setting Measuring to cm by calling fSetMeasurementToCM + Call fSetMeasurementToCM + + '///Getting the decimal separator with GetDecimalSeperator + printlog "looking for used Separator..." + sSeperatorCurr = GetDecimalSeperator +endcase + +'------------------------------------------------------------------------------ + +testcase tNumberformatter + + + 'This part is only for testing a testrun with Chart and can be deleted when checked in!!! + 'Call hNewDocument + 'DocumentCalc.UseMenu + 'hMenuSelectNr(4) + 'hMenuSelectNr(17) + 'hMenuSelectNr(1) + 'Kontext "OLEObjektInsert" + 'OLEObjektInsert.OK + 'printlog "Chart inserted" + 'Kontext "DokumentChart" + + 'Check this one out if above is checked in: + '/// Calling new document + Call hNewDocument + + '/// Calling Subroutine for getting preconditions + Call sNumberformatterPreconditions + + Kontext "TabChartAxisNumbers" + '/// Checking if Category entries in dialog are correct + iCategoryCount = Category.GetItemCount + '/// In the Category section list box 11 entries should be available. + if iCategoryCount = 11 then + printlog "All 11 entries present." + else + warnlog "Warning: Only " & iCategoryCount & " listed!" + endif + + 'Checking if listbox comes up when switching category to Currency + '/// Select Currency in the Category section list box (entry 5) + Category.Select(5) + '/// In the Format section + '/// A drop down list box should be visible + if FormatCurrency.IsVisible then + printlog "FormatCurrency available" + else + warnlog "Drop Down listbox did not come up" + endif + + 'Checking if ZahlenFormat fits to selected Category + '/// The content should match to the category currency + FormatString.Select(1) 'selecting entry + sFormatText = FormatString.GetSelText 'getting text into variable + 'comparing + '/// Comparing with given value "-$1,234" + if sFormatText = "-$1,234" then + printlog "Text fitting to Format: " & sFormatText + else + warnlog "Text not fitting to Format: " & sFormatText + endif + + '/// Select Percent in the Category section list box + Category.Select(4) + + '/// In the Format section + '/// No drop down list box should be visible + 'Checking if NO listbox comes up when switching category to Percent + if FormatCurrency.IsVisible then + warnlog "FormatCurrency should not be available!" + else + printlog "Drop Down listbox did not come up." + endif + + '/// The content should match to the category percent + 'Checking if ZahlenFormat fits to selected Category + FormatString.Select(1) + sFormatText = FormatString.GetSelText + if sFormatText = "-13%" then + printlog "Text fitting to Format, " & sFormatText + else + warnlog "Text not fitting to Format: " & sFormatText + endif + + '/// Set the category to All + Category.Select(1) + + '/// Choose a language Lithuanian from the drop down list box for Language + Language.Select (fLocaleString ("LocaleNumFormLanLith")) + + '/// In the Category list box the entry should Number should be selected + sCategoryText = Category.GetSelIndex + if sCategoryText = 3 then '3 = number entry in Category + printlog sCategoryText & " is selected." + else + warnlog "Wrong entry selected:" & sCategoryText & "!" + endif + + '/// In the Format list box + '/// the entry Bendras should be selected + sFormatText = FormatString.GetSelText + if sFormatText = "Bendras" then + printlog sFormatText & " is selected." + else + warnlog "Wrong entry in Format box selected: " & sformatText & "!" + endif + + '/// Select the entry -1,234 (or -1.234 depending on the locale used) + FormatString.Select(4) + + '/// Does the checkbox Thousands separator get taged ? + if ThousandsSeparator.IsChecked then + printlog "Thousands Separator checked." + else + warnlog "Warning! Thousands Separator does not get checked!" + endif + + '/// Changed the format code to #,##0 (or #.##0) ? + sFormatCode = FormatCode.GetText + if sFormatCode = "#.##0" then + sFormatCode = "#,##0" + printlog "FormatCode changed to " & sFormatCode & "." + else + sFormatCode = "#.##0" + printlog "FormatCode changed to " & sFormatCode & "." + endif + + '/// Set the Language back to Default (English (USA) and choose the category Currency. + '/// Gets the string "English" from t_locale_Strings1.inc in the correct language and sets the + '/// language box to it + Language.Select (fLocaleString ("LocaleNumFormLanEng")) + printlog "Language set to Default." + Category.Select (5) + '/// Category set to Currency + printlog "Category set to Currency." + + '/// Is the fourth entry in the format string box selected ? + if FormatString.GetSelIndex = 4 then + printlog "Fourth entry selected, good." + else + warnlog "Warning! Not the fourth entry selected!" + endif + + '/// Does the Decimal Places Spinfield change to 2? + if DecimalPlaces.GetText = "2" then + printlog "Decimal places = 2, good." + else + warnlog "Warning: Decimal places is not 2!" + endif + + '/// are the check boxes Negative numbers red and Thousands separator tagged ? + if NegativNumbersRed.IsChecked then + printlog "Negative numbers red is checked." + else + warnlog "Warning: Negative numbers red is NOT checked!" + endif + + if ThousandsSeparator.IsChecked then + printlog "ThousandsSeparator is checked." + else + warnlog "Warning: ThousandsSeparator is NOT checked!" + endif + + '/// Change the Language field under Format to $ English (USA) if it is not set to this value yet. + if FormatCurrency.GetSelText = "$ " & (fLocaleString ("LocaleNumFormLanEng")) then + printlog "Format already set to English." + else + printlog "Setting Format to English..." + '/// Getting correct L10N string from global/t_local_strings1.inc + FormatCurrency.Select "$ " & (fLocaleString ("LocaleNumFormLanEng")) + endif + + '/// Compares the Format String match this one : [$$-409]#,##0.00;[RED]-[$$-409]#,##0.00 + sFormatCode = FormatCode.GetText + if sFormatCode = "[$$-409]#,##0.00;[RED]-[$$-409]#,##0.00" then + printlog "Format Code is correct: " & sFormatCode + else + warnlog "Format Code wrong: " & sFormatCode & "!" + endif + + '/// Change the Language Dropdown list box to show Dutch (Netherlands). + printlog "Selecting Dutch..." + Language.Select (fLocaleString ("LocaleNumFormLanDutch")) + + '/// Has the content of the format Listbox changed to show also Euro and Netherlands old fl currency values ? + FormatString.Select (15) + sFormatText = FormatString.GetSelText + '/// Checking for the string "fl 1.234-" + if sFormatText = "fl 1.234-" then + printlog "Format String also shows " & sFormatText + else + warnlog "Format String does not show fl 1.234- but " & sFormatText + endif + + '/// Reset the language to Default and change the Category to Date + Language.Select (fLocaleString ("LocaleNumFormLanEng")) + printlog "Language set to English." + Category.Select (6) + printlog "Category set to Currency." + + '/// Checking if the Options Decimal places, leading zeroes, negative numnbers red, + '/// thousands seperator and so on are disabled ? + if DecimalPlaces.isEnabled = False AND LeadingZeroes.isEnabled = False AND NegativNumbersRed.isEnabled = False AND ThousandsSeparator.isEnabled = False then + printlog "Options disabled." + else + warnlog "Not all options disabled!" + endif + + '/// Checking the Date formats in the format section ? + sFormatText = FormatString.GetSelText + if sFormatText = "12/31/99" then + printlog "Format is correctly set to Date, " & sFormatText + else + warnlog "Format NOT correct: " & sFormatText + endif + + '/// Change the Category to Time. Does the Format List box show time formats ? + Category.Select (7) + printlog "Category Time selected." + FormatString.Select(1) + sFormatText = FormatString.GetSelText + if sFormatText = "13:37" then + printlog "Format is correctly set to time, " & sFormatText + else + warnlog "Format NOT correct: " & sFormatText + endif + + '/// Change the Category to Scientific. Are there two formats shown ? + Category.Select (8) + printlog "Category Scientific selected." + sFormatText = FormatString.GetSelText + if FormatString.GetSelText = "-1.23E+003" then + printlog "Format is correctly set to Scientific, " & sFormatText + else + warnlog "Format NOT correct: " & sFormatText + endif + + '/// Change to the Category Fraction. Are there Fraction formats shown ? + Category.Select (9) + printlog "Category Fraction selected." + sFormatText = FormatString.GetSelText + if sFormatText = "-1234 1/8" then + printlog "Format is correctly set to Fraction, " & sFormatText + else + warnlog "Format NOT correct: " & sFormatText + endif + + '/// Change to Boolean Value. Is there one entry showing in the format section saying TRUE ? + Category.Select (10) + printlog "Category Boolean Value selected." + if FormatString.GetSelText = "TRUE" then + printlog "Format is correctly set to Boolean Value." + else + warnlog "Format NOT correct!" + endif + + '/// Change to Category Text. Is there an @-sign shown in the Format section ? + Category.Select (11) + printlog "Category Text selected." + if FormatString.GetSelText = "@" then + printlog "Format is correctly set to Text." + else + warnlog "Format NOT correct!" + endif + + '/// Closing Number Formatter Dialog + printlog "Closing number formatter dialog..." + if TabChartAxisNumbers.exists(1) then + TabChartAxisNumbers.Cancel + else + printlog "No dialog left, ok." + endif + + '/// Closing Data Series Dialog + Kontext "TabDataSeriesLabels" + printlog "Closing data series dialog..." + if TabDataSeriesLabels.exists(1) then + TabDataSeriesLabels.Cancel + else + printlog "No dialog left, ok." + endif + '/// Closing document + Call hCloseDocument +endcase + +'------------------------------------------------------------------------------- + +testcase tUserDefinedNumberformatter + '/// Open an new doc for writer and calc + '/// for chart this should be disabled + Call hNewDocument 'opening new doc + + '/// Start with the step 2. under preconditions + Call sNumberformatterPreconditions '/Calling Subroutine for getting preconditions + + '/// Change to Category User-defined + Kontext "TabChartAxisNumbers" + Language.Select (fLocaleString ("LocaleNumFormLanEng")) + Category.Select(2) + printlog "Selecting Category user-defined." + + if AddButton.IsEnabled then + warnlog "Button should be disabled!" + else + printlog "Button disabled before typing, good." + endif + + '/// Enter the following Format string into the Format code line : [~jewish]yyyy-mm-dd and click on the green confirmation hook. + FormatCode.SetText "[~jewish]yyyy-mm-dd" + printlog "Entering text in Format Code line..." + + '/// Did this Icon change from grey to green as you began typing ? + if AddButton.IsEnabled then + AddButton.Click + printlog "Add Button clicked." + else + warnlog "AddButton is not enabled." + endif + + '/// Changed the Category from User-defined to Date ? + if Category.GetSelIndex = 6 then + printlog "Category changed to Date, correct." + else + warnlog "Category must change to Date." + endif + + '/// Changed the Format Preview from 05/18/03 to 5663-02-21 ? + QAErrorLog "#i84085#-Number formatter: Preview box cannot be accessed by testool" + + '/// Change back to User-defined and select the Format entered previously. + Category.Select(2) + printlog "Changed to User-defined." + FormatString.Select(1) + 'qaerrorlog "#i83551#-Bad focus behaviour in number formatter dialog." + '/// Click on the little note button next to the format code line. Can you enter a comment now into a newly visible line under the format code line ? + EditCommentButton.Click + if Comment.IsEnabled then + printlog "Comment Field made writable." + Comment.SetText "Test-Text" + else + warnlog "Comment Field not made writable!" + endif + + '/// Can you close this line by hitting the note button again and is the comment kept ? + EditCommentButton.Click + + '/// Is the third Icon in the Format Code line (the X) colored Red ? + if RemoveButton.IsEnabled then + printlog "Remove button is active." + else + warnlog "Remove button not active!" + endif + + '/// Click on the Red X-Icon. Did the Category change to Date and the Format to the default one for the given locale (the third one from top for Englisch (USA)) ? + RemoveButton.Click + '/// Change back to the User-defined category. Is the previously created Number format still available ? + Category.Select(2) + + '/// Closing Number Formatter Dialog + printlog "Closing number formatter dialog..." + if TabChartAxisNumbers.exists(1) then + TabChartAxisNumbers.Cancel + else + printlog "No dialog left, ok." + endif + + '/// Closing Data Series Dialog + Kontext "TabDataSeriesLabels" + printlog "Closing data series dialog..." + if TabDataSeriesLabels.exists(1) then + TabDataSeriesLabels.Cancel + else + printlog "No dialog left, ok." + endif + '/// Closing Document + Call hCloseDocument +endcase + +'------------------------------------------------------------------------------- + +testcase tButtonsNumberformatter + printlog "Testing some buttons now..." + '/// Opening new document + Call hNewDocument 'opening new doc + printlog "Setting some preconditions" + Call sNumberformatterPreconditions '/Calling Subroutine for getting preconditions + '/// Number format opened + Kontext "TabChartAxisNumbers" + '/// Change to Category Date + Category.Select (6) + printlog "Changing to date..." + + '/// Click on Cancel. Does the Number formatter dialog get closed ? + TabChartAxisNumbers.Cancel 'canceling Dialog + if TabChartAxisNumbers.Exists(1) then + warnlog "Dialog should have been closed now." + else + printlog "Ok, Dialog closed." + endif + + '/// Open the Number formatter dialog again. Press the ESC key on the Keyboard. Does the dialog close ? + Call sNumberformatterOpenDialog 'opening Dialog + printlog "testing closing with ESC." + Kontext "TabChartAxisNumbers" + if TabChartAxisNumbers.Exists(1) then + printlog "Dialog should be open now." + else + warnlog "Warning, Dialog not opened." + endif + Kontext "TabChartAxisNumbers" + TabChartAxisNumbers.TypeKeys "<ESCAPE>", true 'using Escape to close the Dialog + sleep (1) + if TabchartAxisNumbers.Exists(1) then + warnlog "ESC should have closed the dialog..." + else + printlog "Fine, Dialog closed." + endif + + '/// Open the Number formatter dialog again. Change to Category Date. Click on Ok. + '/// Does the dialog close and shows the cell you have formatted the date 12/30/99 ? + Call sNumberformatterOpenDialog 'opening Dialog + printlog "Assigning date.." + Kontext "TabChartAxisNumbers" + Category.Select (6) 'category date + TabChartAxisNumbers.OK 'closing dialog + if TabChartAxisNumbers.Exists(1) then 'checking if dialog is closed + warnlog "OK should have closed the dialog..." + else + printlog "Fine, Dialog closed with ok." + endif + + select case gApplication 'opening Dialog again + case "WRITER" :Kontext "DocumentWriter" + EditSelectAll + case "CALC" :Kontext "DocumentCalc" + case "CHART" :printlog "Chart" + case else :warnlog "This onyl runs in Writer and Calc!" + exit sub + end select + + EditCopy 'getting content into clipboard + '/// Copying for comparing the content + sleep(2) + sCell = GetClipboardtext 'clipboard into variable + if sCell = "12/30/99" then + printlog "Cell is formattted correctly, " & sCell + else + warnlog "Formatting is wrong: " & sCell + endif + + select case gApplication 'for selection in Writer, different context menu + case "WRITER" :Kontext "DocumentWriter" + DocumentWriter.TypeKeys "<ESCAPE>" 'deselecting + case "CALC" :Kontext "DocumentCalc" + case "CHART" :printlog "Chart" + case else :warnlog "This onyl runs in Writer and Calc!" + exit sub + end select + + '/// Open the Number formatter dialog again. Change to Category Time. Press the RETURN Key. + '/// Does the dialog close and shows the cell you have formatted the time 12:00:00 AM ? + Call sNumberformatterOpenDialog 'opening Dialog + Kontext "TabChartAxisNumbers" + Category.Select (7) 'selecting Time + TabChartAxisNumbers.TypeKeys "<RETURN>", true + if TabChartAxisNumbers.Exists(1) then + warnlog "Return should have closed the dialog..." + else + printlog "Fine, Dialog closed with ok." + endif + + '/// Select case gApplication for selection in Writer, selecting to get content into clipboard + select case gApplication 'opening Dialog again + case "WRITER" :Kontext "DocumentWriter" + EditSelectAll + case "CALC" :Kontext "DocumentCalc" + case "CHART" :printlog "Chart" + case else :warnlog "This onyl runs in Writer and Calc!" + exit sub + end select + + EditCopy + '/// Getting content into clipboard to compare + sleep(2) + sCell = GetClipboardtext 'clipboard into variable + if sCell = "12:00:00 AM" then + printlog "Cell is formattted correctly: " & sCell + else + warnlog "Formatting is wrong: " & sCell + endif + + '/// Open the Number formatter dialog again. Change to Category Percent. + '/// The Format area shows Percent formats. Click on the Reset Button. Does the Category changes back to Time ? + + 'Resetting status for getting correct context menu + select case gApplication 'for selection in Writer, different context menu + case "WRITER" :Kontext "DocumentWriter" + DocumentWriter.TypeKeys "<ESCAPE>" 'deselecting + case "CALC" :Kontext "DocumentCalc" + case "CHART" :printlog "Chart" + case else :warnlog "This onyl runs in Writer and Calc!" + exit sub + end select + + Call sNumberformatterOpenDialog 'opening Dialog + Kontext "TabChartAxisNumbers" + Category.Select (4) 'selecting percent + printlog "Selecting percent." + FormatString.Select (1) + sFormatText = FormatString.GetSelText + if sFormatText = "-13%" then 'checking if Percent is set in format box + printlog "Fine, switched to percent, " & sFormatText + else + warnlog "Format Box shows wrong value, " & sFormatText + endif + if gApplication ="CALC" then 'checking Application for using Reset button + Zurueck.Click + if Category.GetSelIndex = 7.then + printlog "Reset to Time." + else + warnlog "Reset did not succeed!" + endif + else + Category.Select (7) 'setting the Category for other Application + endif + + TabChartAxisNumbers.OK 'closing dialog + printlog "Dialog closed." + + '/// Open the Number formatter dialog again. Change to Category Percent. + '/// The Format area shows Percent formats. Press the Keys ALT+R . Does the Category changes back to Time ? + Call sNumberformatterOpenDialog 'opening Dialog + Kontext "TabChartAxisNumbers" + Category.Select (4) 'selecting percent + FormatString.Select (1) + sFormatText = FormatString.GetSelText + if sFormatText = "-13%" then 'checking entry of Format box + printlog "Fine, switched to percent, " & sFormatText + else + warnlog "Format Box shows wrong value: " & sFormatText + endif + + if gApplication = "CALC" then + TabChartAxisNumbers.TypeKeys "<MOD2 R>", true 'using ALT+R to reset back from percent to time + if Category.GetSelIndex = 7 then + printlog "ALT-R changed back to Time." + else + warnlog "ALT-R did not change Category back to time." + endif + else + Category.Select (7) 'setting back to Time manually, no Reset button + endif + if TabChartAxisNumbers.Exists(1) then + TabChartAxisNumbers.Cancel + else + printlog "No dialog left, ok." + endif + + '///Closing Number Formatter Dialog + printlog "Closing number formatter dialog..." + if TabChartAxisNumbers.exists(1) then + TabChartAxisNumbers.Cancel + else + printlog "No dialog left, ok." + endif + + '///Closing Data Series Dialog + Kontext "TabDataSeriesLabels" + printlog "Closing data series dialog..." + if TabDataSeriesLabels.exists(1) then + TabDataSeriesLabels.Cancel + else + printlog "No dialog left, ok." + endif + Call hCloseDocument +endcase +' +'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ +' +sub sNumberformatterGetLanguage + +'/// When adapting the test for a new language you will need this script to get the names out of the language dropdown box +'/// This routine is to be run isloated from the rest, the found languages from the dropdownbox willbe written into +'/// The result file. Simply copy'n'paste the needed words into global/tools/inc/t_locale_strings1.inc +'/// The test needs to be run once after the office has bben set to the needed language +'/// This sub routine is only for getting a list of the used languages out of the Numberformatter/Language. +'/// The list depends upon the used locale and is written into the result file +'/// This is not part of the normal test run. This is for getting new languages into t_locale_strings1.inc + + Call hNewDocument 'new doc + Kontext "DocumentWriter" + '///Insert a table/// + DocumentWriter.TypeKeys "<MOD1 F12>", true + Kontext "TabelleEinfuegenWriter" + TabelleEinfuegenWriter.OK 'insert table + printlog "Table inserted" + Kontext "DocumentWriter" + DocumentWriter.TypeKeys "0", true 'insert value + Kontext "DocumentWriter" + '///Open Context Menu/// + DocumentWriter.TypeKeys "<SHIFT F10>", true 'Context menu + '///Open Number Format/// + DocumentWriter.TypeKeys "<DOWN>",11, true + DocumentWriter.TypeKeys "<RETURN>", true + printlog "Opening number formatter dialog." + Kontext "TabChartAxisNumbers" + + iLanguageCount = Language.GetItemCount 'getting number of entries + for iCount = 1 to iLanguageCount + Language.Select (iCount) + sLanguageText = Language.GetSelText + printlog sLanguageText 'printing entries + next iCount + + TabChartAxisNumbers.Close 'closing dialog + Call hCloseDocument +end sub + +'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ diff --git a/testautomation/global/required/includes/g_option.inc b/testautomation/global/required/includes/g_option.inc new file mode 100644 index 000000000000..3ff884d6be57 --- /dev/null +++ b/testautomation/global/required/includes/g_option.inc @@ -0,0 +1,852 @@ +'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 : update and resouce test for all option pages (at tools/options) +'* +'\*********************************************************************** + +global sErrMes as String +global iSectionNumber as Integer + +sub tToolsOptionsTest + ' To prevent users from running just a subsection from this file, without THIS + ' subroutine, in every subsection the value of 'iSectionNumber' is checked. + ' The test will exit with warnlog, if iSectionNumber is 0 + sErrMes = "" + select case uCase(gApplication) + case "WRITER","MASTERDOCUMENT","HTML" : iSectionNumber = 8 + case "IMPRESS","DRAW","MATH","CALC" : iSectionNumber = 7 + end select + ' common testcases are placed in this library + ' these tab-sets are always available: + Call tToolsOptionsStarOffice + Call tToolsOptionsLoadSave + Call tToolsOptionsLanguageSettings + Call tToolsOptionsDataSources + Call tToolsOptionsChart + Call tToolsOptionsInternet + Call tToolsOptionsImprovementProgram +end sub + +'------------------------------------------------------------------------- + +testcase tToolsOptionsStarOffice + + dim EchteAnzahl as Integer, i as Integer + dim gefunden as Boolean, bSave as Boolean + dim iMenuShould as integer + '/// We have 12 tab pages in this category. If the <i>central configuration</i> feature is being used 13 (<i>Single SignOn</i>) + '/// <i>Tools</i> / <i>Options</i> / <i>OpenOffice.org</i> + PrintLog "- Tools/Options/StarOffice ( Extras/Optionen/StarOffice )" + if (0 = iSectionNumber) then + warnlog "You can't run this testcase seperated! Ending now! Please run it via: tToolsOptionsTest" + goto endsub + endif + + if ( gApplication = "BACKGROUND" ) then + ' Do not open any document + else + Call hNewDocument + endif + + ToolsOptions + ToPosInOptionlist ( 1 ) + Kontext "ExtrasOptionenDlg" + EchteAnzahl = Optionsliste.GetItemCount - iSectionNumber + iMenuShould = 14 + + if EchteAnzahl <> iMenuShould then + if ((gtplatform = "sol") OR (gtplatform = "x86") OR gOOO) AND EchteAnzahl = 12 then + printLog "One Tabpage is missing. This is ok for a patched Solaris (sparc and x86) or OOo installation." + else + Warnlog "The number of entries is not " + iMenuShould + "! => the current number is " + EchteAnzahl + endif + endif + + Kontext "Active" + try + if Active.Exists then Active.OK + catch + if Active.Exists then Active.No + endcatch + + for i=1 to EchteAnzahl + gefunden = FALSE + Kontext "OptionenDlg" + Optionsliste.TypeKeys "<Down>" + select case i + case 1 : + Kontext "TabAllgemeines" + '///+<ul><li>User data</li> + printlog " - Userdata / Benutzerdaten" + if TabAllgemeines.IsVisible then + gefunden = TRUE + Call DialogTest ( TabAllgemeines ) + endif + case 2 : + Kontext "TabSonstigesAllgemein" + '///+<li>General</li> + printlog " - General / Allgemein" + if TabSonstigesAllgemein.IsVisible then + gefunden = TRUE + Call DialogTest ( TabSonstigesAllgemein ) + endif + case 3 : + Kontext "TabMemory" + '///+<li>Memory</li> + printlog " - Memory / Arbeitsspeicher" + if TabMemory.IsVisible then + gefunden = TRUE + Call DialogTest ( TabMemory ) + endif + case 4 : + Kontext "TabAnsichtAllgemein" + '///+<li>View</li> + printlog " - View / Ansicht" + if TabAnsichtAllgemein.IsVisible then + gefunden = TRUE + Call DialogTest ( TabAnsichtAllgemein ) + endif + case 5 : + Kontext "TabPrintStarOffice" + '///+<li>Print</li> + printlog " - Print / Drucken" + if TabPrintStarOffice.IsVisible then + gefunden = TRUE + Call DialogTest ( TabPrintStarOffice ) + endif + case 6 : + Kontext "TabPfade" + '///+<li>Paths + '///+ <ul><li>Click <i>edit</i> to all list entries and then close the file dialog</li></ul></li> + printlog " - Paths / Pfade" + if TabPfade.IsVisible then + gefunden = TRUE + Call DialogTest ( TabPfade ) + Call DialogeFuerTypenKontrollieren + endif + case 7 : + Kontext "TabFarben" + '///+<li>Colors + '///+<ul><li>Click on <i>Add</i></li> + '///+<li>Click <i>OK</i> on message box</li> + '///+<li>Click <i>cancel> on <i>Name</i> dialog</li> + '///+<li>Click on <i>Edit</i></li> + '///+<li>Click on <i>Close</i> in <i>Colors</i> dialog</li></ul></li> + printlog " - Color / Farben" + if ( TabFarben.exists( 4 ) ) then + if TabFarben.IsVisible then + gefunden = TRUE + Call DialogTest (TabFarben) + Farbe.Select(1) + Hinzufuegen.Click + Kontext "Active" + Active.OK + Kontext "NameDlg" + Call DialogTest (NameDlg) + NameDlg.Cancel + Kontext "TabFarben" + Bearbeiten.Click + WaitSlot( 3000 ) + Kontext "FarbeDlg" + FarbeDlg.Cancel + endif + endif + case 8 : + Kontext "TabSchriftErsetzung" + '///+<li>Font replacement</li> + printlog " - Font Replacement / Schriftersetzung" + if TabSchriftErsetzung.IsVisible then + gefunden = TRUE + Call DialogTest ( TabSchriftErsetzung ) + endif + case 9: + Kontext "TabSecurity" + '///+<li>Security</li> + printlog " - Security / Sicherheit" + if TabSecurity.IsVisible then + gefunden = TRUE + Call DialogTest ( TabSecurity ) + MacroSecurity.click() + + kontext "TabSecurityLevel" + if ( TabSecurityLevel.exists( 2 ) ) then + call DialogTest( TabSecurityLevel ) + kontext + active.setpage TabTrustedSources + kontext "TabTrustedSources" + call DialogTest( TabTrustedSources ) + TabTrustedSources.cancel + else + warnlog( "Macro Security Options dialog is missing" ) + qaerrorlog( "#i45295# or office built without mozilla support" ) + endif + + Kontext "TabSecurity" + if Protect.isEnabled then + Protect.click() + Kontext "PasswordDLG" + call DialogTest( PasswordDLG ) + PasswordDLG.cancel() + else + select case uCase(gApplication) + case "WRITER","MASTERDOCUMENT" + WarnLog "Protect-Button is disabled." + case "MATH","IMPRESS","DRAW","HTML","CALC" + PrintLog "Protect-Button is disabled." + end select + endif + + Kontext "TabSecurity" + if ( TabSecurity.exists( 1 ) ) then + Options.click + Kontext "TabSecurityOptionsAndWarnings" + Call DialogTest(TabSecurityOptionsAndWarnings) + TabSecurityOptionsAndWarnings.cancel + else + warnlog( "Tabsecurity did not open" ) + endif + + endif + case 10: + Kontext "TabAppearance" + '///+<li>Appearance</li> + printlog " - Appearance / Aussehen" + if TabAppearance.IsVisible then + gefunden = TRUE + Call DialogTest ( TabAppearance ) + endif + case 11: + Kontext "TabAccessibility" + '///+<li>Accessibility</li> + printlog " - Accessibility" + if TabAccessibility.IsVisible then + gefunden = TRUE + Call DialogTest ( TabAccessibility ) + endif + case 12: + Kontext "TabJava" + '///+<li>Java</li></ul> + printlog " - Java" + if TabJava.IsVisible then + gefunden = TRUE + Call DialogTest ( TabJava ) + endif + if useJava.isChecked then + Add.click + Kontext "OeffnenDlg" + if ( OeffnenDlg.exists( 1 ) ) then + OeffnenDlg.Cancel + else + warnlog( "OeffnenDlg is missing" ) + endif + Kontext "TabJava" + Parameters.click + Kontext "JavaStartParameter" + Call DialogTest ( JavaStartParameter ) + JavaStartParameter.cancel + Kontext "TabJava" + ClassPath.click + Kontext "JavaClassPath" + Call DialogTest ( JavaClassPath ) + JavaClassPath.cancel + else + printlog "Use Java is disabled." + endif + case 13: + kontext "TabOnlineUpdate" + '///+<li>Online update</li> + printlog " - Online update" + if TabOnlineUpdate.isVisible then + gefunden = TRUE + Call DialogTest( TabOnlineUpdate ) + endif + 'CheckNow.click + case 14: + Kontext "TabOOoImprovement" + printlog( " - OpenOffice.org Improvement Program" ) + if ( TabOOoImprovement.isVisible() ) then + gefunden = TRUE + Call DialogTest( TabOOoImprovement ) + endif + end select + if ( NOT gefunden ) then + Warnlog "Error with the " & i & ".page, perhaps this page has been deleted or changed its position" + EchteAnzahl = EchteAnzahl - 1 + if EchteAnzahl < 13 then + i=10 + else + i=1-1 + endif + endif + next i + '/// Close the options dialog + Kontext "OptionenDlg" + if ( OptionenDlg.exists( 1 ) ) then + OptionenDlg.Cancel + else + warnlog( "Options Dialog not ready" ) + endif + '/// Close the document + if ( gApplication = "BACKGROUND" ) then + ' We should be on the backing window + else + Call hCloseDocument() + endif + +endcase + +'------------------------------------------------------------------------- + +testcase tToolsOptionsLoadSave + + dim EchteAnzahl as Integer, i as Integer + dim gefunden as Boolean + PrintLog "- Tools/Options/Load Save ( Extras/Optionen/Laden Speichern )" + if (0 = iSectionNumber) then + warnlog "You can't run this testcase seperated! Ending now! Please run it via: tToolsOptionsTest" + goto endsub + endif + if gApplication <> "BACKGROUND" then Call hNewDocument + '/// <i>Tools</i> / <i>Options</i> / <i>Load/Save</i> + ToolsOptions + ToPosInOptionlist (2) + EchteAnzahl = OptionTabPageZaehler (4, FALSE) + for i=1 to EchteAnzahl + gefunden = FALSE + Kontext "OptionenDlg" + Optionsliste.TypeKeys "<Down>" + select case i + case 1 : + Kontext "TabSpeichern" + '///+<ul><li>General</li> + printlog " - General / Save" + if TabSpeichern.IsVisible then + gefunden = TRUE + Call DialogTest ( TabSpeichern ) + endif + case 2 : + Kontext "TabMicrosoftOffice97" + '///+<li>VBA settings</li> + printlog " - VBA Settings / VBA Eigenschaften" + if TabMicrosoftOffice97.IsVisible then + gefunden = TRUE + Call DialogTest ( TabMicrosoftOffice97 ) + endif + case 3 : + Kontext "TabMicrosoftOffice2" + '///+<li>Microsoft Office</li> + printlog " - Microsoft Office" + if TabMicrosoftOffice2.IsVisible then + gefunden = TRUE + Call DialogTest ( TabMicrosoftOffice2 ) + endif + case 4 : + Kontext "TabHTML" + '///+<li>HTML Compatibility</li></ul> + printlog " - HTML Compatibility / HTML Kompatibilitaet" + if TabHTML.IsVisible then + gefunden = TRUE + Call DialogTest ( TabHTML ) + endif + end select + if gefunden=FALSE then + Warnlog "Error with the " + i + ".page, perhaps this page is deleted or change the place!" + EchteAnzahl = EchteAnzahl - 1 + if EchteAnzahl < 5 then + i=11 + else + i=1-1 + endif + endif + next i + '/// Close the options dialog + Kontext "OptionenDlg" + OptionenDlg.Cancel + '/// Close the document + if gApplication <> "BACKGROUND" then + Call hCloseDocument + endif +endcase + +'------------------------------------------------------------------------- + +testcase tToolsOptionsLanguageSettings + + dim EchteAnzahl as Integer, i as Integer, j as Integer + dim gefunden as Boolean + dim bAsianSup as Boolean + + PrintLog "- Tools/Options/Language Settings ( Extras/Optionen/Spracheinstellungen )" + if (0 = iSectionNumber) then + warnlog "You can't run this testcase seperated! Ending now! Please run it via: tToolsOptionsTest" + goto endsub + endif + if gApplication <> "BACKGROUND" then Call hNewDocument + '/// <i>Tools</i> / <i>Options</i> / <i>Language settings</i> + ToolsOptions + ToPosInOptionlist ( 3 ) + EchteAnzahl = Optionsliste.GetItemCount - iSectionNumber + '/// We only have two tab pages in this section: + '///+ <ul><li><i>Languages</i> and <i>Writing Aids</i></li> + '///+<ol><li>In asian languages we have two additional tab pages: + '///+ <ul><li><i>Japanese Find</i> and <i>Asian Layout</i></li></ul></li> + '///+<li>In languages with CTL (<i>Complex Text Layout</i>) there is also one more: + '///+<ul><li><i>Complex Text Layout</i></li></ul></li></ol></li></ul> + select case (EchteAnzahl) + case 2: + printlog "Asian or Complex Text Layout support is not activated (on languages-page)!" + case 3: + printlog "Complex Text Layout support is activated (on languages-page)!" + case 4: + printlog "Asian support is activated (on languages-page)!" + case 5: + if (gAsianSup AND gCTLSup) then + printlog "Asian and Complex Text Layout support is activated (on languages-page)!" + else + Warnlog "There are more than 4 pages!" + endif + case else + Warnlog "There are more than 5 pages!" + end select + Kontext "Active" + try + if Active.Exists then Active.OK + catch + if Active.Exists then Active.No + endcatch + for i=1 to EchteAnzahl + gefunden = FALSE + Kontext "OptionenDlg" + Optionsliste.TypeKeys "<Down>" + select case i + case 1 : + Kontext "TabSprachen" + 'Languages + printlog " - Languages / Sprachen" + if TabSprachen.IsVisible then + gefunden = TRUE + Call DialogTest ( TabSprachen ) + endif + case 2 : + Kontext "TabLinguistik" + printlog " - Writing Aids / Linguistik" + if TabLinguistik.IsVisible then + gefunden = TRUE + Call DialogTest ( TabLinguistik ) + '/// In <i>Writing aids</i> + '///+<ul><li> On <i>modules<i> click <i>edit</i></li> + SprachmoduleBearbeiten.Click + Kontext "ModuleBearbeiten" + Call DialogTest ( ModuleBearbeiten ) + ModuleBearbeiten.Close + '///+<li> close dialog</li></ul> + Kontext "TabLinguistik" + '///+<ul><li>On <i>dictionaries</i> click <i>new</i></li> + '///+<li>close dialog</li></ul> + Neu.Click + Kontext "BenutzerwoerterbuchAnlegen" + Call DialogTest ( BenutzerwoerterbuchAnlegen ) + BenutzerwoerterbuchAnlegen.Cancel + + '///+<ul><li>On <i>dictionaries</i> click <i>edit</i></li> + '///+<li>close dialog</li></ul> + Kontext "TabLinguistik" + for j=1 to 5 + if Bearbeiten.IsEnabled then + Bearbeiten.Click + j=6 + else + Benutzerwoerterbuch.TypeKeys "<Down>" + endif + next j + Kontext "BenutzerwoerterbuchBearbeiten" + if BenutzerwoerterbuchBearbeiten.Exists then + Call DialogTest ( BenutzerwoerterbuchBearbeiten ) + BenutzerwoerterbuchBearbeiten.Close + else + warnlog "Edit the 'user-defined dictionary' is not possible => Bug?" + endif + '/// <i>Options</i> + '///+<ul><li>On 9th, 10th and 11th entry click <i>edit</i></li> + '///+<li>close dialog</li></ul> + Kontext "TabLinguistik" + Optionen.TypeKeys "<PageUp>", 3 + WaitSlot() ' similar effect as a NOOP + Optionen.TypeKeys "<Down>", 6 + WaitSlot() ' similar effect as a NOOP + OptionenBearbeiten.Click + Kontext "SilbentrennungOptionen" + Call DialogTest ( SilbentrennungOptionen ) + SilbentrennungOptionen.Cancel + Kontext "TabLinguistik" + Optionen.TypeKeys "<Down>" + OptionenBearbeiten.Click + Kontext "SilbentrennungOptionen" + Call DialogTest ( SilbentrennungOptionen ) + SilbentrennungOptionen.Cancel + Kontext "TabLinguistik" + Optionen.TypeKeys "<Down>" + OptionenBearbeiten.Click + Kontext "SilbentrennungOptionen" + Call DialogTest ( SilbentrennungOptionen ) + SilbentrennungOptionen.Cancel + endif + case 3,5 : + try + Kontext "TabJapaneseFind" + 'Japanese find + if TabJapaneseFind.IsVisible then + printlog " - Japanese Find / Japanische Suche" + gefunden = TRUE + Call DialogTest ( TabJapaneseFind ) + endif + catch + endcatch + try + Kontext "TabComplexTextLayout" + 'Complex Text Layout + if TabComplexTextLayout.IsVisible then + printlog " - Complex Text Layout" + gefunden = TRUE + Call DialogTest ( TabComplexTextLayout ) + endif + catch + endcatch + case 4 : + Kontext "TabAsianLayoutOptions" + 'Asian layout + printlog " - Asian Layout / Asiatisches Layout" + if TabAsianLayoutOptions.IsVisible then + gefunden = TRUE + Call DialogTest ( TabAsianLayoutOptions ) + endif + end select + if gefunden=FALSE then + Warnlog "Error with the " + i + ".page, perhaps this page is deleted or change the place!" + EchteAnzahl = EchteAnzahl - 1 + if EchteAnzahl < 5 then + i=5 + else + i=1-1 + endif + endif + next i + '/// Close the options dialog + Kontext "OptionenDlg" + OptionenDlg.Cancel + '/// Close the document + if gApplication <> "BACKGROUND" then + Call hCloseDocument + endif +endcase + +'------------------------------------------------------------------------- + +testcase tToolsOptionsInternet + + dim EchteAnzahl as Integer, i as Integer + dim gefunden as Boolean + + PrintLog "- Tools/Options/Internet ( Extras/Optionen/Internet )" + if (0 = iSectionNumber) then + warnlog "You can't run this testcase seperated! Ending now! Please run it via: tToolsOptionsTest" + goto endsub + endif + if gApplication <> "BACKGROUND" then Call hNewDocument + '/// <i>Tools</i> / <i>Options</i> / <i>Internet</i> + ToolsOptions + '/// (The last section in Tools / Options is <i>Internet</i>) + ToPosInOptionlist ( iSectionNumber) + + if gPlatgroup = "w95" OR gPlatform = lcase("osx") then + '/// On MacOS X systems this section includes the tab pages: + '///+<ol><li>Proxy</li> + '///+<li>Search</li> + '///+<li>E-Mai</li></ol> + '/// On Win32 systems this section includes the tab pages: + '///+<ol><li>Proxy</li> + '///+<li>Search</li> + '///+<li>Mozilla Plugin</li></ol> + EchteAnzahl = OptionTabPageZaehler ( 3 , FALSE ) + else + '/// On Unix systems this section includes four tab pages. + '///+<ol><li>Proxy</li> + '///+<li>Search</li> + '///+<li>E-Mail</li> + '///+<li>Mozilla Plugin</li></ol> + EchteAnzahl = OptionTabPageZaehler ( 4 , FALSE ) + endif + + for i=1 to EchteAnzahl + gefunden = FALSE + Kontext "OptionenDlg" + Optionsliste.TypeKeys "<Down>" + + select case i + case 1 : + Kontext "TabProxyServer" + 'Proxy + printlog " - Proxy / Proxy" + if TabProxyServer.IsVisible then + gefunden = TRUE + Call DialogTest ( TabProxyServer ) + endif + case 2 : + Kontext "Active" + 'Search + printlog " - Search / Suche" + if Active.Exists then + sErrMes = Active.GetText + Warnlog "A messagebox exists => BUG : " + sErrMes + Active.OK + endif + Kontext "TabSuche" + if TabSuche.IsVisible then + gefunden = TRUE + Call DialogTest ( TabSuche ) + endif + case 3 : + if gPlatgroup = "unx" then + Kontext "TabEmail" + 'E-mail + printlog " - E-mail" + if TabEmail.IsVisible then + gefunden = TRUE + Call DialogTest ( TabEmail ) + endif + endif + if gPlatgroup = "w95" then + Kontext "TabMozillaPlugin" + 'Mozilla Plug-in (On Win32) + printlog " - Mozilla Plug-in" + if TabMozillaPlugin.IsVisible then + gefunden = TRUE + Call DialogTest ( TabMozillaPlugin ) + endif + endif + case 4 : + if gPlatgroup = "w95" then + warnlog "On Win32 platform there should be only 3 tab pages in section 'Internet'!?" + else + Kontext "TabMozillaPlugin" + printlog " - Mozilla Plug-in" + if TabMozillaPlugin.IsVisible then + gefunden = TRUE + Call DialogTest ( TabMozillaPlugin ) + endif + endif + end select + if gefunden=FALSE then + Warnlog "Error with the " + i + ".page, perhaps this page is deleted or change the place!" + EchteAnzahl = EchteAnzahl - 1 + if EchteAnzahl < 4 then + i=11 + else + i=1-1 + endif + endif + next i + '/// Close the options dialog + Kontext "OptionenDlg" + OptionenDlg.Cancel + '/// Close document + if gApplication <> "BACKGROUND" then + Call hCloseDocument + endif +endcase + +'------------------------------------------------------------------------- + +testcase tToolsOptionsImprovementProgram + + printlog( "Update test for the tools/options dialog of the OOo Improvement Program" ) + + if (gOOO AND NOT gOOoImprovementIsEnabled) then + 'In StarOffice this test should always work - but on OOo contributet builds the function is not available - only on OOo builds provided by Sun Microsystems + qaErrorlog ("This build does not participate in the OOo Improvement Program - test exit") + goto endsub + endif + + dim cLogFile as string + cLogFile = gOfficePath & "user\temp\feedback\Current.csv" + cLogFile = convertpath( cLogFile ) + + dim bImportDialogHasBeenDisplayed as boolean : bImportDialogHasBeenDisplayed = false + + if ( hDeleteFile( cLogFile ) ) then + + printlog( "Test environment is clean, no logfile present (anymore)" ) + + ToolsOptions + hToolsOptions( "StarOffice", "Improvement" ) + printlog( "Improvement Program tabpage" ) + + call DialogTest( TabOOoImprovement ) + + ParticipateNo.check() + ParticipateYes.check() + + if ( ShowData.isEnabled() ) then + + ShowData.click() + + ' Two different IDs for practically the same dialog: FilterAuswahl and TextImport. + ' It depends on the application which one comes up. We just handle them both. + Kontext "FilterAuswahl" + if ( FilterAuswahl.exists( 1 ) ) then + printlog( "FilterAuswahl present" ) + call DialogTest( FilterAuswahl ) + FilterAuswahl.cancel() + bImportDialogHasBeenDisplayed = true + endif + + kontext "TextImport" + if ( TextImport.exists() ) then + printlog( "Text Import dialog present" ) + call DialogTest( TextImport ) + TextImport.cancel() + bImportDialogHasBeenDisplayed = true + endif + else + printlog( "Show data is disabled" ) + endif + + ' Weird messages may appear in any order. We warn about anything + Kontext "Active" + if ( Active.exists( 1 ) ) then + printlog( "Messagebox: " & Active.getText() ) + Active.ok() + else + if ( NOT bImportDialogHasBeenDisplayed ) then + qaerrorlog( "#i97340# Show Data button enabled but no logged data found" ) + endif + endif + + Kontext "Active" + if ( Active.exists( 1 ) ) then + warnlog( "#97342# Second message for missing " & cLogFile ) + Active.ok() + endif + + Kontext "OptionenDlg" + OptionenDlg.cancel() + + else + ' hDeleteFile() returns FALSE if the file is still present for some weird reason + ' We should warn about this because the test breaks at a later point then. + warnlog( "Logfile present, it could not be deleted. Please check path and accessrights" ) + printlog( "Path: " & cLogFile ) + endif + +endcase + +'------------------------------------------------------------------------- + +testcase tToolsOptionsChart + Dim EchteAnzahl as Integer, i as Integer + + PrintLog "- Tools/Options/Chart ( Extras/Optionen/Diagramme )" + if (0 = iSectionNumber) then + warnlog "You can't run this testcase seperated! Ending now! Please run it via: tToolsOptionsTest" + goto endsub + endif +'/// Create a new document + if gApplication <> "BACKGROUND" then + Call hNewDocument + end if +'/// <i>Tools</i> / <i>Options</i> / <i>Chart</i> + ToolsOptions + ToPosInOptionlist ( iSectionNumber -1 ) + EchteAnzahl = OptionTabPageZaehler ( 1, FALSE ) + Kontext "OptionenDlg" + Optionsliste.TypeKeys "<Down>" +'/// Default colors + printlog " - Default Colors / Grundfarben" + Kontext "TabGrundfarben" + Call DialogTest ( TabGrundfarben ) +'/// Close the options dialog + Kontext "OptionenDlg" + OptionenDlg.Cancel + if gApplication <> "BACKGROUND" then +'/// Close bthe document + Call hCloseDocument + end if +endcase + +'------------------------------------------------------------------------- + +testcase tToolsOptionsDataSources + qaerrorlog "#i104508# crashes on quit or reload if this is run." + goto endsub + + Dim EchteAnzahl as Integer, i as Integer + + PrintLog "- Tools/Options/Data Sources ( Extras/Optionen/Datenbank )" + if (0 = iSectionNumber) then + warnlog "You can't run this testcase seperated! Ending now! Please run it via: tToolsOptionsTest" + goto endsub + endif + '/// Create a new document + if gApplication <> "BACKGROUND" then + Call hNewDocument + end if + '/// <i>Tools</i> / <i>Options</i> / <i>Data source</i> + ToolsOptions + ToPosInOptionlist ( iSectionNumber -2) + EchteAnzahl = OptionTabPageZaehler ( 2 , FALSE ) + Kontext "OptionenDlg" + Optionsliste.TypeKeys "<Down>" + printlog " - Connections / Verbindungen" + Kontext "TabConnections" + '/// Connections + Call DialogTest ( TabConnections ) + Kontext "OptionenDlg" + Optionsliste.TypeKeys "<Down>" + printlog " - Databases / Datenbanken" + Kontext "TabRegisteredDatabase" + '/// Databases + Call DialogTest ( TabRegisteredDatabase ) + NewBtn.click + Kontext "CreateDatabaseLink" + call DialogTest( CreateDatabaseLink ) + Browse.click + Kontext "OeffnenDlg" + OeffnenDlg.cancel + Kontext "CreateDatabaseLink" + CreateDatabaseLink.cancel + Kontext "OptionenDlg" + '/// Close the options dialog + OptionenDlg.Cancel + '/// Close the document + if gApplication <> "BACKGROUND" then + Call hCloseDocument + end if +endcase + diff --git a/testautomation/global/required/includes/g_option_application.inc b/testautomation/global/required/includes/g_option_application.inc new file mode 100644 index 000000000000..4fe4a6cb2cad --- /dev/null +++ b/testautomation/global/required/includes/g_option_application.inc @@ -0,0 +1,664 @@ +'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 : update and resouce test for all option pages (at tools/options) +'* +'\*********************************************************************** + +global sErrMes as String +global iSectionNumber as Integer + +sub tToolsOptionsTestFirst + dim sPreviousApplication as string + + sPreviousApplication = gApplication + + ' To prevent users from running just a subsection from this file, without THIS + ' subroutine, in every subsection the value of 'iSectionNumber' is checked. + ' The test will exit with warnlog, if iSectionNumber is 0 + sErrMes = "" + select case gApplication + case "WRITER","MASTERDOCUMENT","HTML" : iSectionNumber = 8 + case "IMPRESS","DRAW","MATH","CALC" : iSectionNumber = 7 + end select + + ' these tabpages only exist in the respective application + gApplication = "WRITER" + iSectionNumber = 8 + Call tToolsOptionsTextDocument + + gApplication = "HTML" + iSectionNumber = 8 + Call tToolsOptionsHTMLDocument + + gApplication = "CALC" + iSectionNumber = 7 + Call tToolsOptionsSpreadsheet + + gApplication = "IMPRESS" + iSectionNumber = 7 + Call tToolsOptionsPresentation + + gApplication = "DRAW" + iSectionNumber = 7 + Call tToolsOptionsDrawing + + gApplication = "MATH" + iSectionNumber = 7 + Call tToolsOptionsFormula + + gApplication = sPreviousApplication +end sub + +'------------------------------------------------------------------------- + +testcase tToolsOptionsTextdocument + dim EchteAnzahl as Integer, i as Integer + dim gefunden as Boolean + + PrintLog "- Tools/Options/Text document ( Extras/Optionen/Textdokument )" + if (0 = iSectionNumber) then + warnlog "You can't run this testcase seperated! Ending now! Please run it via: tToolsOptionsTest" + goto endsub + endif + '/// Create a new document + if gApplication <> "BACKGROUND" then + Call hNewDocument + end if + '/// <i>Tools</i> / <i>Options</i> / <i>Text document</i> + ToolsOptions + Kontext "Active" + if Active.Exists (3) then + if Active.GetText <> sErrMes then Warnlog "A messagebox exists => BUG : " + Active.GetText + Active.OK + end if + ToPosInOptionlist ( 4 ) + EchteAnzahl = Optionsliste.GetItemCount - iSectionNumber + if EchteAnzahl = 10 AND ( gAsianSup = TRUE OR gCTLSup = TRUE ) then + Warnlog "There are only 10 pages in 'text document'-section, but asian support or CTL support are activated! => a section is missing?" + else + printlog "Asian support and CTL support are not activated ( on languages-page )!" + end if + if bDebugVersion = TRUE then EchteAnzahl = EchteAnzahl - 1 + if gAsianSup = FALSE then EchteAnzahl = EchteAnzahl + 1 + if gCTLSup = FALSE then EchteAnzahl = EchteAnzahl + 1 + for i=1 to EchteAnzahl + gefunden = FALSE + Kontext "OptionenDlg" + Optionsliste.TypeKeys "<Down>" + if gAsianSup = FALSE AND gCTLSup = FALSE AND i=6 then i=i+2 + if gAsianSup = FALSE AND gCTLSup = TRUE AND i=6 then i=i+1 + if gAsianSup = TRUE AND gCTLSup = FALSE AND i=7 then i=i+1 + select case i + case 1 : Kontext "TabLaden" + '///+<ul><li>General</li> + printlog " - General / Allgemein" + if TabLaden.IsVisible then + gefunden = TRUE + Call DialogTest ( TabLaden ) + end if + case 2 : Kontext "TabInhalteWriter" + '///+<li>View</li> + printlog " - View / Ansicht" + if TabInhalteWriter.IsVisible then + gefunden = TRUE + Call DialogTest ( TabInhalteWriter ) + end if + case 3 : Kontext "TabDirektCursor" + '///+<li>Formating aids</li> + printlog " - Formating aids / Formatierungshilfen" + if TabDirektCursor.IsVisible then + gefunden = TRUE + Call DialogTest ( TabDirektCursor ) + end if + case 4 : Kontext "TabRaster" + '///+<li>Grid</li> + printlog " - Grid / Raster" + if TabRaster.IsVisible then + gefunden = TRUE + Call DialogTest ( TabRaster ) + end if + case 5 : Kontext "TabGrundschriften" + '///+<li>Default fonts</li> + printlog " - Default Fonts / Grundschriften" + if TabGrundschriften.IsVisible then + gefunden = TRUE + Call DialogTest ( TabGrundschriften ) + end if + case 6 : Kontext "TabGrundschriftenAsian" + '///+<li>Default fonts asian</li> + printlog " - Default Fonts Asian / Grundschriften Asiatisch" + if TabGrundschriftenAsian.IsVisible then + gefunden = TRUE + Call DialogTest ( TabGrundschriftenAsian ) + end if + case 7 : Kontext "TabGrundschriftenCTL" + '///+<li>Default fonts CTL</li> + printlog " - Default Fonts CTL / Grundschriften CTL" + if TabGrundschriftenCTL.IsVisible then + gefunden = TRUE + Call DialogTest ( TabGrundschriftenCTL ) + end if + case 8 : Kontext "TabDruckenWriter" + '///+<li>Print</li> + printlog " - Print / Drucken" + if TabDruckenWriter.IsVisible then + gefunden = TRUE + Call DialogTest ( TabDruckenWriter ) + end if + case 9 : Kontext "TabTabelleOptionen" + '///+<li>Table</li> + printlog " - Table / Tabellen" + if TabTabelleOptionen.IsVisible then + gefunden = TRUE + Call DialogTest ( TabTabelleOptionen ) + end if + case 10: Kontext "TabAenderungenWriter" + '///+<li>Changes</li> + printlog " - Changes / Aenderungen" + if TabAenderungenWriter.IsVisible then + gefunden = TRUE + Call DialogTest ( TabAenderungenWriter ) + end if + case 11: Kontext "TabCompatibility" + '///+<li>Compatibility</li> + printlog " - Compatibility" + if TabCompatibility.IsVisible then + gefunden = TRUE + Call DialogTest ( TabCompatibility ) + end if + case 12: Kontext "TabAutoCaption" + '///+<li>AutoCaption</li> + printlog " - AutoCaption" + if TabAutoCaption.IsVisible then + gefunden = TRUE + Call DialogTest ( TabAutoCaption ) + end if + case 13: Kontext "TabMailMergeEMail" + '///+<li>Mail Merge E-mail</li></ul> + printlog " - Mail Merge E-mail" + if TabMailMergeEMail.IsVisible then + gefunden = TRUE + Call DialogTest ( TabMailMergeEMail ) + ServerAuthentication.click + kontext "ServerAuthentication" + Call DialogTest ( ServerAuthentication ) + ServerAuthentication.cancel + Kontext "TabMailMergeEMail" + TestSettings.click + + ' in case java is not enabled + sleep( 2 ) + try + Kontext "Messagebox" + if ( MessageBox.exists()) then + sleep(2) + warnlog(Messagebox.GetText()) + try + Messagebox.Cancel() + sleep( 2 ) + catch + Messagebox.OK() ' if "OK" works, we are in an undefined state + warnlog( "" ) + endcatch + end if + catch + warnlog( "A messagebox was displayed but coul not be closed." ) + endcatch + + Kontext "TestaccountSettings" + Call DialogTest ( TestaccountSettings ) + TestaccountSettings.cancel + end if + end select + if gefunden=FALSE then + Warnlog "Error with the " + i + ".page, perhaps this page is deleted or change the place!" + EchteAnzahl = EchteAnzahl - 1 + if EchteAnzahl < 12 then + i=13 + else + i=1-1 + end if + end if + next i + '/// Close the options dialog + Kontext "OptionenDlg" + OptionenDlg.Cancel + '/// Close the document + if gApplication <> "BACKGROUND" then + Call hCloseDocument + end if +endcase + +'------------------------------------------------------------------------- + +testcase tToolsOptionsHTMLDocument + dim EchteAnzahl as Integer, i as Integer + dim gefunden as Boolean + + PrintLog "- Tools/Options/HTML-Document ( Extras/Optionen/HTML-Dokument )" + if (0 = iSectionNumber) then + warnlog "You can't run this testcase seperated! Ending now! Please run it via: tToolsOptionsTest" + goto endsub + endif + '/// Create a new document + if gApplication <> "BACKGROUND" then + Call hNewDocument + end if + '/// <i>Tools</i> / <i>options</i> / <i>HTML Document</i> + ToolsOptions + ToPosInOptionlist ( 5 ) + i = 6 + if bDebugVersion = TRUE then i = i + 1 ' here exists the special debug-tabpage, too + EchteAnzahl = OptionTabPageZaehler (i) + if bDebugVersion = TRUE then EchteAnzahl = EchteAnzahl - 1 + for i=1 to EchteAnzahl + gefunden = FALSE + Kontext "OptionenDlg" + Optionsliste.TypeKeys "<Down>" + select case i + case 1 : Kontext "TabInhalteHTML" + '/// View + printlog " - View / Ansicht" + if TabInhalteHTML.IsVisible then + gefunden = TRUE + Call DialogTest ( TabInhalteHTML ) + end if + case 2 : Kontext "TabDirektCursor" + '/// Formating aids + printlog " - Formatting aids / Formatierungshilfen" + if TabDirektCursor.IsVisible then + gefunden = TRUE + Call DialogTest ( TabDirektCursor ) + end if + case 3 : Kontext "TabRaster" + '/// Grid + printlog " - Grid / Raster" + if TabRaster.IsVisible then + gefunden = TRUE + Call DialogTest ( TabRaster ) + end if + case 4 : Kontext "TabDruckenHTML" + '/// Print + printlog " - Print / Drucken" + if TabDruckenHTML.IsVisible then + gefunden = TRUE + Call DialogTest ( TabDruckenHTML ) + end if + case 5 : Kontext "TabTabelleOptionen" + '/// Table + printlog " - Table / Tabelle" + if TabTabelleOptionen.IsVisible then + gefunden = TRUE + Call DialogTest ( TabTabelleOptionen ) + end if + case 6 : Kontext "TabHintergrund" + '/// Background + printlog " - Background / Hintergrund" + Sleep 1 + if TabHintergrund.IsVisible then + gefunden = TRUE + Call DialogTest ( TabHintergrund ) + end if + end select + if gefunden=FALSE then + Warnlog "Error with the " + i + ".page, perhaps this page is deleted or change the place!" + EchteAnzahl = EchteAnzahl - 1 + if EchteAnzahl < 6 then + i=11 + else + i=1-1 + end if + end if + next i + '/// Close the options dialog + Kontext "OptionenDlg" + OptionenDlg.Cancel + '/// Close the document + if gApplication <> "BACKGROUND" then + Call hCloseDocument + end if +endcase + +'------------------------------------------------------------------------- + +testcase tToolsOptionsSpreadsheet + dim EchteAnzahl as Integer, i as Integer + dim gefunden as Boolean + + PrintLog "- Tools/Options/Spreadsheet ( Extras/Optionen/Tabellendokument )" + if (0 = iSectionNumber) then + warnlog "You can't run this testcase seperated! Ending now! Please run it via: tToolsOptionsTest" + goto endsub + endif + '/// Create a new document + if gApplication <> "BACKGROUND" then + Call hNewDocument + end if + '/// <i>Tools</i> / <i>Options</i> / <i>Spreadsheet</i> + ToolsOptions + ToPosInOptionlist ( 4 ) + EchteAnzahl = OptionTabPageZaehler ( 7, FALSE ) + for i=1 to EchteAnzahl + gefunden = FALSE + Kontext "OptionenDlg" + Optionsliste.TypeKeys "<Down>" + select case i + case 1 : Kontext "TabLayoutCalc" + '/// General + printlog " - General / Allgemein" + if TabLayoutCalc.IsVisible then + gefunden = TRUE + Call DialogTest ( TabLayoutCalc ) + end if + case 2 : Kontext "TabInhaltCalc" + '/// View + printlog " - View / Ansicht" + if TabInhaltCalc.IsVisible then + gefunden = TRUE + Call DialogTest ( TabInhaltCalc ) + end if + case 3 : Kontext "TabBerechnen" + '/// Calculate + printlog " - Calculate / Berechnen" + if TabBerechnen.IsVisible then + gefunden = TRUE + Call DialogTest ( TabBerechnen ) + end if + case 4 : Kontext "TabSortierlisten" + '/// Sort lists + printlog " - Sort Lists / Sortierliste" + if TabSortierlisten.IsVisible then + gefunden = TRUE + Call DialogTest ( TabSortierlisten ) + end if + case 5 : Kontext "TabAenderungenCalc" + '/// Changes + printlog " - Changes / Aenderungen" + if TabAenderungenCalc.IsVisible then + gefunden = TRUE + Call DialogTest ( TabAenderungenCalc ) + end if + case 6 : Kontext "TabRaster" + '/// Grid + printlog " - Grid / Raster" + if TabRaster.IsVisible then + gefunden = TRUE + Call DialogTest ( TabRaster ) + end if + case 7 : Kontext "TabPrintCalcOptions" + '/// Print + printlog " - Print / Drucken" + if TabPrintCalcOptions.IsVisible then + gefunden = TRUE + Call DialogTest ( TabPrintCalcOptions ) + end if + end select + if gefunden=FALSE then + Warnlog "Error with the " + i + ".page, perhaps this page is deleted or change the place!" + EchteAnzahl = EchteAnzahl - 1 + if EchteAnzahl < 7 then + i=11 + else + i=1-1 + end if + end if + next i + '/// Close the options dialog + Kontext "OptionenDlg" + OptionenDlg.Cancel + '/// Close the document + if gApplication <> "BACKGROUND" then + Call hCloseDocument + end if +endcase + +'------------------------------------------------------------------------- + +testcase tToolsOptionsPresentation + dim EchteAnzahl as Integer, i as Integer + dim gefunden as Boolean + dim iTemp as integer + + PrintLog "- Tools/Options/Presentation ( Extras/Optionen/Praesentation )" + if (0 = iSectionNumber) then + warnlog "You can't run this testcase seperated! Ending now! Please run it via: tToolsOptionsTest" + goto endsub + endif + '/// Create a new document + if gApplication <> "BACKGROUND" then + Call hNewDocument + end if + kontext "DocumentImpress" + if DocumentImpress.exists(5) then + printlog " - An application of type Presentation is available." + '--- workaround #i48383# + DocumentImpress.MouseDown (10,10) + DocumentImpress.MouseUp (10,10) + else + qaErrorLog " - No application of type Presentation is available" + end if + '/// <i>Tools</i> / <i>Options</i> / <i>Presentation</i> + ToolsOptions + ToPosInOptionlist ( 4 ) + EchteAnzahl = OptionTabPageZaehler ( 4, FALSE ) + for i=1 to EchteAnzahl + gefunden = FALSE + Kontext "OptionenDlg" + Optionsliste.TypeKeys "<Down>" + select case i + case 1 : Kontext "TabSonstigesDraw" + '/// General + printlog " - General / Allgemein" + if TabSonstigesDraw.exists then + if TabSonstigesDraw.IsVisible then + gefunden = TRUE + Call DialogTest ( TabSonstigesDraw ) + end if + else + ' Trying to get root cause on some systems it seems the backing window is used. #i48383# + Kontext "OptionenDlg" + OptionenDlg.SnapShot convertPath(gOfficePath + "user/work/"+gApplication+".bmp") + qaErrorLog "#i48383# Trying to get root cause for wrong window; check picture: " + convertPath(gOfficePath + "user/work/"+gApplication+".bmp") + for iTemp = 1 to Optionsliste.getItemCount + qaErrorLog "" + iTemp + ": '" + Optionsliste.getItemText(iTemp) + "'" + next iTemp + gefunden = TRUE + end if + case 2 : Kontext "TabInhalteDraw" + '/// View + printlog " - View / Ansicht" + if TabInhalteDraw.IsVisible then + gefunden = TRUE + Call DialogTest ( TabInhalteDraw ) + end if + case 3 : Kontext "TabRaster" + '/// Grid + printlog " - Grid / Raster" + if TabRaster.IsVisible then + gefunden = TRUE + Call DialogTest ( TabRaster ) + end if + case 4 : Kontext "TabDruckenDraw" + '/// Print + printlog " - Print / Drucken" + if TabDruckenDraw.IsVisible then + gefunden = TRUE + Call DialogTest ( TabDruckenDraw ) + end if + end select + if gefunden=FALSE then + Warnlog "Error with the " + i + ".page, perhaps this page is deleted or change the place!" + EchteAnzahl = EchteAnzahl - 1 + if EchteAnzahl < 4 then + i=11 + else + i=1-1 + end if + end if + next i + '/// Close the options dialog + Kontext "OptionenDlg" + OptionenDlg.Cancel + '/// Close the document + if gApplication <> "BACKGROUND" then + Call hCloseDocument + end if +endcase + +'------------------------------------------------------------------------- + +testcase tToolsOptionsDrawing + Dim EchteAnzahl as Integer, i as Integer + Dim gefunden as Boolean + + PrintLog "- Tools/Options/Drawing ( Extras/Optionen/Zeichnung )" + if (0 = iSectionNumber) then + warnlog "You can't run this testcase seperated! Ending now! Please run it via: tToolsOptionsTest" + goto endsub + end if + '/// Create a new document + if gApplication <> "BACKGROUND" then + Call hNewDocument + end if + Kontext "DocumentDraw" + if DocumentDraw.exists(5) then + printlog " - An application of type Draw is available." + '--- workaround #i48383# + DocumentDraw.MouseDown (10,10) + DocumentDraw.MouseUp (10,10) + else + qaErrorLog " - No application of type Draw is available" + end if + '/// <i>Tools</i> / <i>Options</i> / <i>Drawing</i> + ToolsOptions + ToPosInOptionlist ( 4 ) + EchteAnzahl = OptionTabPageZaehler ( 4, FALSE ) + for i=1 to EchteAnzahl + gefunden = FALSE + Kontext "OptionenDlg" + Optionsliste.TypeKeys "<Down>" + select case i + case 1 : Kontext "TabSonstigesDraw" + '/// General + printlog " - General / Allgemein" + if TabSonstigesDraw.exists then + if TabSonstigesDraw.IsVisible then + gefunden = TRUE + Call DialogTest ( TabSonstigesDraw ) + end if + else + ' Trying to get root cause on some systems it seems the backing window is used. #i48383# + Kontext "OptionenDlg" + qaErrorLog "#i48383# wrong focus on opening options" + gefunden = TRUE + end if + case 2 : Kontext "TabInhalteDraw" + '/// View + printlog " - View / Ansicht" + if TabInhalteDraw.IsVisible then + gefunden = TRUE + Call DialogTest ( TabInhalteDraw ) + end if + case 3 : Kontext "Active" + if Active.Exists then + Warnlog "A messagebox exists => BUG : " + Active.GetText + try + Active.No + catch + Active.OK + endcatch + end if + Kontext "TabRaster" + '/// Grid + printlog " - Grid / Raster" + if TabRaster.IsVisible then + gefunden = TRUE + Call DialogTest ( TabRaster ) + end if + case 4 : Kontext "TabDruckenDraw" + '/// Print + printlog " - Print / Drucken" + if TabDruckenDraw.IsVisible then + gefunden = TRUE + Call DialogTest ( TabDruckenDraw ) + end if + end select + if gefunden=FALSE then + Warnlog "Error with the " + i + ".page, perhaps this page is deleted or change the place!" + EchteAnzahl = EchteAnzahl - 1 + if EchteAnzahl < 4 then + i=11 + else + i=1-1 + end if + end if + next i + '/// Close the options dialog + Kontext "OptionenDlg" + OptionenDlg.Cancel + '/// Close the document + if gApplication <> "BACKGROUND" then + Call hCloseDocument + end if +endcase + +'------------------------------------------------------------------------- + +testcase tToolsOptionsFormula + dim EchteAnzahl as Integer, i as Integer + + PrintLog "- Tools/Options/Formula ( Extras/Optionen/Formel )" + if (0 = iSectionNumber) then + warnlog "You can't run this testcase seperated! Ending now! Please run it via: tToolsOptionsTest" + goto endsub + endif + '/// Create a new document + if gApplication <> "BACKGROUND" then + Call hNewDocument + end if + '/// <i>Tools</i> / <i>Options</i> / <i>Formula</i> + ToolsOptions + ToPosInOptionlist ( 4 ) + EchteAnzahl = OptionTabPageZaehler ( 1, FALSE ) + Kontext "OptionenDlg" + '/// Print + Optionsliste.TypeKeys "<Down>" + printlog " - Print / Drucken" + Kontext "TabDruckenMath" + Call DialogTest ( TabDruckenMath ) + '/// Close the options dialog + Kontext "OptionenDlg" + OptionenDlg.Cancel + '/// Close the document + if gApplication <> "BACKGROUND" then + Call hCloseDocument + end if +endcase + diff --git a/testautomation/global/required/includes/g_printing.inc b/testautomation/global/required/includes/g_printing.inc new file mode 100644 index 000000000000..a4ff969bcdf9 --- /dev/null +++ b/testautomation/global/required/includes/g_printing.inc @@ -0,0 +1,518 @@ +'encoding UTF-8 Do not remove or change this line! +'******************************************************************************* +' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +' +' Copyright 2000, 2010 Oracle and/or its affiliates. +' +' OpenOffice.org - a multi-platform office productivity suite +' +' This file is part of OpenOffice.org. +' +' OpenOffice.org is free software: you can redistribute it and/or modify +' it under the terms of the GNU Lesser General Public License version 3 +' only, as published by the Free Software Foundation. +' +' OpenOffice.org is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY; without even the implied warranty of +' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +' GNU Lesser General Public License version 3 for more details +' (a copy is included in the LICENSE file that accompanied this code). +' +' You should have received a copy of the GNU Lesser General Public License +' version 3 along with OpenOffice.org. If not, see +' <http://www.openoffice.org/license.html> +' for a copy of the LGPLv3 License. +' +'/****************************************************************************** +'* +'* owner : joerg.skottke@sun.com +'* +'* short description : Resource test for the printing dialog +'* +'\****************************************************************************** + +private const MSG1 = "Incorrect default setting: " + +'******************************************************************************* + +sub g_printing() + + call tPrintCommon() + call tPrintGeneral() + call tPrintApplication() + call tPrintLayout() + call tPrintOptions() + +end sub + +'******************************************************************************* + +testcase tPrintCommon() + + printlog( "Common print options (main dialog)" ) + + printlog( "Open new document" ) + hCreateDocument() + + printlog( "Open printing dialog" ) + FilePrint + + kontext "Printing" + if ( Printing.exists( 2 ) ) then + + call DialogTest( Printing ) + + if ( PreviewPageNumber.isEnabled() ) then + warnlog( "Page number should be disabled for empty document" ) + endif + + if ( ScrollBackward.isEnabled() ) then + warnlog( "Scroll backward button should be disabled for empty document" ) + endif + + if ( ScrollForward.isEnabled() ) then + warnlog( "Scroll forward button should be disabled for empty document" ) + endif + + kontext "Printing" + printlog( "Close print dialog") + Printing.cancel() + + else + warnlog( "Printing dialog did not open" ) + endif + + printlog( "Close document" ) + hDestroyDocument() + +endcase + +'******************************************************************************* + +testcase tPrintGeneral() + + printlog( "General printing options - General tabpage" ) + + dim iSlidesPerPage as integer + dim iExpected as integer + + printlog( "Open new document" ) + hCreateDocument() + + printlog( "Open printing dialog" ) + FilePrint + + kontext "Printing" + if ( Printing.exists( 2 ) ) then + + PrintingTabControl.setPage( TabPrintGeneral ) + + kontext "TabPrintGeneral" + call DialogTest( TabPrintGeneral ) + + printlog( "PrinterList" ) + if ( NOT PrinterList.isEnabled() ) then + warnlog( "Printer List is disabled" ) + endif + + printlog( "Number of copies/Collate" ) + if ( NumberOfCopies.getText <> "1" ) then + warnlog( "Number of copies should be 1 by default, is " & NumberOfCopies.getText() ) + endif + + if ( Collate.isEnabled() ) then + warnlog( "<Collate> should not be enabled for just one copy" ) + endif + + NumberOfCopies.setText( "2" ) + + if ( Collate.isEnabled() ) then + cb_test( Collate, true, "" ) + else + warnlog( "Collate should be enabled if number of copies <> 1" ) + endif + + NumberOfCopies.setText( "1" ) + + if ( Collate.isEnabled() ) then + warnlog( "<Collate> should not be enabled for just one copy" ) + endif + + printlog( "Properties/Details" ) + Details.click() ' open + Details.click() ' close + + if ( gPlatGroup = "unx" and lcase( gPlatform ) <> "osx" ) then + Properties.click() + kontext "TabSPAPaper" + if ( TabSPAPaper.exists( 2 ) ) then + TabSPAPaper.close() + else + warnlog( "Printer properties did not open." ) + endif + else + printlog( "Skipping printer properties on Windows and MacOS X (no SPAdmin)" ) + endif + + kontext "TabPrintGeneral" + printlog( "General settings on the Tab-Page" ) + + select case( gApplication ) + case "WRITER", "HTML", "MASTERDOCUMENT" + + lb_test( PrintNotes, 4, 1, "" ) + + if ( NOT AllPages.isChecked() ) then + warnlog( MSG1 & "<All pages> should be checked" ) + endif + + if ( Pages.isEnabled() ) then + Pages.check() + PageRange.setText( "1-5,7" ) + else + warnlog( "Pages setting disabled" ) + endif + + 'Selection.check() + 'AllPages.check() + + case "CALC" + + printlog( "Print ranges" ) + if ( NOT SelectedSheets.isChecked() ) then + warnlog( MSG1 & "<Selected sheets> should be selected" ) + endif + + AllSheets.check() + SelectedSheets.check() + SelectedCells.check() + + if ( NOT PrintAllPages.isChecked() ) then + warnlog( MSG1 & "<Thereof print all pages> should be selected" ) + endif + + PrintPages.check() + PageRange.setText( "1-5,8" ) + PrintAllPages.check() + + case "IMPRESS", "DRAW" + + printlog( "Print ranges" ) + if ( NOT AllSlides.isChecked() ) then + warnlog( MSG1 & "<All slides> should be selected" ) + endif + + Slides.check() + PageRange.setText( "1-6,9" ) + + Selection.check() + + + if ( gApplication = "IMPRESS" ) then + + printlog( "General print options/layout (IMPRESS only)" ) + + lb_test( PartsToPrint, 4, 1, "" ) + + if ( SlidesPerPage.isEnabled() ) then + warnlog( "<Slides per page> should only be enabled for Handouts" ) + endif + + if ( ArrangeSlides.isEnabled() ) then + warnlog( "<Ararange slides> should only be enabled for Handouts" ) + endif + + PartsToPrint.select( 2 ) ' Should be "Handouts" to enable further controls + + if ( NOT SlidesPerPage.isEnabled() ) then + warnlog( "<Slides per Page> should be enabled for Handouts" ) + endif + + if ( NOT ArrangeSlides.isEnabled() ) then + warnlog( "<Arrange slides> should be enabled for Handouts" ) + endif + + lb_test( SlidesPerPage, 6, 0, "" ) + lb_test( ArrangeSlides, 2, 1, "" ) + + endif + + + case "MATH" + + printlog( "Math does not have any special options on this tabpage" ) + + case default + warnlog( "Invalid gApplication: " & gApplication ) + end select + + kontext "Printing" + printlog( "Close print dialog" ) + Printing.cancel() + + else + warnlog( "Printing dialog did not open" ) + endif + + printlog( "Close document" ) + hDestroyDocument() + +endcase + +'******************************************************************************* + +testcase tPrintApplication() + + printlog( "Application specific printing options - Application tabpage" ) + + printlog( "Open new document" ) + hCreateDocument() + + printlog( "Open printing dialog" ) + FilePrint + + kontext "Printing" + if ( Printing.exists( 2 ) ) then + + PrintingTabControl.setPage( TabApplication ) + + kontext "TabApplication" + call DialogTest( TabApplication ) + + printlog( "Check defaults, modify and reset controls" ) + select case( gApplication ) + case "WRITER", "HTML", "MASTERDOCUMENT" + + cb_test( PrintPageBackground, true, "" ) + 'cb_test( PrintGraphicsAndDiagrams, true, "" ) + cb_test( PrintPicturesAndObjects, true, "" ) + cb_test( PrintTextInBlack, false, "" ) + cb_test( PrintBlankPages, true, "" ) + + if ( gApplication <> "HTML" ) then + cb_test( PrintHiddenText, false, "" ) + cb_test( PrintTextPlaceholder, false, "" ) + endif + + case "CALC" + + cb_test( IncludeEmptyPages, false, "" ) + + case "IMPRESS", "DRAW" + + cb_test( SlideName, false, "" ) + cb_test( DateAndTime, false, "" ) + if ( gApplication = "IMPRESS" ) then + cb_test( HiddenPages, false, "" ) + endif + + printlog( "Color options" ) + if ( NOT OriginalColors.isChecked() ) then + warnlog( MSG1 & "<Original colors> should be checked" ) + endif + + GrayScale.check() + BlackAndWhite.check() + + printlog( "Scaling options" ) + if ( NOT OriginalSize.isChecked() ) then + warnlog( MSG1 & "<Original size> should be checked" ) + endif + + FitToPage.check() + MultiplePages.check() + TilePaper.check() + + case "MATH" + + cb_test( TitleRow, true, "" ) + cb_test( FormulaText, true, "" ) + cb_test( Borders, true, "" ) + + if ( NOT OriginalSizeMath.isChecked() ) then + warnlog( MSG1 & "<Original size> should be selected" ) + endif + + FitToPageMath.check() + Scaling.check() + ScalingFactor.setText( "1000" ) + + case default + + warnlog( "Invalid gApplication: " & gApplication ) + + end select + + kontext "Printing" + printlog( "Close print dialog" ) + Printing.cancel() + + else + warnlog( "Printing dialog did not open" ) + endif + + printlog( "Close document" ) + hDestroyDocument() + +endcase + +'******************************************************************************* + +testcase tPrintLayout() + + printlog( "Layout printing options - Layout tabpage" ) + + printlog( "Open new document" ) + hCreateDocument() + + printlog( "Open printing dialog" ) + FilePrint + + kontext "Printing" + if ( Printing.exists( 2 ) ) then + + ' Math does not have a layout page as it does not have any layout options + if ( gApplication <> "MATH" ) then + + PrintingTabControl.setPage( TabLayout ) + + kontext "TabLayout" + call DialogTest( TabLayout ) + + printlog( "Controls common for (almost) all applications" ) + if ( gApplication <> "CALC" ) then + if ( NOT PagesPerSheet.isChecked()) then + warnlog( MSG1 & "<Pages per sheet> should be selected" ) + endif + + lb_test( NumberOfPages, 7, 1, "" ) + NumberOfPages.select( 7 ) + + if ( NumberOfColumns.getText() <> "1" ) then + warnlog( MSG1 & "<Pages> has incorrect default: " & NumberOfColumns.getText() ) + endif + + if ( NumberOfRows.getText() <> "1" ) then + warnlog( MSG1 & "<by> has incorrect default: " & NumberOfRows.getText() ) + endif + + NumberOfColumns.typeKeys( "<UP>" ) + NumberOfRows.typeKeys( "<UP>" ) + DistanceBetweenPages.typeKeys( "<UP>" ) + MarginToSheetBorder.typeKeys( "<UP>" ) + + lb_test( PaperOrientation, 3, 1, "" ) + else + if ( PagesPerSheet.isVisible() ) then + warnlog( "<Pages per Sheet> should not be visible for spreadsheet documents" ) + endif + endif + + lb_test( PrintOrder, 2, 1, "" ) + cb_test( BorderAroundPages, false, "" ) + + select case( gApplication ) + case "WRITER", "HTML", "MASTERDOCUMENT" + + 'if ( NOT PrintBrochureRTL.isEnabled() ) then + ' warnlog( "<Brochure> listbox should be enabled" ) + 'endif + + Brochure.check() + + 'lb_test( PrintBrochureRTL, 2, 1, "#i105265#" ) + + case "CALC" + + printlog( "Calc does not have any options in this section" ) + + case "IMPRESS", "DRAW" + + if ( BrochurePageSides.isEnabled() ) then + warnlog( "<Page sides> listbox should be disabled" ) + endif + Brochure.check() + lb_test( BrochurePageSides, 3, 1, "" ) + + case default + + warnlog( "Invalid gApplication: " & gApplication ) + + end select + + else ' What we do if gApplication = MATH + try + PrintingTabControl.setPage( TabLayout ) + warnlog( "Math should not have a layout page as no layout options exist" ) + catch + printlog( "Math has no layout page. Good." ) + endcatch + endif + + kontext "Printing" + printlog( "Close print dialog" ) + Printing.cancel() + + else + warnlog( "Printing dialog did not open" ) + endif + + printlog( "Close document" ) + hDestroyDocument() + +endcase + +'******************************************************************************* + +testcase tPrintOptions() + + printlog( "Extended printing options - Options tabpage" ) + + printlog( "Open new document" ) + hCreateDocument() + + printlog( "Open printing dialog" ) + FilePrint + + kontext "Printing" + if ( Printing.exists( 2 ) ) then + + PrintingTabControl.setPage( TabOptions ) + + kontext "TabOptions" + call DialogTest( TabOptions ) + + printlog( "Controls common for all applications" ) + cb_test( PrintToFile, false, "" ) + cb_test( PrintAsSingleJobs, false, "" ) + cb_test( PrintReverse, false, "" ) + + printlog( "Application specific controls" ) + select case( gApplication ) + case "WRITER", "HTML", "MASTERDOCUMENT", "IMPRESS", "DRAW" + + cb_test( PaperTrayFromPrefs, false, "" ) + + case "CALC", "MATH" + + printlog( "Calc does not have any program specific options." ) + + case default + + warnlog( "Invalid gApplication: " & gApplication ) + + end select + + kontext "Printing" + printlog( "Close print dialog" ) + Printing.cancel() + + else + warnlog( "Printing dialog did not open" ) + endif + + printlog( "Close document" ) + hDestroyDocument() + +endcase + |