1 '**************************************************************************
2 '* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 '* Copyright 2008 by Sun Microsystems, Inc.
6 '* OpenOffice.org - a multi-platform office productivity suite
8 '* $RCSfile: w_autotext.inc,v $
12 '* last change: $Author: rt $ $Date: 2008-09-04 09:18:43 $
14 '* This file is part of OpenOffice.org.
16 '* OpenOffice.org is free software: you can redistribute it and/or modify
17 '* it under the terms of the GNU Lesser General Public License version 3
18 '* only, as published by the Free Software Foundation.
20 '* OpenOffice.org is distributed in the hope that it will be useful,
21 '* but WITHOUT ANY WARRANTY; without even the implied warranty of
22 '* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 '* GNU Lesser General Public License version 3 for more details
24 '* (a copy is included in the LICENSE file that accompanied this code).
26 '* You should have received a copy of the GNU Lesser General Public License
27 '* version 3 along with OpenOffice.org. If not, see
28 '* <http://www.openoffice.org/license.html>
29 '* for a copy of the LGPLv3 License.
31 '/************************************************************************
33 '* owner : helge.delfs@sun.com
35 '* short description : Test of autotext in writer
37 '\***********************************************************************
49 testcase tEditAutotext_1
58 Printlog "- Create a new autotext with content!"
59 printlog " New Writerdocument"
61 printlog " Create a new autotext category"
62 if wCreateAutotextCategory( "AANewCategory" ) = false then
63 Warnlog "Unable to create new Autotext category"
65 if Autotext.Exists then Autotext.Close
73 printlog " Insert some text and format text"
74 Call wTypeKeys("This becomes an autotext!")
76 Call wTypeKeys("<Home><Right>")
79 Active.SetPage TabFont
81 if gAsianSup = True then
83 if StyleWest.GetItemCount >= 3 then
86 For i = 6 to FontWest.GetItemCount
95 Vergleich1$ = FontWest.GetSelText
96 Vergleich2$ = StyleWest.GetSelText
98 Vergleich3$ = SizeWest.GetSelText
101 if Style.GetItemCount >= 3 then
104 For i = 6 to Font.GetItemCount
113 Vergleich1$ = Font.GetSelText
114 Vergleich2$ = Style.GetSelText
116 Vergleich3$ = Size.GetSelText
120 Active.Setpage TabHyperlinkZeichen
121 Kontext "TabHyperlinkZeichen"
122 UrlName.Settext "http://www.irgendwas.de"
124 Vergleich4$ = TargetFrame.GetSelText
125 TabHyperlinkZeichen.Ok
127 Call wTypeKeys("<End>")
128 Call wTypeKeys("<Shift Home>")
130 printlog " Call Edit / Autotext"
133 if Active.Exists then
134 warnlog Active.Gettext
138 printlog " Uncheck 'Preview and Select first group in List"
139 Vorschau_anzeigen.Uncheck
141 if wSelectAutotextCategory( "AANewCategory" ) = false then
142 Warnlog "Unable to select Autotext category"
144 if Autotext.Exists then Autotext.Close
150 printlog " Insert a name for the Autotext and a Shortcut"
151 NameText.Settext "HDEAutotext"
152 Kuerzel.Settext "HDE"
153 printlog " Select 'New' in Menubutton 'Autotext'"
155 if Menue.IsEnabled then
158 Warnlog "Unable to create autotext->Button 'Autotext' is disabled"
166 Call hMenuSelectNr ( 1 )
168 Warnlog "Menu Autotext->'New' disabled ! Test failed !"
175 printlog " Check if Autotext has been added to list"
177 if Active.Exists then
178 if Active.GetRT = 304 then
179 Warnlog "Unable to add autotext: " + Active.Gettext
188 if wSelectAutotextCategory("AANewCategory") = false then
189 Warnlog "Created autotext category not found!"
193 sAll = Liste.GetItemCount
195 Liste.TypeKeys "<Down>"
196 if Liste.Gettext = "HDEAutotext" then
197 printlog "Autotext has been found!"
202 printlog " Check if content has been added to named autotext"
204 if Autotext.Exists then
205 Warnlog "New autotext has not been found!"
209 Call wTypeKeys("<Shift Home>")
211 if GetClipboardtext <> "This becomes an autotext!" then
212 Warnlog "Autotext has no content!"
214 Call wTypeKeys ("<Home><Right>")
217 Active.SetPage TabFont
219 if gAsianSup = True then
220 if Vergleich1$ <> FontWest.GetSelText then Warnlog "Wrong Font in Autotext!"
221 if Vergleich2$ <> StyleWest.GetSelText then Warnlog "Wrong Fontstyle in Autotext!"
222 if Vergleich3$ <> SizeWest.GetSelText then Warnlog "Wrong Fontsize in Autotext!"
224 if Vergleich1$ <> Font.GetSelText then Warnlog "Wrong Font in Autotext!"
225 if Vergleich2$ <> Style.GetSelText then Warnlog "Wrong Fontstyle in Autotext!"
226 if Vergleich3$ <> Size.GetSelText then Warnlog "Wrong Fontsize in Autotext!"
230 Active.Setpage TabHyperlinkZeichen
231 Kontext "TabHyperlinkZeichen"
232 if UrlName.Gettext <> "http://www.irgendwas.de/" then Warnlog "Wrong hyperlink has been added to text!"
233 if Vergleich4$ <> TargetFrame.GetSelText then warnlog "Wrong targetFrame has been added to text!"
234 TabHyperlinkZeichen.Cancel
239 printlog " Delete whole category with created autotext"
240 Call wDeleteAutotextCategory( "AANewCategory" )
242 if Autotext.Exists then Autotext.Close
247 '---------------------------------------------------
249 testcase tEditAutotext_2
258 Printlog "- Create a new autotext with content! (Text only)"
259 printlog " New Writerdocument"
261 printlog " Create a new autotext category"
262 if wCreateAutotextCategory( "AANewCategory" ) = false then
263 Warnlog "Unable to create new Autotext category"
265 if Autotext.Exists then Autotext.Close
273 printlog " Insert some text and format text"
274 Call wTypeKeys("This becomes an autotext!")
276 Call wTypeKeys("<Home><Right>")
279 Active.SetPage TabFont
281 if gAsianSup = true then
283 if StyleWest.GetItemCount >= 3 then
286 For i = 6 to FontWest.GetItemCount
295 Vergleich1$ = FontWest.GetSelText
296 Vergleich2$ = StyleWest.GetSelText
298 Vergleich3$ = SizeWest.GetSelText
301 if Style.GetItemCount >= 3 then
304 For i = 6 to Font.GetItemCount
313 Vergleich1$ = Font.GetSelText
314 Vergleich2$ = Style.GetSelText
316 Vergleich3$ = Size.GetSelText
320 Active.Setpage TabHyperlinkZeichen
321 Kontext "TabHyperlinkZeichen"
322 UrlName.Settext "http://www.irgendwas.de"
324 Vergleich4$ = TargetFrame.GetSelText
325 TabHyperlinkZeichen.Ok
327 Call wTypeKeys("<End>")
328 Call wTypeKeys("<Shift Home>")
330 printlog " Call Edit / Autotext"
333 if Active.Exists then
334 warnlog Active.Gettext
339 printlog " Uncheck 'Preview and Select first group in List"
340 Vorschau_anzeigen.Uncheck
342 if wSelectAutotextCategory( "AANewCategory" ) = false then
343 Warnlog "Unable to select Autotext category"
345 if Autotext.Exists then Autotext.Close
351 printlog " Insert a name for the Autotext and a Shortcut"
352 NameText.Settext "HDEAutotext"
353 Kuerzel.Settext "HDE"
354 printlog " Select 'New' in Menubutton 'Autotext'"
359 Call hMenuSelectNr ( 2 )
361 Warnlog "Menu Autotext->'New' disabled ! Test failed !"
368 printlog " Check if Autotext has been added to list"
370 if Active.Exists then
371 if Active.GetRT = 304 then
372 Warnlog "Unable to add autotext: " + Active.Gettext
381 if wSelectAutotextCategory("AANewCategory") = false then
382 Warnlog "Created autotext category not found!"
386 sAll = Liste.GetItemCount
388 Liste.TypeKeys "<Down>"
389 if Liste.Gettext = "HDEAutotext" then
390 printlog "Autotext has been found!"
395 printlog " Check if content has been added to named autotext"
397 if Autotext.Exists then
398 Warnlog "New autotext has not been found!"
402 Call wTypeKeys("<Home><Up>" , 4)
403 Call wTypeKeys("<Shift End>")
405 if GetClipboardtext <> "This becomes an autotext!" then
406 Warnlog "Autotext has no content!"
408 Call wTypeKeys ("<Home><Right>")
411 Active.SetPage TabFont
413 if gAsianSup = true then
414 if Vergleich1$ = FontWest.GetSelText then Warnlog "Wrong Font in Autotext!"
415 if Vergleich2$ = StyleWest.GetSelText then Warnlog "Wrong Fontstyle in Autotext!"
416 if Vergleich3$ = SizeWest.GetSelText then Warnlog "Wrong Fontsize in Autotext!"
418 if Vergleich1$ = Font.GetSelText then Warnlog "Wrong Font in Autotext!"
419 if Vergleich2$ = Style.GetSelText then Warnlog "Wrong Fontstyle in Autotext!"
420 if Vergleich3$ = Size.GetSelText then Warnlog "Wrong Fontsize in Autotext!"
424 Active.Setpage TabHyperlinkZeichen
425 Kontext "TabHyperlinkZeichen"
426 if UrlName.Gettext = "http://www.irgendwas.de/" then Warnlog "Wrong hyperlink has been added to text!"
427 if Vergleich4$ = TargetFrame.GetSelText then Warnlog "Wrong targetFrame has been added to text!"
428 TabHyperlinkZeichen.Cancel
433 printlog " Delete whole category with created autotext"
434 Call wDeleteAutotextCategory( "AANewCategory" )
436 if Autotext.Exists then Autotext.Close
441 '---------------------------------------------------
443 testcase tEditAutotext_3
447 Dim AlterWert as String
448 Dim hauMatsch as integer
450 printlog " Edit / Autotext"
451 PrintLog "- Edit / Autotext"
452 printlog " New document"
454 printlog " Select Edit / Autotext"
457 if Active.Exists then
458 warnlog Active.Gettext
462 printlog " - Select and Insert all Autotexts "
463 printlog " Select and Insert all autotexts"
466 Vorschau_anzeigen.Uncheck
470 Liste.TypeKeys "<Down>"
474 hauMatsch = Liste.GetItemCount
476 for i = 1 to hauMatsch
478 for j=1 to Liste.GetItemCount
480 Liste.TypeKeys "<Down>"
483 Vorschau_anzeigen.Check
488 Call tCheckAutotextInGroup(Liste.GetItemCount-hauMatsch,i)
493 if Autotext.Exists then Autotext.Close
498 '---------------------------------------------------
500 testcase tEditAutotext_4
504 printlog " Create a new categorie"
505 printlog " - Create new categorie"
506 if wCreateAutotextCategory("AAAAAA") = false then
507 Warnlog "Unable to create category"
509 if Autotext.Exists then Autotext.Close
514 printlog " Close dialog and check if categorie has been created"
516 if Autotext.Exists then Autotext.Close
517 if wSelectAutotextCategory("AAAAAA") = false then
518 Warnlog "New categorie has been deleted ( after closing and reopening dialog )"
520 if Autotext.Exists then Autotext.Close
526 Kontext "BereicheBearbeitenAutotext"
527 printlog " Rename the new categorie"
528 printlog " - Rename new categorie!"
529 Bereich.Settext "AAAAAArrghh"
531 printlog " In dialog click 'rename'"
532 if Umbenennen.IsEnabled then
534 BereicheBearbeitenAutoText.OK
536 if Active.Exists then
537 if Active.GetRT = 304 then
538 warnlog Active.Gettext
543 Warnlog "Categorie couldn't be renamed (Button is disabled), no further test!"
544 Kontext "BereicheBearbeitenAutotext"
545 BereicheBearbeitenAutoText.Close
546 if wDeleteAutotextCategory("AAAAAA") = false then Warnlog "Unable to delete category"
553 Kontext "BereicheBearbeitenAutotext"
554 if BereicheBearbeitenAutotext.Exists then BereicheBearbeitenAutotext.Ok
555 printlog " Close dialog and check if Categorie has been renamed"
557 if Autotext.Exists then Autotext.Close
559 if wSelectAutotextCategory("AAAAAArrghh") = false then
560 Warnlog "Categorie hasn't been correctly renamed"
561 AlterWert=Liste.Gettext
564 printlog " Delete new categorie"
565 printlog " - Delete new categorie"
566 printlog " Select 'Categories'"
569 if Active.Exists then
570 if Active.GetRT = 304 then
571 warnlog Active.Gettext
575 Kontext "BereicheBearbeitenAutoText"
576 Bereich.SetText "AAAAAArrghh"
577 printlog " Select 'Delete', close document and check if categorie has been deleted"
578 if Loeschen.IsEnabled then
581 Warnlog "Categorie couldn't be deleted (Button is disabled)!"
584 BereicheBearbeitenAutoText.OK
586 if Not MessageBox.Exists(2) then
587 Warnlog "No messsage after deleting Categorie and closing the Dialog !"
591 if Active.Exists then
592 if Active.GetRT = 304 then
593 warnlog Active.Gettext
597 if wSelectAutotextCategory("AAAAAArrghh") = false then
598 Warnlog "After denying the 'Deletemessage' the categorie has been deleted!"
603 if Active.Exists then
604 if Active.GetRT = 304 then
605 warnlog Active.Gettext
609 Kontext "BereicheBearbeitenAutoText"
610 Bereich.SetText "AAAAAArrghh"
611 if Loeschen.IsEnabled then
613 BereicheBearbeitenAutotext.Ok
615 if MessageBox.Exists(2) then MessageBox.Yes
617 if Active.Exists then
618 if Active.GetRT = 304 then
619 QAErrorlog Active.Gettext
624 if wSelectAutotextCategory("AAAAAArrghh") = true then
625 Warnlog "Though the categorie has been deleted it is always there!"
628 Warnlog "Area couldn't be deleted (Button is disabled)!"
634 if Autotext.Exists then Autotext.Close
636 printlog " Close document"
640 '---------------------------------------------------
642 testcase tEditAutotext_5
643 printlog " - Insert Autotext with ShortCuts"
645 printlog " try to insert autotexts with Shotcut"
647 Call wTypeKeys "<Return>", 3
648 Call wBlindtextEinfuegen
651 if Active.Exists then
652 warnlog Active.GetText
656 Call wTypeKeys "<Mod1 A>"
659 printlog " Check if autotext has been inserted"
660 if GetClipboardText = "" then Warnlog "Autotext couldn't be inserted with Short-Cut!"
662 printlog " Close document"