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_fields3.inc,v $
13 '* last change: $Author: vg $ $Date: 2008-08-18 12:26:51 $
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 - References Test
38 '\***********************************************************************
43 Call tSetReferenceNoSelection
44 Call tSetReferenceTextSelection
45 Call tInsertReferencePage
46 Call tInsertReferenceChapter
47 Call tInsertReferenceReference
48 Call tInsertReferenceAboveBelow
49 Call tInsertReferenceAsPageStyle
52 Call tInsertCaptionAbove
53 Call tInsertCaptionBelow
54 Call tInsertBookmarkPage
55 Call tInsertBookmarkChapter
56 Call tInsertBookmarkReference
57 Call tInsertBookmarkAboveBelow
58 Call tInsertBookmarkAsPageStyle
62 '-----------------------------------------------------------------
64 testcase tCrossReference
66 printlog "Insert/Cross-reference"
67 '/// <b> Insert/Cross-reference </b>
69 '/// Open a new document
72 '/// Insert/Cross-reference
75 Kontext "TabReferenzen"
76 if TabReferenzen.Exists then
79 Warnlog "Tabpage References should be as the actived tabpage!"
82 '/// Close the document
87 '-----------------------------------------------------------------
89 testcase tSetReferenceNoSelection
91 Dim sReference as String
92 Dim sTestFile as String
95 sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\fields\pageTest.sxw")
97 printlog "Set Reference - Cursor at any position"
98 '/// <b> Set Reference - Cursor at any position </b>
102 '/// Open test file pageTest.sxw
103 Call hFileOpen(sTestFile)
104 Call sMakeReadOnlyDocumentEditable
106 '/// Set curson to the 2nd page
107 Call wTypeKeys "<MOD1 Home>"
108 Call fFindWord ("Sec")
109 Call wTypeKeys "<End><Return>"
111 '/// Insert/Cross-reference , choose "Set Reference"
113 Kontext "TabReferenzen"
116 Namefeld.SetText sReference
121 Kontext "TabReferenzen"
124 if Namefeld.GetText <> sReference then
125 Warnlog "Reference can't be set correctly!"
129 '/// Close the document
134 '-----------------------------------------------------------------
136 testcase tSetReferenceTextSelection
138 Dim sReference as String
140 sReference = "myTest"
142 printlog "Set Reference - Select some text"
143 '/// <b> Set Reference - Select some text </b>
145 '/// Open a new document
148 '/// Input some text and select them
149 Call wTypeKeys "ABCD"
150 Call wTypeKeys "<Shift Home>"
152 '/// Insert/Cross-reference , choose "Set Reference"
154 Kontext "TabReferenzen"
157 Namefeld.SetText sReference
162 Kontext "TabReferenzen"
165 if Namefeld.GetText <> sReference then
166 Warnlog "Reference can't be set correctly!"
170 '/// Close the document
175 '-----------------------------------------------------------------
177 testcase tInsertReferencePage
179 Dim sReference as String
180 Dim sTestFile as String
182 sReference = "myTest"
183 sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\fields\pageTest.sxw")
185 printlog "Insert Reference - Page"
186 '/// <b> Insert Reference - Page </b>
190 '/// Open test file pageTest.sxw
191 Call hFileOpen(sTestFile)
192 Call sMakeReadOnlyDocumentEditable
194 '/// Set curson to the 2nd page
195 Call wTypeKeys "<MOD1 Home>"
196 Call fFindWord ("Sec")
197 Call wTypeKeys "<End><Return>"
199 '/// Insert/Cross-reference , choose "Set Reference"
201 Kontext "TabReferenzen"
204 Namefeld.SetText sReference
208 Call wTypeKeys "<Return>" , 2
210 '/// Insert/Cross-reference , choose "Insert Reference" and "Page"
212 Kontext "TabReferenzen"
215 Auswahl.Select sReference
222 Call wTypeKeys "<F9>"
224 Call wTypeKeys "<Shift Home>"
226 if fGetFieldContent( ) <> "2" then
227 Warnlog "Should get 2 , but get " & fGetFieldContent()
230 '/// Close the document
235 '-----------------------------------------------------------------
237 testcase tInsertReferenceChapter
239 Dim sReference as String
240 Dim sTestFile as String
242 sReference = "myTest"
243 sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\fields\chapterTest.sxw")
245 printlog "Insert Reference - Chapter"
246 '/// <b> Insert Reference - Chapter </b>
250 '/// Open test file chapterTest.sxw
251 Call hFileOpen(sTestFile)
252 Call sMakeReadOnlyDocumentEditable
254 '/// Set curson to the 2nd line
255 Call wTypeKeys "<MOD1 Home>"
256 Call wTypeKeys "<Down><Home>"
258 '/// Insert/Cross-reference , choose "Set Reference"
260 Kontext "TabReferenzen"
263 Namefeld.SetText sReference
267 Call wTypeKeys "<End>"
268 Call wTypeKeys "<Return>" , 2
270 '/// Insert/Cross-reference , choose "Insert Reference" and "Chapter"
272 Kontext "TabReferenzen"
275 Auswahl.Select sReference
282 Call wTypeKeys "<F9>"
284 Call wTypeKeys "<Shift Home>"
286 if fGetFieldContent( ) <> "2" then
287 Warnlog "#i40625# Should get 2 , but get " & fGetFieldContent()
290 '/// Close the document
295 '-----------------------------------------------------------------
297 testcase tInsertReferenceReference
299 Dim sReference as String
300 Dim sReferenceName as String
303 sReferenceName = "myTest"
305 printlog "Insert Reference - Reference"
306 '/// <b> Insert Reference - Reference</b>
308 '/// Open a new document
311 '/// Input some thing in the document and press return
312 Call wTypeKeys "This is a test !"
313 Call wTypeKeys "<Return>"
315 '/// Select some text
316 Call wTypeKeys "<Up><End>"
317 Call wTypeKeys "<Shift Left>" , 5
319 '/// Insert/Cross-reference , choose "Set Reference"
321 Kontext "TabReferenzen"
324 Namefeld.SetText sReferenceName
328 '/// set focus to 2nd line
329 Call wTypeKeys "<Down>"
331 '/// Insert/Cross-reference , choose "Insert Reference" and "Reference"
333 Kontext "TabReferenzen"
336 Auswahl.Select sReferenceName
343 Call wTypeKeys "<F9>"
345 Call wTypeKeys "<Shift Home>"
347 if fGetFieldContent() <> sReference then
348 Warnlog "Should get " & sReference & " but get " & fGetFieldContent()
351 '/// Close the document
356 '-----------------------------------------------------------------
358 testcase tInsertReferenceAboveBelow
360 Dim sReference as String
364 sReference = "myTest"
365 Select Case iSystemSprache
366 Case 01 : sAbove = "above" : sBelow = "below"
367 Case 35 : sAbove = "sur" : sBelow = "sous"
368 Case 39 : sAbove = "sopra" : sBelow = "sotto"
369 Case 49 : sAbove = "oben" : sBelow = "unten"
370 Case 46 : sAbove = "ovan" : sBelow = "under"
371 Case 55 : sAbove = "arriba" : sBelow = "abajo"
374 printlog "Insert Reference - Above/Below"
375 '/// <b> Insert Reference - Above/Below</b>
377 '/// Open a new document
380 '/// Press Return first , then input some text in
381 '/// + the document , press return again
382 Call wTypeKeys "<Return>"
383 Call wTypeKeys "This is a test !"
384 Call wTypeKeys "<Return>"
386 '/// Insert a reference before "This is ..."
387 Call wTypeKeys "<Up><Home>"
389 Kontext "TabReferenzen"
392 Namefeld.SetText sReference
396 '/// set focus to 3rd line
397 Call wTypeKeys "<Down>"
399 '/// Insert/Cross-reference , choose "Insert Reference" and "above/below"
401 Kontext "TabReferenzen"
404 Auswahl.Select sReference
411 Call wTypeKeys "<F9>"
413 Call wTypeKeys "<Shift Home>"
415 if fGetFieldContent() <> sAbove then 'Check systemlanguage / Office-Language - if other than 01 then ignore/QaErrorLog!
416 Warnlog "Should get " & sAbove & " but get " & fGetFieldContent()
419 '/// set focus to 1st line
420 Call wTypeKeys "<MOD1 Home>"
422 '/// Insert/Cross-reference , choose "Insert Reference" and "above/below"
424 Kontext "TabReferenzen"
427 Auswahl.Select sReference
434 Call wTypeKeys "<F9>"
436 Call wTypeKeys "<Shift Home>"
438 if fGetFieldContent() <> sBelow then
439 Warnlog "Should get " & sBelow & " but get " & fGetFieldContent()
442 '/// Close the document
447 '-----------------------------------------------------------------
449 testcase tInsertReferenceAsPageStyle
451 Dim sReference as String
452 Dim sTestSytle as String
454 sReference = "myTest"
457 printlog "Insert Reference - As Page Style"
458 '/// <b> Insert Reference - As Page Style </b>
460 '/// Open a new document
463 '/// Fomrat/page / page , set Format as "A , B , C ..."
464 Call fFormatPageWriter("TabSeite")
468 '/// Input some thing in the document , press return
469 Call wTypeKeys "This is a test !"
470 Call wTypeKeys "<Return>"
472 '/// Insert a reference before "This is ..."
473 Call wTypeKeys "<Up><Home>"
475 Kontext "TabReferenzen"
478 Namefeld.SetText sReference
482 '/// set focus to 2nd line
483 Call wTypeKeys "<Down>"
485 '/// Insert/Cross-reference , choose "Insert Reference" and "As Page Style"
487 Kontext "TabReferenzen"
490 Auswahl.Select sReference
497 Call wTypeKeys "<F9>"
499 Call wTypeKeys "<Shift Home>"
501 if fGetFieldContent() <> sTestSytle then
502 Warnlog "Should get " & sTestSytle & " but get " & fGetFieldContent()
505 '/// Close the document
510 '-----------------------------------------------------------------
512 testcase tInsertFootnote
514 Dim sFootnote as String
518 printlog "Insert Footnote"
519 '/// <b> Insert Footnote </b>
521 '/// Open a new document
526 Kontext "FussnoteEinfuegen"
530 ZeichenText.SetText sFootnote
533 '/// Check if footnote is inserted correctly
534 Call wTypeKeys "<MOD1 Home>"
535 Call wTypeKeys "<Shift End>"
536 if fGetFieldContent() <> sFootnote then
537 Warnlog "Should get " & sFootnote & " but get " & fGetFieldContent()
544 '-----------------------------------------------------------------
546 testcase tInsertEndnote
548 Dim sEndnote as String
552 printlog "Insert Endnote"
553 '/// <b> Insert Endnote </b>
555 '/// Open a new document
560 Kontext "FussnoteEinfuegen"
564 ZeichenText.SetText sEndnote
567 '/// Check if footnote is inserted correctly
568 Call wTypeKeys "<MOD1 Home>"
569 Call wTypeKeys "<Shift End>"
570 if fGetFieldContent() <> sEndnote then
571 Warnlog "Should get " & sEndnote & " but get " & fGetFieldContent()
578 '-----------------------------------------------------------------
580 testcase tInsertCaptionAbove
582 Dim sCategory as String
583 Dim sCaption as String
584 Dim sSeparator as String
586 sCategory = "A" : sCaption = "B" : sSeparator = "*"
588 printlog "Insert Caption - Above"
589 '/// <b> Insert Caption - Above </b>
591 '/// Open a new document
597 '/// Insert / Caption , set Category as A , set Caption as B , Set Seperator as *
599 Kontext "Beschriftung"
600 Kategorie.SetText sCategory
601 Separator.SetText sSeparator
602 BeschriftungsText.SetText sCaption
607 '/// Check if the insertion is correct
608 Call wTypeKeys "<Return>"
609 Call wTypeKeys "<Up><Home><Shift End>"
612 if fGetFieldContent() <> sCategory & " 1" & sSeparator & sCaption then
613 Warnlog "Should get " & sCategory & " 1" & sSeparator & sCaption & " but get " & fGetFieldContent()
616 Call wTypeKeys "<Down>"
617 Call wTypeKeys "<Home><Shift End>"
620 Warnlog "Should NOT get anything !"
628 '-----------------------------------------------------------------
630 testcase tInsertCaptionBelow
632 Dim sCategory as String
633 Dim sCaption as String
634 Dim sSeparator as String
636 sCategory = "A" : sCaption = "B" : sSeparator = "*"
638 printlog "Insert Caption - Below"
639 '/// <b> Insert Caption - Below </b>
641 '/// Open a new document
647 '/// Insert / Caption , set Category as A , set Caption as B,
648 '/// + select position as Above
650 Kontext "Beschriftung"
651 Kategorie.SetText sCategory
652 Separator.SetText sSeparator
653 BeschriftungsText.SetText sCaption
658 '/// Check if the insertion is correct
659 Call wTypeKeys "<Return>"
660 Call wTypeKeys "<Up><Home><Shift End>"
663 Warnlog "Should NOT get anything !"
667 Call wTypeKeys "<Down>"
668 Call wTypeKeys "<Home><Shift End>"
670 if fGetFieldContent() <> sCategory & " 1" & sSeparator & sCaption then
671 Warnlog "Should get " & sCategory & " 1" & sSeparator & sCaption & " but get " & fGetFieldContent()
678 '-----------------------------------------------------------------
680 testcase tInsertBookmarkPage
682 Dim sBookmark as String
683 Dim sTestFile as String
686 sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\fields\pageTest.sxw")
688 printlog "Insert Bookmark - Page"
689 '/// <b> Insert Bookmark - Page </b>
693 '/// Open test file pageTest.sxw
694 Call hFileOpen(sTestFile)
695 Call sMakeReadOnlyDocumentEditable
697 '/// Set curson to the 2nd page
698 Call wTypeKeys "<MOD1 Home>"
699 Call fFindWord ("Sec")
700 Call wTypeKeys "<Home>"
702 '/// Insert a bookmark
704 Kontext "TextmarkeEinfuegen"
705 Textmarken.SetText sBookmark
706 TextmarkeEinfuegen.OK
708 Call wTypeKeys "<End>"
709 Call wTypeKeys "<Return>" , 2
711 '/// Insert/Cross-reference , choose "Bookmarks" and "Page"
713 Kontext "TabReferenzen"
716 Auswahl.Select sBookmark
723 Call wTypeKeys "<F9>"
725 Call wTypeKeys "<Shift Home>"
727 if fGetFieldContent( ) <> "2" then
728 Warnlog "Should get 2 , but get " & fGetFieldContent()
731 '/// Close the document
736 '-----------------------------------------------------------------
738 testcase tInsertBookmarkChapter
740 Dim sBookmark as String
741 Dim sTestFile as String
744 sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\fields\chapterTest.sxw")
746 printlog "Insert Bookmark - Chapter"
747 '/// <b> Insert Bookmark - Chapter </b>
751 '/// Open test file chapterTest.sxw
752 Call hFileOpen(sTestFile)
753 Call sMakeReadOnlyDocumentEditable
755 '/// Set curson to the 2nd line
756 Call wTypeKeys "<MOD1 Home>"
757 Call wTypeKeys "<Down><Home>"
759 '/// Insert a bookmark
761 Kontext "TextmarkeEinfuegen"
762 Textmarken.SetText sBookmark
763 TextmarkeEinfuegen.OK
765 Call wTypeKeys "<End>"
766 Call wTypeKeys "<Return>" , 2
768 '/// Insert/Cross-reference , choose "Bookmarks" and "Chapter"
770 Kontext "TabReferenzen"
773 Auswahl.Select sBookmark
780 Call wTypeKeys "<F9>"
782 Call wTypeKeys "<Shift Home>"
784 if fGetFieldContent( ) <> "2" then
785 Warnlog "#i40625# Should get 2 , but get " & fGetFieldContent()
788 '/// Close the document
793 '-----------------------------------------------------------------
795 testcase tInsertBookmarkReference
797 Dim sReference as String
798 Dim sBookmark as String
803 printlog "Insert Bookmkar - Reference"
804 '/// <b> Insert Bookmkar - Reference</b>
806 '/// Open a new document
809 '/// Input some thing in the document and press return
810 Call wTypeKeys "This is a test !"
811 Call wTypeKeys "<Return>"
813 '/// Select some text
814 Call wTypeKeys "<Up><End>"
815 Call wTypeKeys "<Shift Left>" , 5
817 '/// Insert a bookmark
819 Kontext "TextmarkeEinfuegen"
820 Textmarken.SetText sBookmark
821 TextmarkeEinfuegen.OK
823 '/// set focus to 2nd line
824 Call wTypeKeys "<Down>"
826 '/// Insert/Cross-reference , choose "Bookmark" and "Reference"
828 Kontext "TabReferenzen"
831 Auswahl.Select sBookmark
838 Call wTypeKeys "<F9>"
840 Call wTypeKeys "<Shift Home>"
842 if fGetFieldContent() <> sReference then
843 Warnlog "Should get " & sReference & " but get " & fGetFieldContent()
846 '/// Close the document
851 '-----------------------------------------------------------------
853 testcase tInsertBookmarkAboveBelow
855 Dim sBookmark as String
860 Select Case iSystemSprache
861 Case 01 : sAbove = "above" : sBelow = "below"
862 Case 35 : sAbove = "sur" : sBelow = "sous"
863 Case 39 : sAbove = "sopra" : sBelow = "sotto"
864 Case 49 : sAbove = "oben" : sBelow = "unten"
865 Case 46 : sAbove = "ovan" : sBelow = "under"
866 Case 55 : sAbove = "arriba" : sBelow = "abajo"
869 printlog "Insert Bookmark - Above/Below"
870 '/// <b> Insert Bookmark - Above/Below</b>
872 '/// Open a new document
875 '/// Press Return first , then input some thing in
876 '/// + the document , press return again
877 Call wTypeKeys "<Return>"
878 Call wTypeKeys "This is a test !"
879 Call wTypeKeys "<Return>"
881 '/// Insert a Bookmark before "This is ..."
882 Call wTypeKeys "<Up><Home>"
884 Kontext "TextmarkeEinfuegen"
885 Textmarken.SetText sBookmark
886 TextmarkeEinfuegen.OK
888 '/// set focus to 3rd line
889 Call wTypeKeys "<Down>"
891 '/// Insert/Cross-reference , choose "Bookmarks" and "above/below"
893 Kontext "TabReferenzen"
896 Auswahl.Select sBookmark
903 Call wTypeKeys "<F9>"
905 Call wTypeKeys "<Shift Home>"
907 if fGetFieldContent() <> sAbove then
908 Warnlog "Should get " & sAbove & " but get " & fGetFieldContent()
911 '/// set focus to 1st line
912 Call wTypeKeys "<MOD1 Home>"
914 '/// Insert/Cross-reference , choose "Bookmark" and "above/below"
916 Kontext "TabReferenzen"
919 Auswahl.Select sBookmark
926 Call wTypeKeys "<F9>"
928 Call wTypeKeys "<Shift Home>"
930 if fGetFieldContent() <> sBelow then
931 Warnlog "Should get " & sBelow & " but get " & fGetFieldContent()
934 '/// Close the document
939 '-----------------------------------------------------------------
941 testcase tInsertBookmarkAsPageStyle
943 Dim sBookmark as String
944 Dim sTestSytle as String
949 printlog "Insert Bookmark - As Page Style"
950 '/// <b> Insert Bookmark - As Page Style </b>
952 '/// Open a new document
955 '/// Fomrat/page / page , set Format as "A , B , C ..."
956 Call fFormatPageWriter("TabSeite")
960 '/// Input some thing in the document , press return
961 Call wTypeKeys "This is a test !"
962 Call wTypeKeys "<Return>"
964 '/// Insert a Bookmark before "This is ..."
965 Call wTypeKeys "<Up><Home>"
967 Kontext "TextmarkeEinfuegen"
968 Textmarken.SetText sBookmark
969 TextmarkeEinfuegen.OK
971 '/// set focus to 2nd line
972 Call wTypeKeys "<Down>"
974 '/// Insert/Cross-reference , choose "Bookmark" and "As Page Style"
976 Kontext "TabReferenzen"
979 Auswahl.Select sBookmark
986 Call wTypeKeys "<F9>"
988 Call wTypeKeys "<Shift Home>"
990 if fGetFieldContent() <> sTestSytle then
991 Warnlog "Should get " & sTestSytle & " but get " & fGetFieldContent()
994 '/// Close the document
999 '-----------------------------------------------------------------