1 'encoding UTF-8 Do not remove or change this line!
2 '**************************************************************************
3 '* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 '* Copyright 2008 by Sun Microsystems, Inc.
7 '* OpenOffice.org - a multi-platform office productivity suite
9 '* $RCSfile: w_fields5.inc,v $
13 '* last change: $Author: vg $ $Date: 2008-08-18 12:27:14 $
15 '* This file is part of OpenOffice.org.
17 '* OpenOffice.org is free software: you can redistribute it and/or modify
18 '* it under the terms of the GNU Lesser General Public License version 3
19 '* only, as published by the Free Software Foundation.
21 '* OpenOffice.org is distributed in the hope that it will be useful,
22 '* but WITHOUT ANY WARRANTY; without even the implied warranty of
23 '* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 '* GNU Lesser General Public License version 3 for more details
25 '* (a copy is included in the LICENSE file that accompanied this code).
27 '* You should have received a copy of the GNU Lesser General Public License
28 '* version 3 along with OpenOffice.org. If not, see
29 '* <http://www.openoffice.org/license.html>
30 '* for a copy of the LGPLv3 License.
32 '/************************************************************************
34 '* owner : helge.delfs@sun.com
36 '* short description : Fields - Variables
38 '\***********************************************************************
42 Call tVariablesSetValueToText
43 Call tVariablesSetValueToNumber
44 Call tVariablesSetFormats
45 Call tVariablesShowVariable1
46 Call tVariablesShowVariable2
47 Call tVariablesInsertFormula
48 Call tVariablesNumberRange
49 Call tVariablesInputfield
50 Call tVariablesUserfield
51 Call tVariablesDDEFieldManual
52 Call tVariablesDDEFieldAutomatic
56 '-----------------------------------------------------------------
58 testcase tVariablesSetValueToText
59 if bAsianLan = true then
60 QaErrorLog "No testing with Asian language. Aborting."
66 Dim sResult() as String
70 sValue = "This is a test!"
84 "1" & gSeperator & "00" , _
86 "1" & gSeperator & "00" , _
90 printlog "Set value to text"
91 '/// <b> Set value to text </b>
95 '/// Insert/Fields/Other/Variables / Select "set Variable" ,
96 '/// Set Name and Value(text) , then choose Text , General ,
97 '/// + -1234 , -1234.12 , -1,234 , -1,234,12 separately
98 Call fInsertFieldsOther("TabVariablen")
102 NameText.SetText sName(i)
104 Zahlenformat.Select i+1
107 Call wTypeKeys "<Return>"
108 Kontext "TabVariablen"
110 Kontext "TabVariablen"
113 '/// Check if the insertion is correct
114 Call wTypeKeys "<MOD1 Home>"
117 Call wTypeKeys "<Shift Right>"
118 if fGetFieldContent() <> sResult(i) then
119 Warnlog i & "Should get " & sResult(i) & " but get " & fGetFieldContent()
121 Call wTypeKeys "<Down><Home>"
128 '-----------------------------------------------------------------
130 testcase tVariablesSetValueToNumber
131 if bAsianLan = true then
132 QaErrorLog "No testing with Asian language. Aborting."
136 Dim sName() as String
138 Dim sResult() as String
162 printlog "Set value to number"
163 '/// <b> Set value to number </b>
167 '/// Insert/Fields/Other/Variables / Select "set Variable" ,
168 '/// Set Name and Value(number) , then choose Text , General ,
169 '/// + -1234 , -1234.12 , -1,234 , -1,234,12 separately
170 Call fInsertFieldsOther("TabVariablen")
174 NameText.SetText sName(i)
176 Zahlenformat.Select i+1
179 Call wTypeKeys "<Return>"
180 Kontext "TabVariablen"
182 Kontext "TabVariablen"
185 '/// Check if the insertion is correct
186 Call wTypeKeys "<MOD1 Home>"
189 Call wTypeKeys "<Shift Right>"
190 if fGetFieldContent() <> sResult(i) then
191 QaErrorLog i & "#i94596# - Should get " & sResult(i) & " but get " & fGetFieldContent()
193 Call wTypeKeys "<Down><Home>"
200 '-----------------------------------------------------------------
202 testcase tVariablesSetFormats
203 qaerrorlog "#i94596# - tVariablesSetFormats outcommented due to bug."
208 Dim iFormat() as Integer
209 Dim sResult() as String
217 iFormat = Array( 8, 10 , 52 , 55 , 56)
227 printlog "Set format as 'Additional formats...'"
228 '/// <b> Set format as 'Additional formats...' </b>
231 CALL GetLanguageText (01)
232 mUnit = fSetMeasurementToCM() ' Set measurement unit to cm
234 '/// Insert/Fields/Other/Variables / Select "set Variable" ,
235 '/// Set Name and Value(number) , then choose format as 'Additional formats...'
236 '/// In the number format dialog , select 'All' in Category
237 '/// + Select some different formats ...
238 Call fInsertFieldsOther("TabVariablen")
241 NameText.SetText sName
245 Zahlenformat.Select Zahlenformat.GetItemCount
247 Kontext "Zahlenformat"
248 Sprache.Select fGetLanguageName(01)
252 KategorieFormat.Select iFormat(i)
256 Kontext "TabVariablen"
258 Call wTypeKeys "<Shift Left>"
260 if fGetFieldContent() <> sResult(i) then
261 Warnlog i & ": Should get " & sResult(i) & " but get " & fGetFieldContent()
263 Kontext "TabVariablen"
271 '-----------------------------------------------------------------
273 testcase tVariablesShowVariable1
275 Dim sName() as String
276 Dim sResult() as String
292 printlog "Show Variable - 1"
293 '/// <b> Show Variable - 2</b>
297 '/// Insert/Fields/Other/Variables / Select "set Variable" ,
298 '/// Set Name and Value , then choose General , add 3 variables
299 '/// + then select Show Variable , insert 3 variables
300 Call fInsertFieldsOther("TabVariablen")
304 NameText.SetText sName(i)
305 Wert.SetText sResult(i)
306 Zahlenformat.Select 2
311 Call wTypeKeys "<Return>"
312 Kontext "TabVariablen"
321 '/// Check if the insertion is correct
322 Call wTypeKeys "<MOD1 Home>"
325 Call wTypeKeys "<Down><Home>"
326 Call wTypeKeys "<Shift Right>"
327 if fGetFieldContent() <> sResult(i) then
328 Warnlog "Should get " & sResult(i) & " but get " & fGetFieldContent()
332 '/// Delete the 1st line
333 Call wTypeKeys "<MOD1 Home><Shift End><Delete>"
335 Call wTypeKeys "<MOD1 Home>"
338 Call wTypeKeys "<Down><Home>"
339 Call wTypeKeys "<Shift Right>"
340 if fGetFieldContent() <> "0" then
341 Warnlog i & "Should get 0 but get " & fGetFieldContent()
349 '-----------------------------------------------------------------
351 testcase tVariablesShowVariable2
355 Dim sResult() as String
369 printlog "Show Variable - 2"
370 '/// <b> Show Variable - 2 </b>
374 '/// Insert/Fields/Other/Variables / Select "set Variable" ,
375 '/// Set Name and Value , then choose General , insert a variable
376 Call fInsertFieldsOther("TabVariablen")
380 NameText.SetText sName
382 Zahlenformat.Select 2
385 '/// Then select Show Variable , insert this variable
386 Call wTypeKeys "<Return>"
387 Kontext "TabVariablen"
393 '/// Insert a same name variable again , but set to another number
394 Call wTypeKeys "<Return>"
396 Kontext "TabVariablen"
399 NameText.SetText sName
401 Zahlenformat.Select 2
404 '/// Then select Show Variable , insert this variable again
405 Call wTypeKeys "<Return>"
406 Kontext "TabVariablen"
413 '/// Check if the insertion is correct
414 Call wTypeKeys "<F9><MOD1 Home>"
417 Call wTypeKeys "<Shift Right>"
418 if fGetFieldContent() <> sResult(i) then
419 Warnlog i & "Should get " & sResult(i) & " but get " & fGetFieldContent()
421 Call wTypeKeys "<Down><Home>"
428 '-----------------------------------------------------------------
430 testcase tVariablesInsertFormula
432 Dim sName() as String
433 Dim sValue() as String
434 Dim sResult as String
449 printlog "Insert formula"
450 '/// <b> Insert formula </b>
454 '/// Insert/Fields/Other/Variables / Select "set Variable" , add 2 variables - A and B
455 Call fInsertFieldsOther("TabVariablen")
459 NameText.SetText sName(i)
460 Wert.SetText sValue(i)
461 Zahlenformat.Select 2
466 '/// Then select 'Insert formula' , A+B
467 Call wTypeKeys "<Return>"
468 Kontext "TabVariablen"
470 Wert.SetText (sName(0) & "+" & sName(1))
474 Call wTypeKeys "<Shift Left>"
475 if fGetFieldContent() <> sResult then
476 Warnlog "Should get " & sResult & " but get " & fGetFieldContent()
483 '-----------------------------------------------------------------
485 testcase tVariablesNumberRange
487 Dim sResult() as String
491 printlog "Number range"
492 '/// <b> Number range </b>
496 Call wTypeKeys "<Return>"
498 '/// Insert/Fields/Other/Variables / Select "Number range" , insert 4 numbers for
499 '/// + Table , text , drawing and illustration
500 Call fInsertFieldsOther("TabVariablen")
506 Call wTypeKeys "<Return>"
507 Kontext "TabVariablen"
511 '/// Then insert Table , text , drawing and illustration separately
512 '/// + Check if the result is correct
513 Call wTypeKeys "<MOD1 Home>"
514 Kontext "TabVariablen"
522 Call wTypeKeys "<Home>"
523 sResult = Array("1" , "1" , "1" , "1" , "1")
526 Call wTypeKeys "<Shift Right>"
527 if fGetFieldContent() <> sResult(x) then
528 Warnlog "Should get " & sResult(x) & " but get " & fGetFieldContent()
530 Call wTypeKeys "<Down><Home>"
532 Call wTypeKeys "<MOD1 Home><Shift End><Delete>"
534 Kontext "TabVariablen"
542 '-----------------------------------------------------------------
544 testcase tVariablesInputfield
548 Dim sReference as String
549 Dim sFieldContent as String
551 sName = "myTest" : sValue = "100"
552 sReference = "NewTest"
553 sFieldContent = "10000"
555 printlog "Input field"
556 '/// <b> Input field </b>
560 '/// Insert/Fields/Other/Variables / Select "set Variable" , add 1 variable - A
561 Call fInsertFieldsOther("TabVariablen")
564 NameText.SetText sName
566 Zahlenformat.Select 2
568 Call wTypeKeys "<Return>"
571 '/// Select "Input field" , set reference , press insert ,
572 '/// + a dialog should pop up , insert field content
573 '/// + Table , text , drawing and illustration
574 Kontext "TabVariablen"
576 Wert.SetText sReference
578 Kontext "Eingabefeld"
579 if Titel.GetText <> sReference then
580 Warnlog "Reference should be " & sReference & " but get " & Titel.GetText
582 EingabeText.SetText sFieldContent
585 Kontext "TabVariablen"
588 '/// Check if the insertion is correct
589 Call wTypeKeys "<MOD1 Home>"
590 Call wTypeKeys "<Shift Right>"
591 if fGetFieldContent() <> sValue then
592 Warnlog "Should get " & sValue & " but get " & fGetFieldContent()
595 Call wTypeKeys "<Down><Home>"
596 Call wTypeKeys "<Shift Right>"
597 if fGetFieldContent() <> sFieldContent then
598 Warnlog "Should get " & sFieldContent & " but get " & fGetFieldContent()
601 '/// Delete variable A in the document , Check if the insertion is still correct
602 Call wTypeKeys "<MOD1 Home>"
603 Call wTypeKeys "<Shift Right><Delete>"
605 Call wTypeKeys "<Down><Home>"
606 Call wTypeKeys "<Shift Right>"
607 if fGetFieldContent() <> sFieldContent then
608 Warnlog "2-Should get " & sFieldContent & " but get " & fGetFieldContent()
615 '-----------------------------------------------------------------
617 testcase tVariablesUserfield
619 Dim sName() as String
620 Dim sValue() as String
621 Dim sResult1() as String
622 Dim sResult2() as String
626 sName = Array("U1" , "UserField" , "U2")
627 sValue = Array("UserField - 10" , "100" , "UserField + 10")
628 sResult1 = Array("-10" , "100" , "110")
629 sResult2 = Array("90" , "100" , "110")
632 printlog "User field"
633 '/// <b> User field </b>
637 '/// Insert/Fields/Other/Variables / Select "User Field"
638 Call fInsertFieldsOther("TabVariablen")
642 NameText.SetText sName(i)
643 Wert.SetText sValue(i)
644 Zahlenformat.Select 3
647 Call wTypeKeys "<Shift Left>"
648 if fGetFieldContent() <> sResult1(i) then
649 Warnlog "Should get " & sResult1(i) & " but get " & fGetFieldContent()
651 Call wTypeKeys "<End><Return>"
653 Kontext "TabVariablen"
657 '/// Check if the result is OK.
658 Call wTypeKeys "<F9>"
659 Call wTypeKeys "<MOD1 Home>"
662 Call wTypeKeys "<Shift Right>"
663 if fGetFieldContent() <> sResult2(i) then
664 Warnlog "Should get " & sResult2(i) & " but get " & fGetFieldContent()
666 Call wTypeKeys "<Down><Left>"
673 '-----------------------------------------------------------------
675 testcase tVariablesDDEFieldManual
676 qaerrorlog "#i93906# - tVariablesDDEFieldManual outcommented due to a problem with copying field-contents outside the office."
679 Dim sDDEFile as String
680 Dim sContent as String
682 Dim sDDEStatement as String
683 Dim sSectionName as String
685 sDDEFile = Convertpath ( gNetzOfficePath + "dde_test.oxt")
688 sSectionName = "Section1"
689 sDDEStatement = "soffice " & sDDEFile & " " & sSectionName
691 printlog "DDE field - manual"
692 '/// <b> DDE field - manual </b>
694 if hFileExists ( sDDEFile ) then app.kill ( sDDEFile )
698 '/// Input something , insert a section , then save it and close the file
699 Call wTypeKeys sContent
700 Call wTypeKeys "<Shift Home>"
701 Call fInsertSection("TabBereiche")
702 Bereichsliste.Settext sSectionName
705 Call hFileSaveAsKill(sDDEFile)
708 '/// Opan a new document
711 '/// Insert/Fields/Other/Variables / Select "DDE Field"
712 '/// Set DDE name and DDE statement , select "DDE manual"
713 Call fInsertFieldsOther("TabVariablen")
716 NameText.SetText sName
717 Wert.SetText sDDEStatement
724 Call wTypeKeys "<MOD1 Home>"
725 Call wTypeKeys "<Shift End>"
726 if fGetFieldContent() <> sContent then
727 Warnlog "Should get " & sContent & " but get " & fGetFieldContent()
730 '/// Open the test file which you just closed , add something ,
732 Call hFileOpen(sDDEFile)
733 Call wTypeKeys "<MOD1 Home>"
738 '/// Check if the content is changed -- Should NOT
740 Call wTypeKeys "<F9>"
741 Call wTypeKeys "<MOD1 Home><Shift End>"
742 if fGetFieldContent() <> sContent then
743 Warnlog "Should get " & sContent & " but get " & fGetFieldContent()
746 '/// Edit/Fields , press update button
748 Kontext "VerknuepfungenBearbeiten"
750 VerknuepfungenBearbeiten.Close
752 '/// Check if the content is changed -- Should NOT
754 Call wTypeKeys "<F9>"
755 Call wTypeKeys "<MOD1 Home><Shift End>"
756 if fGetFieldContent() <> ("XYZ" & sContent) then
757 Warnlog "Should get XYZ" & sContent & " but get " & fGetFieldContent()
762 if hFileExists ( sDDEFile ) then app.kill ( sDDEFile )
766 '-----------------------------------------------------------------
768 testcase tVariablesDDEFieldAutomatic
769 qaerrorlog "#i102792# - tVariablesDDEFieldAutomatic outcommented. Fields not updated."
772 Dim sDDEFile as String
773 Dim sContent as String
775 Dim sDDEStatement as String
776 Dim sSectionName as String
778 sDDEFile = Convertpath ( gNetzOfficePath + "dde_test.oxt")
781 sSectionName = "Section1"
782 sDDEStatement = "soffice " & sDDEFile & " " & sSectionName
784 printlog "DDE field - automatic"
785 '/// <b> DDE field - automatic </b>
787 if hFileExists ( sDDEFile ) then app.kill ( sDDEFile )
791 '/// Input something , insert a section , then save it and close the file
792 Call wTypeKeys sContent
793 Call wTypeKeys "<Shift Home>"
794 Call fInsertSection("TabBereiche")
795 Bereichsliste.Settext sSectionName
798 Call hFileSaveAsKill(sDDEFile)
801 '/// Opan a new document
804 '/// Insert/Fields/Other/Variables / Select "DDE Field"
805 '/// Set DDE name and DDE statement , select "DDE automatic"
806 Call fInsertFieldsOther("TabVariablen")
809 NameText.SetText sName
810 Wert.SetText sDDEStatement
817 Call wTypeKeys "<MOD1 Home>"
818 Call wTypeKeys "<Shift End>"
819 if fGetFieldContent() <> sContent then
820 Warnlog "Should get " & sContent & " but get " & fGetFieldContent()
823 '/// Open the test file which you just closed , add something ,
825 Call hFileOpen(sDDEFile)
826 Call wTypeKeys "<MOD1 Home>"
831 '/// Check if the content is changed -- Should
833 Call wTypeKeys "<F9>"
834 Call wTypeKeys "<MOD1 Home><Shift End>"
835 if fGetFieldContent() <> ("XYZ" & sContent) then
836 Warnlog "Should get XYZ" & sContent & " but get " & fGetFieldContent()
841 if hFileExists ( sDDEFile ) then app.kill ( sDDEFile )
845 '-----------------------------------------------------------------