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_textframes5.inc,v $
13 '* last change: $Author: vg $ $Date: 2008-08-18 12:38:10 $
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 : Test of textframe - 5
38 '\***********************************************************************
42 Call tTextframes_71 'Test negative value in Horizontal and vertical
43 Call tTextframes_72 ''Vertical to' when anchor is inside frame
44 Call tTextframes_73 ''Vertical to' when anchor is inside document body
45 Call tTextframes_74 ''Vertical to' when anchor is inside table cell
46 Call tTextframes_75 ''Vertical to' when anchor is inside header
47 Call tTextframes_76 ''Vertical to' when anchor is inside footer
48 Call tTextframes_77 ''Vertical to' when anchor is inside Footnote
49 Call tTextframes_78 ''Vertical to' when anchor is inside endnote
50 Call tTextframes_80 'Line of text - Top
51 Call tTextframes_81 'Line of text - Bottom
52 Call tTextframes_82 'Line of text - Center
53 Call tTextframes_83 'Line of text - From Bottom (positive)
54 Call tTextframes_84 'Line of text - From Bottom (negative)
55 Call tTextframes_85 'Import from MS Word
59 '---------------------------------------------------
61 testcase tTextframes_71
63 Dim iVertical as Integer
64 Dim sVerticalBy as String
65 Dim iHorizontal as Integer
66 Dim sHorizontalBy as String
68 iHorizontal = 4 'From Left
69 sHorizontalBy = "-1"+ gSeperator + "00" + gMeasurementUnit
70 iVertical = 4 'From top
71 sVerticalBy = "-1"+ gSeperator + "50" + gMeasurementUnit
73 printlog "- Test negative value in Horizontal and vertical"
74 '/// Test negative value in Horizontal and vertical
79 '/// + Set Horizontal as "from top" ,
80 '/// + set Horizontal by to -1cm ,
81 '/// + set Vertical as "from Left" ,
82 '/// + set vertical by to -1.5cm
85 Active.Setpage TabType
87 Horizontal.Select iHorizontal
89 HorizontalBy.SetText sHorizontalBy
91 Vertical.Select iVertical
93 VerticalBy.SetText sVerticalBy
97 '/// Check if the configuration is effective
98 '/// Format/Frame / Type ,
99 Call fFormatFrame("TabType")
101 if fCalculateTolerance( HorizontalBy.GetText, sHorizontalBy ) > 0.2 then
102 Warnlog "Something wrong in Horizontal by !"
104 if fCalculateTolerance( VerticalBy.GetText, sVerticalBy ) > 0.2 then
105 Warnlog "Something wrong in Vertical by !"
113 '-----------------------------------------------------------------
115 testcase tTextframes_72
117 printlog "- 'Vertical to' when anchor is inside frame"
118 '/// 'Vertical to' when anchor is inside frame
122 '/// Open a test file , which includes 2 frames ,
123 '/// Frame A is anchored Frame B
124 Call hFileOpen(( Convertpath (gTesttoolpath + "writer\optional\input\textframe\frameInFrame.sxw") ),false)
125 Call sMakeReadOnlyDocumentEditable
127 'Set focus to Frame B
128 Call wTypeKeys ( "<Shift F4>" )
131 '/// Format/Frame / Type ,
132 '/// + Check if "Entire frame" and "Frame text area"
133 '/// + are in Vertical to area
134 Call fFormatFrame("TabType")
135 if HorizontalTo.GetSelIndex <> 3 then
136 Warnlog "Horizontal To should be 'Entire Frame' but get " & HorizontalTo.GetSelText
138 if VerticalTo.GetSelIndex <> 2 then
139 Warnlog "Vertical To should be 'Frame Text Area' but get " & VerticalTo.GetSelText
144 printlog " Close active document "
145 Do Until GetDocumentCount = 0
151 '-----------------------------------------------------------------
153 testcase tTextframes_73
155 printlog "- 'Vertical to' when anchor is inside document body"
156 '/// 'Vertical to' when anchor is inside document body
160 '/// Open a test file , which includes 1 frame in the document body
161 Call hFileOpen((Convertpath (gTesttoolpath + "writer\optional\input\textframe\frame.sxw")),false)
162 Call sMakeReadOnlyDocumentEditable
164 '/// Set focus to Frame
165 Call wTypeKeys ( "<Shift F4>" )
168 '/// Format/Frame / Type ,
169 '/// + Check if "Entire page" and "Page text area"
170 '/// + are in Vertical to area
171 Call fFormatFrame("TabType")
172 if HorizontalTo.GetSelIndex <> 7 then
173 Warnlog "Horizontal To should be 'Entire Page' but get " & HorizontalTo.GetSelText
175 if VerticalTo.GetSelIndex <> 4 then
176 Warnlog "Vertical To should be 'Page Text Area' but get " & VerticalTo.GetSelText
180 printlog " Close active document "
181 Do Until GetDocumentCount = 0
187 '-----------------------------------------------------------------
189 testcase tTextframes_74
191 printlog "- 'Vertical to' when anchor is inside table cell"
192 '/// 'Vertical to' when anchor is inside table cell
196 '/// Open a test file , which includes 1 frame in the document body
197 Call hFileOpen((Convertpath (gTesttoolpath + "writer\optional\input\textframe\frameInTable.sxw")),false)
198 Call sMakeReadOnlyDocumentEditable
200 '/// Set focus to Frame
201 Call wTypeKeys ( "<Shift F4>" )
203 '/// Format/Frame / Type ,
204 '/// + Check if "Entire page" and "Page text area"
205 '/// + are in Vertical to area
206 Call fFormatFrame("TabType")
207 if HorizontalTo.GetSelIndex <> 7 then
208 Warnlog "Horizontal To should be 'Entire Page' but get " & HorizontalTo.GetSelText
210 if VerticalTo.GetSelIndex <> 4 then
211 Warnlog "Vertical To should be 'Page Text Area' but get " & VerticalTo.GetSelText
215 printlog " Close active document "
216 Do Until GetDocumentCount = 0
222 '-----------------------------------------------------------------
224 testcase tTextframes_75
226 printlog "- 'Vertical to' when anchor is inside header"
227 '/// 'Vertical to' when anchor is inside header
231 '/// Open a test file , which includes 1 frame in the header
232 Call hFileOpen((Convertpath (gTesttoolpath + "writer\optional\input\textframe\Header.sxw")),false)
233 Call sMakeReadOnlyDocumentEditable
235 '/// Set focus to Frame
236 Call wTypeKeys ( "<Shift F4>" )
239 '/// Format/Frame / Type ,
240 '/// + Check if "Entire page" and "Page text area"
241 '/// + are in Vertical to area
242 Call fFormatFrame("TabType")
243 if HorizontalTo.GetSelIndex <> 7 then
244 Warnlog "Horizontal To should be 'Entire Page' but get " & HorizontalTo.GetSelText
246 if VerticalTo.GetSelIndex <> 4 then
247 Warnlog "Vertical To should be 'Page Text Area' but get " & VerticalTo.GetSelText
251 printlog " Close active document "
252 Do Until GetDocumentCount = 0
258 '-----------------------------------------------------------------
260 testcase tTextframes_76
262 printlog "- 'Vertical to' when anchor is inside footer"
263 '/// 'Vertical to' when anchor is inside footer
267 '/// Open a test file , which includes 1 frame in the footer
268 Call hFileOpen((gTesttoolpath + "writer\optional\input\textframe\Footer.sxw"),false)
269 Call sMakeReadOnlyDocumentEditable
271 '/// Set focus to Frame
272 Call wTypeKeys ( "<Shift F4>" )
275 '/// Format/Frame / Type ,
276 '/// + Check if "Entire page" and "Page text area"
277 '/// + are in Vertical to area
278 Call fFormatFrame("TabType")
279 if HorizontalTo.GetSelIndex <> 7 then
280 Warnlog "Horizontal To should be 'Entire Page' but get " & HorizontalTo.GetSelText
282 if VerticalTo.GetSelIndex <> 4 then
283 Warnlog "Vertical To should be 'Page Text Area' but get " & VerticalTo.GetSelText
287 printlog " Close active document "
288 Do Until GetDocumentCount = 0
294 '-----------------------------------------------------------------
296 testcase tTextframes_77
298 printlog "- 'Vertical to' when anchor is inside Footnote"
299 '/// 'Vertical to' when anchor is inside Footnote
303 '/// Open a test file , which includes 1 frame in the footnote
304 Call hFileOpen((Convertpath(gTesttoolpath + "writer\optional\input\textframe\frameInFootnote.sxw")),false)
305 Call sMakeReadOnlyDocumentEditable
307 '/// Set focus to Frame
308 Call wTypeKeys ( "<Shift F4>" )
311 '/// Format/Frame / Type ,
312 '/// + Check if "Entire page" and "Page text area"
313 '/// + are in Vertical to area
314 Call fFormatFrame("TabType")
315 if HorizontalTo.GetSelIndex <> 7 then
316 Warnlog "Horizontal To should be 'Entire Page' but get " & HorizontalTo.GetSelText
318 if VerticalTo.GetSelIndex <> 4 then
319 Warnlog "Vertical To should be 'Page Text Area' but get " & VerticalTo.GetSelText
323 printlog " Close active document "
324 Do Until GetDocumentCount = 0
330 '-----------------------------------------------------------------
332 testcase tTextframes_78
334 printlog "- 'Vertical to' when anchor is inside endnote"
335 '/// 'Vertical to' when anchor is inside endnote
339 '/// Open a test file , which includes 1 frame in the endnote
340 Call hFileOpen((Convertpath(gTesttoolpath + "writer\optional\input\textframe\frameInEndnote.sxw")),false)
341 Call sMakeReadOnlyDocumentEditable
343 '/// Set focus to Frame
344 Call wTypeKeys ( "<Shift F4>" )
347 '/// Format/Frame / Type ,
348 '/// + Check if "Entire page" and "Page text area"
349 '/// + are in Vertical to area
350 Call fFormatFrame("TabType")
351 if HorizontalTo.GetSelIndex <> 7 then
352 Warnlog "Horizontal To should be 'Entire Page' but get " & HorizontalTo.GetSelText
354 if VerticalTo.GetSelIndex <> 4 then
355 Warnlog "Vertical To should be 'Page Text Area' but get " & VerticalTo.GetSelText
359 printlog " Close active document "
360 Do Until GetDocumentCount = 0
366 '-----------------------------------------------------------------
368 testcase tTextframes_80
370 Dim sTestFile as String
371 Dim iVertical as Integer
372 Dim iVerticalTo as Integer
373 Dim sPositionY as String
375 sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\textframe\lineOfText.sxw")
377 iVerticalTo = 6 ' Line of text'
378 sPositionY = "0"+ gSeperator + "20" + gMeasurementUnit
380 printlog "- 'Line of text' - Top"
381 '/// 'Line of text' - Top
385 '/// Open a test file , which includes 1 frame which is
386 '/// + anchored 'To Character' and a picture which is anchored
388 Call hFileOpen(sTestFile,false)
389 Call sMakeReadOnlyDocumentEditable
391 '/// Set focus to Frame
392 Call wTypeKeys ( "<Shift F4>" )
395 '/// Format/Frame / Type , select Top in Vertical ,
396 '/// + select 'Line of text' in vertical to
397 Call fFormatFrame("TabType")
398 Vertical.Select iVertical
400 VerticalTo.Select iVerticalTo
404 '/// Check if the result is right
405 'Set focus to the picture
406 Call wTypeKeys "<Tab>"
409 Call fPositionAndSize("TabPositionAndSizeWriter")
410 if fCalculateTolerance( sPositionY, Verticalby.Gettext) > 0.3 then
411 Warnlog "The picture's position isn't right !"
413 TabPositionAndSizeWriter.Cancel
415 printlog " Close active document "
416 Do Until GetDocumentCount = 0
422 '-----------------------------------------------------------------
424 testcase tTextframes_81
426 Dim sTestFile as String
427 Dim iVertical as Integer
428 Dim iVerticalTo as Integer
429 Dim sPositionY as String
431 sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\textframe\lineOfText.sxw")
432 iVertical = 2 ' Bottom
433 iVerticalTo = 6 ' Line of text'
434 sPositionY = "3"+ gSeperator + "50" + gMeasurementUnit
436 printlog "- 'Line of text' - Bottom"
437 '/// 'Line of text' - Bottom
441 '/// Open a test file , which includes 1 frame which is
442 '/// + anchored 'To Character' and a picture which is anchored
444 Call hFileOpen(sTestFile,false)
445 Call sMakeReadOnlyDocumentEditable
447 '/// Set focus to Frame
448 Call wTypeKeys ( "<Shift F4>" )
451 '/// Format/Frame / Type , select Bottom in Vertical ,
452 '/// + select 'Line of text' in vertical to
453 Call fFormatFrame("TabType")
454 Vertical.Select iVertical
456 VerticalTo.Select iVerticalTo
460 '/// Check if the result is right
461 'Set focus to the picture
462 Call wTypeKeys "<Tab>"
465 Call fPositionAndSize("TabPositionAndSizeWriter")
466 if fCalculateTolerance( sPositionY, Verticalby.Gettext) > 0.3 then
467 Warnlog "The picture's position isn't right !"
469 TabPositionAndSizeWriter.Cancel
471 printlog " Close active document "
472 Do Until GetDocumentCount = 0
478 '-----------------------------------------------------------------
480 testcase tTextframes_82
482 Dim sTestFile as String
483 Dim iVertical as Integer
484 Dim iVerticalTo as Integer
485 Dim sPositionY as String
487 sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\textframe\lineOfText.sxw")
488 iVertical = 4 ' Center
489 iVerticalTo = 6 ' Line of text'
490 sPositionY = "1"+ gSeperator + "80" + gMeasurementUnit
492 printlog "- 'Line of text' - Center"
493 '/// 'Line of text' - Center
497 '/// Open a test file , which includes 1 frame which is
498 '/// + anchored 'To Character' and a picture which is anchored
500 Call hFileOpen(sTestFile,false)
501 Call sMakeReadOnlyDocumentEditable
503 '/// Set focus to Frame
504 Call wTypeKeys ( "<Shift F4>" )
507 '/// Format/Frame / Type , select Center in Vertical ,
508 '/// + select 'Line of text' in vertical to
509 Call fFormatFrame("TabType")
510 Vertical.Select iVertical
512 VerticalTo.Select iVerticalTo
516 '/// Check if the result is right
517 'Set focus to the picture
518 Call wTypeKeys "<Tab>"
521 Call fPositionAndSize("TabPositionAndSizeWriter")
522 if fCalculateTolerance( sPositionY, Verticalby.Gettext) > 0.3 then
523 Warnlog "The picture's position isn't right !"
525 TabPositionAndSizeWriter.Cancel
527 printlog " Close active document "
528 Do Until GetDocumentCount = 0
534 '-----------------------------------------------------------------
536 testcase tTextframes_83
538 Dim sTestFile as String
539 Dim iVertical as Integer
540 Dim iVerticalTo as Integer
541 Dim sPositionY as String
542 Dim sVerticalBy as String
544 sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\textframe\lineOfText.sxw")
545 iVertical = 6 ' From Bottom
546 iVerticalTo = 2 ' Line of text'
547 sPositionY = "2"+ gSeperator + "30" + gMeasurementUnit
548 sVerticalBy = "1"+ gSeperator + "00" + gMeasurementUnit
550 printlog "- 'Line of text' - From Bottom(positive)"
551 '/// 'Line of text' - From Bottom(positive)
555 '/// Open a test file , which includes 1 frame which is
556 '/// + anchored 'To Character' and a picture which is anchored
558 Call hFileOpen(sTestFile,false)
559 Call sMakeReadOnlyDocumentEditable
561 '/// Set focus to Frame
562 Call wTypeKeys ( "<Shift F4>" )
565 '/// Format/Frame / Type , select From Bottom in Vertical ,
566 '/// + select 'Line of text' in vertical to ,
567 '/// + input a positive number in vertical by
568 Call fFormatFrame("TabType")
569 if Vertical.GetItemCount <> 6 then
570 warnlog " Missing string in frame options"
575 Vertical.Select iVertical
577 VerticalTo.Select iVerticalTo
579 VerticalBy.SetText sVerticalBy
582 '/// Check if the result is right
583 'Set focus to the picture
584 Call wTypeKeys "<Tab>"
587 Call fPositionAndSize("TabPositionAndSizeWriter")
588 if fCalculateTolerance( sPositionY, Verticalby.Gettext) > 0.3 then
589 Warnlog "The picture's position isn't right !"
591 TabPositionAndSizeWriter.Cancel
593 printlog " Close active document "
594 Do Until GetDocumentCount = 0
600 '-----------------------------------------------------------------
602 testcase tTextframes_84
604 Dim sTestFile as String
605 Dim iVertical as Integer
606 Dim iVerticalTo as Integer
607 Dim sPositionY as String
608 Dim sVerticalBy as String
610 sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\textframe\lineOfText.sxw")
611 iVertical = 6 ' From Bottom
612 iVerticalTo = 2 ' Line of text'
613 sPositionY = "4"+ gSeperator + "30" + gMeasurementUnit
614 sVerticalBy = "-1"+ gSeperator + "00" + gMeasurementUnit
616 printlog "- 'Line of text' - From Bottom(negative)"
617 '/// 'Line of text' - From Bottom(negative)
621 '/// Open a test file , which includes 1 frame which is
622 '/// + anchored 'To Character' and a picture which is anchored
624 Call hFileOpen(sTestFile,false)
625 Call sMakeReadOnlyDocumentEditable
627 '/// Set focus to Frame
628 Call wTypeKeys ( "<Shift F4>" )
631 '/// Format/Frame / Type , select From Bottom in Vertical ,
632 '/// + select 'Line of text' in vertical to ,
633 '/// + input a negative number in vertical by
634 Call fFormatFrame("TabType")
635 if Vertical.GetItemCount <> 6 then
636 warnlog " Missing string in frame options"
641 Vertical.Select iVertical
643 VerticalTo.Select iVerticalTo
645 VerticalBy.SetText sVerticalBy
648 '/// Check if the result is right
649 'Set focus to the picture
650 Call wTypeKeys "<Tab>"
653 Call fPositionAndSize("TabPositionAndSizeWriter")
654 if fCalculateTolerance( sPositionY, Verticalby.Gettext) > 0.3 then
655 Warnlog "The picture's position isn't right !"
657 TabPositionAndSizeWriter.Cancel
659 printlog " Close active document "
660 Do Until GetDocumentCount = 0
666 '-----------------------------------------------------------------
668 testcase tTextframes_85
670 Dim sTestFile as String
671 Dim iVerticalTop as Integer
672 Dim iVerticalBottom as Integer
673 Dim iVerticalCenter as Integer
674 Dim iVerticalTo as Integer
676 sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\textframe\lineOfText.doc")
677 iVerticalTop = 1 ' Top
678 iVerticalBottom = 2 ' Bottom
679 iVerticalCenter = 4 ' Center
681 iVerticalTo = 6 ' Line of text'
683 printlog "- Import from MS Word"
684 '/// Import from MS Word
688 '/// Open a MS Word file , which includes 3 frames ,
689 '/// + One is top to the line text ,
690 '/// + another one is center to the line text ,
691 '/// + the 3rd one is bottom to the line text
692 Call hFileOpen(sTestFile,false)
693 Call sMakeReadOnlyDocumentEditable
696 '/// Set focus to 1st Frame
697 Call wTypeKeys ( "<Shift F4>" )
699 '/// Format/Frame / Type , check if 'To character' in anchor area
700 '/// + check if 'Line of text' in vertical to ,
701 '/// + check if 'Top' in Vertical
702 Call fFormatFrame("TabType")
703 if AnchorAtCharacter.IsChecked <> TRUE then
704 Warnlog "The anchor should be To Character!"
706 if Vertical.GetSelIndex <> iVerticalTop then
707 Warnlog "should be Top , but get " &Vertical.GetSelText
709 if VerticalTo.GetSelIndex <> iVerticalTo then
710 Warnlog "Top:should be line of text , but get " &VerticalTo.GetSelText
714 '/// Set focus to 2nd Frame
715 Call wTypeKeys "<Tab>"
718 '/// Format/Frame / Type , check if 'To character' in anchor area
719 '/// + check if 'Line of text' in vertical to ,
720 '/// + check if 'Center' in Vertical
721 Call fFormatFrame("TabType")
722 if AnchorAtCharacter.IsChecked <> TRUE then
723 Warnlog "The anchor should be To Character!"
725 if Vertical.GetSelIndex <> iVerticalCenter then
726 Warnlog "should be Center , but get " &Vertical.GetSelText
728 if VerticalTo.GetSelIndex <> iVerticalTo then
729 Warnlog "Center:should be line of text , but get " &VerticalTo.GetSelText
733 '/// Set focus to 3rd Frame
734 Call wTypeKeys "<Tab>"
737 '/// Format/Frame / Type , check if 'To character' in anchor area
738 '/// + check if 'Line of text' in vertical to ,
739 '/// + check if 'Bottom' in Vertical
740 Call fFormatFrame("TabType")
741 if AnchorAtCharacter.IsChecked <> TRUE then
742 Warnlog "The anchor should be To Character!"
744 if Vertical.GetSelIndex <> iVerticalBottom then
745 Warnlog "should be Bottom , but get " &Vertical.GetSelText
747 if VerticalTo.GetSelIndex <> iVerticalTo then
748 Warnlog "Bottom:should be line of text , but get " &VerticalTo.GetSelText
752 printlog " Close active document "
753 Do Until GetDocumentCount = 0
759 ' ------------------------------------------------------------------------------