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_fields6.inc,v $
13 '* last change: $Author: vg $ $Date: 2008-08-18 12:27:26 $
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 - Functions
38 '\***********************************************************************
42 Call tFunctionsConditionalText
43 Call tFunctionsHiddenText
44 Call tFunctionsHiddenParagraph
45 Call tFunctionsInputField
46 Call tFunctionsPlaceholderText
47 Call tFunctionsPlaceholderTable
48 Call tFunctionsPlaceholderFrame
49 Call tFunctionsPlaceholderGraphics
50 Call tFunctionsPlaceholderObject
51 Call tFunctionsInputlistRemove
52 Call tFunctionsInputlistMoveUp
53 Call tFunctionsInputlistMoveDown
54 Call tFunctionsCombineCharacter
58 '-----------------------------------------------------------------
60 testcase tFunctionsConditionalText
63 Dim sValue() as String
64 Dim sCondition as String
67 Dim sResult() as String
73 SCondition = "X==" + Chr(34) + "Sun" + Chr(34)
88 printlog "Conditional text"
89 '/// <b> Conditional text </b>
93 '/// Insert/Fields/Other/Variables / Select "set Variable" ,
94 '/// Set 1 Name and set its Value to "Sun" , then goto tabpage function
95 '/// + choose "Conditional text" , set condition like
96 '/// if X="Sun" then "YES" else "NO"
97 '/// Set another value to "NoSun"
100 Call fInsertFieldsOther("TabVariablen")
103 NameText.SetText sName
104 Wert.SetText sValue(i)
105 Zahlenformat.Select 1
108 Call wTypeKeys "<Return>"
109 Call fInsertFieldsOther("TabFunktionen")
112 Bedingung.SetText sCondition
117 Call wTypeKeys "<Return>"
120 '/// Check if the insertion is correct
121 Call wTypeKeys "<MOD1 Home>"
124 Call wTypeKeys "<Shift Right>"
125 if fGetFieldContent() <> sResult(i) then
126 Warnlog "Should get " & sResult(i) & " but get " & fGetFieldContent()
128 Call wTypeKeys "<Down><Home>"
135 '-----------------------------------------------------------------
137 testcase tFunctionsHiddenText
140 Dim sValue() as String
141 Dim sCondition as String
142 Dim sHiddenText as String
143 Dim sResult() as String
144 Dim bHiddenText as Boolean
149 SCondition = "X==" + Chr(34) + "ABC" + Chr(34)
150 sHiddenText = "HiddenText"
161 printlog "Hidden text"
162 '/// <b> Hidden text </b>
166 '/// Tools/Options / StarOffice writer / Formatting Aids
167 '/// Uncheck 'Fields : Hidden text"
169 Call hToolsOptions("WRITER","FORMATTINGAIDS")
170 bHiddenText = FeldVersteckterText.IsChecked
171 if bHiddenText = TRUE then
172 FeldVersteckterText.UnCheck
174 Kontext "ExtrasOptionenDlg"
177 '/// Insert/Fields/Other/Variables / Select "set Variable" ,
178 '/// Set Name and set its Value to "ABC" , then goto tabpage function
179 '/// + choose "hidden text" , set condition like
180 '/// if X="ABC" as condition , hidden text is "HiddenText"
181 '/// Set another value to "NoTABC"
182 '/// Check if the insertion is correct
185 Call wTypeKeys "<MOD1 Home><Shift End>"
186 Call fInsertFieldsOther("TabVariablen")
189 NameText.SetText sName
190 Wert.SetText sValue(i)
191 Zahlenformat.Select 1
194 Call wTypeKeys "<Return>"
195 Call fInsertFieldsOther("TabFunktionen")
196 Feldtyp.Select 7 'Hidden text
198 Bedingung.SetText sCondition
199 Hinweis.SetText sHiddenText
203 Call wTypeKeys "<Shift Left>"
204 if fGetFieldContent() <> sResult(i) then
205 Warnlog "Should get " & sResult(i) & " but get " & fGetFieldContent()
211 Call hToolsOptions("WRITER","FORMATTINGAIDS")
212 if bHiddenText = TRUE then FeldVersteckterText.Check
213 Kontext "ExtrasOptionenDlg"
220 '-----------------------------------------------------------------
222 testcase tFunctionsHiddenParagraph
225 Dim sValue() as String
226 Dim sCondition as String
227 Dim sHiddenText as String
228 Dim sResult() as String
229 Dim bHiddenText as Boolean
234 SCondition = "X==" + Chr(34) + "ABC" + Chr(34)
235 sHiddenText = "HiddenText"
246 printlog "Hidden paragraph"
247 '/// <b> Hidden paragraph </b>
251 '/// Tools/Options / StarOffice writer / Formatting Aids
252 '/// Uncheck 'Fields : Hidden paragraph"
254 Call hToolsOptions("WRITER","FORMATTINGAIDS")
255 bHiddenText = VersteckteAbsatze.IsChecked
256 if bHiddenText = TRUE then
257 VersteckteAbsatze.UnCheck
259 Kontext "ExtrasOptionenDlg"
262 '/// Input a paragraph first
263 Call wTypeKeys "<Return>"
264 Call wTypeKeys sHiddenText
265 Call wTypeKeys "<Up>"
267 '/// Insert/Fields/Other/Variables / Select "set Variable" ,
268 '/// Set Name and set its Value to "ABC" , then goto tabpage function
269 '/// + choose "hidden paragraph" , set condition like
270 '/// if X="ABC" as condition
271 '/// Check if the paragraph disappear or not
274 Call wTypeKeys "<MOD1 Home><Shift End>"
275 Call fInsertFieldsOther("TabVariablen")
278 NameText.SetText sName
279 Wert.SetText sValue(i)
280 Zahlenformat.Select 1
283 Call wTypeKeys "<Down><Home>"
284 Call fInsertFieldsOther("TabFunktionen")
285 Feldtyp.Select 8 'Hidden paragraph
287 Bedingung.SetText sCondition
291 Call wTypeKeys "<MOD1 Home><Down><Shift End>"
292 if fGetFieldContent() <> sResult(i) then
293 Warnlog "Should get " & sResult(i) & " but get " & fGetFieldContent()
299 Call hToolsOptions("WRITER","FORMATTINGAIDS")
300 if bHiddenText = TRUE then VersteckteAbsatze.Check
301 Kontext "ExtrasOptionenDlg"
308 '-----------------------------------------------------------------
310 testcase tFunctionsInputField
312 Dim sReference as String
313 Dim sFieldContent as String
315 sReference = "NewTest"
316 sFieldContent = "10000"
318 printlog "Input field"
319 '/// <b> Input field </b>
323 '/// Insert/Fields/Other/Functions / Select "Input field" ,
324 '/// + set reference , press insert button , input field content
325 Call fInsertFieldsOther("TabFunktionen")
326 Feldtyp.Select 3 'Input field
328 Hinweis.SetText sReference
330 Kontext "Eingabefeld"
331 if Titel.GetText <> sReference then
332 Warnlog "Reference should be " & sReference & " but get " & Titel.GetText
334 EingabeText.SetText sFieldContent
337 Kontext "TabFunktionen"
340 '/// Check if the insertion is correct
341 Call wTypeKeys "<MOD1 Home>"
342 Call wTypeKeys "<Shift Right>"
343 if fGetFieldContent() <> sFieldContent then
344 Warnlog "Should get " & sFieldContent & " but get " & fGetFieldContent()
351 '-----------------------------------------------------------------
353 testcase tFunctionsPlaceholderText
355 Dim sPlaceHolder as String
357 sPlaceHolder = "Text"
359 printlog "Placeholder - Text"
360 '/// <b> Placeholder - Text </b>
364 '/// Insert/Fields/Other/Functions / Select "Placeholder" ,
366 Call fInsertFieldsOther("TabFunktionen")
367 Feldtyp.Select 5 'Placeholder
370 Platzhalter.SetText sPlaceHolder
374 '/// Check if the insertion is correct
375 Call wTypeKeys "<MOD1 Home>"
376 Call wTypeKeys "<Shift Right>"
377 if fGetFieldContent() <> ("<" & sPlaceHolder & ">" )then
378 Warnlog "Should get <" & sPlaceHolder & "> but get " & fGetFieldContent()
385 '-----------------------------------------------------------------
387 testcase tFunctionsPlaceholderTable
389 printlog "Placeholder - Table"
390 '/// <b> Placeholder - Table </b>
394 Call fFormatPageWriter("TabSeite")
404 if Active.Exists then
405 if Active.GetRT = 304 then ' is it a messagebox ?
408 Warnlog "Messagebox is not up "
411 Warnlog "Something wrong !"
414 '/// Insert/Fields/Other/Functions / Select "Placeholder" ,
416 Call fInsertFieldsOther("TabFunktionen")
417 Feldtyp.Select 5 'Placeholder
420 Platzhalter.SetText "TableTableTableTableTable"
424 '/// Check if the insertion is correct
425 Call wTypeKeys "<MOD1 Home>"
426 Call wTypeKeys "<Shift Right>"
427 if fGetFieldContent() <> ("<TableTableTableTableTable>" )then
428 Warnlog "Should get <TableTableTableTableTable> but get " & fGetFieldContent()
432 Call wTypeKeys "<MOD1 Home>"
435 Call gMouseMove(0,0,30,25)
436 Call gMouseClick(30,25)
439 Kontext "TabelleEinfuegenWriter"
440 if TabelleEinfuegenWriter.Exists then
441 TabelleEinfuegenWriter.Cancel
443 Warnlog "Insert table dialog isn't up !"
450 '-----------------------------------------------------------------
452 testcase tFunctionsPlaceholderFrame
454 printlog "Placeholder - Frame"
455 '/// <b> Placeholder - Frame </b>
459 fFormatPageWriter("TabSeite")
468 if Active.Exists then
469 if Active.GetRT = 304 then ' is it a messagebox ?
472 Warnlog "Messagebox is not up "
475 Warnlog "Something wrong !"
478 '/// Insert/Fields/Other/Functions / Select "Placeholder" ,
480 Call fInsertFieldsOther("TabFunktionen")
481 Feldtyp.Select 5 'Placeholder
484 Platzhalter.SetText "FrameFrameFrameFrameFrameFrame"
488 '/// Check if the insertion is correct
489 Call wTypeKeys "<MOD1 Home>"
490 Call wTypeKeys "<Shift Right>"
491 if fGetFieldContent() <> ("<FrameFrameFrameFrameFrameFrame>" )then
492 Warnlog "Should get <FrameFrameFrameFrameFrameFrame> but get " & fGetFieldContent()
496 Call wTypeKeys "<MOD1 Home>"
498 Call gMouseMove(0,0,30,25)
499 Call gMouseClick(30,25)
504 Active.SetPage TabType
509 Warnlog "Format/Frame dialog isn't up !"
516 '-----------------------------------------------------------------
518 testcase tFunctionsPlaceholderGraphics
520 printlog "Placeholder - Graphics"
521 '/// <b> Placeholder - Graphics </b>
525 fFormatPageWriter("TabSeite")
535 if Active.Exists then
536 if Active.GetRT = 304 then ' is it a messagebox ?
539 Warnlog "Messagebox is not up "
542 Warnlog "Something wrong !"
545 '/// Insert/Fields/Other/Functions / Select "Placeholder" ,
546 '/// + select Graphics
547 Call fInsertFieldsOther("TabFunktionen")
548 Feldtyp.Select 5 'Placeholder
551 Platzhalter.SetText "GraphicsGraphicsGraphicsGraphicsGraphics"
555 '/// Check if the insertion is correct
556 Call wTypeKeys "<MOD1 Home>"
557 Call wTypeKeys "<Shift Right>"
558 if fGetFieldContent() <> ("<GraphicsGraphicsGraphicsGraphicsGraphics>" )then
559 Warnlog "Should get <GraphicsGraphicsGraphicsGraphicsGraphics> but get " & fGetFieldContent()
563 Call wTypeKeys "<MOD1 Home>"
565 Call gMouseMove(0,0,30,25)
566 Call gMouseClick(30,25)
570 Kontext "GrafikEinfuegenDlg"
572 GrafikEinfuegenDlg.Cancel
574 Warnlog "Insert picture dialog isn't up !"
581 '-----------------------------------------------------------------
583 testcase tFunctionsPlaceholderObject
585 printlog "Placeholder - Object"
586 '/// <b> Placeholder - Object </b>
590 fFormatPageWriter("TabSeite")
599 if Active.Exists then
600 if Active.GetRT = 304 then ' is it a messagebox ?
603 Warnlog "Messagebox is not up "
606 Warnlog "Something wrong !"
609 '/// Insert/Fields/Other/Functions / Select "Placeholder" ,
611 Call fInsertFieldsOther("TabFunktionen")
612 Feldtyp.Select 5 'Placeholder
615 Platzhalter.SetText "ObjectObjectObjectObjectObjectObject"
619 '/// Check if the insertion is correct
620 Call wTypeKeys "<MOD1 Home>"
621 Call wTypeKeys "<Shift Right>"
622 if fGetFieldContent() <> ("<ObjectObjectObjectObjectObjectObject>" )then
623 Warnlog "Should get <ObjectObjectObjectObjectObjectObject> but get " & fGetFieldContent()
627 Call wTypeKeys "<MOD1 Home>"
629 Call gMouseMove(0,0,30,25)
630 Call gMouseClick(30,25)
634 Kontext "OLEObjektEinfuegen"
636 OLEObjektEinfuegen.Cancel
638 Warnlog "Insert OLE Object dialog isn't up !"
645 '-----------------------------------------------------------------
647 testcase tFunctionsInputlistRemove
652 sItem1 = "First" : sItem2 = "Second"
654 printlog "Input list - Remove"
655 '/// <b> Input list Remove</b>
659 '/// Insert/Fields/Other/Functions / Select "Input list" ,
660 '/// + insert 2 itmes , remove 1st one
661 Call fInsertFieldsOther("TabFunktionen")
662 Feldtyp.Select 2 'Input list
664 NewListEntry.SetText sItem1
666 NewListEntry.SetText sItem2
670 Call wTypeKeys "<Return>"
671 Kontext "TabFunktionen"
677 '/// Check if the insertion is correct
678 Call wTypeKeys "<MOD1 Home>"
679 Call wTypeKeys "<Shift Right>"
680 if fGetFieldContent() <> sItem1 then
681 Warnlog "Should get " & sItem1 & " but get " & fGetFieldContent()
683 Call wTypeKeys "<Down><Home>"
684 Call wTypeKeys "<Shift Right>"
685 if fGetFieldContent() <> sItem2 then
686 Warnlog "Should get " & sItem2 & " but get " & fGetFieldContent()
693 '-----------------------------------------------------------------
695 testcase tFunctionsInputlistMoveUp
700 sItem1 = "First" : sItem2 = "Second"
702 printlog "Input list - Move up"
703 '/// <b> Input list Move up</b>
707 '/// Insert/Fields/Other/Functions / Select "Input list" ,
708 '/// + insert 2 itmes , press move up
709 Call fInsertFieldsOther("TabFunktionen")
710 Feldtyp.Select 2 'Input list
712 NewListEntry.SetText sItem1
714 NewListEntry.SetText sItem2
718 Call wTypeKeys "<Return>"
719 Kontext "TabFunktionen"
724 '/// Check if the insertion is correct
725 Call wTypeKeys "<MOD1 Home>"
726 Call wTypeKeys "<Shift Right>"
727 if fGetFieldContent() <> sItem1 then
728 Warnlog "Should get " & sItem1 & " but get " & fGetFieldContent()
730 Call wTypeKeys "<Down><Home>"
731 Call wTypeKeys "<Shift Right>"
732 if fGetFieldContent() <> sItem2 then
733 Warnlog "Should get " & sItem2 & " but get " & fGetFieldContent()
740 '-----------------------------------------------------------------
742 testcase tFunctionsInputlistMoveDown
747 sItem1 = "First" : sItem2 = "Second"
749 printlog "Input list - Move down"
750 '/// <b> Input list Move down</b>
754 '/// Insert/Fields/Other/Functions / Select "Input list" ,
755 '/// + insert 2 itmes , press move down
756 Call fInsertFieldsOther("TabFunktionen")
757 Feldtyp.Select 2 'Input list
759 NewListEntry.SetText sItem1
761 NewListEntry.SetText sItem2
765 Call wTypeKeys "<Return>"
766 Kontext "TabFunktionen"
772 '/// Check if the insertion is correct
773 Call wTypeKeys "<MOD1 Home>"
774 Call wTypeKeys "<Shift Right>"
775 if fGetFieldContent() <> sItem1 then
776 Warnlog "Should get " & sItem1 & " but get " & fGetFieldContent()
778 Call wTypeKeys "<Down><Home>"
779 Call wTypeKeys "<Shift Right>"
780 if fGetFieldContent() <> sItem2 then
781 Warnlog "Should get " & sItem2 & " but get " & fGetFieldContent()
788 '-----------------------------------------------------------------
790 testcase tFunctionsCombineCharacter
792 Dim sCombineCharacter as String
793 Dim sTestFile as String
795 sCombineCharacter = "ABC"
796 sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\fields\CombineTest.sxw")
798 printlog "Combine Character"
799 '/// <b> Combine Character </b>
803 '/// Open test file pageTest.sxw
804 Call hFileOpen(sTestFile)
805 Call sMakeReadOnlyDocumentEditable
806 Call wTypeKeys "<MOD1 Home>"
807 Call wTypeKeys "<Right>"
809 '/// Insert/Fields/Other/Functions / Select "Combine characters"
810 Call fInsertFieldsOther("TabFunktionen")
811 Feldtyp.Select 6 'Combine characters
813 Namefeld.SetText sCombineCharacter
817 '/// Check if the insertion is correct
818 Call wTypeKeys "<Shift Left>"
819 if fGetFieldContent() <> sCombineCharacter then
820 Warnlog "Should get " & sCombineCharacter & " but get " & fGetFieldContent()
823 Call wTypeKeys ( "<Shift F4>" )
826 Call fPositionAndSize("TabPositionAndSizeWriter")
827 if StrToDouble(Horizontalby.Gettext) < 6.5 OR StrToDouble(Horizontalby.Gettext) > 7.5 then
828 Warnlog "Something wrong in combine character"
830 TabPositionAndSizeWriter.Cancel
836 '-----------------------------------------------------------------