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_section_1.inc,v $
13 '* last change: $Author: vg $ $Date: 2008-08-18 12:34:52 $
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 : Section test(Insert/Section Format/Section)
38 '************************************************************************
40 ' #1 tInsertSection_1 'test for insert a section
41 ' #1 tInsertSection_2 'test for the default section name and automatic numbering
42 ' #1 tInsertSection_3 'Need to check section name
43 ' #1 tInsertSection_4 'check if the layout in section is not destroyed
44 ' #1 tInsertSection_5 'Linked Section test
45 ' #1 tInsertSection_6 'Insert Section should be disabled in the follow opeation
47 '\***********************************************************************
50 printLog Chr(13) + "--------- Insert Section ----------"
59 '-------------------------------------------------------------------------
61 testcase tInsertSection_1
64 Call fInsertSection("Section Test")
66 Call wTypeKeys "<RETURN>"
67 '/// Test for insert a section with western words ///
68 Call fInsertSection("Western Test")
70 Call wTypeKeys "<UP>" , 1
71 Call wTypeKeys "Section : western test"
74 if bAsianLan = TRUE then
75 Call wTypeKeys "<DOWN>" , 1
76 Call wTypeKeys "<RETURN>"
77 '///+... test for insert a section with asian character -- Simplified Chinese ///
78 Call fInsertSection("Asian Test")
80 Call wTypeKeys "<UP>" , 1
84 Call wTypeKeys "<DOWN>" , 1
85 Call wTypeKeys "<RETURN>"
87 '/// Test for insert a section with a graphic object
88 Call fInsertSection("Graphic Test")
89 Call wTypeKeys "<UP>" , 1
90 Call hGrafikEinfuegen(gTesttoolPath + "writer\optional\input\graphics\jolink.jpg")
93 Call wTypeKeys "<DOWN>" , 10
94 Call wTypeKeys "<RETURN>"
95 '/// Test for insert a section with a draw object ///
96 Call fInsertSection("Draw Test")
98 Call wTypeKeys "<UP>" , 1
101 Kontext "OLEObjektEinfuegen"
102 AusDateiErstellen.Check
103 oleDatei.Settext ConvertPath(gTesttoolpath + "writer\optional\input\section\section_test.sxd")
104 OLEObjektEinfuegen.OK
112 '/// Test for insert a section with combination of different objects///
113 Call fInsertSection("combination of different objects test")
116 '/// -- western words ///
117 Call wTypeKeys "<UP>" , 1
118 Call wTypeKeys "Section : western test<return>"
120 Call hGrafikEinfuegen(gTesttoolPath & "writer\optional\input\graphics\jolink.jpg")
123 Call wTypeKeys "<DOWN>" , 1
124 Call wTypeKeys "<RETURN>"
125 '/// -- drawing object ///
126 InsertObjectOLEObject
128 Kontext "OLEObjektEinfuegen"
129 AusDateiErstellen.Check
130 oleDatei.Settext ConvertPath(gTesttoolpath & "writer\optional\input\section\section_test.sxd")
131 OLEObjektEinfuegen.OK
138 '----------------------------------------------------------
140 testcase tInsertSection_2
142 Dim SectionName as String
145 '/// Test for the default section name and automatic numbering
146 '///+<b>Only Big 10 languages!</b>
147 '///+ Automatic numbering test is from 1-3.
151 SectionName = gDefaultSectionName + j
154 Kontext "TabBereiche"
157 Call wTypeKeys "<UP>"
158 'Check the section name is correct or NOT (Format/Section)
161 Kontext "BereicheBearbeiten"
162 if BereichsName.GetText <> SectionName then
163 QAErrorLog "The default Section Name may be changed or wrong wrong : " & BereichsName.Gettext
165 BereicheBearbeiten.Cancel
167 Call wTypeKeys "<DOWN>"
172 '----------------------------------------------------------
174 testcase tInsertSection_3
176 Dim SectionName() as Variant
179 '*************************************************************
180 '/// Need to check section name, include : ///
181 '/// SectionTest --- normal name ///
182 '/// Section Test --- devided by space ///
183 '/// Section-Test --- devided by dash ///
184 '/// Section*Test --- devided by asterisk ///
185 '/// sèction --- include German umlaut character ///
186 '/// säction --- include French character ///
188 '/// *** maybe need add more testcases here *** ///
189 '*************************************************************
191 SectionName = Array( _
200 j = UBound(SectionName)
206 fInsertSection(SectionName(i))
207 Call wTypeKeys "<Up>" , 1
210 Kontext "BereicheBearbeiten"
211 if BereichsName.GetText <> SectionName(i) then warnlog " The Section Name is wrong, it should be :" +SectionName(i) +", but: "+BereichsName.GetText
212 BereicheBearbeiten.Cancel
214 Call wTypeKeys "<Down>" , 1
216 Warnlog " Insert Section is failed , the section name should be " +SectionName(i)
223 '----------------------------------------------------------
225 testcase tInsertSection_4
227 Dim Message1 as String
230 '/// Check if the layout in section is not destroyed.
232 '/// 1. Test for a section includes more than 1 line of text.
233 printlog " Section includes more than 1 line of text"
236 Call wTypeKeys "This is first line<return>"
237 Call wTypeKeys "This is Second line"
242 Message1 = GetClipboardText
245 Kontext "TabBereiche"
252 if Message1 <> GetClipboardText then Warnlog " Layout is destroyed"
255 '/// 2. test for a section includes more than 1 graphic///
256 printlog " Section includes more than 1 graphic"
259 Call hGrafikEinfuegen ( gTesttoolPath & "writer\optional\input\graphics\jolink.jpg" )
264 Active.SetPage TabZusaetze
265 Kontext "TabZusaetze"
266 ObjektName.SetText "jolink"
270 Call wTypeKeys "<ESCAPE>"
271 Call wTypeKeys "<RETURN>" , 2
273 Call hGrafikEinfuegen ( gTesttoolPath + "writer\optional\input\graphics\bild.jpg" )
278 Active.SetPage TabZusaetze
279 Kontext "TabZusaetze"
280 ObjektName.SetText "bild"
283 Call wTypeKeys "<ESCAPE>"
284 Call wTypeKeys "<RETURN>" , 4
291 Active.Setpage TabBereiche
292 Kontext "TabBereiche"
294 'Check if correct graphic have been selected
296 Call wNavigatorAuswahl(4,j)
300 Active.SetPage TabZusaetze
301 Kontext "TabZusaetze"
303 Message1 = ObjektName.GetText
305 case 1 : if Message1 <> "jolink" then Warnlog "Wrong Graphicname: Not -> 'jolink' But -> "+ Message1
306 case 2 : if Message1 <> "bild" then Warnlog "Wrong Graphicname: Not -> 'bild' But -> "+ Message1
315 '/// 3. test for a section across page breaks ///
316 printlog " Section across page breaks"
319 ' Call dialog with Insert/ManualBreak and in dialog check 'page break'
320 Call wTypeKeys "Page Break"
321 Call wTypeKeys "<LEFT>" , 5
325 Kontext "UmbruchEinfuegen"
333 Kontext "TabBereiche"
339 Kontext "NavigatorWriter"
340 Seitennummer.SetText "2"
342 'set page number to 2
343 if Seitennummer.GetText <> "2" then
344 warnlog "Something wrong in a section across page breaks, perhaps due to bug #101873."
350 '----------------------------------------------------------
352 testcase tInsertSection_5
358 if Dir (gOfficePath + "user\work\link_of_section_test.oot") <> "" then
359 kill (gOfficePath + "user\work\link_of_section_test.oot")
362 '/// Linked Section test ///
366 '/// 1. Check option 'Link' in dialogue Insert-Section ///
367 printlog " - Check option 'Link' in dialogue Insert-Section"
371 Active.Setpage TabBereiche
372 Kontext "TabBereiche"
377 if Geschuetzt.IsChecked <>TRUE then warnlog "The checkbox 'protect' is NOT checked"
379 '/// 2. Check Link from other sections ///
380 printlog " - Check Link from other sections "
382 '/// - Check if the link document contains no sections"
383 printlog " - Check if the link document contains no sections"
385 DateiVerknuepfung.Settext ConvertPath(gTesttoolpath + "writer\optional\input\section\bt.sxw")
387 if Bereich.GetItemCount <> 0 then warnlog "Should NO entry in the section listbox"
390 Call wTypeKeys "Hello World!"
397 ' On Tabpage 'Font' adjust settings
398 active.SetPage TabFont
402 Message2 = FontWest.GetSelText
403 Message1 = StyleWest.GetItemCount
404 StyleWest.Select Message1
405 Message3 = StyleWest.GetSelText
409 Message2 = Font.GetSelText
410 Message1 = Style.GetItemCount
411 Style.Select Message1
412 Message3 = Style.GetSelText
419 Call fInsertSection("Section-Test-link")
422 if gApplication = "WRITER" then
423 Call hFileSaveAsKill (gOfficePath + "user\work\link_of_section_test.odt")
433 Active.Setpage TabBereiche
434 Kontext "TabBereiche"
439 Dateiname.Settext ConvertPath(gOfficePath + "user\work\link_of_section_test.odt")
444 Active.Setpage TabBereiche
445 Kontext "TabBereiche"
451 Warnlog "Something wrong in Section name . Bug i35168"
454 if Bereich.GetSelText <> "Section-Test-link" then warnlog "the section name is wrong" + Bereich.GetSelText
456 Bereichsliste.Settext "SectionLink"
461 Call wTypeKeys "<up>" , 2
464 Kontext "BereicheBearbeiten"
465 if BereichsName.GetText <> "SectionLink" then warnlog "The Section Name is wrong : " + BereichsName.Gettext
466 BereicheBearbeiten.Cancel
471 'On Tabpage 'Font' adjust settings
472 active.SetPage TabFont
475 if FontWest.GetSelIndex <> 1 then Warnlog "Font should "+ Message2 +" is "+ FontWest.GetSelText
476 if StyleWest.GetSelIndex <> Message1 then Warnlog "FontStyle should " +Message3+" is "+ StyleWest.GetSelText
477 if SizeWest.GetSelIndex <> 24 then Warnlog "Wrong Font Size : " + SizeWest.GetSelText
479 if Font.GetSelIndex <> 1 then Warnlog "Font should "+ Message2 +" is "+ Font.GetSelText
480 if Style.GetSelIndex <> Message1 then Warnlog "FontStyle should " +Message3+" is "+ Style.GetSelText
481 if Size.GetSelIndex <> 24 then Warnlog "Wrong Font Size : " + Size.GetSelText
487 '/// 3. Check simple link from file ///
488 printlog " - Check simple link from file"
490 '/// test for entering path/name directly ///
496 Active.Setpage TabBereiche
497 Kontext "TabBereiche"
500 DateiVerknuepfung.Settext ConvertPath(gTesttoolpath + "writer\optional\input\section\bt.sxw")
506 '/// 4. test via browse - button ///
512 Active.Setpage TabBereiche
513 Kontext "TabBereiche"
519 Dateiname.Settext ConvertPath(gTesttoolpath + "writer\optional\input\section\bt.sxw")
524 Active.Setpage TabBereiche
525 Kontext "TabBereiche"
532 '----------------------------------------------------------
534 testcase tInsertSection_6
536 '/// Insert Section should be disabled in the follow opeations///
537 printlog " - Insert Section should be disabled in the follow opeations"
541 '/// 1. Multiselection ///
542 printlog " - Multiselection "
544 Call wTypeKeys "Multiselection test , Multiselection test !"
545 Call fMultiSelection("Multiselection")
550 Warnlog "Menu Insert / Section should be disabled !"
558 '/// 2. cell selection in table ///
559 printlog " - Check cell selection in table "
562 Kontext "TabelleEinfuegenWriter"
563 TabelleEinfuegenWriter.OK
566 Call wTypeKeys "<Shift Right>"
571 Warnlog "Menu Insert / Section should be disabled !"
577 '/// 3. insert a frame ///
578 printlog " - Check after insert a frame "
582 active.SetPage TabType
589 Warnlog "Menu Insert / Section should be disabled !"
595 '/// 4. insert a graphic ///
596 printlog " - Check after insert a graphic "
598 Call hGrafikEinfuegen ( gTesttoolPath + "writer\optional\input\graphics\jolink.jpg" )
603 Warnlog "Menu Insert / Section should be disabled !"
609 '/// 5. insert a OLE object ///
610 printlog " - Check after insert a OLE-object (drawing) "
612 InsertObjectOLEObject
613 Kontext "OLEObjektEinfuegen"
614 AusDateiErstellen.Check
615 oleDatei.Settext ConvertPath(gTesttoolpath + "writer\optional\input\section\section_test.sxd")
616 OLEObjektEinfuegen.OK
621 Warnlog "Menu Insert / Section should be disabled !"