diff options
Diffstat (limited to 'testautomation/writer/optional/includes/fields')
7 files changed, 5566 insertions, 0 deletions
diff --git a/testautomation/writer/optional/includes/fields/w_fields1.inc b/testautomation/writer/optional/includes/fields/w_fields1.inc new file mode 100755 index 000000000000..2f727260b6c2 --- /dev/null +++ b/testautomation/writer/optional/includes/fields/w_fields1.inc @@ -0,0 +1,384 @@ +'encoding UTF-8 Do not remove or change this line! +'************************************************************************** +' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +' +' Copyright 2000, 2010 Oracle and/or its affiliates. +' +' OpenOffice.org - a multi-platform office productivity suite +' +' This file is part of OpenOffice.org. +' +' OpenOffice.org is free software: you can redistribute it and/or modify +' it under the terms of the GNU Lesser General Public License version 3 +' only, as published by the Free Software Foundation. +' +' OpenOffice.org is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY; without even the implied warranty of +' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +' GNU Lesser General Public License version 3 for more details +' (a copy is included in the LICENSE file that accompanied this code). +' +' You should have received a copy of the GNU Lesser General Public License +' version 3 along with OpenOffice.org. If not, see +' <http://www.openoffice.org/license.html> +' for a copy of the LGPLv3 License. +' +'/************************************************************************ +'* +'* owner : helge.delfs@oracle.com +'* +'* short description : Fields general test +'* +'\*********************************************************************** + +sub w_fields1 + + Call tInsertFieldsDate + Call tInsertFieldsTime + Call tInsertFieldsPageNumber + Call tInsertFieldsPageCount + Call tInsertFieldsSubject + Call tInsertFieldsTitle + Call tInsertFieldsAuthor + +end sub + +'----------------------------------------------------------------- + +testcase tInsertFieldsDate + + Dim sDate as String + sDate = Date + + printlog "Insert / Fields / Date" + '/// <b> Default should be mm/dd/yy </b> + + Call hNewDocument + + '/// Insert / Fields / Date , the 1st date is fixed + InsertFieldsDate + + '/// Return + Call wTypeKeys "<Return>" + + '/// Insert / Fields / Date + InsertFieldsDate + + Call wTypeKeys "<Home>" + + '/// Set 2nd date only to be date , not fixed + '/// In 2nd date , Edit / Fields , select date in 'select' + '/// Select second format in 'Format' + EditFields + Kontext "FeldbefehlBearbeitenDokument" + Auswahl.Select 2 + Zahlenformat.Select 2 'Should be the same as the value we get with 'Time'. + '/// Close the dialog + FeldbefehlBearbeitenDokument.OK + + '/// Set first date to the right format, but leave as unfixed + '/// In 1nd date , Edit / Fields , select second format in 'Format' + Call wTypeKeys "<MOD1 Home>" + + EditFields + Kontext "FeldbefehlBearbeitenDokument" + Zahlenformat.Select 2 'Should be the same as the value we get with 'Time'. + FeldbefehlBearbeitenDokument.OK + + '/// Check if the date is correct + Call wTypeKeys "<MOD1 Home>" + Call wTypeKeys "<Shift Right>" + EditCopy + if GetClipboard <> sDate then + Warnlog "Fixed date is wrong ! Hope you don't run this case in the midnight" + end if + + Call wTypeKeys "<Down><Home>" + Call wTypeKeys "<Shift Right>" + EditCopy + if GetClipboard <> sDate then + Warnlog "Date is wrong ! Hope you don't run this case in the midnight" + end if + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tInsertFieldsTime + + Dim sTime as String + Dim sTime1 as String + Dim sTime2 as String + Dim sTemp as String + + printlog "Insert / Fields / Time" + '/// <b> Default could be hh/mm/ss pm or simply hh/mm/ss , depending on the system the test is running on.</b> + + Call hNewDocument + sTime = Time + + '/// Insert / Fields / Time , the 1st time is fixed + InsertFieldsTime + + '/// Return + Call wTypeKeys "<Return>" + + '/// Insert / Fields / Time + InsertFieldsTime + + Call wTypeKeys "<Home>" + + '/// Set 2nd time only to be time , not fixed + '/// In 2nd time , Edit / Fields , select Time in 'select' + EditFields + Kontext "FeldbefehlBearbeitenDokument" + Auswahl.Select 2 + FeldbefehlBearbeitenDokument.OK + + '/// Check if the time is correct + Call wTypeKeys "<MOD1 Home>" + Call wTypeKeys "<Shift Right>" + EditCopy + sTime1 = GetClipboard + if NOT Len(sTime1) > 7 then Warnlog "Fixed time-format is wrong !" + + Call wTypeKeys "<Down><Home>" + Call wTypeKeys "<Shift Right>" + EditCopy + sTime2 = GetClipboard + if NOT Len(sTime2) > 7 then Warnlog "Time-format is wrong !" + + printlog "Stop for a while ..." + '/// Stop for a while , check if the time is still correct + Sleep 2 + Call wTypeKeys "<MOD1 Home>" + Call wTypeKeys "<Shift Right>" + EditCopy + if GetClipboard <> sTime1 then Warnlog "Fixed time is wrong !" + + Call wTypeKeys "<Down><Home>" + Call wTypeKeys "<Shift Right>" + EditCopy + if GetClipboard = sTime2 then Warnlog "Time is wrong !" + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tInsertFieldsPageNumber + + Dim sPage1 , sPage2 as String + + sPage1 = "1" : sPage2 = "2" + + printlog "Insert / Fields / Page Number" + + Call hNewDocument + + '/// In 1st page , Insert / Fields / Page Number + InsertFieldsPageNumbers + + '/// Insert a page break + InsertManualBreak + Sleep 2 + kontext "UmbruchEinfuegen" + Seitenumbruch.check + UmbruchEinfuegen.OK + + '/// In 2nd page , Insert / Fields / Page Number + InsertFieldsPageNumbers + + Call wTypeKeys "<MOD1 Home>" + + '/// Check if the page number is correct + Call wTypeKeys "<Shift Right>" + if fGetFieldContent( ) <> sPage1 then + QAErrorLog "#i31214# The 1st page number isn't correct ! should be: '" + sPage1 + "', but was: '" + GetClipboard + "'." + end if + + Call wTypeKeys "<MOD1 End>" + Call wTypeKeys "<Shift Left>" + EditCopy + if GetClipboard <> sPage2 then + Warnlog "The 2nd page number isn't correct !" + end if + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tInsertFieldsPageCount + + Dim sPage1 , sPage2 as String + + sPage1 = "1" : sPage2 = "2" + + printlog "Insert / Fields / Page Count" + + Call hNewDocument + + '/// In 1st page , Insert / Fields / Page Count + InsertFieldsPageCount + + Call wTypeKeys "<MOD1 Home>" + + '/// Check if the 1st page count is correct + Call wTypeKeys "<Shift Right>" + EditCopy + if GetClipboard <> sPage1 then + Warnlog "1-The 1st page count isn't correct !" + end if + Call wTypeKeys "<End>" + + '/// Insert a page break + InsertManualBreak + Sleep 2 + kontext "UmbruchEinfuegen" + Seitenumbruch.check + UmbruchEinfuegen.OK + + '/// In 2nd page , Insert / Fields / Page Count + InsertFieldsPageCount + + Call wTypeKeys "<MOD1 Home>" + + '/// Check if the page count is correct + Call wTypeKeys "<Shift Right>" + 'EditCopy + if fGetFieldContent( ) <> sPage2 then + Warnlog "2-The 1st page count isn't correct" + end if + + Call wTypeKeys "<MOD1 End>" + Call wTypeKeys "<Shift Left>" + EditCopy + if GetClipboard <> sPage2 then + Warnlog "The 2nd page count isn't correct !" + end if + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tInsertFieldsSubject + + Dim sSubject as String + sSubject = "This is a Subject" + + printlog "Insert / Fields / Subject" + + Call hNewDocument + + '/// File / Properties / Description , input some + '/// + text in Subject + Call fFileProperties("TabBeschreibung") + Thema.Settext sSubject + TabBeschreibung.OK + + '/// Insert / Fields / Subject + InsertFieldsSubject + + '/// Check if the subject is correct + Call wTypeKeys "<Shift Left>" + EditCopy + if GetClipboard <> sSubject then + Warnlog "Subject isn't correct ! should be: '" + sSubject + "', but was: '" + GetClipboard + "'." + end if + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tInsertFieldsTitle + + Dim sTitle as String + + sTitle = "This is a Title" + + printlog "Insert / Fields / Title" + + Call hNewDocument + + '/// File / Properties / Description , input some + '/// + text in Title + Call fFileProperties("TabBeschreibung") + Titel.Settext sTitle + TabBeschreibung.OK + + '/// Insert / Fields / Title + InsertFieldsTitle + + '/// Check if the title is correct + Call wTypeKeys "<Shift Left>" + EditCopy + if GetClipboard <> sTitle then + Warnlog "Title isn't correct ! should be: '" + sTitle + "', but was: '" + GetClipboard + "'." + end if + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tInsertFieldsAuthor + + Dim sFirstName , sLastName as String + Dim sFirstName1 , sLastName1 as String + + sFirstName1 = "Test1" : sLastName1 = "Test2" + + printlog "Insert / Fields / Author" + + Call hNewDocument + + '/// Change author to author :Test2 Test1 + ToolsOptions + Call hToolsOptions("STAROFFICE","USERDATA") + sFirstName = VorName.GetText + sLastName = ZuName.GetText + VorName.SetText sFirstName1 + ZuName.SetText sLastName1 + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK + + '/// File / Properties / General , check "Apply user + '/// + data" , click "delete" button + Call fFileProperties("TabDokument") + BenutzerdatenVerwenden.Check + Sleep 1 + Loeschen.Click + Sleep 1 + TabDokument.OK + + '/// Insert / Fields / Author + InsertFieldsAuthor + + '/// Check if the title is correct + Call wTypeKeys "<Shift Left>" + EditCopy + if GetClipboard <> (sFirstName1 + " " + sLastName1) then + Warnlog "Author isn't correct ! should be: '" + (sFirstName1 + " " + sLastName1) + "', but was: '" + GetClipboard + "'." + end if + + 'Recover author to default + ToolsOptions + Call hToolsOptions("STAROFFICE","USERDATA") + VorName.SetText sFirstName + ZuName.SetText sLastName + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK + + Call hCloseDocument + +endcase diff --git a/testautomation/writer/optional/includes/fields/w_fields2.inc b/testautomation/writer/optional/includes/fields/w_fields2.inc new file mode 100755 index 000000000000..4f2c5c39388c --- /dev/null +++ b/testautomation/writer/optional/includes/fields/w_fields2.inc @@ -0,0 +1,1064 @@ +'encoding UTF-8 Do not remove or change this line! +'************************************************************************** +' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +' +' Copyright 2000, 2010 Oracle and/or its affiliates. +' +' OpenOffice.org - a multi-platform office productivity suite +' +' This file is part of OpenOffice.org. +' +' OpenOffice.org is free software: you can redistribute it and/or modify +' it under the terms of the GNU Lesser General Public License version 3 +' only, as published by the Free Software Foundation. +' +' OpenOffice.org is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY; without even the implied warranty of +' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +' GNU Lesser General Public License version 3 for more details +' (a copy is included in the LICENSE file that accompanied this code). +' +' You should have received a copy of the GNU Lesser General Public License +' version 3 along with OpenOffice.org. If not, see +' <http://www.openoffice.org/license.html> +' for a copy of the LGPLv3 License. +' +'/************************************************************************ +'* +'* owner : helge.delfs@oracle.com +'* +'* short description : Fields general test +'* +'\*********************************************************************** + +sub w_fields2 + + Call tDialogNonModal + Call tDocumentAuthor + Call tDocumentAuthorFixed + Call tDocumentChapter + Call tDocumentDate + Call tDocumentFilename + Call tDocumentPage + Call tDocumentSender + Call tDocumentSenderFixed + Call tDocumentStatistics + Call tDocumentTemplate + Call tDocumentTime + +end sub + +'----------------------------------------------------------------- + +testcase tDialogNonModal + + Dim sTest as String + + sTest = "This is a Test" + + printlog "NON modal" + '/// <b> NON modal </b> + + Call hNewDocument + + '/// Insert / Fields / Other / Document , test if + '/// + the dialog is NON modal + Call fInsertFieldsOther("TabDokumentFeldbefehle") + try + Call wTypeKeys sTest + catch + Warnlog "Something is wrong in dialog document!" + endcatch + Kontext "TabDokumentFeldbefehle" + TabDokumentFeldbefehle.Close + + Call wTypeKeys "<Shift Home>" + EditCopy + if GetClipboard <> sTest then + Warnlog "The text in document isn't corrrect!" + end if + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tDocumentAuthor + if iSprache <> 1 then + QaErrorLog "Currently no any other language than English. Aborting." + exit sub + end if + + Dim sFirstName as String + Dim sLastName as String + Dim sFirstName1 as String + Dim sLastName1 as String + Dim sFirstName2 as String + Dim sLastName2 as String + Dim sInitial1 as String + Dim sInitial2 as String + + sFirstName1 = "ABC" : sLastName1 = "DEF" + sFirstName2 = "XYZ" : sLastName2 = "OPQ" + sInitial1 = "AD" : sInitial2 = "XO" + + printlog "Insert/Fields/Other/Document / Author " + '/// <b> Insert/Fields/Other/Document / Author </b> + + Call hNewDocument + + '/// Change author to author1 :ABC DEF + ToolsOptions + Call hToolsOptions("STAROFFICE","USERDATA") + sFirstName = VorName.GetText + sLastName = ZuName.GetText + Kuerzel.SetText "" + VorName.SetText sFirstName1 + ZuName.SetText sLastName1 + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK + + '/// Insert/Fields/Other/Document / Author (Name, Initial) + Call fInsertFieldsOther("TabDokumentFeldbefehle") + Feldtyp.Select fGetType("Author") + Sleep 1 + Auswahl.Select 1 + Sleep 1 + Einfuegen.Click + sleep 1 + Call wTypeKeys "<Return>" + Kontext "TabDokumentFeldbefehle" + Auswahl.Select 2 + Sleep 1 + Einfuegen.Click + TabDokumentFeldbefehle.Close + + '/// Check if the name is inserted correctly + Call wTypeKeys "<MOD1 Home><Shift End>" + EditCopy + if GetClipboard <> (sFirstName1 + " " + sLastName1) then + Warnlog "Should get " & sFirstName1 & " " & sLastName1 & " but get " & GetClipboard + end if + + '/// Check if the Initial is inserted correctly + Call wTypeKeys "<Down>" + Call wTypeKeys "<End><Shift Home>" + EditCopy + if GetClipboard <> sInitial1 then + Warnlog "Should get " & sInitial1 & " but get " & GetClipboard + end if + + '/// Change author to author1 :XYZ OPQ + ToolsOptions + Call hToolsOptions("STAROFFICE","USERDATA") + VorName.SetText sFirstName2 + ZuName.SetText sLastName2 + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK + Sleep 2 + + '/// Press F9 + Call wTypeKeys "<F9>" + Sleep 3 + + '/// Check if the name is changed + Call wTypeKeys "<MOD1 Home><Shift End>" + EditCopy + if GetClipboard <> (sFirstName2 + " " + sLastName2) then + Warnlog "Should get " & sFirstName2 & " " & sLastName2 & " but get " & GetClipboard + end if + + '/// Check if the Initial is changed + Call wTypeKeys "<Down><End><Shift Home>" + EditCopy + if GetClipboard <> sInitial2 then + Warnlog "Should get " & sInitial2 & " but get " & GetClipboard + end if + + 'Change author to default + ToolsOptions + Call hToolsOptions("STAROFFICE","USERDATA") + VorName.SetText sFirstName + ZuName.SetText sLastName + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tDocumentAuthorFixed + if iSprache <> 1 then + QaErrorLog "Currently no any other language than English. Aborting." + exit sub + end if + + Dim sFirstName as String + Dim sLastName as String + Dim sFirstName1 as String + Dim sLastName1 as String + Dim sFirstName2 as String + Dim sLastName2 as String + Dim sInitial1 as String + + sFirstName1 = "ABC" : sLastName1 = "DEF" + sFirstName2 = "XYZ" : sLastName2 = "OPQ" + sInitial1 = "AD" + + printlog "Insert/Fields/Other/Document / Author - Fixed" + '/// <b> Insert/Fields/Other/Document / Author - Fixed</b> + + Call hNewDocument + + '/// Change author to author1 :ABC DEF + ToolsOptions + Call hToolsOptions("STAROFFICE","USERDATA") + sFirstName = VorName.GetText + sLastName = ZuName.GetText + Kuerzel.SetText "" + VorName.SetText sFirstName1 + ZuName.SetText sLastName1 + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK + + '/// Insert/Fields/Other/Document / Author (Name, Initial) + '/// + check 'Fixed content' + Call fInsertFieldsOther("TabDokumentFeldbefehle") + Feldtyp.Select fGetType("Author") + Sleep 1 + Auswahl.Select 1 + Sleep 1 + InhaltFix.Check + Einfuegen.Click + sleep 1 + Call wTypeKeys "<Return>" + Kontext "TabDokumentFeldbefehle" + Auswahl.Select 2 + Sleep 1 + InhaltFix.Check + Einfuegen.Click + TabDokumentFeldbefehle.Close + + '/// Check if the name is inserted correctly + Call wTypeKeys "<MOD1 Home><Shift End>" + EditCopy + if GetClipboard <> (sFirstName1 + " " + sLastName1) then + Warnlog "Should get " & sFirstName1 & " " & sLastName1 & " but get " & GetClipboard + end if + + '/// Check if the Initial is inserted correctly + Call wTypeKeys "<Down>" + Call wTypeKeys "<End><Shift Home>" + EditCopy + if GetClipboard <> sInitial1 then + Warnlog "Should get " & sInitial1 & " but get " & GetClipboard + end if + + '/// Change author to author1 :XYZ OPQ + ToolsOptions + Call hToolsOptions("STAROFFICE","USERDATA") + VorName.SetText sFirstName2 + ZuName.SetText sLastName2 + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK + Sleep 2 + + '/// Press F9 + Call wTypeKeys "<F9>" + Sleep 3 + + '/// Check if the name is changed + Call wTypeKeys "<MOD1 Home><Shift End>" + EditCopy + if GetClipboard <> (sFirstName1 + " " + sLastName1) then + Warnlog "Still should get " & sFirstName1 & " " & sLastName1 & " but get " & GetClipboard + end if + + '/// Check if the Initial is changed + Call wTypeKeys "<Down><End><Shift Home>" + EditCopy + if GetClipboard <> sInitial1 then + Warnlog "Still should get " & sInitial1 & " but get " & GetClipboard + end if + + 'Change author to default + ToolsOptions + Call hToolsOptions("STAROFFICE","USERDATA") + VorName.SetText sFirstName + ZuName.SetText sLastName + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tDocumentChapter + + Dim sTestFile as String + Dim sChapter() as String + Dim i as Integer + + sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\fields\chapterTest.sxw") + + sChapter = Array( _ + "My House" , _ + "Before2After" , _ + "Before2AfterMy House" , _ + "2" , _ + ) + + printlog "Insert/Fields/Other/Document / Chapter" + '/// <b> Insert/Fields/Other/Document / Chapter </b> + + Call hNewDocument + + '/// Open test file chapterTest.sxw + Call hFileOpen(sTestFile) + Call sMakeReadOnlyDocumentEditable + + Call wTypeKeys "<MOD1 End><Return>" + + '/// Insert/Fields/Other/Document / Chapter + '/// Insert Chapter name, Chapter number, + '/// Chapter number and name , Chapter number without separator + '/// Check if the insertion is correct + Call fInsertFieldsOther("TabDokumentFeldbefehle") + Feldtyp.Select fGetType("Chapter") + for i = 0 to UBound(sChapter) + Kontext "TabDokumentFeldbefehle" + Formatliste.Select i+1 + Sleep 1 + Einfuegen.Click + sleep 1 + Call wTypeKeys "<F9>" + Sleep 2 + Call wTypeKeys "<Shift Home>" + Sleep 1 + if fGetFieldContent() <> sChapter(i) then + QaErrorLog i &"#94997# Should get " & sChapter(i) & " but get " & fGetFieldContent() + end if + Call wTypeKeys "<Delete>" + next i + Kontext "TabDokumentFeldbefehle" + TabDokumentFeldbefehle.Close + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tDocumentDate + + Dim sDate as String + + printlog "Insert/Fields/Other/Document / Date" + '/// <b> Insert/Fields/Other/Document / Date </b> + + Call hNewDocument + + '/// Insert/Fields/Other/Document / Date + '/// Check if the insertion is correct + Call fInsertFieldsOther("TabDokumentFeldbefehle") + Feldtyp.Select fGetType("Date") + Auswahl.Select 1 + Einfuegen.Click + Kontext "TabDokumentFeldbefehle" + TabDokumentFeldbefehle.Close + + Call wTypeKeys "<Shift Left>" + EditCopy + Sleep 1 + if GetClipboard = "" then + Warnlog "Field returns an empty string" + end if + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tDocumentFilename + if bAsianLan = true then + QaErrorLog "No testing with Asian language. Aborting." + goto endsub + end if + + Dim sOriginalFile as String + Dim sTestFile as String + Dim sFilename(4) as String + Dim i as Integer + + sTestFile = Convertpath (gOfficepath + "user\work\pageTest.sxw") + sOriginalFile = Convertpath (gTesttoolpath + "writer\optional\input\fields\pageTest.sxw") + ' document has to be copied to local file system to avoid opening a read-only file + ' because all field data gets lost if documents write-protection is removed via 'sMakeReadOnlyDocumentEditable' + FileCopy (sOriginalFile, sTestFile) + if FileExists ( sTestFile ) = false then + Warnlog "Test document couldn't be copied to local file system. Test aborted!" + goto endsub + end if + + sFilename(0) = "pageTest.sxw" + sFilename(1) = "pageTest" + sFilename(2) = Convertpath (gOfficepath + "user\work\") + sFilename(3) = sTestFile + + printlog "Insert/Fields/Other/Document / File name" + + Call hNewDocument + + '/// Open test file pageTest.sxw + Call hFileOpen(sTestFile) + + Call wTypeKeys "<MOD1 Home>" + Call wTypeKeys "<End><Return>" + + printlog "Insert/Fields/Other/Document / File name" + printlog "Insert File name, File name without extension , Path , Path/File name" + printlog "Check if the insertion is correct" + Call fInsertFieldsOther("TabDokumentFeldbefehle") + Feldtyp.Select fGetType("File name") + for i = 0 to 3 + Kontext "TabDokumentFeldbefehle" + Formatliste.Select i+1 + Sleep 1 + Einfuegen.Click + sleep 1 + Call wTypeKeys "<F9>" + Sleep 2 + Call wTypeKeys "<Shift LEFT>" 'HOME + Sleep 1 + if fGetFieldContent() <> sFilename(i) then + Warnlog i &" - Should get " & sFilename(i) & " but get " & fGetFieldContent() + end if + Call wTypeKeys "<Delete>" + next i + Kontext "TabDokumentFeldbefehle" + TabDokumentFeldbefehle.Close + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tDocumentPage + + Dim sTestFile as String + Dim sPage() as String + Dim i as Integer + + sPage = Array( _ + "2" , _ + "1" , _ + "3" , _ + ) + + sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\fields\pageTest.sxw") + + printlog "Insert/Fields/Other/Document / Page" + '/// <b> Insert/Fields/Other/Document / Page </b> + + Call hNewDocument + + '/// Open test file pageTest.sxw which includes 3 pages + Call hFileOpen(sTestFile) + Call sMakeReadOnlyDocumentEditable + + '/// Go to the 2nd page + Call wTypeKeys "<MOD1 Home>" + Call fFindWord ("Sec") + Call wTypeKeys "<End><Return>" + + '/// Insert/Fields/Other/Document / Page + '/// Insert Page numbers, Privious page , Next page + Call fInsertFieldsOther("TabDokumentFeldbefehle") + Feldtyp.Select fGetType("Page") + for i = 0 to UBound(sPage) + Kontext "TabDokumentFeldbefehle" + Auswahl.Select i+1 + Sleep 1 + Einfuegen.Click + sleep 1 + Call wTypeKeys "<F9>" + Sleep 2 + Call wTypeKeys "<Shift Home>" + Sleep 1 + EditCopy + if GetClipboard <> sPage(i) then + Warnlog i &" - Should get " & sPage(i) & " but get " & GetClipboard + end if + Call wTypeKeys "<Delete>" + next i + Kontext "TabDokumentFeldbefehle" + TabDokumentFeldbefehle.Close + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tDocumentSender + if iSprache <> 1 then + QaErrorLog "Currently no testing with other languages than English. (ID's are not the same) Aborting." + exit sub + end if + + Dim aUserData(14) as String + Dim aUserData1() as String + Dim aUserData2() as String + + Dim i as Integer + + aUserData1 = Array( _ + "Com1" , _ + "ABC" , _ + "DEF" , _ + "AD" , _ + "Str1" , _ + "Country1" , _ + "123" , _ + "City1" , _ + "Title1" , _ + "Posi1" , _ + "123" , _ + "465" , _ + "789" , _ + "AD@a.a" , _ + "State1" , _ + ) + aUserData2 = Array( _ + "Com2" , _ + "XYZ" , _ + "OPQ" , _ + "XO" , _ + "Str2" , _ + "Country2" , _ + "321" , _ + "City2" , _ + "Title2" , _ + "Posi2" , _ + "222" , _ + "654" , _ + "987" , _ + "XO@b.b" , _ + "State2" , _ + ) + + printlog "Insert/Fields/Other/Document / Sender" + '/// <b> Insert/Fields/Other/Document / Sender </b> + + Call hNewDocument + + '/// Change user data + ToolsOptions + Call hToolsOptions("STAROFFICE","USERDATA") + aUserData(0) = Firma.GetText + aUserData(1) = VorName.GetText + aUserData(2) = ZuName.GetText + aUserData(3) = Strasse.GetText + aUserData(4) = City.GetText + aUserData(5) = State.GetText + aUserData(6) = Zip.GetText + aUserData(7) = Land.GetText + aUserData(8) = Titel.GetText + aUserData(9) = Position.GetText + aUserData(10) = TelPriv.GetText + aUserData(11) = TelGe.GetText + aUserData(12) = Fax.GetText + aUserData(13) = EMail.GetText + + Kuerzel.SetText "" + Firma.SetText aUserData1(0) + VorName.SetText aUserData1(1) + ZuName.SetText aUserData1(2) + Strasse.SetText aUserData1(4) + City.SetText aUserData1(7) + State.SetText aUserData1(14) + Zip.SetText aUserData1(6) + Land.SetText aUserData1(5) + Titel.SetText aUserData1(8) + Position.SetText aUserData1(9) + TelPriv.SetText aUserData1(10) + TelGe.SetText aUserData1(11) + Fax.SetText aUserData1(12) + EMail.SetText aUserData1(13) + + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK + + '/// Insert/Fields/Other/Document / Sender + Call fInsertFieldsOther("TabDokumentFeldbefehle") + Feldtyp.Select fGetType("Sender") + for i= 0 to UBound(aUserData1) + Kontext "TabDokumentFeldbefehle" + Auswahl.Select i+1 + Sleep 1 + Einfuegen.Click + sleep 1 + Call wTypeKeys "<Return>" + next i + Kontext "TabDokumentFeldbefehle" + TabDokumentFeldbefehle.Close + + '/// Check if the configuration is inserted correctly + Call wTypeKeys "<MOD1 Home>" + for i= 0 to UBound(aUserData1) + Call wTypeKeys "<Shift End>" + if fGetFieldContent() <> aUserData1(i) then + Warnlog "i32872 1.Should get " & aUserData1(i)& " but get " & fGetFieldContent() + end if + Call wTypeKeys "<Down><Home>" + next i + + '/// Change author to author1 :XYZ OPQ + ToolsOptions + Call hToolsOptions("STAROFFICE","USERDATA") + Kuerzel.SetText "" + Firma.SetText aUserData2(0) + VorName.SetText aUserData2(1) + ZuName.SetText aUserData2(2) + Strasse.SetText aUserData2(4) + City.SetText aUserData2(7) + State.SetText aUserData2(14) + Zip.SetText aUserData2(6) + Land.SetText aUserData2(5) + Titel.SetText aUserData2(8) + Position.SetText aUserData2(9) + TelPriv.SetText aUserData2(10) + TelGe.SetText aUserData2(11) + Fax.SetText aUserData2(12) + EMail.SetText aUserData2(13) + + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK + Sleep 2 + + '/// Press F9 + Call wTypeKeys "<F9>" + Sleep 3 + + '/// Check if the configuration is changed + Call wTypeKeys "<MOD1 Home>" + for i= 0 to UBound(aUserData1) + Call wTypeKeys "<Shift End>" + if fGetFieldContent() <> aUserData2(i) then + Warnlog "i32872 2.Should get " & aUserData2(i)& " but get " & fGetFieldContent() + end if + Call wTypeKeys "<Down><Home>" + next i + + 'Change author to default + ToolsOptions + Call hToolsOptions("STAROFFICE","USERDATA") + Firma.SetText aUserData(0) + VorName.SetText aUserData(1) + ZuName.SetText aUserData(2) + Strasse.SetText aUserData(3) + City.SetText aUserData(4) + State.SetText aUserData(5) + Zip.SetText aUserData(6) + Land.SetText aUserData(7) + Titel.SetText aUserData(8) + Position.SetText aUserData(9) + TelPriv.SetText aUserData(10) + TelGe.SetText aUserData(11) + Fax.SetText aUserData(12) + EMail.SetText aUserData(13) + + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tDocumentSenderFixed + if iSprache <> 1 then + QaErrorLog "Currently no testing with other languages than English. (ID's are not the same) Aborting." + exit sub + end if + + Dim aUserData(16) as String + Dim aUserData1() as String + Dim aUserData2() as String + + Dim i as Integer + + aUserData1 = Array( _ + "Com1" , _ + "ABC" , _ + "DEF" , _ + "AD" , _ + "Str1" , _ + "Country1" , _ + "123" , _ + "City1" , _ + "Title1" , _ + "Posi1" , _ + "123" , _ + "465" , _ + "789" , _ + "AD@a.a" , _ + "State1" , _ + ) + + aUserData2 = Array( _ + "Com2" , _ + "XYZ" , _ + "OPQ" , _ + "XO" , _ + "Str2" , _ + "Country2" , _ + "321" , _ + "City2" , _ + "Title2" , _ + "Posi2" , _ + "222" , _ + "654" , _ + "987" , _ + "XO@b.b" , _ + "State2" , _ + ) + + + printlog "Insert/Fields/Other/Document / Sender - Fixed" + '/// <b> Insert/Fields/Other/Document / Sender - Fixed</b> + + Call hNewDocument + + '/// Change user data + ToolsOptions + Call hToolsOptions("STAROFFICE","USERDATA") + aUserData(0) = Firma.GetText + aUserData(1) = VorName.GetText + aUserData(2) = ZuName.GetText + aUserData(3) = Strasse.GetText + aUserData(4) = City.GetText + aUserData(5) = State.GetText + aUserData(6) = Zip.GetText + aUserData(7) = Land.GetText + aUserData(8) = Titel.GetText + aUserData(9) = Position.GetText + aUserData(10) = TelPriv.GetText + aUserData(11) = TelGe.GetText + aUserData(12) = Fax.GetText + aUserData(13) = EMail.GetText + + Kuerzel.SetText "" + Firma.SetText aUserData1(0) + VorName.SetText aUserData1(1) + ZuName.SetText aUserData1(2) + Strasse.SetText aUserData1(4) + City.SetText aUserData1(7) + State.SetText aUserData1(14) + Zip.SetText aUserData1(6) + Land.SetText aUserData1(5) + Titel.SetText aUserData1(8) + Position.SetText aUserData1(9) + TelPriv.SetText aUserData1(10) + TelGe.SetText aUserData1(11) + Fax.SetText aUserData1(12) + EMail.SetText aUserData1(13) + + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK + + '/// Insert/Fields/Other/Document / Sender , check 'Fixed content' + Call fInsertFieldsOther("TabDokumentFeldbefehle") + Feldtyp.Select fGetType("Sender") + for i= 0 to UBound(aUserData1) + Kontext "TabDokumentFeldbefehle" + Auswahl.Select i+1 + Sleep 1 + InhaltFix.Check + Einfuegen.Click + sleep 1 + Call wTypeKeys "<Return>" + next i + Kontext "TabDokumentFeldbefehle" + TabDokumentFeldbefehle.Close + + '/// Check if the configuration is inserted correctly + Call wTypeKeys "<MOD1 Home>" + for i= 0 to UBound(aUserData1) + Call wTypeKeys "<Shift End>" + if fGetFieldContent() <> aUserData1(i) then + Warnlog "i32872 1.Should get " & aUserData1(i)& " but get " & fGetFieldContent() + end if + Call wTypeKeys "<Down><Home>" + next i + + '/// Change author to author1 :XYZ OPQ + ToolsOptions + Call hToolsOptions("STAROFFICE","USERDATA") + Kuerzel.SetText "" + Firma.SetText aUserData2(0) + VorName.SetText aUserData2(1) + ZuName.SetText aUserData2(2) + Strasse.SetText aUserData2(4) + City.SetText aUserData2(7) + State.SetText aUserData2(14) + Zip.SetText aUserData2(6) + Land.SetText aUserData2(5) + Titel.SetText aUserData2(8) + Position.SetText aUserData2(9) + TelPriv.SetText aUserData2(10) + TelGe.SetText aUserData2(11) + Fax.SetText aUserData2(12) + EMail.SetText aUserData2(13) + + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK + Sleep 2 + + '/// Press F9 + Call wTypeKeys "<F9>" + Sleep 3 + + '/// Check if the configuration is changed + Call wTypeKeys "<MOD1 Home>" + for i= 0 to UBound(aUserData1) + Call wTypeKeys "<Shift End>" + if fGetFieldContent() <> aUserData1(i) then + Warnlog "i32872 2.Should get " & aUserData1(i)& " but get " & fGetFieldContent() + end if + Call wTypeKeys "<Down><Home>" + next i + + 'Change author to default + ToolsOptions + Call hToolsOptions("STAROFFICE","USERDATA") + Firma.SetText aUserData(0) + VorName.SetText aUserData(1) + ZuName.SetText aUserData(2) + Strasse.SetText aUserData(3) + City.SetText aUserData(4) + State.SetText aUserData(5) + Zip.SetText aUserData(6) + Land.SetText aUserData(7) + Titel.SetText aUserData(8) + Position.SetText aUserData(9) + TelPriv.SetText aUserData(10) + TelGe.SetText aUserData(11) + Fax.SetText aUserData(12) + EMail.SetText aUserData(13) + + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tDocumentStatistics + + Dim sTestFile as String + Dim sOriginalFile as string + Dim sStatistics() as String + Dim sType as string + Dim i as Integer + + sStatistics = Array( "2", "2", "3", "13", "2", "2", "1" ) + + sTestFile = Convertpath (gOfficepath + "user\work\statisticsTest.sxw") + sOriginalFile = Convertpath (gTesttoolpath + "writer\optional\input\fields\statisticsTest.sxw") + ' document has to be copied to local file system to avoid opening a read-only file + ' because all field data gets lost if documents write-protection is removed via 'sMakeReadOnlyDocumentEditable' + FileCopy (sOriginalFile, sTestFile) + if FileExists ( sTestFile ) = false then + Warnlog "Test document couldn't be copied to local file system. Test aborted!" + goto endsub + end if + + printlog "Insert/Fields/Other/Document / Statistics" + '/// <b> Insert/Fields/Other/Document / Statistics </b> + + '/// Open test file statisticsTest.sxw which includes + '/// 2 tables , 2 pictures , 22 paragraph , 1 object , + '/// 2 words , 12 characters and 2 pages + Call hFileOpen(sTestFile) + + Call wTypeKeys "<MOD1 Home><Down>" + + '/// Insert/Fields/Other/Document / Statistics + '/// Insert Pages, Paragraphs , Words , Characters , Tables, Graphics , Objects. + '/// Check if the insertion is correct + Call fInsertFieldsOther("TabDokumentFeldbefehle") + Feldtyp.Select fGetType("Statistics") + sType = Auswahl.GetSelText + for i = 0 to UBound(sStatistics) + Kontext "TabDokumentFeldbefehle" + Auswahl.Select i+1 + Sleep 1 + Einfuegen.Click + sleep 1 + Call wTypeKeys "<F9>" + Sleep 2 + Call wTypeKeys "<Shift Home>" + Sleep 1 + EditCopy + if GetClipboard <> sStatistics(i) then + Warnlog "- " & sType & ": Should get " & sStatistics(i) & " but get " & GetClipboard + end if + Call wTypeKeys "<Delete>" + next i + Kontext "TabDokumentFeldbefehle" + TabDokumentFeldbefehle.Close + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tDocumentTemplate + + Dim sTestFile as String + Dim sOriginalFile as string + Dim sDirectory as String + Dim oDirectory as String + Dim sLanguage as String + Dim sFormat() as String + Dim sResult(6) as String + Dim i as Integer + + sLanguage = fGetDirLanguage() + sTestFile = Convertpath (gOfficepath + "user\work\diploma.ott") + sOriginalFile = Convertpath (gTesttoolpath + "writer\optional\input\fields\diploma.ott") + ' document has to be copied to local file system to avoid opening a read-only file + ' because all field data gets lost if documents write-protection is removed via 'sMakeReadOnlyDocumentEditable' + FileCopy (sOriginalFile, sTestFile) + if FileExists ( sTestFile ) = false then + Warnlog "Test document couldn't be copied to local file system. Test aborted!" + goto endsub + end if + + sResult(0) = fGetCateGory() + sResult(1) = "diploma.ott" + sResult(2) = "diploma" + sResult(3) = Convertpath (gOfficepath + "user\work") + sResult(4) = sTestFile + sResult(5) = fGetStyle() + + printlog "Insert/Fields/Other/Document / Template" + '/// <b> Insert/Fields/Other/Document / Template </b> + + '/// Open test file diploma.ott + Call hFileOpen(sTestFile) + + Call wTypeKeys "<MOD1 Home>" + + '/// Insert/Fields/Other/Document / Template + '/// Insert Category , File name , File name without extension , + '/// + Path , Path/File name , Style + '/// Check if the insertion is correct + Call fInsertFieldsOther("TabDokumentFeldbefehle") + Feldtyp.Select fGetType("Templates") + for i = 1 to Formatliste.GetItemCount + Kontext "TabDokumentFeldbefehle" + Formatliste.Select i + Sleep 1 + Einfuegen.Click + sleep 1 + Call wTypeKeys "<F9>" + Sleep 2 + Call wTypeKeys "<Shift Left>" + Sleep 1 + EditCopy + if GetClipboard <> sResult(i-1) then + select case i-1 + case 0 + QAErrorlog "#i70342#Field 'Templates->Category' is empty" + case else + Warnlog " - Should get " & sResult(i-1) & " but get " & GetClipboard + end select + end if + Call wTypeKeys "<Delete>" + next i + Kontext "TabDokumentFeldbefehle" + TabDokumentFeldbefehle.Close + + Do Until GetDocumentCount = 0 + Call hCloseDocument + Loop +endcase + +'----------------------------------------------------------------- + +testcase tDocumentTime + + Dim sTime1 as String + Dim sTime2 as String + + printlog "Insert/Fields/Other/Document / Time" + '/// <b> Insert/Fields/Other/Document / Time </b> + + Call hNewDocument + + '/// Insert/Fields/Other/Document / Time + '/// Insert a fixed time and a time . + '/// Check if the insertion is correct + Call fInsertFieldsOther("TabDokumentFeldbefehle") + Feldtyp.Select fGetType("Time") + Auswahl.Select 1 'Time (Fixed) + Sleep 1 + Einfuegen.Click + sleep 1 + Call wTypeKeys "<Return>" + + Kontext "TabDokumentFeldbefehle" + Auswahl.Select 1 'Time + Sleep 1 + Einfuegen.Click + sleep 1 + Kontext "TabDokumentFeldbefehle" + TabDokumentFeldbefehle.Close + + Call wTypeKeys "<MOD1 Home>" + Call wTypeKeys "<Shift End>" + EditCopy + sTime1 = GetClipboard + + Call wTypeKeys "<Down><Home>" + Call wTypeKeys "<Shift End>" + EditCopy + sTime2 = GetClipboard + + Sleep 5 + Call wTypeKeys "<F9>" + + 'Check fixed time + Call wTypeKeys "<MOD1 Home>" + Call wTypeKeys "<Shift End>" + EditCopy + if sTime1 <> GetClipboard then + Warnlog "Time should NOT change !" + end if + + 'Check time + Call wTypeKeys "<Down><Home>" + Call wTypeKeys "<Shift End>" + EditCopy + if sTime2 <> GetClipboard then + Warnlog "Time should change !" + end if + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- diff --git a/testautomation/writer/optional/includes/fields/w_fields3.inc b/testautomation/writer/optional/includes/fields/w_fields3.inc new file mode 100755 index 000000000000..7b4e7f50722b --- /dev/null +++ b/testautomation/writer/optional/includes/fields/w_fields3.inc @@ -0,0 +1,993 @@ +'encoding UTF-8 Do not remove or change this line! +'************************************************************************** +' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +' +' Copyright 2000, 2010 Oracle and/or its affiliates. +' +' OpenOffice.org - a multi-platform office productivity suite +' +' This file is part of OpenOffice.org. +' +' OpenOffice.org is free software: you can redistribute it and/or modify +' it under the terms of the GNU Lesser General Public License version 3 +' only, as published by the Free Software Foundation. +' +' OpenOffice.org is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY; without even the implied warranty of +' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +' GNU Lesser General Public License version 3 for more details +' (a copy is included in the LICENSE file that accompanied this code). +' +' You should have received a copy of the GNU Lesser General Public License +' version 3 along with OpenOffice.org. If not, see +' <http://www.openoffice.org/license.html> +' for a copy of the LGPLv3 License. +' +'/************************************************************************ +'* +'* owner : helge.delfs@oracle.com +'* +'* short description : Fields - References Test +'* +'\*********************************************************************** + +sub w_fields3 + + Call tCrossReference + Call tSetReferenceNoSelection + Call tSetReferenceTextSelection + Call tInsertReferencePage + Call tInsertReferenceChapter + Call tInsertReferenceReference + Call tInsertReferenceAboveBelow + Call tInsertReferenceAsPageStyle + Call tInsertFootnote + Call tInsertEndnote + Call tInsertCaptionAbove + Call tInsertCaptionBelow + Call tInsertBookmarkPage + Call tInsertBookmarkChapter + Call tInsertBookmarkReference + Call tInsertBookmarkAboveBelow + Call tInsertBookmarkAsPageStyle + +end sub + +'----------------------------------------------------------------- + +testcase tCrossReference + + printlog "Insert/Cross-reference" + '/// <b> Insert/Cross-reference </b> + + '/// Open a new document + Call hNewDocument + + '/// Insert/Cross-reference + InsertReferenceField + Sleep 2 + Kontext "TabReferenzen" + if TabReferenzen.Exists then + TabReferenzen.Close + else + Warnlog "Tabpage References should be as the actived tabpage!" + end if + + '/// Close the document + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tSetReferenceNoSelection + + Dim sReference as String + Dim sTestFile as String + + sReference = "myTest" + sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\fields\pageTest.sxw") + + printlog "Set Reference - Cursor at any position" + '/// <b> Set Reference - Cursor at any position </b> + + Call hNewDocument + + '/// Open test file pageTest.sxw + Call hFileOpen(sTestFile) + Call sMakeReadOnlyDocumentEditable + + '/// Set curson to the 2nd page + Call wTypeKeys "<MOD1 Home>" + Call fFindWord ("Sec") + Call wTypeKeys "<End><Return>" + + '/// Insert/Cross-reference , choose "Set Reference" + InsertReferenceField + Kontext "TabReferenzen" + Feldtyp.Select 1 + Sleep 1 + Namefeld.SetText sReference + Einfuegen.Click + TabReferenzen.Close + + InsertReferenceField + Kontext "TabReferenzen" + Feldtyp.Select 2 + Sleep 1 + if Namefeld.GetText <> sReference then + Warnlog "Reference can't be set correctly!" + end if + TabReferenzen.Close + + '/// Close the document + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tSetReferenceTextSelection + + Dim sReference as String + + sReference = "myTest" + + printlog "Set Reference - Select some text" + '/// <b> Set Reference - Select some text </b> + + '/// Open a new document + Call hNewDocument + + '/// Input some text and select them + Call wTypeKeys "ABCD" + Call wTypeKeys "<Shift Home>" + + '/// Insert/Cross-reference , choose "Set Reference" + InsertReferenceField + Kontext "TabReferenzen" + Feldtyp.Select 1 + Sleep 1 + Namefeld.SetText sReference + Einfuegen.Click + TabReferenzen.Close + + InsertReferenceField + Kontext "TabReferenzen" + Feldtyp.Select 2 + Sleep 1 + if Namefeld.GetText <> sReference then + Warnlog "Reference can't be set correctly!" + end if + TabReferenzen.Close + + '/// Close the document + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tInsertReferencePage + + Dim sReference as String + Dim sTestFile as String + + sReference = "myTest" + sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\fields\pageTest.sxw") + + printlog "Insert Reference - Page" + '/// <b> Insert Reference - Page </b> + + Call hNewDocument + + '/// Open test file pageTest.sxw + Call hFileOpen(sTestFile) + Call sMakeReadOnlyDocumentEditable + + '/// Set curson to the 2nd page + Call wTypeKeys "<MOD1 Home>" + Call fFindWord ("Sec") + Call wTypeKeys "<End><Return>" + + '/// Insert/Cross-reference , choose "Set Reference" + InsertReferenceField + Kontext "TabReferenzen" + Feldtyp.Select 1 + Sleep 1 + Namefeld.SetText sReference + Einfuegen.Click + TabReferenzen.Close + + Call wTypeKeys "<Return>" , 2 + + '/// Insert/Cross-reference , choose "Insert Reference" and "Page" + InsertReferenceField + Kontext "TabReferenzen" + Feldtyp.Select 2 + Sleep 1 + Auswahl.Select sReference + Sleep 1 + Formatliste.Select 1 + Sleep 1 + Einfuegen.Click + TabReferenzen.Close + + Call wTypeKeys "<F9>" + Sleep 2 + Call wTypeKeys "<Shift Home>" + + if fGetFieldContent( ) <> "2" then + Warnlog "Should get 2 , but get " & fGetFieldContent() + end if + + '/// Close the document + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tInsertReferenceChapter + + Dim sReference as String + Dim sTestFile as String + + sReference = "myTest" + sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\fields\chapterTest.sxw") + + printlog "Insert Reference - Chapter" + '/// <b> Insert Reference - Chapter </b> + + Call hNewDocument + + '/// Open test file chapterTest.sxw + Call hFileOpen(sTestFile) + Call sMakeReadOnlyDocumentEditable + + '/// Set curson to the 2nd line + Call wTypeKeys "<MOD1 Home>" + Call wTypeKeys "<Down><Home>" + + '/// Insert/Cross-reference , choose "Set Reference" + InsertReferenceField + Kontext "TabReferenzen" + Feldtyp.Select 1 + Sleep 1 + Namefeld.SetText sReference + Einfuegen.Click + TabReferenzen.Close + + Call wTypeKeys "<End>" + Call wTypeKeys "<Return>" , 2 + + '/// Insert/Cross-reference , choose "Insert Reference" and "Chapter" + InsertReferenceField + Kontext "TabReferenzen" + Feldtyp.Select 2 + Sleep 1 + Auswahl.Select sReference + Sleep 1 + Formatliste.Select 2 + Sleep 1 + Einfuegen.Click + TabReferenzen.Close + + Call wTypeKeys "<F9>" + Sleep 2 + Call wTypeKeys "<Shift Home>" + + if fGetFieldContent( ) <> "2" then + Warnlog "#i40625# Should get 2 , but get " & fGetFieldContent() + end if + + '/// Close the document + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tInsertReferenceReference + + Dim sReference as String + Dim sReferenceName as String + + sReference = "est !" + sReferenceName = "myTest" + + printlog "Insert Reference - Reference" + '/// <b> Insert Reference - Reference</b> + + '/// Open a new document + Call hNewDocument + + '/// Input some thing in the document and press return + Call wTypeKeys "This is a test !" + Call wTypeKeys "<Return>" + + '/// Select some text + Call wTypeKeys "<Up><End>" + Call wTypeKeys "<Shift Left>" , 5 + + '/// Insert/Cross-reference , choose "Set Reference" + InsertReferenceField + Kontext "TabReferenzen" + Feldtyp.Select 1 + Sleep 1 + Namefeld.SetText sReferenceName + Einfuegen.Click + TabReferenzen.Close + + '/// set focus to 2nd line + Call wTypeKeys "<Down>" + + '/// Insert/Cross-reference , choose "Insert Reference" and "Reference" + InsertReferenceField + Kontext "TabReferenzen" + Feldtyp.Select 2 + Sleep 1 + Auswahl.Select sReferenceName + Sleep 1 + Formatliste.Select 3 + Sleep 1 + Einfuegen.Click + TabReferenzen.Close + + Call wTypeKeys "<F9>" + Sleep 2 + Call wTypeKeys "<Shift Home>" + + if fGetFieldContent() <> sReference then + Warnlog "Should get " & sReference & " but get " & fGetFieldContent() + end if + + '/// Close the document + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tInsertReferenceAboveBelow + + Dim sReference as String + Dim sAbove as String + Dim sBelow as String + + sReference = "myTest" + Select Case iSystemSprache + Case 01 : sAbove = "above" : sBelow = "below" + Case 35 : sAbove = "sur" : sBelow = "sous" + Case 39 : sAbove = "sopra" : sBelow = "sotto" + Case 49 : sAbove = "oben" : sBelow = "unten" + Case 46 : sAbove = "ovan" : sBelow = "under" + Case 55 : sAbove = "arriba" : sBelow = "abajo" + End Select + + printlog "Insert Reference - Above/Below" + '/// <b> Insert Reference - Above/Below</b> + + '/// Open a new document + Call hNewDocument + + '/// Press Return first , then input some text in + '/// + the document , press return again + Call wTypeKeys "<Return>" + Call wTypeKeys "This is a test !" + Call wTypeKeys "<Return>" + + '/// Insert a reference before "This is ..." + Call wTypeKeys "<Up><Home>" + InsertReferenceField + Kontext "TabReferenzen" + Feldtyp.Select 1 + Sleep 1 + Namefeld.SetText sReference + Einfuegen.Click + TabReferenzen.Close + + '/// set focus to 3rd line + Call wTypeKeys "<Down>" + + '/// Insert/Cross-reference , choose "Insert Reference" and "above/below" + InsertReferenceField + Kontext "TabReferenzen" + Feldtyp.Select 2 + Sleep 1 + Auswahl.Select sReference + Sleep 1 + Formatliste.Select 4 + Sleep 1 + Einfuegen.Click + TabReferenzen.Close + + Call wTypeKeys "<F9>" + Sleep 2 + Call wTypeKeys "<Shift Home>" + + if fGetFieldContent() <> sAbove then 'Check systemlanguage / Office-Language - if other than 01 then ignore/QaErrorLog! + Warnlog "Should get " & sAbove & " but get " & fGetFieldContent() + end if + + '/// set focus to 1st line + Call wTypeKeys "<MOD1 Home>" + + '/// Insert/Cross-reference , choose "Insert Reference" and "above/below" + InsertReferenceField + Kontext "TabReferenzen" + Feldtyp.Select 2 + Sleep 1 + Auswahl.Select sReference + Sleep 1 + Formatliste.Select 4 + Sleep 1 + Einfuegen.Click + TabReferenzen.Close + + Call wTypeKeys "<F9>" + Sleep 2 + Call wTypeKeys "<Shift Home>" + + if fGetFieldContent() <> sBelow then + Warnlog "Should get " & sBelow & " but get " & fGetFieldContent() + end if + + '/// Close the document + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tInsertReferenceAsPageStyle + + Dim sReference as String + Dim sTestSytle as String + + sReference = "myTest" + sTestSytle = "A" + + printlog "Insert Reference - As Page Style" + '/// <b> Insert Reference - As Page Style </b> + + '/// Open a new document + Call hNewDocument + + '/// Fomrat/page / page , set Format as "A , B , C ..." + Call fFormatPageWriter("TabSeite") + Numerierung.Select 1 + TabSeite.OK + + '/// Input some thing in the document , press return + Call wTypeKeys "This is a test !" + Call wTypeKeys "<Return>" + + '/// Insert a reference before "This is ..." + Call wTypeKeys "<Up><Home>" + InsertReferenceField + Kontext "TabReferenzen" + Feldtyp.Select 1 + Sleep 1 + Namefeld.SetText sReference + Einfuegen.Click + TabReferenzen.Close + + '/// set focus to 2nd line + Call wTypeKeys "<Down>" + + '/// Insert/Cross-reference , choose "Insert Reference" and "As Page Style" + InsertReferenceField + Kontext "TabReferenzen" + Feldtyp.Select 2 + Sleep 1 + Auswahl.Select sReference + Sleep 1 + Formatliste.Select 5 + Sleep 1 + Einfuegen.Click + TabReferenzen.Close + + Call wTypeKeys "<F9>" + Sleep 2 + Call wTypeKeys "<Shift Home>" + + if fGetFieldContent() <> sTestSytle then + Warnlog "Should get " & sTestSytle & " but get " & fGetFieldContent() + end if + + '/// Close the document + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tInsertFootnote + + Dim sFootnote as String + + sFootnote = "Test" + + printlog "Insert Footnote" + '/// <b> Insert Footnote </b> + + '/// Open a new document + Call hNewDocument + + '/// Insert/Footnote + InsertFootnote + Kontext "FussnoteEinfuegen" + 'check footnote + Fussnote.Check + Zeichen.Check + ZeichenText.SetText sFootnote + FussnoteEinfuegen.OK + + '/// Check if footnote is inserted correctly + Call wTypeKeys "<MOD1 Home>" + Call wTypeKeys "<Shift End>" + if fGetFieldContent() <> sFootnote then + Warnlog "Should get " & sFootnote & " but get " & fGetFieldContent() + end if + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tInsertEndnote + + Dim sEndnote as String + + sEndnote = "Test" + + printlog "Insert Endnote" + '/// <b> Insert Endnote </b> + + '/// Open a new document + Call hNewDocument + + '/// Insert Endnote + InsertFootnote + Kontext "FussnoteEinfuegen" + 'check endnote + Endnote.Check + Zeichen.Check + ZeichenText.SetText sEndnote + FussnoteEinfuegen.OK + + '/// Check if footnote is inserted correctly + Call wTypeKeys "<MOD1 Home>" + Call wTypeKeys "<Shift End>" + if fGetFieldContent() <> sEndnote then + Warnlog "Should get " & sEndnote & " but get " & fGetFieldContent() + end if + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tInsertCaptionAbove + + Dim sCategory as String + Dim sCaption as String + Dim sSeparator as String + + sCategory = "A" : sCaption = "B" : sSeparator = "*" + + printlog "Insert Caption - Above" + '/// <b> Insert Caption - Above </b> + + '/// Open a new document + Call hNewDocument + + '/// Insert a frame + Call wInsertFrame + + '/// Insert / Caption , set Category as A , set Caption as B , Set Seperator as * + InsertCaption + Kontext "Beschriftung" + Kategorie.SetText sCategory + Separator.SetText sSeparator + BeschriftungsText.SetText sCaption + Position.Select 1 + Beschriftung.OK + Sleep 1 + + '/// Check if the insertion is correct + Call wTypeKeys "<Return>" + Call wTypeKeys "<Up><Home><Shift End>" + EditCopy + + if fGetFieldContent() <> sCategory & " 1" & sSeparator & sCaption then + Warnlog "Should get " & sCategory & " 1" & sSeparator & sCaption & " but get " & fGetFieldContent() + end if + + Call wTypeKeys "<Down>" + Call wTypeKeys "<Home><Shift End>" + try + EditCopy + Warnlog "Should NOT get anything !" + catch + endcatch + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tInsertCaptionBelow + + Dim sCategory as String + Dim sCaption as String + Dim sSeparator as String + + sCategory = "A" : sCaption = "B" : sSeparator = "*" + + printlog "Insert Caption - Below" + '/// <b> Insert Caption - Below </b> + + '/// Open a new document + Call hNewDocument + + '/// Insert a frame + Call wInsertFrame + + '/// Insert / Caption , set Category as A , set Caption as B, + '/// + select position as Above + InsertCaption + Kontext "Beschriftung" + Kategorie.SetText sCategory + Separator.SetText sSeparator + BeschriftungsText.SetText sCaption + Position.Select 2 + Beschriftung.OK + Sleep 1 + + '/// Check if the insertion is correct + Call wTypeKeys "<Return>" + Call wTypeKeys "<Up><Home><Shift End>" + try + EditCopy + Warnlog "Should NOT get anything !" + catch + endcatch + + Call wTypeKeys "<Down>" + Call wTypeKeys "<Home><Shift End>" + EditCopy + if fGetFieldContent() <> sCategory & " 1" & sSeparator & sCaption then + Warnlog "Should get " & sCategory & " 1" & sSeparator & sCaption & " but get " & fGetFieldContent() + end if + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tInsertBookmarkPage + + Dim sBookmark as String + Dim sTestFile as String + + sBookmark = "myTest" + sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\fields\pageTest.sxw") + + printlog "Insert Bookmark - Page" + '/// <b> Insert Bookmark - Page </b> + + Call hNewDocument + + '/// Open test file pageTest.sxw + Call hFileOpen(sTestFile) + Call sMakeReadOnlyDocumentEditable + + '/// Set curson to the 2nd page + Call wTypeKeys "<MOD1 Home>" + Call fFindWord ("Sec") + Call wTypeKeys "<Home>" + + '/// Insert a bookmark + InsertBookmark + Kontext "TextmarkeEinfuegen" + Textmarken.SetText sBookmark + TextmarkeEinfuegen.OK + + Call wTypeKeys "<End>" + Call wTypeKeys "<Return>" , 2 + + '/// Insert/Cross-reference , choose "Bookmarks" and "Page" + InsertReferenceField + Kontext "TabReferenzen" + Feldtyp.Select 5 + Sleep 1 + Auswahl.Select sBookmark + Sleep 1 + Formatliste.Select 1 + Sleep 1 + Einfuegen.Click + TabReferenzen.Close + + Call wTypeKeys "<F9>" + Sleep 2 + Call wTypeKeys "<Shift Home>" + + if fGetFieldContent( ) <> "2" then + Warnlog "Should get 2 , but get " & fGetFieldContent() + end if + + '/// Close the document + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tInsertBookmarkChapter + + Dim sBookmark as String + Dim sTestFile as String + + sBookmark = "myTest" + sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\fields\chapterTest.sxw") + + printlog "Insert Bookmark - Chapter" + '/// <b> Insert Bookmark - Chapter </b> + + Call hNewDocument + + '/// Open test file chapterTest.sxw + Call hFileOpen(sTestFile) + Call sMakeReadOnlyDocumentEditable + + '/// Set curson to the 2nd line + Call wTypeKeys "<MOD1 Home>" + Call wTypeKeys "<Down><Home>" + + '/// Insert a bookmark + InsertBookmark + Kontext "TextmarkeEinfuegen" + Textmarken.SetText sBookmark + TextmarkeEinfuegen.OK + + Call wTypeKeys "<End>" + Call wTypeKeys "<Return>" , 2 + + '/// Insert/Cross-reference , choose "Bookmarks" and "Chapter" + InsertReferenceField + Kontext "TabReferenzen" + Feldtyp.Select 5 + Sleep 1 + Auswahl.Select sBookmark + Sleep 1 + Formatliste.Select 2 + Sleep 1 + Einfuegen.Click + TabReferenzen.Close + + Call wTypeKeys "<F9>" + Sleep 2 + Call wTypeKeys "<Shift Home>" + + if fGetFieldContent( ) <> "2" then + Warnlog "#i40625# Should get 2 , but get " & fGetFieldContent() + end if + + '/// Close the document + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tInsertBookmarkReference + + Dim sReference as String + Dim sBookmark as String + + sReference = "est !" + sBookmark = "myTest" + + printlog "Insert Bookmkar - Reference" + '/// <b> Insert Bookmkar - Reference</b> + + '/// Open a new document + Call hNewDocument + + '/// Input some thing in the document and press return + Call wTypeKeys "This is a test !" + Call wTypeKeys "<Return>" + + '/// Select some text + Call wTypeKeys "<Up><End>" + Call wTypeKeys "<Shift Left>" , 5 + + '/// Insert a bookmark + InsertBookmark + Kontext "TextmarkeEinfuegen" + Textmarken.SetText sBookmark + TextmarkeEinfuegen.OK + + '/// set focus to 2nd line + Call wTypeKeys "<Down>" + + '/// Insert/Cross-reference , choose "Bookmark" and "Reference" + InsertReferenceField + Kontext "TabReferenzen" + Feldtyp.Select 5 + Sleep 1 + Auswahl.Select sBookmark + Sleep 1 + Formatliste.Select 3 + Sleep 1 + Einfuegen.Click + TabReferenzen.Close + + Call wTypeKeys "<F9>" + Sleep 2 + Call wTypeKeys "<Shift Home>" + + if fGetFieldContent() <> sReference then + Warnlog "Should get " & sReference & " but get " & fGetFieldContent() + end if + + '/// Close the document + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tInsertBookmarkAboveBelow + + Dim sBookmark as String + Dim sAbove as String + Dim sBelow as String + + sBookmark = "myTest" + Select Case iSystemSprache + Case 01 : sAbove = "above" : sBelow = "below" + Case 35 : sAbove = "sur" : sBelow = "sous" + Case 39 : sAbove = "sopra" : sBelow = "sotto" + Case 49 : sAbove = "oben" : sBelow = "unten" + Case 46 : sAbove = "ovan" : sBelow = "under" + Case 55 : sAbove = "arriba" : sBelow = "abajo" + End Select + + printlog "Insert Bookmark - Above/Below" + '/// <b> Insert Bookmark - Above/Below</b> + + '/// Open a new document + Call hNewDocument + + '/// Press Return first , then input some thing in + '/// + the document , press return again + Call wTypeKeys "<Return>" + Call wTypeKeys "This is a test !" + Call wTypeKeys "<Return>" + + '/// Insert a Bookmark before "This is ..." + Call wTypeKeys "<Up><Home>" + InsertBookmark + Kontext "TextmarkeEinfuegen" + Textmarken.SetText sBookmark + TextmarkeEinfuegen.OK + + '/// set focus to 3rd line + Call wTypeKeys "<Down>" + + '/// Insert/Cross-reference , choose "Bookmarks" and "above/below" + InsertReferenceField + Kontext "TabReferenzen" + Feldtyp.Select 5 + Sleep 1 + Auswahl.Select sBookmark + Sleep 1 + Formatliste.Select 4 + Sleep 1 + Einfuegen.Click + TabReferenzen.Close + + Call wTypeKeys "<F9>" + Sleep 2 + Call wTypeKeys "<Shift Home>" + + if fGetFieldContent() <> sAbove then + Warnlog "Should get " & sAbove & " but get " & fGetFieldContent() + end if + + '/// set focus to 1st line + Call wTypeKeys "<MOD1 Home>" + + '/// Insert/Cross-reference , choose "Bookmark" and "above/below" + InsertReferenceField + Kontext "TabReferenzen" + Feldtyp.Select 5 + Sleep 1 + Auswahl.Select sBookmark + Sleep 1 + Formatliste.Select 4 + Sleep 1 + Einfuegen.Click + TabReferenzen.Close + + Call wTypeKeys "<F9>" + Sleep 2 + Call wTypeKeys "<Shift Home>" + + if fGetFieldContent() <> sBelow then + Warnlog "Should get " & sBelow & " but get " & fGetFieldContent() + end if + + '/// Close the document + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tInsertBookmarkAsPageStyle + + Dim sBookmark as String + Dim sTestSytle as String + + sBookmark = "myTest" + sTestSytle = "A" + + printlog "Insert Bookmark - As Page Style" + '/// <b> Insert Bookmark - As Page Style </b> + + '/// Open a new document + Call hNewDocument + + '/// Fomrat/page / page , set Format as "A , B , C ..." + Call fFormatPageWriter("TabSeite") + Numerierung.Select 1 + TabSeite.OK + + '/// Input some thing in the document , press return + Call wTypeKeys "This is a test !" + Call wTypeKeys "<Return>" + + '/// Insert a Bookmark before "This is ..." + Call wTypeKeys "<Up><Home>" + InsertBookmark + Kontext "TextmarkeEinfuegen" + Textmarken.SetText sBookmark + TextmarkeEinfuegen.OK + + '/// set focus to 2nd line + Call wTypeKeys "<Down>" + + '/// Insert/Cross-reference , choose "Bookmark" and "As Page Style" + InsertReferenceField + Kontext "TabReferenzen" + Feldtyp.Select 5 + Sleep 1 + Auswahl.Select sBookmark + Sleep 1 + Formatliste.Select 5 + Sleep 1 + Einfuegen.Click + TabReferenzen.Close + + Call wTypeKeys "<F9>" + Sleep 2 + Call wTypeKeys "<Shift Home>" + + if fGetFieldContent() <> sTestSytle then + Warnlog "Should get " & sTestSytle & " but get " & fGetFieldContent() + end if + + '/// Close the document + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- diff --git a/testautomation/writer/optional/includes/fields/w_fields4.inc b/testautomation/writer/optional/includes/fields/w_fields4.inc new file mode 100755 index 000000000000..d1e16a1a36be --- /dev/null +++ b/testautomation/writer/optional/includes/fields/w_fields4.inc @@ -0,0 +1,1033 @@ +'encoding UTF-8 Do not remove or change this line! +'************************************************************************** +' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +' +' Copyright 2000, 2010 Oracle and/or its affiliates. +' +' OpenOffice.org - a multi-platform office productivity suite +' +' This file is part of OpenOffice.org. +' +' OpenOffice.org is free software: you can redistribute it and/or modify +' it under the terms of the GNU Lesser General Public License version 3 +' only, as published by the Free Software Foundation. +' +' OpenOffice.org is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY; without even the implied warranty of +' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +' GNU Lesser General Public License version 3 for more details +' (a copy is included in the LICENSE file that accompanied this code). +' +' You should have received a copy of the GNU Lesser General Public License +' version 3 along with OpenOffice.org. If not, see +' <http://www.openoffice.org/license.html> +' for a copy of the LGPLv3 License. +' +'/************************************************************************ +'* +'* owner : helge.delfs@oracle.com +'* +'* short description : Doc Information Test +'* +'\*********************************************************************** + +sub w_fields4 + + Call tDocInformationTitle + Call tDocInformationSubject + Call tDocInformationKeywords + Call tDocInformationDescription + Call tDocInformationUserDefined + Call tDocInformationCreated + Call tDocInformationModified + Call tDocInformationModifiedSavefile + Call tDocInformationPrinted + Call tDocInformationRevisionnumber + Call tDocInformationTotaleditingtime + +end sub + +'----------------------------------------------------------------- + +testcase tDocInformationTitle + + Dim sTitle as String + Dim sTestFile as String + Dim sVarResult as String + Dim sFixResult as String + + sTitle = "Title Test" + sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\fields\fields_docinfos.sxw") + sVarResult = sTitle + sFixResult = "This is the title" + + printlog "Doc Information - Title" + '/// <b> Doc Information - Title </b> + + Call hNewDocument + + '/// Open test file fields_docinfos.sxw + Call hFileOpen(sTestFile) + Call sMakeReadOnlyDocumentEditable + + '/// File / Properties / Description , input some + '/// + new text in Title + Call fFileProperties("TabBeschreibung") + Titel.Settext sTitle + TabBeschreibung.OK + + '/// Check if the title is changed in the document + '/// It should be changed in Var + '/// It should NOT be changed in Fix + Call fFindWord ("Title") + + Call wTypeKeys "<End><Right>" + Sleep 1 + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sVarResult then + Warnlog "Should get " & sVarResult & " but get " & fGetFieldContent() + end if + + Call wTypeKeys "<End><Right>" + Sleep 1 + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sFixResult then + Warnlog "Should get " & sFixResult & " but get " & fGetFieldContent() + end if + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tDocInformationSubject + + Dim sSubject as String + Dim sTestFile as String + Dim sVarResult as String + Dim sFixResult as String + + sSubject = "Subject Test" + sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\fields\fields_docinfos.sxw") + sVarResult = sSubject + sFixResult = "This is the subject" + + printlog "Doc Information - Subject" + '/// <b> Doc Information - Subject </b> + + Call hNewDocument + + '/// Open test file fields_docinfos.sxw + Call hFileOpen(sTestFile) + Call sMakeReadOnlyDocumentEditable + + '/// File / Properties / Description , input some + '/// + text in Subject + Call fFileProperties("TabBeschreibung") + Thema.Settext sSubject + TabBeschreibung.OK + + '/// Check if the Subject is changed in the document + '/// It should be changed in Var + '/// It should NOT be changed in Fix + Call fFindWord ("Subject") + + Call wTypeKeys "<End><Right>" + Sleep 1 + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sVarResult then + Warnlog "Should get " & sVarResult & " but get " & fGetFieldContent() + end if + + Call wTypeKeys "<End><Right>" + Sleep 1 + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sFixResult then + Warnlog "Should get " & sFixResult & " but get " & fGetFieldContent() + end if + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tDocInformationKeywords + + Dim sKeywords as String + Dim sTestFile as String + Dim sVarResult as String + Dim sFixResult as String + + sKeywords = "Keywords Test" + sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\fields\fields_docinfos.sxw") + sVarResult = sKeywords + sFixResult = "This are keywords" + + printlog "Doc Information - Keywords" + '/// <b> Doc Information - Keywords </b> + + Call hNewDocument + + '/// Open test file fields_docinfos.sxw + Call hFileOpen(sTestFile) + Call sMakeReadOnlyDocumentEditable + + '/// File / Properties / Description , input some + '/// + text in Keywords + Call fFileProperties("TabBeschreibung") + Schluesselwoerter.Settext sKeywords + TabBeschreibung.OK + + '/// Check if the Keywords is changed in the document + '/// It should be changed in Var + '/// It should NOT be changed in Fix + Call fFindWord ("Keywords") + + Call wTypeKeys "<End><Right>" + Sleep 1 + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sVarResult then + Warnlog "Should get " & sVarResult & " but get " & fGetFieldContent() + end if + + Call wTypeKeys "<End><Right>" + Sleep 1 + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sFixResult then + Warnlog "Should get " & sFixResult & " but get " & fGetFieldContent() + end if + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tDocInformationDescription + + Dim sDescription as String + Dim sTestFile as String + Dim sVarResult as String + Dim sFixResult as String + + sDescription = "Description Test" + sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\fields\fields_docinfos.sxw") + sVarResult = sDescription + sFixResult = "This is the description" + + printlog "Doc Information - Description" + '/// <b> Doc Information - Description </b> + + Call hNewDocument + + '/// Open test file fields_docinfos.sxw + Call hFileOpen(sTestFile) + Call sMakeReadOnlyDocumentEditable + + '/// File / Properties / Description , input some + '/// + text in Description + Call fFileProperties("TabBeschreibung") + Beschreibung.Settext sDescription + Schluesselwoerter.Gettext '<--This command is useless , but important ! :-) + TabBeschreibung.OK + + '/// Check if the Description is changed in the document + '/// It should be changed in Var + '/// It should NOT be changed in Fix + Call fFindWord ("Description") + + Call wTypeKeys "<End>" + Call wTypeKeys "<Down>" , 4 + Call wTypeKeys "<Right>" , 2 + Sleep 1 + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sVarResult then + Warnlog "Due to i31893 , should get " & sVarResult & " but get " & fGetFieldContent() + end if + + Call wTypeKeys "<End><Right>" + Sleep 1 + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sFixResult then + Warnlog "Should get " & sFixResult & " but get " & fGetFieldContent() + end if + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tDocInformationUserDefined + QAErrorLog "#i112077#Tabpage 'Custom properties' has no declaration" + goto endsub + Dim sTestFile as String + Dim sOriginalFile as string + Dim sVarResult() as String + Dim sFixResult() as String + Dim i as integer + Dim j as Integer + + j = UBound(sVarResult) + sTestFile = Convertpath (gOfficepath + "user\work\fields_docinfos.sxw") + sOriginalFile = Convertpath (gTesttoolpath + "writer\optional\input\fields\fields_docinfos.sxw") + ' document has to be copied to local file system to avoid opening a read-only file + ' because all field data gets lost if documents write-protection is removed via 'sMakeReadOnlyDocumentEditable' + FileCopy (sOriginalFile, sTestFile) + if FileExists ( sTestFile ) = false then + Warnlog "Test document couldn't be copied to local file system. Test aborted!" + goto endsub + end if + + sVarResult = Array( _ + "A1" , _ + "B2" , _ + "C3" , _ + "D4" , _ + ) + + sFixResult = Array( _ + "Lennon" , _ + "McCartney" , _ + "Harrison" , _ + "Star" , _ + ) + + printlog "Doc Information - User Defined" + + + Call hNewDocument + + '/// Open test file fields_docinfos.sxw + Call hFileOpen(sTestFile) + + '/// File / Properties / Description , input some + '/// + text in Description + Call fFileProperties("TabDokument") + Info0.Settext sVarResult(0) + Info1.Settext sVarResult(1) + Info2.Settext sVarResult(2) + Info3.Settext sVarResult(3) + TabBenutzer.OK + + '/// Check if the User defined is changed in the document + '/// It should be changed in Var + '/// It should NOT be changed in Fix + Call fFindWord ("Info fields") + + Call wTypeKeys "<End><Right><Down><Home>" + Sleep 1 + + for i= 0 to UBound(sVarResult) + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sVarResult(i) then + Warnlog "Should get " & sVarResult(i) & " but get " & fGetFieldContent() + end if + + Call wTypeKeys "<End><Right>" + Sleep 1 + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sFixResult(i) then + Warnlog "Should get " & sFixResult(i) & " but get " & fGetFieldContent() + end if + + Call wTypeKeys "<End><Down><Home><Left><Home>" + next i + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tDocInformationCreated + + Dim sTestFile as String + Dim sOriginalFile as String + Dim sFirstName as String + Dim sLastName as String + Dim sFirstName1 as String + Dim sLastName1 as String + Dim sVarResult(3) as String + Dim sFixResult(3) as String + Dim i as Integer + + sFirstName1 = "Test1" : sLastName1 = "Test2" + sTestFile = Convertpath (gOfficePath + "user\work\fields_docinfos.sxw") + sOriginalFile = Convertpath (gTesttoolpath + "writer\optional\input\fields\fields_docinfos.sxw") + ' document has to be copied to local file system to avoid opening a read-only file + ' because all field data gets lost if documents write-protection is removed via 'sMakeReadOnlyDocumentEditable' + FileCopy (sOriginalFile, sTestFile) + if FileExists ( sTestFile ) = false then + Warnlog "Test document couldn't be copied to local file system. Test aborted!" + goto endsub + end if + + sVarResult(0) = sFirstName1 + " " + sLastName1 + sVarResult(1) = fGetDate1(Date) + + sFixResult(0) = "Éric Savary" + sFixResult(1) = "07/20/2000" + sFixResult(2) = "11:41:21" + + printlog "Doc Information - Created" + '/// <b> Doc Information - Created </b> + + Call hNewDocument + + '/// Open test file fields_docinfos.sxw + Call hFileOpen(sTestFile) + Call sMakeReadOnlyDocumentEditable + + Call fFindWord ("Created") + Call wTypeKeys "<End><Right><Down><Down><Down><Home>" + Sleep 1 + Call wTypeKeys "<Shift Right>" + sVarResult(2)= fGetFieldContent() + Call wTypeKeys "<MOD1 Home>" , 3 + + '/// Change author to author :Test2 Test1 + ToolsOptions + Call hToolsOptions("STAROFFICE","USERDATA") + sFirstName = VorName.GetText + sLastName = ZuName.GetText + VorName.SetText sFirstName1 + ZuName.SetText sLastName1 + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK + + '/// File / Properties / General , check "Apply user + '/// + data" , click "delete" button + Call fFileProperties("TabDokument") + BenutzerdatenVerwenden.Check + Sleep 1 + Loeschen.Click + Sleep 1 + TabDokument.OK + + '/// Check if the Created field is changed in the document + '/// It should be changed in Var + '/// It should NOT be changed in Fix + Call fFindWord ("Created") + + Call wTypeKeys "<End><Right><Down><Home>" + Sleep 1 + + for i = 0 to 1 + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sVarResult(i) then + Warnlog "Should get " & sVarResult(i) & " but get " & fGetFieldContent() + end if + + Call wTypeKeys "<End><Right>" + Sleep 1 + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sFixResult(i) then + Warnlog "Should get " & sFixResult(i) & " but get " & fGetFieldContent() + end if + Call wTypeKeys "<End><Down><Home><Left><Home>" + next i + + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() = sVarResult(2) then + Warnlog "Should get " & sFixResult(2) & " but get " & fGetFieldContent() + end if + + Call wTypeKeys "<End><Right>" + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sFixResult(2) then + Warnlog "Should get " & sFixResult(2) & " but get " & fGetFieldContent() + end if + + 'Recover author to default + ToolsOptions + Call hToolsOptions("STAROFFICE","USERDATA") + VorName.SetText sFirstName + ZuName.SetText sLastName + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tDocInformationModified + + Dim sTestFile as String + Dim sOriginalFile as String + Dim sSaveasFile as String + Dim sFirstName as String + Dim sLastName as String + Dim sFirstName1 as String + Dim sLastName1 as String + Dim sVarResult(3) as String + Dim sFixResult(3) as String + Dim i as Integer + + sFirstName1 = "Test1" : sLastName1 = "Test2" + sTestFile = Convertpath (gOfficePath + "user\work\fields_docinfos.sxw") + sOriginalFile = Convertpath (gTesttoolpath + "writer\optional\input\fields\fields_docinfos.sxw") + ' document has to be copied to local file system to avoid opening a read-only file + ' because all field data gets lost if documents write-protection is removed via 'sMakeReadOnlyDocumentEditable' + FileCopy (sOriginalFile, sTestFile) + if FileExists ( sTestFile ) = false then + Warnlog "Test document couldn't be copied to local file system. Test aborted!" + goto endsub + end if + sSaveasFile = ConvertPath (gOfficePath + "user\work\fields_docinfos1.sxw" ) + + sVarResult(0) = sFirstName1 + " " + sLastName1 + sVarResult(1) = fGetDate1(Date) + + sFixResult(0) = "Éric Savary" + sFixResult(1) = "08/18/2000" + sFixResult(2) = "11:40:11" + + printlog "Doc Information - Modified" + '/// <b> Doc Information - Modified </b> + + if FileExists ( sSaveAsFile ) then app.kill ( sSaveAsFile ) + + Call hNewDocument + + '/// Open test file fields_docinfos.sxw + Call hFileOpen(sTestFile) + Call hFileSaveAsKill (sSaveAsFile) + + Call fFindWord ("Modified") + Call wTypeKeys "<End><Right><Down><Down><Down><Home>" + Sleep 1 + Call wTypeKeys "<Shift Right>" + sVarResult(2)= fGetFieldContent() + Call wTypeKeys "<MOD1 Home>" , 3 + + '/// Change author to author : Test2 Test1 + ToolsOptions + Call hToolsOptions("STAROFFICE","USERDATA") + sFirstName = VorName.GetText + sLastName = ZuName.GetText + VorName.SetText sFirstName1 + ZuName.SetText sLastName1 + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK + + '/// File / Properties / General , check "Apply user + '/// + data" , click "delete" button + Call fFileProperties("TabDokument") + BenutzerdatenVerwenden.Check + Sleep 1 + Loeschen.Click + Sleep 1 + TabDokument.OK + + FileSave + try + Kontext "Active" + Active.Yes + catch + endcatch + Sleep 3 + + '/// Check if the Modified field is changed in the document + '/// It should be changed in Var + '/// It should NOT be changed in Fix + Call fFindWord ("Modified") + + Call wTypeKeys "<End><Right><Down><Home>" + Sleep 1 + + for i = 0 to 1 + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sVarResult(i) then + Warnlog "Should get " & sVarResult(i) & " but get " & fGetFieldContent() + end if + + Call wTypeKeys "<End><Right>" + Sleep 1 + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sFixResult(i) then + Warnlog "Should get " & sFixResult(i) & " but get " & fGetFieldContent() + end if + Call wTypeKeys "<End><Down><Home><Left><Home>" + next i + + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() = sVarResult(2) then + Warnlog "Should get " & sFixResult(2) & " but get " & fGetFieldContent() + end if + + Call wTypeKeys "<End><Right>" + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sFixResult(2) then + Warnlog "Should get " & sFixResult(2) & " but get " & fGetFieldContent() + end if + + 'Recover author to default + ToolsOptions + Call hToolsOptions("STAROFFICE","USERDATA") + VorName.SetText sFirstName + ZuName.SetText sLastName + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK + + FileClose + Sleep 1 + Kontext "Active" + if Active.Exists(2) then + try + Active.Yes + catch + endcatch + end if + + if FileExists ( sSaveAsFile ) then app.kill ( sSaveAsFile ) + +endcase + +'----------------------------------------------------------------- + +testcase tDocInformationModifiedSavefile + QaErrorLog "#i102792# - tDocInformationModifiedSavefile outcommented due to issue." + goto endsub + + Dim sTestFile as String + Dim sOriginalFile as string + Dim sSaveasFile as String + Dim sFirstName as String + Dim sLastName as String + Dim sFirstName1 as String + Dim sLastName1 as String + Dim sVarResult(3) as String + Dim sFixResult(3) as String + Dim i as Integer + + sFirstName1 = "Test1" : sLastName1 = "Test2" + sTestFile = Convertpath (gOfficePath + "user\work\fields_docinfos.sxw") + sOriginalFile = Convertpath (gTesttoolpath + "writer\optional\input\fields\fields_docinfos.sxw") + ' document has to be copied to local file system to avoid opening a read-only file + ' because all field data gets lost if documents write-protection is removed via 'sMakeReadOnlyDocumentEditable' + FileCopy (sOriginalFile, sTestFile) + if FileExists ( sTestFile ) = false then + Warnlog "Test document couldn't be copied to local file system. Test aborted!" + goto endsub + end if + sSaveasFile = ConvertPath (gOfficePath + "user\work\fields_docinfos1.sxw" ) + + sVarResult(0) = sFirstName1 + " " + sLastName1 + sVarResult(1) = fGetDate1(Date) + + sFixResult(0) = "Éric Savary" + sFixResult(1) = "08/18/2000" + sFixResult(2) = "11:40:11" + + if FileExists ( sSaveAsFile ) then app.kill ( sSaveAsFile ) + + printlog "Doc Information - Modified (save file)" + '/// <b> Doc Information - Modified (save file)</b> + + Call hNewDocument + + '/// Open test file fields_docinfos.sxw + Call hFileOpen(sTestFile) + + Call fFindWord ("Modified") + Call wTypeKeys "<End><Right><Down><Down><Down><Home>" + Sleep 1 + Call wTypeKeys "<Shift Right>" + sVarResult(2)= fGetFieldContent() + Call wTypeKeys "<MOD1 Home>" , 3 + + '/// Change author to author : Test2 Test1 + ToolsOptions + Call hToolsOptions("STAROFFICE","USERDATA") + sFirstName = VorName.GetText + sLastName = ZuName.GetText + VorName.SetText sFirstName1 + ZuName.SetText sLastName1 + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK + + '/// Save the file as another file + Call hFileSaveAsKill(sSaveAsFile) + + '/// Check if the Modified field is changed in the document + '/// It should be changed in Var + '/// It should NOT be changed in Fix + Call fFindWord ("Modified") + + Call wTypeKeys "<End><Right><Down><Home>" + Sleep 1 + + for i = 0 to 1 + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sVarResult(i) then + QAErrorlog "#i41327# Should get " & sVarResult(i) & " but get " & fGetFieldContent() + end if + + Call wTypeKeys "<End><Right>" + Sleep 1 + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sFixResult(i) then + Warnlog "Should get " & sFixResult(i) & " but get " & fGetFieldContent() + end if + Call wTypeKeys "<End><Down><Home><Left><Home>" + next i + + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() = sVarResult(2) then + QAErrorlog "#i41327# Should get " & sFixResult(2) & " but get " & fGetFieldContent() + end if + + Call wTypeKeys "<End><Right>" + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sFixResult(2) then + Warnlog "Should get " & sFixResult(2) & " but get " & fGetFieldContent() + end if + + 'Recover author to default + ToolsOptions + Call hToolsOptions("STAROFFICE","USERDATA") + VorName.SetText sFirstName + ZuName.SetText sLastName + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK + + FileClose + Sleep 1 + Kontext "Active" + if Active.Exists(2) then + try + Active.Yes + catch + endcatch + end if + + if FileExists ( sSaveAsFile ) then app.kill ( sSaveAsFile ) + +endcase + +'----------------------------------------------------------------- + +testcase tDocInformationPrinted + + Dim sTestFile as String + Dim sOriginalFile as String + Dim sFirstName as String + Dim sLastName as String + Dim sFirstName1 as String + Dim sLastName1 as String + Dim sVarResult(3) as String + Dim sFixResult(3) as String + Dim i as Integer + + sFirstName1 = "Test1" : sLastName1 = "Test2" + sTestFile = Convertpath (gOfficePath + "user\work\fields_docinfos.sxw") + sOriginalFile = Convertpath (gTesttoolpath + "writer\optional\input\fields\fields_docinfos.sxw") + ' document has to be copied to local file system to avoid opening a read-only file + ' because all field data gets lost if documents write-protection is removed via 'sMakeReadOnlyDocumentEditable' + FileCopy (sOriginalFile, sTestFile) + if FileExists ( sTestFile ) = false then + Warnlog "Test document couldn't be copied to local file system. Test aborted!" + goto endsub + end if + + + sVarResult(0) = sFirstName1 + " " + sLastName1 + sVarResult(1) = fGetDate1(Date) + + sFixResult(0) = "Éric Savary" + sFixResult(1) = "08/11/2004" + sFixResult(2) = "11:46:06" + + printlog "Doc Information - Printed" + '/// <b> Doc Information - Printed </b> + + Call hNewDocument + + '/// Open test file fields_docinfos.sxw + Call hFileOpen(sTestFile) + + Call fFindWord ("Last printed") + Call wTypeKeys "<End><Right><Down><Down><Down><Home>" + Call wTypeKeys "<Shift Right>" + Sleep 1 + sVarResult(2)= fGetFieldContent() + Call wTypeKeys "<MOD1 Home>" , 3 + + '/// Change author to author : Test2 Test1 + ToolsOptions + Call hToolsOptions("STAROFFICE","USERDATA") + sFirstName = VorName.GetText + sLastName = ZuName.GetText + VorName.SetText sFirstName1 + ZuName.SetText sLastName1 + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK + + '/// Print file + FilePrint + Kontext "Active" + if Active.Exists then + if Active.GetRT = 304 then + Active.Ok + QAErrorLog "No Default-Printer! The testcase isn't tested !" + Kontext "Printing" + Sleep 1 + Printing.Cancel + goto NoTest + end if + else + Kontext "Printing" + Sleep 1 + Printing.OK + kontext "active" + if active.exists(5) then + QaErrorLog "Error Printing..." + Active.ok + end if + end if + + '/// Check if the Printed field is changed in the document + '/// It should be changed in Var + '/// It should NOT be changed in Fix + Call fFindWord ("Last printed") + + Call wTypeKeys "<End><Right><Down><Home>" + Sleep 1 + + for i = 0 to 1 + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sVarResult(i) then + Warnlog "Should get " & sVarResult(i) & " but get " & fGetFieldContent() + end if + + Call wTypeKeys "<End><Right>" + Sleep 1 + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sFixResult(i) then + Warnlog "Should get " & sFixResult(i) & " but get " & fGetFieldContent() + end if + Call wTypeKeys "<End><Down><Home><Left><Home>" + next i + + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() = sVarResult(2) then + Warnlog "Should NOT get " & sFixResult(2) + end if + + Call wTypeKeys "<End><Right>" + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sFixResult(2) then + Warnlog "Should get " & sFixResult(2) & " but get " & fGetFieldContent() + end if + + 'Recover author to default + ToolsOptions + Call hToolsOptions("STAROFFICE","USERDATA") + VorName.SetText sFirstName + ZuName.SetText sLastName + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK + NoTest: + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tDocInformationRevisionnumber + + Dim sTestFile as String + Dim sOriginalFile as string + Dim sSaveasFile as String + Dim sFirstName as String + Dim sLastName as String + Dim sFirstName1 as String + Dim sLastName1 as String + Dim sVarResult as String + Dim sFixResult as String + + sFirstName1 = "Test1" : sLastName1 = "Test2" + sVarResult = "17" : sFixResult = "4" + + sTestFile = Convertpath (gOfficePath + "user\work\fields_docinfos.sxw") + sOriginalFile = Convertpath (gTesttoolpath + "writer\optional\input\fields\fields_docinfos.sxw") + ' document has to be copied to local file system to avoid opening a read-only file + ' because all field data gets lost if documents write-protection is removed via 'sMakeReadOnlyDocumentEditable' + FileCopy (sOriginalFile, sTestFile) + if FileExists ( sTestFile ) = false then + Warnlog "Test document couldn't be copied to local file system. Test aborted!" + goto endsub + end if + sSaveasFile = ConvertPath (gOfficePath + "user\work\tDocInformationRevisionnumber.sxw" ) + + if FileExists ( sSaveAsFile ) then app.kill ( sSaveAsFile ) + + printlog "Doc Information - Revision number" + '/// <b> Doc Information - Revision number</b> + + Call hNewDocument + + '/// Open test file fields_docinfos.sxw + Call hFileOpen(sTestFile) + + '/// Change author to author : Test2 Test1 + ToolsOptions + Call hToolsOptions("STAROFFICE","USERDATA") + sFirstName = VorName.GetText + sLastName = ZuName.GetText + VorName.SetText sFirstName1 + ZuName.SetText sLastName1 + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK + + '/// Save the file as another file + Call hFileSaveAsKill(sSaveAsFile) + + '/// Press F9 + Call wTypeKeys "<F9>" + + '/// Save the file + FileSave + try + Kontext "Active" + Active.Yes + catch + endcatch + Sleep 3 + + '/// Check if the Revision number field is changed in the document + '/// It should be changed in Var + '/// It should NOT be changed in Fix + Call fFindWord ("Version") + + Call wTypeKeys "<End><Right>" + Sleep 1 + + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sVarResult then + Warnlog "Should get " & sVarResult & " but get " & fGetFieldContent() + end if + + Call wTypeKeys "<End><Right>" + Sleep 1 + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sFixResult then + Warnlog "Should get " & sFixResult & " but get " & fGetFieldContent() + end if + + 'Recover author to default + ToolsOptions + Call hToolsOptions("STAROFFICE","USERDATA") + VorName.SetText sFirstName + ZuName.SetText sLastName + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK + + FileClose + Sleep 1 + Kontext "Active" + if Active.Exists(2) then + try + Active.Yes + catch + endcatch + end if + + if FileExists ( sSaveAsFile ) then app.kill ( sSaveAsFile ) + +endcase + +'----------------------------------------------------------------- + +testcase tDocInformationTotaleditingtime + + Dim sTestFile as String + Dim sOriginalFile as string + Dim sSaveasFile as String + Dim sVarResult as String + Dim sFixResult as String + + sFixResult = "00:29:05" + sTestFile = Convertpath (gOfficePath + "user\work\fields_docinfos.sxw") + sOriginalFile = Convertpath (gTesttoolpath + "writer\optional\input\fields\fields_docinfos.sxw") + ' document has to be copied to local file system to avoid opening a read-only file + ' because all field data gets lost if documents write-protection is removed via 'sMakeReadOnlyDocumentEditable' + FileCopy (sOriginalFile, sTestFile) + if FileExists ( sTestFile ) = false then + Warnlog "Test document couldn't be copied to local file system. Test aborted!" + goto endsub + end if + sSaveasFile = ConvertPath (gOfficePath + "user\work\tDocInformationRevisionnumber.sxw" ) + + if FileExists ( sSaveAsFile ) then app.kill ( sSaveAsFile ) + + printlog "Doc Information - Tatal editing time" + '/// <b> Doc Information - Tatal editing time </b> + + Call hNewDocument + + '/// Open test file fields_docinfos.sxw + Call hFileOpen(sTestFile) + + '/// Save the file as another file + Call hFileSaveAsKill(sSaveAsFile) + + '/// Press F9 + Call wTypeKeys "<F9>" + + Call fFindWord ("Accessed") + Call wTypeKeys "<End><Right>" + Sleep 1 + Call wTypeKeys "<Shift Right>" + sVarResult = fGetFieldContent() + Call wTypeKeys "<MOD1 Home>" , 3 + + '/// Save the file + FileSave + try + Kontext "Active" + Active.Yes + catch + endcatch + Sleep 3 + + '/// Check if the tatal editing time field is changed in the document + '/// It should be changed in Var + '/// It should NOT be changed in Fix + Call fFindWord ("Accessed") + + Call wTypeKeys "<End><Right>" + Sleep 1 + + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() = sVarResult then + Warnlog "Should NOT get " & sVarResult + end if + + Call wTypeKeys "<End><Right>" + Sleep 1 + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sFixResult then + Warnlog "Should get " & sFixResult & " but get " & fGetFieldContent() + end if + + FileClose + Sleep 1 + Kontext "Active" + if Active.Exists(2) then + try + Active.Yes + catch + endcatch + end if + + if FileExists ( sSaveAsFile ) then app.kill ( sSaveAsFile ) + +endcase + +'----------------------------------------------------------------- diff --git a/testautomation/writer/optional/includes/fields/w_fields5.inc b/testautomation/writer/optional/includes/fields/w_fields5.inc new file mode 100755 index 000000000000..334d01906307 --- /dev/null +++ b/testautomation/writer/optional/includes/fields/w_fields5.inc @@ -0,0 +1,841 @@ +'encoding UTF-8 Do not remove or change this line! +'************************************************************************** +' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +' +' Copyright 2000, 2010 Oracle and/or its affiliates. +' +' OpenOffice.org - a multi-platform office productivity suite +' +' This file is part of OpenOffice.org. +' +' OpenOffice.org is free software: you can redistribute it and/or modify +' it under the terms of the GNU Lesser General Public License version 3 +' only, as published by the Free Software Foundation. +' +' OpenOffice.org is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY; without even the implied warranty of +' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +' GNU Lesser General Public License version 3 for more details +' (a copy is included in the LICENSE file that accompanied this code). +' +' You should have received a copy of the GNU Lesser General Public License +' version 3 along with OpenOffice.org. If not, see +' <http://www.openoffice.org/license.html> +' for a copy of the LGPLv3 License. +' +'/************************************************************************ +'* +'* owner : helge.delfs@oracle.com +'* +'* short description : Fields - Variables +'* +'\*********************************************************************** + +sub w_fields5 + + Call tVariablesSetValueToText + Call tVariablesSetValueToNumber + Call tVariablesSetFormats + Call tVariablesShowVariable1 + Call tVariablesShowVariable2 + Call tVariablesInsertFormula + Call tVariablesNumberRange + Call tVariablesInputfield + Call tVariablesUserfield + Call tVariablesDDEFieldManual + Call tVariablesDDEFieldAutomatic + +end sub + +'----------------------------------------------------------------- + +testcase tVariablesSetValueToText + if bAsianLan = true then + QaErrorLog "No testing with Asian language. Aborting." + exit sub + end if + + Dim sName() as String + Dim sValue as String + Dim sResult() as String + Dim i as Integer + Dim j as Integer + + sValue = "This is a test!" + + sName = Array( _ + "myTest1" , _ + "myTest2" , _ + "myTest3" , _ + "myTest4" , _ + "myTest5" , _ + "myTest6" , _ + ) + sResult = Array( _ + "This is a test!" , _ + "1" , _ + "1" , _ + "1" & gSeperator & "00" , _ + "1" , _ + "1" & gSeperator & "00" , _ + ) + j = UBound(sResult) + + printlog "Set value to text" + '/// <b> Set value to text </b> + + Call hNewDocument + + '/// Insert/Fields/Other/Variables / Select "set Variable" , + '/// Set Name and Value(text) , then choose Text , General , + '/// + -1234 , -1234.12 , -1,234 , -1,234,12 separately + Call fInsertFieldsOther("TabVariablen") + for i = 0 to j + Feldtyp.Select 1 + Sleep 1 + NameText.SetText sName(i) + Wert.SetText sValue + Zahlenformat.Select i+1 + Einfuegen.Click + sleep 1 + Call wTypeKeys "<Return>" + Kontext "TabVariablen" + next i + Kontext "TabVariablen" + TabVariablen.Close + + '/// Check if the insertion is correct + Call wTypeKeys "<MOD1 Home>" + + for i = 0 to j + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sResult(i) then + Warnlog i & "Should get " & sResult(i) & " but get " & fGetFieldContent() + end if + Call wTypeKeys "<Down><Home>" + next i + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tVariablesSetValueToNumber + if bAsianLan = true then + QaErrorLog "No testing with Asian language. Aborting." + exit sub + end if + + Dim sName() as String + Dim sValue as String + Dim sResult() as String + Dim i as Integer + Dim j as Integer + + sValue = "1234,567" + + sName = Array( _ + "myTest1" , _ + "myTest2" , _ + "myTest3" , _ + "myTest4" , _ + "myTest5" , _ + "myTest6" , _ + ) + sResult = Array( _ + "1234,567" , _ + "1234,57" , _ + "1235" , _ + "1234,57" , _ + "1.235" , _ + "1.234,57" , _ + ) + j = UBound(sResult) + + printlog "Set value to number" + '/// <b> Set value to number </b> + + Call hNewDocument + + '/// Insert/Fields/Other/Variables / Select "set Variable" , + '/// Set Name and Value(number) , then choose Text , General , + '/// + -1234 , -1234.12 , -1,234 , -1,234,12 separately + Call fInsertFieldsOther("TabVariablen") + for i = 0 to j + Feldtyp.Select 1 + Sleep 1 + NameText.SetText sName(i) + Wert.SetText sValue + Zahlenformat.Select i+1 + Einfuegen.Click + sleep 1 + Call wTypeKeys "<Return>" + Kontext "TabVariablen" + next i + Kontext "TabVariablen" + TabVariablen.Close + + '/// Check if the insertion is correct + Call wTypeKeys "<MOD1 Home>" + + for i = 0 to j + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sResult(i) then + QaErrorLog i & "#i94596# - Should get " & sResult(i) & " but get " & fGetFieldContent() + end if + Call wTypeKeys "<Down><Home>" + next i + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tVariablesSetFormats + qaerrorlog "#i94596# - tVariablesSetFormats outcommented due to bug." + goto endsub + + Dim sName as String + Dim sValue as String + Dim iFormat() as Integer + Dim sResult() as String + Dim i as Integer + Dim j as Integer + Dim mUnit as String + + sName = "myTest" + sValue = "1234.567" + + iFormat = Array( 8, 10 , 52 , 55 , 56) + sResult = Array( _ + "123456.70%" , _ + "$1,234.57" , _ + "1.23E+003" , _ + "1234 55/97" , _ + "TRUE" , _ + ) + j = UBound(sResult) + + printlog "Set format as 'Additional formats...'" + '/// <b> Set format as 'Additional formats...' </b> + + Call hNewDocument + CALL GetLanguageText (01) + mUnit = fSetMeasurementToCM() ' Set measurement unit to cm + + '/// Insert/Fields/Other/Variables / Select "set Variable" , + '/// Set Name and Value(number) , then choose format as 'Additional formats...' + '/// In the number format dialog , select 'All' in Category + '/// + Select some different formats ... + Call fInsertFieldsOther("TabVariablen") + Feldtyp.Select 1 + Sleep 1 + NameText.SetText sName + Wert.SetText sValue + + for i = 0 to j + Zahlenformat.Select Zahlenformat.GetItemCount + Sleep 3 + Kontext "Zahlenformat" + Sprache.Select fGetLanguageName(01) + Sleep 2 + Kategorie.Select 1 + Sleep 1 + KategorieFormat.Select iFormat(i) + Sleep 1 + Zahlenformat.OK + + Kontext "TabVariablen" + Einfuegen.Click + Call wTypeKeys "<Shift Left>" + sleep 1 + if fGetFieldContent() <> sResult(i) then + Warnlog i & ": Should get " & sResult(i) & " but get " & fGetFieldContent() + end if + Kontext "TabVariablen" + next i + TabVariablen.Close + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tVariablesShowVariable1 + + Dim sName() as String + Dim sResult() as String + Dim i as Integer + Dim j as Integer + + sName = Array( _ + "myTest1" , _ + "myTest2" , _ + "myTest3" , _ + ) + sResult = Array( _ + "1" , _ + "10" , _ + "100" , _ + ) + j = UBound(sResult) + + printlog "Show Variable - 1" + '/// <b> Show Variable - 2</b> + + Call hNewDocument + + '/// Insert/Fields/Other/Variables / Select "set Variable" , + '/// Set Name and Value , then choose General , add 3 variables + '/// + then select Show Variable , insert 3 variables + Call fInsertFieldsOther("TabVariablen") + for i = 0 to j + Feldtyp.Select 1 + Sleep 1 + NameText.SetText sName(i) + Wert.SetText sResult(i) + Zahlenformat.Select 2 + Einfuegen.Click + sleep 1 + next i + for i = 0 to j + Call wTypeKeys "<Return>" + Kontext "TabVariablen" + Feldtyp.Select 2 + Sleep 1 + Auswahl.Select i+1 + Einfuegen.Click + sleep 1 + next i + TabVariablen.Close + + '/// Check if the insertion is correct + Call wTypeKeys "<MOD1 Home>" + + for i = 0 to j + Call wTypeKeys "<Down><Home>" + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sResult(i) then + Warnlog "Should get " & sResult(i) & " but get " & fGetFieldContent() + end if + next i + + '/// Delete the 1st line + Call wTypeKeys "<MOD1 Home><Shift End><Delete>" + + Call wTypeKeys "<MOD1 Home>" + + for i = 0 to j + Call wTypeKeys "<Down><Home>" + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> "0" then + Warnlog i & "Should get 0 but get " & fGetFieldContent() + end if + next i + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tVariablesShowVariable2 + + Dim sName as String + Dim sValue as String + Dim sResult() as String + Dim i as Integer + Dim j as Integer + + sResult = Array( _ + "100" , _ + "100" , _ + "200" , _ + "200" , _ + ) + j = UBound(sResult) + + sName = "myTest" + + printlog "Show Variable - 2" + '/// <b> Show Variable - 2 </b> + + Call hNewDocument + + '/// Insert/Fields/Other/Variables / Select "set Variable" , + '/// Set Name and Value , then choose General , insert a variable + Call fInsertFieldsOther("TabVariablen") + sValue = "100" + Feldtyp.Select 1 + Sleep 1 + NameText.SetText sName + Wert.SetText sValue + Zahlenformat.Select 2 + Einfuegen.Click + + '/// Then select Show Variable , insert this variable + Call wTypeKeys "<Return>" + Kontext "TabVariablen" + Feldtyp.Select 2 + Sleep 1 + Auswahl.Select 1 + Einfuegen.Click + + '/// Insert a same name variable again , but set to another number + Call wTypeKeys "<Return>" + sValue = "200" + Kontext "TabVariablen" + Feldtyp.Select 1 + Sleep 1 + NameText.SetText sName + Wert.SetText sValue + Zahlenformat.Select 2 + Einfuegen.Click + + '/// Then select Show Variable , insert this variable again + Call wTypeKeys "<Return>" + Kontext "TabVariablen" + Feldtyp.Select 2 + Sleep 1 + Auswahl.Select 1 + Einfuegen.Click + TabVariablen.Close + + '/// Check if the insertion is correct + Call wTypeKeys "<F9><MOD1 Home>" + + for i = 0 to j + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sResult(i) then + Warnlog i & "Should get " & sResult(i) & " but get " & fGetFieldContent() + end if + Call wTypeKeys "<Down><Home>" + next i + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tVariablesInsertFormula + + Dim sName() as String + Dim sValue() as String + Dim sResult as String + Dim i as Integer + Dim j as Integer + + sName = Array( _ + "myTest1" , _ + "myTest2" , _ + ) + sValue = Array( _ + "10" , _ + "100" , _ + ) + sResult = "110" + j = UBound(sName) + + printlog "Insert formula" + '/// <b> Insert formula </b> + + Call hNewDocument + + '/// Insert/Fields/Other/Variables / Select "set Variable" , add 2 variables - A and B + Call fInsertFieldsOther("TabVariablen") + for i = 0 to j + Feldtyp.Select 1 + Sleep 1 + NameText.SetText sName(i) + Wert.SetText sValue(i) + Zahlenformat.Select 2 + Einfuegen.Click + sleep 1 + next i + + '/// Then select 'Insert formula' , A+B + Call wTypeKeys "<Return>" + Kontext "TabVariablen" + Feldtyp.Select 4 + Wert.SetText (sName(0) & "+" & sName(1)) + Einfuegen.Click + TabVariablen.Close + + Call wTypeKeys "<Shift Left>" + if fGetFieldContent() <> sResult then + Warnlog "Should get " & sResult & " but get " & fGetFieldContent() + end if + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tVariablesNumberRange + + Dim sResult() as String + Dim i as Integer + Dim x as Integer + + printlog "Number range" + '/// <b> Number range </b> + + Call hNewDocument + + Call wTypeKeys "<Return>" + + '/// Insert/Fields/Other/Variables / Select "Number range" , insert 4 numbers for + '/// + Table , text , drawing and illustration + Call fInsertFieldsOther("TabVariablen") + for i = 1 to 4 + Feldtyp.Select 6 + Sleep 1 + Auswahl.Select i + Einfuegen.Click + Call wTypeKeys "<Return>" + Kontext "TabVariablen" + sleep 1 + next i + + '/// Then insert Table , text , drawing and illustration separately + '/// + Check if the result is correct + Call wTypeKeys "<MOD1 Home>" + Kontext "TabVariablen" + + for i = 1 to 4 + Feldtyp.Select 6 + Sleep 1 + Auswahl.Select i + Einfuegen.Click + Sleep 2 + Call wTypeKeys "<Home>" + sResult = Array("1" , "1" , "1" , "1" , "1") + sResult(i) = "2" + for x = 0 to 4 + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sResult(x) then + Warnlog "Should get " & sResult(x) & " but get " & fGetFieldContent() + end if + Call wTypeKeys "<Down><Home>" + next x + Call wTypeKeys "<MOD1 Home><Shift End><Delete>" + sleep 1 + Kontext "TabVariablen" + next i + TabVariablen.Close + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tVariablesInputfield + + Dim sName as String + Dim sValue as String + Dim sReference as String + Dim sFieldContent as String + + sName = "myTest" : sValue = "100" + sReference = "NewTest" + sFieldContent = "10000" + + printlog "Input field" + '/// <b> Input field </b> + + Call hNewDocument + + '/// Insert/Fields/Other/Variables / Select "set Variable" , add 1 variable - A + Call fInsertFieldsOther("TabVariablen") + Feldtyp.Select 1 + Sleep 1 + NameText.SetText sName + Wert.SetText sValue + Zahlenformat.Select 2 + Einfuegen.Click + Call wTypeKeys "<Return>" + Sleep 1 + + '/// Select "Input field" , set reference , press insert , + '/// + a dialog should pop up , insert field content + '/// + Table , text , drawing and illustration + Kontext "TabVariablen" + Feldtyp.Select 5 + Wert.SetText sReference + Einfuegen.Click + Kontext "Eingabefeld" + if Titel.GetText <> sReference then + Warnlog "Reference should be " & sReference & " but get " & Titel.GetText + end if + EingabeText.SetText sFieldContent + Eingabefeld.OK + + Kontext "TabVariablen" + TabVariablen.Close + + '/// Check if the insertion is correct + Call wTypeKeys "<MOD1 Home>" + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sValue then + Warnlog "Should get " & sValue & " but get " & fGetFieldContent() + end if + + Call wTypeKeys "<Down><Home>" + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sFieldContent then + Warnlog "Should get " & sFieldContent & " but get " & fGetFieldContent() + end if + + '/// Delete variable A in the document , Check if the insertion is still correct + Call wTypeKeys "<MOD1 Home>" + Call wTypeKeys "<Shift Right><Delete>" + + Call wTypeKeys "<Down><Home>" + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sFieldContent then + Warnlog "2-Should get " & sFieldContent & " but get " & fGetFieldContent() + end if + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tVariablesUserfield + + Dim sName() as String + Dim sValue() as String + Dim sResult1() as String + Dim sResult2() as String + Dim i as Integer + Dim j as Integer + + sName = Array("U1" , "UserField" , "U2") + sValue = Array("UserField - 10" , "100" , "UserField + 10") + sResult1 = Array("-10" , "100" , "110") + sResult2 = Array("90" , "100" , "110") + j = UBound(sResult1) + + printlog "User field" + '/// <b> User field </b> + + Call hNewDocument + + '/// Insert/Fields/Other/Variables / Select "User Field" + Call fInsertFieldsOther("TabVariablen") + for i = 0 to j + Feldtyp.Select 9 + Sleep 1 + NameText.SetText sName(i) + Wert.SetText sValue(i) + Zahlenformat.Select 3 + Einfuegen.Click + Sleep 2 + Call wTypeKeys "<Shift Left>" + if fGetFieldContent() <> sResult1(i) then + Warnlog "Should get " & sResult1(i) & " but get " & fGetFieldContent() + end if + Call wTypeKeys "<End><Return>" + sleep 1 + Kontext "TabVariablen" + next i + TabVariablen.Close + + '/// Check if the result is OK. + Call wTypeKeys "<F9>" + Call wTypeKeys "<MOD1 Home>" + Sleep 1 + for i = 0 to j + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sResult2(i) then + Warnlog "Should get " & sResult2(i) & " but get " & fGetFieldContent() + end if + Call wTypeKeys "<Down><Left>" + next i + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tVariablesDDEFieldManual + qaerrorlog "#i112079#testcase must be reworked" + goto endsub + + Dim sDDEFile as String + Dim sContent as String + Dim sName as String + Dim sDDEStatement as String + Dim sSectionName as String + + sDDEFile = Convertpath ( gOfficePath + "\user\work\dde_test.odt") + sContent = "DDE" + sName = "myTest" + sSectionName = "Section1" + sDDEStatement = "soffice " & sDDEFile & " " & sSectionName + + printlog "DDE field - manual" + '/// <b> DDE field - manual </b> + + if FileExists ( sDDEFile ) then app.kill ( sDDEFile ) + + Call hNewDocument + + '/// Input something , insert a section , then save it and close the file + Call wTypeKeys sContent + Call wTypeKeys "<Shift Home>" + Call fInsertSection("TabBereiche") + Bereichsliste.Settext sSectionName + TabBereiche.OK + Sleep 1 + Call hFileSaveAsKill(sDDEFile) + Call hCloseDocument + + '/// Opan a new document + Call hNewDocument + '/// Insert/Fields/Other/Variables / Select "DDE Field" + '/// Set DDE name and DDE statement , select "DDE manual" + Call fInsertFieldsOther("TabVariablen") + Feldtyp.Select 3 + Sleep 1 + NameText.SetText sName + Wert.SetText sDDEStatement + Formatliste.Select 1 + Einfuegen.Click + Sleep 2 + TabVariablen.Close + Sleep 2 + + Call wTypeKeys "<MOD1 Home>" + Call wTypeKeys "<Shift End>" + if fGetFieldContent() <> sContent then + Warnlog "Should get " & sContent & " but get " & fGetFieldContent() + end if + + '/// Open the test file which you just closed , add something , + '/// Save the file + Call hFileOpen(sDDEFile) + Call wTypeKeys "<MOD1 Home>" + Call wTypeKeys "XYZ" + FileSave + Call hCloseDocument + + '/// Check if the content is changed -- Should NOT + Sleep 2 + Call wTypeKeys "<F9>" + Call wTypeKeys "<MOD1 Home><Shift End>" + if fGetFieldContent() <> sContent then + Warnlog "Should get " & sContent & " but get " & fGetFieldContent() + end if + + '/// Edit/Fields , press update button + EditFields + Kontext "VerknuepfungenBearbeiten" + Aktualisieren.Click + VerknuepfungenBearbeiten.Close + + '/// Check if the content is changed -- Should NOT + Sleep 1 + Call wTypeKeys "<F9>" + Call wTypeKeys "<MOD1 Home><Shift End>" + if fGetFieldContent() <> ("XYZ" & sContent) then + Warnlog "Should get XYZ" & sContent & " but get " & fGetFieldContent() + end if + + Call hCloseDocument + + if FileExists( sDDEFile ) then app.kill ( sDDEFile ) + +endcase + +'----------------------------------------------------------------- + +testcase tVariablesDDEFieldAutomatic + qaerrorlog "#i112079#testcase must be reworked" + goto endsub + + qaerrorlog "#i102792# - tVariablesDDEFieldAutomatic outcommented. Fields not updated." + goto endsub + + Dim sDDEFile as String + Dim sContent as String + Dim sName as String + Dim sDDEStatement as String + Dim sSectionName as String + + sDDEFile = Convertpath ( gNetzOfficePath + "dde_test.oxt") + sContent = "DDE" + sName = "myTest" + sSectionName = "Section1" + sDDEStatement = "soffice " & sDDEFile & " " & sSectionName + + printlog "DDE field - automatic" + '/// <b> DDE field - automatic </b> + + if FileExists ( sDDEFile ) then app.kill ( sDDEFile ) + + Call hNewDocument + + '/// Input something , insert a section , then save it and close the file + Call wTypeKeys sContent + Call wTypeKeys "<Shift Home>" + Call fInsertSection("TabBereiche") + Bereichsliste.Settext sSectionName + TabBereiche.OK + Sleep 1 + Call hFileSaveAsKill(sDDEFile) + Call hCloseDocument + + '/// Opan a new document + Call hNewDocument + + '/// Insert/Fields/Other/Variables / Select "DDE Field" + '/// Set DDE name and DDE statement , select "DDE automatic" + Call fInsertFieldsOther("TabVariablen") + Feldtyp.Select 3 + Sleep 1 + NameText.SetText sName + Wert.SetText sDDEStatement + Formatliste.Select 2 + Einfuegen.Click + Sleep 2 + TabVariablen.Close + Sleep 2 + + Call wTypeKeys "<MOD1 Home>" + Call wTypeKeys "<Shift End>" + if fGetFieldContent() <> sContent then + Warnlog "Should get " & sContent & " but get " & fGetFieldContent() + end if + + '/// Open the test file which you just closed , add something , + '/// Save the file + Call hFileOpen(sDDEFile) + Call wTypeKeys "<MOD1 Home>" + Call wTypeKeys "XYZ" + FileSave + Call hCloseDocument + + '/// Check if the content is changed -- Should + Sleep 2 + Call wTypeKeys "<F9>" + Call wTypeKeys "<MOD1 Home><Shift End>" + if fGetFieldContent() <> ("XYZ" & sContent) then + Warnlog "Should get XYZ" & sContent & " but get " & fGetFieldContent() + end if + + Call hCloseDocument + + if FileExists ( sDDEFile ) then app.kill ( sDDEFile ) + +endcase + +'----------------------------------------------------------------- diff --git a/testautomation/writer/optional/includes/fields/w_fields6.inc b/testautomation/writer/optional/includes/fields/w_fields6.inc new file mode 100755 index 000000000000..e310b67740af --- /dev/null +++ b/testautomation/writer/optional/includes/fields/w_fields6.inc @@ -0,0 +1,830 @@ +'encoding UTF-8 Do not remove or change this line! +'************************************************************************** +' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +' +' Copyright 2000, 2010 Oracle and/or its affiliates. +' +' OpenOffice.org - a multi-platform office productivity suite +' +' This file is part of OpenOffice.org. +' +' OpenOffice.org is free software: you can redistribute it and/or modify +' it under the terms of the GNU Lesser General Public License version 3 +' only, as published by the Free Software Foundation. +' +' OpenOffice.org is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY; without even the implied warranty of +' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +' GNU Lesser General Public License version 3 for more details +' (a copy is included in the LICENSE file that accompanied this code). +' +' You should have received a copy of the GNU Lesser General Public License +' version 3 along with OpenOffice.org. If not, see +' <http://www.openoffice.org/license.html> +' for a copy of the LGPLv3 License. +' +'/************************************************************************ +'* +'* owner : helge.delfs@oracle.com +'* +'* short description : Fields - Functions +'* +'\*********************************************************************** + +sub w_fields6 + + Call tFunctionsConditionalText + Call tFunctionsHiddenText + Call tFunctionsHiddenParagraph + Call tFunctionsInputField + Call tFunctionsPlaceholderText + Call tFunctionsPlaceholderTable + Call tFunctionsPlaceholderFrame + Call tFunctionsPlaceholderGraphics + Call tFunctionsPlaceholderObject + Call tFunctionsInputlistRemove + Call tFunctionsInputlistMoveUp + Call tFunctionsInputlistMoveDown + Call tFunctionsCombineCharacter + +end sub + +'----------------------------------------------------------------- + +testcase tFunctionsConditionalText + + Dim sName as String + Dim sValue() as String + Dim sCondition as String + Dim sElse as String + Dim sThen as String + Dim sResult() as String + Dim iType as Integer + Dim i as Integer + Dim j as Integer + + sName = "X" + SCondition = "X==" + Chr(34) + "Sun" + Chr(34) + SThen = "Yes" + sElse = "No" + + sValue = Array( _ + "Sun" , _ + "NOTSun" , _ + ) + sResult = Array( _ + "Sun" , _ + "Yes" , _ + "NOTSun" , _ + "No" , _ + ) + + printlog "Conditional text" + '/// <b> Conditional text </b> + + Call hNewDocument + + '/// Insert/Fields/Other/Variables / Select "set Variable" , + '/// Set 1 Name and set its Value to "Sun" , then goto tabpage function + '/// + choose "Conditional text" , set condition like + '/// if X="Sun" then "YES" else "NO" + '/// Set another value to "NoSun" + j = UBound(sValue) + for i = 0 to j + Call fInsertFieldsOther("TabVariablen") + Feldtyp.Select 1 + Sleep 1 + NameText.SetText sName + Wert.SetText sValue(i) + Zahlenformat.Select 1 + Einfuegen.Click + TabVariablen.Close + Call wTypeKeys "<Return>" + Call fInsertFieldsOther("TabFunktionen") + Feldtyp.Select 1 + Sleep 1 + Bedingung.SetText sCondition + Dann.SetText sThen + Sonst.SetText sElse + Einfuegen.Click + TabFunktionen.Close + Call wTypeKeys "<Return>" + next i + + '/// Check if the insertion is correct + Call wTypeKeys "<MOD1 Home>" + j = UBound(sResult) + for i = 0 to j + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sResult(i) then + Warnlog "Should get " & sResult(i) & " but get " & fGetFieldContent() + end if + Call wTypeKeys "<Down><Home>" + next i + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tFunctionsHiddenText + + Dim sName as String + Dim sValue() as String + Dim sCondition as String + Dim sHiddenText as String + Dim sResult() as String + Dim bHiddenText as Boolean + Dim i as Integer + Dim j as Integer + + sName = "X" + SCondition = "X==" + Chr(34) + "ABC" + Chr(34) + sHiddenText = "HiddenText" + + sValue = Array( _ + "ABC" , _ + "NOTABC" , _ + ) + sResult = Array( _ + "" , _ + "HiddenText" , _ + ) + + printlog "Hidden text" + '/// <b> Hidden text </b> + + Call hNewDocument + + '/// Tools/Options / StarOffice writer / Formatting Aids + '/// Uncheck 'Fields : Hidden text" + ToolsOptions + Call hToolsOptions("WRITER","FORMATTINGAIDS") + bHiddenText = FeldVersteckterText.IsChecked + if bHiddenText = TRUE then + FeldVersteckterText.UnCheck + end if + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK + + '/// Insert/Fields/Other/Variables / Select "set Variable" , + '/// Set Name and set its Value to "ABC" , then goto tabpage function + '/// + choose "hidden text" , set condition like + '/// if X="ABC" as condition , hidden text is "HiddenText" + '/// Set another value to "NoTABC" + '/// Check if the insertion is correct + j = UBound(sValue) + for i = 0 to j + Call wTypeKeys "<MOD1 Home><Shift End>" + Call fInsertFieldsOther("TabVariablen") + Feldtyp.Select 1 + Sleep 1 + NameText.SetText sName + Wert.SetText sValue(i) + Zahlenformat.Select 1 + Einfuegen.Click + TabVariablen.Close + Call wTypeKeys "<Return>" + Call fInsertFieldsOther("TabFunktionen") + Feldtyp.Select 7 'Hidden text + Sleep 1 + Bedingung.SetText sCondition + Hinweis.SetText sHiddenText + Einfuegen.Click + TabFunktionen.Close + + Call wTypeKeys "<Shift Left>" + if fGetFieldContent() <> sResult(i) then + Warnlog "Should get " & sResult(i) & " but get " & fGetFieldContent() + end if + next i + + 'Recover to default + ToolsOptions + Call hToolsOptions("WRITER","FORMATTINGAIDS") + if bHiddenText = TRUE then FeldVersteckterText.Check + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tFunctionsHiddenParagraph + + Dim sName as String + Dim sValue() as String + Dim sCondition as String + Dim sHiddenText as String + Dim sResult() as String + Dim bHiddenText as Boolean + Dim i as Integer + Dim j as Integer + + sName = "X" + SCondition = "X==" + Chr(34) + "ABC" + Chr(34) + sHiddenText = "HiddenText" + + sValue = Array( _ + "ABC" , _ + "NOTABC" , _ + ) + sResult = Array( _ + "ABC" , _ + "HiddenText" , _ + ) + + printlog "Hidden paragraph" + '/// <b> Hidden paragraph </b> + + Call hNewDocument + + '/// Tools/Options / StarOffice writer / Formatting Aids + '/// Uncheck 'Fields : Hidden paragraph" + ToolsOptions + Call hToolsOptions("WRITER","FORMATTINGAIDS") + bHiddenText = VersteckteAbsatze.IsChecked + if bHiddenText = TRUE then + VersteckteAbsatze.UnCheck + end if + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK + + '/// Input a paragraph first + Call wTypeKeys "<Return>" + Call wTypeKeys sHiddenText + Call wTypeKeys "<Up>" + + '/// Insert/Fields/Other/Variables / Select "set Variable" , + '/// Set Name and set its Value to "ABC" , then goto tabpage function + '/// + choose "hidden paragraph" , set condition like + '/// if X="ABC" as condition + '/// Check if the paragraph disappear or not + j = UBound(sValue) + for i = 0 to j + Call wTypeKeys "<MOD1 Home><Shift End>" + Call fInsertFieldsOther("TabVariablen") + Feldtyp.Select 1 + Sleep 1 + NameText.SetText sName + Wert.SetText sValue(i) + Zahlenformat.Select 1 + Einfuegen.Click + TabVariablen.Close + Call wTypeKeys "<Down><Home>" + Call fInsertFieldsOther("TabFunktionen") + Feldtyp.Select 8 'Hidden paragraph + Sleep 1 + Bedingung.SetText sCondition + Einfuegen.Click + TabFunktionen.Close + + Call wTypeKeys "<MOD1 Home><Down><Shift End>" + if fGetFieldContent() <> sResult(i) then + Warnlog "Should get " & sResult(i) & " but get " & fGetFieldContent() + end if + next i + + 'Recover to default + ToolsOptions + Call hToolsOptions("WRITER","FORMATTINGAIDS") + if bHiddenText = TRUE then VersteckteAbsatze.Check + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tFunctionsInputField + + Dim sReference as String + Dim sFieldContent as String + + sReference = "NewTest" + sFieldContent = "10000" + + printlog "Input field" + '/// <b> Input field </b> + + Call hNewDocument + + '/// Insert/Fields/Other/Functions / Select "Input field" , + '/// + set reference , press insert button , input field content + Call fInsertFieldsOther("TabFunktionen") + Feldtyp.Select 3 'Input field + Sleep 1 + Hinweis.SetText sReference + Einfuegen.Click + Kontext "Eingabefeld" + if Titel.GetText <> sReference then + Warnlog "Reference should be " & sReference & " but get " & Titel.GetText + end if + EingabeText.SetText sFieldContent + Eingabefeld.OK + + Kontext "TabFunktionen" + TabFunktionen.Close + + '/// Check if the insertion is correct + Call wTypeKeys "<MOD1 Home>" + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sFieldContent then + Warnlog "Should get " & sFieldContent & " but get " & fGetFieldContent() + end if + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tFunctionsPlaceholderText + + Dim sPlaceHolder as String + + sPlaceHolder = "Text" + + printlog "Placeholder - Text" + '/// <b> Placeholder - Text </b> + + Call hNewDocument + + '/// Insert/Fields/Other/Functions / Select "Placeholder" , + '/// + select Text + Call fInsertFieldsOther("TabFunktionen") + Feldtyp.Select 5 'Placeholder + Sleep 1 + Formatliste.Select 1 + Platzhalter.SetText sPlaceHolder + Einfuegen.Click + TabFunktionen.Close + + '/// Check if the insertion is correct + Call wTypeKeys "<MOD1 Home>" + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> ("<" & sPlaceHolder & ">" )then + Warnlog "Should get <" & sPlaceHolder & "> but get " & fGetFieldContent() + end if + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tFunctionsPlaceholderTable + + printlog "Placeholder - Table" + '/// <b> Placeholder - Table </b> + + Call hNewDocument + + Call fFormatPageWriter("TabSeite") + Breite.SetText "15" + Hoehe.SetText "15" + Links.SetText "0" + Rechts.SetText "0" + Oben.SetText "0" + Unten.SetText "0" + TabSeite.OK + Sleep 2 + Kontext "Active" + if Active.Exists then + if Active.GetRT = 304 then ' is it a messagebox ? + Active.Yes + else + Warnlog "Messagebox is not up " + end if + else + Warnlog "Something wrong !" + end if + + '/// Insert/Fields/Other/Functions / Select "Placeholder" , + '/// + select Table + Call fInsertFieldsOther("TabFunktionen") + Feldtyp.Select 5 'Placeholder + Sleep 1 + Formatliste.Select 2 + Platzhalter.SetText "TableTableTableTableTable" + Einfuegen.Click + TabFunktionen.Close + + '/// Check if the insertion is correct + Call wTypeKeys "<MOD1 Home>" + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> ("<TableTableTableTableTable>" )then + Warnlog "Should get <TableTableTableTableTable> but get " & fGetFieldContent() + end if + + Call fSetToBigSize() + Call wTypeKeys "<MOD1 Home>" + Sleep 1 + + Call gMouseMove(0,0,30,25) + Call gMouseClick(30,25) + Sleep 3 + + Kontext "TabelleEinfuegenWriter" + if TabelleEinfuegenWriter.Exists then + TabelleEinfuegenWriter.Cancel + else + Warnlog "Insert table dialog isn't up !" + end if + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tFunctionsPlaceholderFrame + + printlog "Placeholder - Frame" + '/// <b> Placeholder - Frame </b> + + Call hNewDocument + + fFormatPageWriter("TabSeite") + Breite.SetText "15" + Hoehe.SetText "15" + Links.SetText "0" + Rechts.SetText "0" + Oben.SetText "0" + Unten.SetText "0" + TabSeite.OK + Kontext "Active" + if Active.Exists then + if Active.GetRT = 304 then ' is it a messagebox ? + Active.Yes + else + Warnlog "Messagebox is not up " + end if + else + Warnlog "Something wrong !" + end if + + '/// Insert/Fields/Other/Functions / Select "Placeholder" , + '/// + select Frame + Call fInsertFieldsOther("TabFunktionen") + Feldtyp.Select 5 'Placeholder + Sleep 1 + Formatliste.Select 3 + Platzhalter.SetText "FrameFrameFrameFrameFrameFrame" + Einfuegen.Click + TabFunktionen.Close + + '/// Check if the insertion is correct + Call wTypeKeys "<MOD1 Home>" + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> ("<FrameFrameFrameFrameFrameFrame>" )then + Warnlog "Should get <FrameFrameFrameFrameFrameFrame> but get " & fGetFieldContent() + end if + + Call fSetToBigSize() + Call wTypeKeys "<MOD1 Home>" + Sleep 1 + Call gMouseMove(0,0,30,25) + Call gMouseClick(30,25) + Sleep 3 + + try + Kontext + Active.SetPage TabType + Kontext "TabType" + AutoHoehe.UnCheck + TabType.Cancel + catch + Warnlog "Format/Frame dialog isn't up !" + endcatch + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tFunctionsPlaceholderGraphics + + printlog "Placeholder - Graphics" + '/// <b> Placeholder - Graphics </b> + + Call hNewDocument + + fFormatPageWriter("TabSeite") + Breite.SetText "15" + Hoehe.SetText "15" + Links.SetText "0" + Rechts.SetText "0" + Oben.SetText "0" + Unten.SetText "0" + + TabSeite.OK + Kontext "Active" + if Active.Exists then + if Active.GetRT = 304 then ' is it a messagebox ? + Active.Yes + else + Warnlog "Messagebox is not up " + end if + else + Warnlog "Something wrong !" + end if + + '/// Insert/Fields/Other/Functions / Select "Placeholder" , + '/// + select Graphics + Call fInsertFieldsOther("TabFunktionen") + Feldtyp.Select 5 'Placeholder + Sleep 1 + Formatliste.Select 4 + Platzhalter.SetText "GraphicsGraphicsGraphicsGraphicsGraphics" + Einfuegen.Click + TabFunktionen.Close + + '/// Check if the insertion is correct + Call wTypeKeys "<MOD1 Home>" + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> ("<GraphicsGraphicsGraphicsGraphicsGraphics>" )then + Warnlog "Should get <GraphicsGraphicsGraphicsGraphicsGraphics> but get " & fGetFieldContent() + end if + + Call fSetToBigSize() + Call wTypeKeys "<MOD1 Home>" + Sleep 1 + Call gMouseMove(0,0,30,25) + Call gMouseClick(30,25) + Sleep 3 + + try + Kontext "GrafikEinfuegenDlg" + Oeffnen.Click + GrafikEinfuegenDlg.Cancel + catch + Warnlog "Insert picture dialog isn't up !" + endcatch + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tFunctionsPlaceholderObject + + printlog "Placeholder - Object" + '/// <b> Placeholder - Object </b> + + Call hNewDocument + + fFormatPageWriter("TabSeite") + Breite.SetText "15" + Hoehe.SetText "15" + Links.SetText "0" + Rechts.SetText "0" + Oben.SetText "0" + Unten.SetText "0" + TabSeite.OK + Kontext "Active" + if Active.Exists then + if Active.GetRT = 304 then ' is it a messagebox ? + Active.Yes + else + Warnlog "Messagebox is not up " + end if + else + Warnlog "Something wrong !" + end if + + '/// Insert/Fields/Other/Functions / Select "Placeholder" , + '/// + select object + Call fInsertFieldsOther("TabFunktionen") + Feldtyp.Select 5 'Placeholder + Sleep 1 + Formatliste.Select 5 + Platzhalter.SetText "ObjectObjectObjectObjectObjectObject" + Einfuegen.Click + TabFunktionen.Close + + '/// Check if the insertion is correct + Call wTypeKeys "<MOD1 Home>" + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> ("<ObjectObjectObjectObjectObjectObject>" )then + Warnlog "Should get <ObjectObjectObjectObjectObjectObject> but get " & fGetFieldContent() + end if + + Call fSetToBigSize() + Call wTypeKeys "<MOD1 Home>" + Sleep 1 + Call gMouseMove(0,0,30,25) + Call gMouseClick(30,25) + Sleep 3 + + try + Kontext "OLEObjektEinfuegen" + NeuErstellen.Check + OLEObjektEinfuegen.Cancel + catch + Warnlog "Insert OLE Object dialog isn't up !" + endcatch + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tFunctionsInputlistRemove + + Dim sItem1 as String + Dim sItem2 as String + + sItem1 = "First" : sItem2 = "Second" + + printlog "Input list - Remove" + '/// <b> Input list Remove</b> + + Call hNewDocument + + '/// Insert/Fields/Other/Functions / Select "Input list" , + '/// + insert 2 itmes , remove 1st one + Call fInsertFieldsOther("TabFunktionen") + Feldtyp.Select 2 'Input list + Sleep 1 + NewListEntry.SetText sItem1 + AddListEntry.Click + NewListEntry.SetText sItem2 + AddListEntry.Click + Sleep 1 + Einfuegen.Click + Call wTypeKeys "<Return>" + Kontext "TabFunktionen" + EntrysList.Select 1 + RemoveEntry.Click + Einfuegen.Click + TabFunktionen.Close + + '/// Check if the insertion is correct + Call wTypeKeys "<MOD1 Home>" + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sItem1 then + Warnlog "Should get " & sItem1 & " but get " & fGetFieldContent() + end if + Call wTypeKeys "<Down><Home>" + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sItem2 then + Warnlog "Should get " & sItem2 & " but get " & fGetFieldContent() + end if + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tFunctionsInputlistMoveUp + + Dim sItem1 as String + Dim sItem2 as String + + sItem1 = "First" : sItem2 = "Second" + + printlog "Input list - Move up" + '/// <b> Input list Move up</b> + + Call hNewDocument + + '/// Insert/Fields/Other/Functions / Select "Input list" , + '/// + insert 2 itmes , press move up + Call fInsertFieldsOther("TabFunktionen") + Feldtyp.Select 2 'Input list + Sleep 1 + NewListEntry.SetText sItem1 + AddListEntry.Click + NewListEntry.SetText sItem2 + AddListEntry.Click + Sleep 1 + Einfuegen.Click + Call wTypeKeys "<Return>" + Kontext "TabFunktionen" + MoveUpEntry.Click + Einfuegen.Click + TabFunktionen.Close + + '/// Check if the insertion is correct + Call wTypeKeys "<MOD1 Home>" + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sItem1 then + Warnlog "Should get " & sItem1 & " but get " & fGetFieldContent() + end if + Call wTypeKeys "<Down><Home>" + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sItem2 then + Warnlog "Should get " & sItem2 & " but get " & fGetFieldContent() + end if + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tFunctionsInputlistMoveDown + + Dim sItem1 as String + Dim sItem2 as String + + sItem1 = "First" : sItem2 = "Second" + + printlog "Input list - Move down" + '/// <b> Input list Move down</b> + + Call hNewDocument + + '/// Insert/Fields/Other/Functions / Select "Input list" , + '/// + insert 2 itmes , press move down + Call fInsertFieldsOther("TabFunktionen") + Feldtyp.Select 2 'Input list + Sleep 1 + NewListEntry.SetText sItem1 + AddListEntry.Click + NewListEntry.SetText sItem2 + AddListEntry.Click + Sleep 1 + Einfuegen.Click + Call wTypeKeys "<Return>" + Kontext "TabFunktionen" + EntrysList.Select 1 + MoveDownEntry.Click + Einfuegen.Click + TabFunktionen.Close + + '/// Check if the insertion is correct + Call wTypeKeys "<MOD1 Home>" + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sItem1 then + Warnlog "Should get " & sItem1 & " but get " & fGetFieldContent() + end if + Call wTypeKeys "<Down><Home>" + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sItem2 then + Warnlog "Should get " & sItem2 & " but get " & fGetFieldContent() + end if + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tFunctionsCombineCharacter + + Dim sCombineCharacter as String + Dim sTestFile as String + + sCombineCharacter = "ABC" + sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\fields\CombineTest.sxw") + + printlog "Combine Character" + '/// <b> Combine Character </b> + + Call hNewDocument + + '/// Open test file pageTest.sxw + Call hFileOpen(sTestFile) + Call sMakeReadOnlyDocumentEditable + Call wTypeKeys "<MOD1 Home>" + Call wTypeKeys "<Right>" + + '/// Insert/Fields/Other/Functions / Select "Combine characters" + Call fInsertFieldsOther("TabFunktionen") + Feldtyp.Select 6 'Combine characters + Sleep 1 + Namefeld.SetText sCombineCharacter + Einfuegen.Click + TabFunktionen.Close + + '/// Check if the insertion is correct + Call wTypeKeys "<Shift Left>" + if fGetFieldContent() <> sCombineCharacter then + Warnlog "Should get " & sCombineCharacter & " but get " & fGetFieldContent() + end if + + Call wTypeKeys ( "<Shift F4>" ) + FormatAnchorToPage + Sleep 1 + Call fPositionAndSize("TabPositionAndSizeWriter") + if StrToDouble(Horizontalby.Gettext) < 6.5 OR StrToDouble(Horizontalby.Gettext) > 7.5 then + Warnlog "Something wrong in combine character" + end if + TabPositionAndSizeWriter.Cancel + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- diff --git a/testautomation/writer/optional/includes/fields/w_fields7.inc b/testautomation/writer/optional/includes/fields/w_fields7.inc new file mode 100755 index 000000000000..5893e324366b --- /dev/null +++ b/testautomation/writer/optional/includes/fields/w_fields7.inc @@ -0,0 +1,421 @@ +'encoding UTF-8 Do not remove or change this line! +'************************************************************************** +' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +' +' Copyright 2000, 2010 Oracle and/or its affiliates. +' +' OpenOffice.org - a multi-platform office productivity suite +' +' This file is part of OpenOffice.org. +' +' OpenOffice.org is free software: you can redistribute it and/or modify +' it under the terms of the GNU Lesser General Public License version 3 +' only, as published by the Free Software Foundation. +' +' OpenOffice.org is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY; without even the implied warranty of +' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +' GNU Lesser General Public License version 3 for more details +' (a copy is included in the LICENSE file that accompanied this code). +' +' You should have received a copy of the GNU Lesser General Public License +' version 3 along with OpenOffice.org. If not, see +' <http://www.openoffice.org/license.html> +' for a copy of the LGPLv3 License. +' +'/************************************************************************ +'* +'* owner : helge.delfs@oracle.com +'* +'* short description : Fields - L10N test +'* +'\*********************************************************************** + +sub w_fields7 + + Call tL10NtestAboveBelow + Call tL10NtestDate + Call tL10NtestTime + +end sub + +'----------------------------------------------------------------- + +testcase tL10NtestAboveBelow + + if iSprache <> 1 then + QaErrorLog "Currently no any other language than English. Aborting." + exit sub + end if + + Dim sTestFile as String + Dim sAbove() as String + Dim sBelow() as String + Dim iCountry() as Integer + Dim i as Integer + Dim j as Integer + + Dim sUILanguage as integer, sLocale as integer + Dim sCurrency as integer, sWestern as integer, sAsian as integer, sCTL as integer + Dim sAsiancb as boolean, sCTLcb as boolean + Dim sAsiancbChecked as boolean, sCTLcbChecked as boolean + + if iSprache <> 01 then + QAErrorlog "This is a English-only testcase" + end if + + Call hNewDocument + ' Get current settings on language tabpage and remember + ToolsOptions + Call hToolsOptions("LANGUAGESETTINGS","LANGUAGES") + sUILanguage = UILanguage.GetSelIndex + sLocale = Gebietsschema.GetSelIndex + sCurrency = StandardWaehrung.GetSelIndex + sWestern = Westlich.GetSelIndex + if Asiatisch.IsEnabled then sAsian = Asiatisch.GetSelIndex + if LanguageComplexScript.IsEnabled then sCTL = LanguageComplexScript.GetSelIndex + sAsiancb = Aktivieren.IsEnabled + sCTLcb = ComplexScriptEnabled.IsEnabled + sAsiancbChecked = Aktivieren.IsChecked + sCTLcbChecked = ComplexScriptEnabled.IsChecked + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.Cancel + Call hCloseDocument + + sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\fields\AboveBelow.sxw") + + sBelow = Array( _ + "below" , _ + "infra" , _ + "abajo" , _ + "sotto" , _ + "ovan" , _ + "unten" , _ + "abaixo" , _ + "後述" , _ + "아래" , _ + "下面" , _ + "下面" , _ + ) + sAbove = Array( _ + "above" , _ + "supra" , _ + "arriba" , _ + "sopra" , _ + "nedan" , _ + "oben" , _ + "acima" , _ + "前述" , _ + "위" , _ + "上面" , _ + "上面" , _ + ) + iCountry = Array ( 1 , 33 , 34 , 39 , 46 , 49 , _ + 55, 81 , 82 , 86 , 88 ) + + printlog "L10N test - above/below" + '/// <b> L10N test - above/below </b> + + Call hNewDocument + + '/// Open test file AboveBelow.sxw + Call hFileOpen(sTestFile) + Call sMakeReadOnlyDocumentEditable + + '/// Check if reference above/below is changed after language is changed + + j = UBound(iCountry) + for i = 0 to j + Call wTypeKeys "<MOD1 Home>" + fSetLocale(fGetLanguageName(iCountry(i))) + if iCountry(i) < 80 then + fSetWestern(fGetLanguageName(iCountry(i))) + fSetAsian("Null") + else + fSetWestern("Null") + fSetAsian(fGetLanguageName(iCountry(i))) + end if + + Call wTypeKeys "<F9>" + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sBelow(i) then + Warnlog "Should get " & sBelow(i) & " but get " & fGetFieldContent() + end if + Call wTypeKeys "<MOD1 End>" + Call wTypeKeys "<Shift Left>" + if fGetFieldContent() <> sAbove(i) then + Warnlog i & " - Should get " & sAbove(i) & " but get " & fGetFieldContent() + end if + next i + + ' set back language tabpage values + ToolsOptions + Call hToolsOptions("LANGUAGESETTINGS","LANGUAGES") + UILanguage.Select sUILanguage + Gebietsschema.Select sLocale + StandardWaehrung.Select sCurrency + Westlich.Select sWestern + if sAsiancb = true then + if sAsiancbChecked = true then Aktivieren.IsChecked + end if + + if sCTLcb = true then + if sCTLcbChecked = true then ComplexScriptEnabled.IsChecked + end if + + if Asiatisch.IsEnabled and sAsian > 0 then Asiatisch.Select sAsian + if LanguageComplexScript.IsEnabled and sCTL > 0 then LanguageComplexScript.Select sCTL + + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.Ok + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tL10NtestDate + if iSprache <> 1 then + QaErrorLog "Currently no any other language than English. Aborting." + exit sub + end if + + Dim sTestFile as String + Dim sOriginalFile as string + Dim sDate() as String + Dim iCountry() as Integer + Dim i , j as Integer + + Dim sUILanguage as integer, sLocale as integer + Dim sCurrency as integer, sWestern as integer, sAsian as integer, sCTL as integer + Dim sAsiancb as boolean, sCTLcb as boolean + Dim sAsiancbChecked as boolean, sCTLcbChecked as boolean + + if iSprache <> 01 then + QAErrorlog "This is a English-only testcase" + goto endsub + end if + + Call hNewDocument + ' Get current settings on language tabpage and remember + ToolsOptions + Call hToolsOptions("LANGUAGESETTINGS","LANGUAGES") + sUILanguage = UILanguage.GetSelIndex + sLocale = Gebietsschema.GetSelIndex + sCurrency = StandardWaehrung.GetSelIndex + sWestern = Westlich.GetSelIndex + if Asiatisch.IsEnabled then sAsian = Asiatisch.GetSelIndex + if LanguageComplexScript.IsEnabled then sCTL = LanguageComplexScript.GetSelIndex + sAsiancb = Aktivieren.IsEnabled + sCTLcb = ComplexScriptEnabled.IsEnabled + sAsiancbChecked = Aktivieren.IsChecked + sCTLcbChecked = ComplexScriptEnabled.IsChecked + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.Cancel + Call hCloseDocument + + sTestFile = Convertpath (gOfficepath + "user\work\Date.sxw") + sOriginalFile = Convertpath (gTesttoolpath + "writer\optional\input\fields\Date.sxw") + ' document has to be copied to local file system to avoid opening a read-only file + ' because all field data gets lost if documents write-protection is removed via 'sMakeReadOnlyDocumentEditable' + FileCopy (sOriginalFile, sTestFile) + if FileExists ( sTestFile ) = false then + Warnlog "Test document couldn't be copied to local file system. Test aborted!" + goto endsub + end if + + + sDate = Array( _ + "Tuesday, August 3, 2004" , _ + "mardi 3 août 2004" , _ + "martes, 3 de agosto de 2004" , _ + "martedì 3 agosto 2004" , _ + "tisdag 3 augusti 2004" , _ + "Dienstag, 3. August 2004" , _ + "Terça-feira, 3 de Agosto de 2004" , _ + "2004年8月3日(火曜日)" , _ + "04-8-3 화요일" , _ + "2004年8月3日 星期二" , _ + "中華民國93年8月3日 星期二" , _ + ) + iCountry = Array ( 1 , 33 , 34 , 39 , 46 , 49 , _ + 55, 81 , 82 , 86 , 88 ) + + printlog "L10N test - Date" + '/// <b> L10N test - Date </b> + + Call hNewDocument + + '/// Open test file Date.sxw + Call hFileOpen(sTestFile) + + '/// Check if Date is changed after language is changed + j = UBound(iCountry) + for i = 0 to j + Call wTypeKeys "<MOD1 Home>" + fSetLocale(fGetLanguageName(iCountry(i))) + if iCountry(i) < 80 then + fSetWestern(fGetLanguageName(iCountry(i))) + fSetAsian("Null") + else + fSetWestern("Null") + fSetAsian(fGetLanguageName(iCountry(i))) + end if + + Call wTypeKeys "<F9>" + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sDate(i) then + Warnlog i & " - Should get " & sDate(i) & " but get " & fGetFieldContent() + end if + next i + + ' set back language tabpage values + ToolsOptions + Call hToolsOptions("LANGUAGESETTINGS","LANGUAGES") + UILanguage.Select sUILanguage + Gebietsschema.Select sLocale + StandardWaehrung.Select sCurrency + Westlich.Select sWestern + if sAsiancb = true then + if sAsiancbChecked = true then Aktivieren.IsChecked + end if + + if sCTLcb = true then + if sCTLcbChecked = true then ComplexScriptEnabled.IsChecked + end if + + if Asiatisch.IsEnabled and sAsian > 0 then Asiatisch.Select sAsian + if LanguageComplexScript.IsEnabled and sCTL > 0 then LanguageComplexScript.Select sCTL + + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.Ok + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- + +testcase tL10NtestTime + if iSprache <> 1 then + QaErrorLog "Currently no any other language than English. Aborting." + goto endsub + end if + + Dim sTestFile as String + Dim sOriginalFile as string + Dim sTime() as String + Dim iCountry() as Integer + Dim i as Integer + Dim j as Integer + + Dim sUILanguage as integer, sLocale as integer + Dim sCurrency as integer, sWestern as integer, sAsian as integer, sCTL as integer + Dim sAsiancb as boolean, sCTLcb as boolean + Dim sAsiancbChecked as boolean, sCTLcbChecked as boolean + + if iSprache <> 01 then + QAErrorlog "This is a English-only testcase" + goto endsub + end if + + Call hNewDocument + ' Get current settings on language tabpage and remember + ToolsOptions + Call hToolsOptions("LANGUAGESETTINGS","LANGUAGES") + sUILanguage = UILanguage.GetSelIndex + sLocale = Gebietsschema.GetSelIndex + sCurrency = StandardWaehrung.GetSelIndex + sWestern = Westlich.GetSelIndex + if Asiatisch.IsEnabled then sAsian = Asiatisch.GetSelIndex + if LanguageComplexScript.IsEnabled then sCTL = LanguageComplexScript.GetSelIndex + sAsiancb = Aktivieren.IsEnabled + sCTLcb = ComplexScriptEnabled.IsEnabled + sAsiancbChecked = Aktivieren.IsChecked + sCTLcbChecked = ComplexScriptEnabled.IsChecked + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.Cancel + Call hCloseDocument + + sTestFile = Convertpath (gOfficepath + "user\work\Time.sxw") + sOriginalFile = Convertpath (gTesttoolpath + "writer\optional\input\fields\Time.sxw") + ' document has to be copied to local file system to avoid opening a read-only file + ' because all field data gets lost if documents write-protection is removed via 'sMakeReadOnlyDocumentEditable' + FileCopy (sOriginalFile, sTestFile) + if FileExists ( sTestFile ) = false then + Warnlog "Test document couldn't be copied to local file system. Test aborted!" + goto endsub + end if + + + sTime = Array( _ + "04:46:08 PM" , _ + "04:46:08 PM" , _ + "04:46:08 PM" , _ + "04.46.08 p." , _ + "04:46:08 em" , _ + "04:46:08 nachm." , _ + "04:46:08 PM" , _ + "午後 4:46:08" , _ + "오후 4시 46분 8초" , _ + "下午 04:46:08" , _ + "下午 04:46:08" , _ + ) + iCountry = Array ( 1 , 33 , 34 , 39 , 46 , 49 , _ + 55, 81 , 82 , 86 , 88 ) + + printlog "L10N test - time" + '/// <b> L10N test - time </b> + + Call hNewDocument + + '/// Open test file Time.sxw + Call hFileOpen(sTestFile) + + '/// Check if time is changed after language is changed + j = UBound(iCountry) + for i = 0 to j + Call wTypeKeys "<MOD1 Home>" + fSetLocale(fGetLanguageName(iCountry(i))) + if iCountry(i) < 80 then + fSetWestern(fGetLanguageName(iCountry(i))) + fSetAsian("Null") + else + fSetWestern("Null") + fSetAsian(fGetLanguageName(iCountry(i))) + end if + + Call wTypeKeys "<F9>" + Call wTypeKeys "<Shift Right>" + if fGetFieldContent() <> sTime(i) then + Warnlog i & " - Should get " & sTime(i) & " but get " & fGetFieldContent() + end if + next i + + ' set back language tabpage values + ToolsOptions + Call hToolsOptions("LANGUAGESETTINGS","LANGUAGES") + UILanguage.Select sUILanguage + Gebietsschema.Select sLocale + StandardWaehrung.Select sCurrency + Westlich.Select sWestern + if sAsiancb = true then + if sAsiancbChecked = true then Aktivieren.IsChecked + end if + + if sCTLcb = true then + if sCTLcbChecked = true then ComplexScriptEnabled.IsChecked + end if + + if Asiatisch.IsEnabled and sAsian > 0 then Asiatisch.Select sAsian + if LanguageComplexScript.IsEnabled and sCTL > 0 then LanguageComplexScript.Select sCTL + + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.Ok + + Call hCloseDocument + +endcase + +'----------------------------------------------------------------- |