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_autocorrect1.inc,v $
13 '* last change: $Author: vg $ $Date: 2008-08-18 12:23:21 $
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 the AutoCorrect/AutoFormat/Options
38 '************************************************************************
42 ' #1 tToolsAutocorrectOptions_1
43 ' #1 tToolsAutocorrectOptions_2
44 ' #1 tToolsAutocorrectOptions_3
45 ' #1 tToolsAutocorrectOptions_4_1
46 ' #1 tToolsAutocorrectOptions_4_2
47 ' #1 tToolsAutocorrectOptions_5
48 ' #1 tToolsAutocorrectOptions_6
49 ' #1 tToolsAutocorrectOptions_7
50 ' #1 tToolsAutocorrectOptions_8
51 ' #1 tToolsAutocorrectOptions_11
52 ' #1 tToolsAutocorrectOptions_12
53 ' #1 tToolsAutocorrectOptions_13
54 ' #1 tToolsAutocorrectOptions_14
55 ' #1 tToolsAutocorrectOptions_16
56 ' #1 tToolsAutocorrectOptions_18
57 ' #1 tToolsAutocorrectOptions_19
59 '\***********************************************************************
61 sub w_autocorrect_autoformat_1
63 printLog Chr(13) + "- Test the AutoCorrect/AutoFormat Options features"
65 Call tReplaceDashes_1 'Replace all of dashes
66 '## Tab page Options in Tools/Autocorrect|Autoformat ##
67 Call tToolsAutocorrectOptions_1 'Use Replacement table
68 Call tToolsAutocorrectOptions_2 'Correct TWo INitial CApital
69 Call tToolsAutocorrectOptions_3 'Capitalize first letter of every setence
70 Call tToolsAutocorrectOptions_4_1 'Automatic bold
71 Call tToolsAutocorrectOptions_4_2 'Automatic underline
72 Call tToolsAutocorrectOptions_5 'URL Recognition
73 Call tToolsAutocorrectOptions_6 'Replace 1st ... with 1^st...
74 Call tToolsAutocorrectOptions_7 'Replace 1/2 ... with ½ ...
75 Call tToolsAutocorrectOptions_8 'Replace dashes
76 Call tToolsAutocorrectOptions_11 'Ignore double spaces
77 Call tToolsAutocorrectOptions_12 'Apply numbering
78 Call tToolsAutocorrectOptions_13 'Apply Border
79 Call tToolsAutocorrectOptions_14 'Create Table
80 Call Ttoolsautocorrectoptions_16 'Remove Blank Paragraphs
81 Call Ttoolsautocorrectoptions_18 'Replace bullets with •
82 Call tToolsAutocorrectOptions_19 'Replace standard quotes with custom quotes
86 '-------------------------------------------------------------------------
88 testcase tReplaceDashes_1
90 Dim testWord as string, testResult as String
94 printLog "Replace dashes test"
95 '/// Replace dashes test
96 '/// - "Bla - Bla" One short line between two words (with Blank before and after)
97 '/// - "Bla--Bla" Dashes lines between two words (without Blanks)
98 '/// - "Helen and --Tom" Dashes Lines before a Word (one Blank before, none after)
99 '/// - "(Bla--Bla)" Testing Text in brackets ( )
100 '/// - "[Bla--Bla]" Testing Text in brackets [ ]
101 '/// - "{Bla--Bla}" Testing Text in brackets { }
107 Case 1 : testWord = "Bla - Bla" : testResult = "Bla – Bla"
108 Case 2 : testWord = "Bla--Bla" : testResult = "Bla—Bla"
109 Case 3 : testWord = "Helen and --Tom" : testResult = "Helen and –Tom"
110 Case 4 : testWord = "(Bla--Bla)" : testResult = "(Bla—Bla)"
111 Case 5 : testWord = "[Bla--Bla]" : testResult = "[Bla—Bla]"
112 Case 6 : testWord = "{Bla--Bla}" : testResult = "{Bla—Bla}"
115 printlog "- Replace dashes " & testword & " => " & testResult
116 Call wTypeKeys testWord
119 Call wTypeKeys "<Left><Shift Home>"
121 if GetClipboardText <> testResult then Warnlog "Something wrong in the test for " + testWord(i)
122 Call wTypeKeys "<DELETE>"
129 '-------------------------------------------------------------------------
131 testcase tToolsAutocorrectOptions_1
133 printLog "Test 'Use Replacement table'"
134 '/// Test 'Use Replacement table'
136 '/// Insert new test word in replacement table
137 '/// Tools/AutoCorrect / Replace , insert new test words in new and replace ,
138 '/// + and press button New.
141 Active.SetPage TabErsetzung
142 Kontext "TabErsetzung"
143 Kuerzel.SetText "Aabbcc"
144 ErsetzenDurch.SetText "Aaccbb"
150 '/// M:Y T:Y (default)
153 Active.SetPage TabOptionenAutokorrektur
154 Kontext "TabOptionenAutokorrektur"
155 Einstellungen.Select 1
156 if Not Einstellungen.IsChecked then Warnlog "First Checkbox: " & Einstellungen.IsChecked
157 Einstellungen.TypeKeys "<Right>"
158 if Not Einstellungen.IsChecked then Warnlog "Second Checkbox: " & Einstellungen.IsChecked
159 TabOptionenAutokorrektur.Ok
161 Call wTypeKeys "Aabbcc"
163 Call wTypeKeys "<BACKSPACE><Shift Home>"
165 if GetClipboardText <> "Aaccbb" then Warnlog "Something wrong in Use Replacement table when M:Y T:Y"
167 Call wTypeKeys "<DELETE>"
170 Call fAutocorrectOptions("UseReplacementTable")
172 Call wTypeKeys "Aabbcc"
174 Call wTypeKeys "<BACKSPACE><Shift Home>"
177 if GetClipboardText <> "Aabbcc" then
178 Warnlog "The content should NOT be changed before Autoformat! M:Y T:N"
180 Call wTypeKeys "<ESCAPE>"
181 FormatAutoformatApply
182 Call wTypeKeys "<Home><Shift End>"
183 GetClipboardText = ""
185 if GetClipboardText <> "Aaccbb" then
186 Warnlog "The content should be changed after Autoformat!M:Y T:N"
190 Call wTypeKeys "<DELETE>"
193 Call fAutocorrectOptions("UseReplacementTable")
195 Call wTypeKeys "Aabbcc"
197 Call wTypeKeys "<BACKSPACE><Shift Home>"
198 GetClipboardText = ""
200 if GetClipboardText <> "Aaccbb" then Warnlog "Something wrong in Use Replacement table when M:N T:Y"
202 Call wTypeKeys "<DELETE>"
205 Call fAutocorrectOptions("UseReplacementTable")
207 Call wTypeKeys "Aabbcc"
209 Call wTypeKeys "<BACKSPACE><Shift Home>"
211 if GetClipboardText <> "Aabbcc" then
212 Warnlog "The content should NOT be changed before Autoformat! M:N T:N"
216 Call wTypeKeys "<ESCAPE>"
217 FormatAutoformatApply
218 Call wTypeKeys "<Home><Shift End>"
219 GetClipboardText = ""
221 if GetClipboardText <> "Aabbcc" then
222 Warnlog "The content should NOT be changed after Autoformat! M:N T:N"
226 '/// Recover to the default M:Y T:Y
227 Call fAutocorrectOptions("UseReplacementTable")
229 'remove the test words which you insert in the replacement table
233 Active.SetPage TabErsetzung
234 Kontext "TabErsetzung"
235 for i =1 to Liste.GetItemCount
236 if Kuerzel.GetText = "Aabbcc" then
237 i = Liste.GetItemCount + 1
240 Liste.Typekeys "<Down>"
249 '-------------------------------------------------------------------------
251 testcase tToolsAutocorrectOptions_2
253 Dim testContent as String
254 Dim hopeResult as String
255 Dim hopeResultBeforeAutoformat as String
256 Dim hopeResultAfterAutoformat as String
258 printLog "Test 'Correct TWo INitial CApital' "
259 '/// Test 'Correct TWo INitial CApital'
262 '/// M:Y T:Y (default)
265 Call wTypeKeys testContent
267 Call wTypeKeys "<BACKSPACE><Shift Home>"
269 if GetClipboardText <> hopeResult then Warnlog "Something wrong in Correct TWo INitial CApital when M:Y T:Y"
271 Call wTypeKeys "<DELETE>"
275 hopeResultBeforeAutoformat = "TEst"
276 hopeResultAfterAutoformat = "Test"
278 Call fAutocorrectOptions("CorrectTWoINitialCApitals")
280 Call wTypeKeys testContent
282 Call wTypeKeys "<BACKSPACE><Shift Home>"
285 if GetClipboardText <> hopeResultBeforeAutoformat then
286 Warnlog "The content should NOT be changed before Autoformat! M:Y T:N"
290 Call wTypeKeys "<ESCAPE>"
291 FormatAutoformatApply
292 Call wTypeKeys "<Shift End>"
294 if GetClipboardText <> hopeResultAfterAutoformat then
295 Warnlog "The content should be changed after Autoformat!M:Y T:N"
299 Call wTypeKeys "<DELETE>"
305 Call fAutocorrectOptions("CorrectTWoINitialCApitals")
307 Call wTypeKeys testContent
309 Call wTypeKeys "<BACKSPACE><Shift Home>"
311 if GetClipboardText <> hopeResult then Warnlog "Something wrong in Correct TWo INitial CApital when M:N T:Y"
313 Call wTypeKeys "<DELETE>"
317 hopeResultBeforeAutoformat = "TEst"
318 hopeResultAfterAutoformat = "TEst"
320 Call fAutocorrectOptions("CorrectTWoINitialCApitals")
322 Call wTypeKeys testContent
324 Call wTypeKeys "<BACKSPACE><Shift Home>"
326 if GetClipboardText <> hopeResultBeforeAutoformat then
327 Warnlog "The content should NOT be changed before Autoformat! M:N T:N"
331 Call wTypeKeys "<ESCAPE>"
332 FormatAutoformatApply
333 Call wTypeKeys "<Shift End>"
335 if GetClipboardText <> hopeResultAfterAutoformat then
336 Warnlog "The content should NOT be changed after Autoformat! M:N T:N"
340 '/// Recover to the default M:Y T:Y
341 Call fAutocorrectOptions("CorrectTWoINitialCApitals")
347 '-------------------------------------------------------------------------
349 testcase tToolsAutocorrectOptions_3
351 Dim testContent as String
352 Dim hopeResult as String
353 Dim hopeResultBeforeAutoformat as String
354 Dim hopeResultAfterAutoformat as String
356 printLog "Test 'Capitalize first letter of every setence'"
357 '/// Test 'Capitalize first letter of every setence'
360 '/// M:Y T:Y (default)
361 testContent = "the test for StarOffice automation. who is the author?"
362 hopeResult = "The test for StarOffice automation. Who is the author?"
363 Call wTypeKeys testContent
364 Call wTypeKeys "<Shift Home>"
366 if GetClipboardText <> hopeResult then Warnlog "Something wrong in Capitalize first letter of every setence when M:Y T:Y"
368 Call wTypeKeys "<DELETE>"
371 testContent = "the test for StarOffice automation. who is the author?"
372 hopeResultBeforeAutoformat = "the test for StarOffice automation. who is the author?"
373 hopeResultAfterAutoformat = "The test for StarOffice automation. Who is the author?"
375 Call fAutocorrectOptions("CapitalizeFirstLetter")
376 Call wTypeKeys testContent
377 Call wTypeKeys "<Shift Home>"
379 if GetClipboardText <> hopeResultBeforeAutoformat then
380 Warnlog "The content should NOT be changed before Autoformat! M:Y T:N"
384 Call wTypeKeys "<ESCAPE>"
385 FormatAutoformatApply
386 Call wTypeKeys "<Shift End>"
388 if GetClipboardText <> hopeResultAfterAutoformat then
389 Warnlog "The content should be changed after Autoformat!M:Y T:N"
393 Call wTypeKeys "<DELETE>"
396 testContent = "the test for StarOffice automation. who is the author?"
397 hopeResult = "The test for StarOffice automation. Who is the author?"
399 Call fAutocorrectOptions("CapitalizeFirstLetter")
400 Call wTypeKeys testContent
401 Call wTypeKeys "<Shift Home>"
403 if GetClipboardText <> hopeResult then Warnlog "Something wrong in Capitalize first letter of every setence when M:N T:Y"
405 Call wTypeKeys "<DELETE>"
407 '/// test 'Capitalize first letter of every setence' , M:N T:N
408 testContent = "the test for StarOffice automation. who is the author?"
409 hopeResultBeforeAutoformat = "the test for StarOffice automation. who is the author?"
410 hopeResultAfterAutoformat = "the test for StarOffice automation. who is the author?"
412 Call fAutocorrectOptions("CapitalizeFirstLetter")
414 Call wTypeKeys testContent
415 Call wTypeKeys "<Shift Home>"
417 if GetClipboardText <> hopeResultBeforeAutoformat then
418 Warnlog "The content should NOT be changed before Autoformat! M:N T:N"
422 Call wTypeKeys "<ESCAPE>"
423 FormatAutoformatApply
424 Call wTypeKeys "<Shift End>"
426 if GetClipboardText <> hopeResultAfterAutoformat then
427 Warnlog "The content should NOT be changed after Autoformat! M:N T:N"
432 '/// Recover to the default
433 Call fAutocorrectOptions("CapitalizeFirstLetter")
440 '-------------------------------------------------------------------------
442 testcase tToolsAutocorrectOptions_4_1
444 Dim testContent as String
445 Dim hopeResult as String
446 Dim hopeResultBeforeAutoformat as String
447 Dim hopeResultAfterAutoformat as String
448 Dim getStyle as String
449 Dim hopeStyle as String
451 printLog "Test 'Automatic bold and underline' --- bold "
452 '/// Test 'Automatic bold'
455 '/// M:Y T:Y (default)
456 testContent = "*Test*"
459 Call wTypeKeys testContent
460 Call wTypeKeys "<Shift Home>"
462 if GetClipboardText <> hopeResult then Warnlog "Something wrong in Automatic bold when M:Y T:Y"
464 fFormatCharacter("TabFont")
467 getStyle = Style.GetSelText
469 hopeStyle = Style.GetSelText
471 getStyle = StyleWest.GetSelText
473 hopeStyle = StyleWest.GetSelText
477 if getStyle <> hopeStyle then Warnlog "The style is NOT bold style when M:Y T:Y"
489 Call wTypeKeys "<DELETE>"
492 testContent = "*Test*"
493 hopeResultBeforeAutoformat = "*Test*"
494 hopeResultAfterAutoformat = "Test"
496 Call fAutocorrectOptions("AutomaticBoldAndUnderline")
498 Call wTypeKeys testContent
499 Call wTypeKeys "<Shift Home>"
502 if GetClipboardText <> hopeResultBeforeAutoformat then
503 Warnlog "The content should NOT be changed before Autoformat! M:Y T:N"
507 fFormatCharacter("TabFont")
510 getStyle = Style.GetSelText
512 hopeStyle = Style.GetSelText
514 getStyle = StyleWest.GetSelText
516 hopeStyle = StyleWest.GetSelText
520 if getStyle <> hopeStyle then Warnlog "The style should be standard style before autoformat!"
523 Call wTypeKeys "<ESCAPE>"
524 FormatAutoformatApply
525 Call wTypeKeys "<Shift End>"
527 if GetClipboardText <> hopeResultAfterAutoformat then
528 Warnlog "The content should be changed after Autoformat!M:Y T:N"
531 fFormatCharacter("TabFont")
534 getStyle = Style.GetSelText
536 hopeStyle = Style.GetSelText
538 getStyle = StyleWest.GetSelText
540 hopeStyle = StyleWest.GetSelText
544 if getStyle <> hopeStyle then Warnlog "The style is NOT bold style when M:Y T:Y"
558 Call wTypeKeys "<DELETE>"
561 testContent = "*Test*"
564 Call fAutocorrectOptions("AutomaticBoldAndUnderline")
566 Call wTypeKeys testContent
567 Call wTypeKeys "<Shift Home>"
569 if GetClipboardText <> hopeResult then Warnlog "Something wrong in Automatic bold when M:Y T:Y"
571 fFormatCharacter("TabFont")
574 getStyle = Style.GetSelText
576 hopeStyle = Style.GetSelText
578 getStyle = StyleWest.GetSelText
580 hopeStyle = StyleWest.GetSelText
584 if getStyle <> hopeStyle then Warnlog "The style is NOT bold style when M:Y T:Y"
593 Call wTypeKeys "<DELETE>"
596 testContent = "*Test*"
597 hopeResultBeforeAutoformat = "*Test*"
598 hopeResultAfterAutoformat = "*Test*"
600 Call fAutocorrectOptions("AutomaticBoldAndUnderline")
602 Call wTypeKeys testContent
603 Call wTypeKeys "<Shift Home>"
605 if GetClipboardText <> hopeResultBeforeAutoformat then
606 Warnlog "The content should NOT be changed before Autoformat! M:N T:N"
610 fFormatCharacter("TabFont")
613 getStyle = Style.GetSelText
615 hopeStyle = Style.GetSelText
617 getStyle = StyleWest.GetSelText
619 hopeStyle = StyleWest.GetSelText
623 if getStyle <> hopeStyle then Warnlog "The style should be standard style before autoformat!"
626 Call wTypeKeys "<ESCAPE>"
627 FormatAutoformatApply
628 Call wTypeKeys "<Shift End>"
630 if GetClipboardText <> hopeResultAfterAutoformat then
631 Warnlog "The content should NOT be changed after Autoformat! M:N T:N"
634 fFormatCharacter("TabFont")
637 getStyle = Style.GetSelText
639 hopeStyle = Style.GetSelText
641 getStyle = StyleWest.GetSelText
643 hopeStyle = StyleWest.GetSelText
647 if getStyle <> hopeStyle then Warnlog "The style should be standard style after autoformat!"
652 '/// Recover to the default M:Y T:Y
653 Call fAutocorrectOptions("AutomaticBoldAndUnderline")
659 '-------------------------------------------------------------------------
661 testcase tToolsAutocorrectOptions_4_2
663 Dim testContent as String
664 Dim hopeResult as String
665 Dim hopeResultBeforeAutoformat as String
666 Dim hopeResultAfterAutoformat as String
667 Dim getUnderlineStatus as Integer
668 Dim hopeUnderlineStatus as Integer ' 1 = without , 2 = single
670 printLog "Test 'Automatic bold and underline' --- underline "
671 '/// Test 'Automatic underline'
674 '/// M:Y T:Y (default)
675 testContent = "_Test_"
678 Call wTypeKeys testContent
679 Call wTypeKeys "<Shift Home>"
681 if GetClipboardText <> hopeResult then Warnlog "Something wrong in Automatic underline when M:Y T:Y"
683 fFormatCharacter("TabFontEffects")
685 getUnderlineStatus = Underline.GetSelIndex
687 hopeUnderlineStatus = Underline.GetSelIndex
689 if getUnderlineStatus <> hopeUnderlineStatus then Warnlog "The content is NOT underlined when M:Y T:Y"
694 Call wTypeKeys "<DELETE>"
697 testContent = "_Test_"
698 hopeResultBeforeAutoformat = "_Test_"
699 hopeResultAfterAutoformat = "Test"
701 Call fAutocorrectOptions("AutomaticBoldAndUnderline")
703 Call wTypeKeys testContent
704 Call wTypeKeys "<Shift Home>"
707 if GetClipboardText <> hopeResultBeforeAutoformat then
708 Warnlog "The content should NOT be changed before Autoformat! M:Y T:N"
712 fFormatCharacter("TabFontEffects")
714 getUnderlineStatus = Underline.GetSelIndex
717 hopeUnderlineStatus = Underline.GetSelIndex
719 if getUnderlineStatus <> hopeUnderlineStatus then Warnlog "The content should NOT be underlined when M:Y T:N before autoformat!"
723 Call wTypeKeys "<ESCAPE>"
724 FormatAutoformatApply
725 Call wTypeKeys "<Shift End>"
727 if GetClipboardText <> hopeResultAfterAutoformat then
728 Warnlog "The content should be changed after Autoformat!M:Y T:N"
731 fFormatCharacter("TabFontEffects")
732 getUnderlineStatus = Underline.GetSelIndex
734 hopeUnderlineStatus = Underline.GetSelIndex
736 if getUnderlineStatus <> hopeUnderlineStatus then Warnlog "The content should be underlined when M:Y T:N"
741 Call wTypeKeys "<DELETE>"
744 testContent = "_Test_"
747 Call fAutocorrectOptions("AutomaticBoldAndUnderline")
749 Call wTypeKeys testContent
750 Call wTypeKeys "<Shift Home>"
752 if GetClipboardText <> hopeResult then Warnlog "Something wrong in Automatic bold when M:N T:Y"
754 fFormatCharacter("TabFontEffects")
755 getUnderlineStatus = Underline.GetSelIndex
758 hopeUnderlineStatus = Underline.GetSelIndex
760 if getUnderlineStatus <> hopeUnderlineStatus then Warnlog "The content is NOT underlined when M:N T:Y"
766 Call wTypeKeys "<DELETE>"
769 testContent = "_Test_"
770 hopeResultBeforeAutoformat = "_Test_"
771 hopeResultAfterAutoformat = "_Test_"
773 Call fAutocorrectOptions("AutomaticBoldAndUnderline")
775 Call wTypeKeys testContent
776 Call wTypeKeys "<Shift Home>"
778 if GetClipboardText <> hopeResultBeforeAutoformat then
779 Warnlog "The content should NOT be changed before Autoformat! M:N T:N"
783 fFormatCharacter("TabFontEffects")
784 getUnderlineStatus = Underline.GetSelIndex
786 hopeUnderlineStatus = Underline.GetSelIndex
788 if getUnderlineStatus <> hopeUnderlineStatus then Warnlog "The content should NOT be underlined before autoformat!M:N T:N "
791 Call wTypeKeys "<ESCAPE>"
792 FormatAutoformatApply
793 Call wTypeKeys "<Shift End>"
795 if GetClipboardText <> hopeResultAfterAutoformat then
796 Warnlog "The content should NOT be changed after Autoformat! M:N T:N"
799 fFormatCharacter("TabFontEffects")
800 getUnderlineStatus = Underline.GetSelIndex
803 hopeUnderlineStatus = Underline.GetSelIndex
805 if getUnderlineStatus <> hopeUnderlineStatus then Warnlog "The content should NOT be underlined after autoformat! M:N T:N"
810 '/// Recover to the default M:Y T:Y
811 Call fAutocorrectOptions("AutomaticBoldAndUnderline")
817 '-------------------------------------------------------------------------
819 testcase tToolsAutocorrectOptions_5
821 Dim testContent as String
822 Dim hopeResult as String
823 Dim hopeResultBeforeAutoformat as String
824 Dim hopeResultAfterAutoformat as String
826 printLog "URL Recognition"
830 '/// M:Y T:Y (default)
831 testContent = "WWW.sun.com"
832 hopeResult = "http://WWW.sun.com/"
834 Call wTypeKeys testContent
836 Call wTypeKeys "<Home>"
838 fFormatCharacter("TabHyperlinkZeichen")
839 if URLName.GetText <> hopeResult then Warnlog "The URL is NOT appeared when M:Y T:Y"
841 TabHyperlinkZeichen.OK
847 testContent = "WWW.sun.com"
848 hopeResultBeforeAutoformat = ""
849 hopeResultAfterAutoformat = "http://WWW.sun.com/"
851 Call fAutocorrectOptions("URLRecognition")
853 Call wTypeKeys testContent
855 Call wTypeKeys "<Home>"
857 fFormatCharacter("TabHyperlinkZeichen")
858 if URLName.GetText <> hopeResultBeforeAutoformat then Warnlog "The URL should NOT appeare when M:Y T:N before autoformat!"
860 TabHyperlinkZeichen.OK
862 FormatAutoformatApply
864 fFormatCharacter("TabHyperlinkZeichen")
865 if URLName.GetText <> hopeResultAfterAutoformat then Warnlog "The URL should appeare when M:Y T:N after autoformat!"
867 TabHyperlinkZeichen.OK
873 testContent = "WWW.sun.com"
874 hopeResult = "http://WWW.sun.com/"
876 Call fAutocorrectOptions("URLRecognition")
878 Call wTypeKeys testContent
880 Call wTypeKeys "<Home>"
882 fFormatCharacter("TabHyperlinkZeichen")
883 if URLName.GetText <> hopeResult then Warnlog "The URL is NOT appeared when M:N T:Y"
885 TabHyperlinkZeichen.OK
891 testContent = "WWW.sun.com"
892 hopeResultBeforeAutoformat = ""
893 hopeResultAfterAutoformat = ""
895 Call fAutocorrectOptions("URLRecognition")
897 Call wTypeKeys testContent
899 Call wTypeKeys "<Home>"
901 fFormatCharacter("TabHyperlinkZeichen")
902 if URLName.GetText <> hopeResultBeforeAutoformat then Warnlog "The URL should NOT appeare when M:N T:N before autoformat!"
904 TabHyperlinkZeichen.OK
906 FormatAutoformatApply
908 fFormatCharacter("TabHyperlinkZeichen")
909 if URLName.GetText <> hopeResultAfterAutoformat then Warnlog "The URL should NOT appeare when M:N T:N after autoformat!"
911 TabHyperlinkZeichen.OK
913 '/// Recover to the default M:Y T:Y
914 Call fAutocorrectOptions("URLRecognition")
920 '-------------------------------------------------------------------------
922 testcase tToolsAutocorrectOptions_6
924 Dim testContent as String
926 printLog "Replace 1st ... with 1^st..."
927 '/// Replace 1st ... with 1^st...
932 '/// M:Y T:Y (default)
933 Call wTypeKeys testContent
935 Call wTypeKeys "<BACKSPACE><Shift Left><Shift Left>"
937 fFormatCharacter("TabFontPosition")
938 if SuperScript.IsChecked <> TRUE then Warnlog "The superscript should be checked when M:Y T:Y"
943 Call wTypeKeys "<DELETE>"
946 Call fAutocorrectOptions("Replace1st")
948 Call wTypeKeys testContent
950 Call wTypeKeys "<BACKSPACE><Shift Left><Shift Left>"
952 fFormatCharacter("TabFontPosition")
953 if SuperScript.IsChecked = TRUE then Warnlog "The superscript should NOT be checked when M:Y T:N before autoformat!"
957 FormatAutoformatApply
959 fFormatCharacter("TabFontPosition")
960 if SuperScript.IsChecked <> TRUE then Warnlog "The superscript should be checked when M:Y T:N after autoformat!"
965 Call wTypeKeys "<DELETE>"
968 Call fAutocorrectOptions("Replace1st")
970 Call wTypeKeys testContent
972 Call wTypeKeys "<BACKSPACE><Shift Left><Shift Left>"
974 fFormatCharacter("TabFontPosition")
975 if SuperScript.IsChecked <> TRUE then Warnlog "The superscript should be checked when M:N T:Y"
980 Call wTypeKeys "<DELETE>"
983 Call fAutocorrectOptions("Replace1st")
985 Call wTypeKeys testContent
987 Call wTypeKeys "<BACKSPACE><Shift Left><Shift Left>"
989 fFormatCharacter("TabFontPosition")
990 if SuperScript.IsChecked = TRUE then Warnlog "The superscript should NOT be checked when M:N T:N before autoformat!"
994 FormatAutoformatApply
996 fFormatCharacter("TabFontPosition")
997 if SuperScript.IsChecked = TRUE then Warnlog "The superscript should NOT be checked when M:N T:N after autoformat!"
1001 '/// Recover to the default M:Y T:Y
1002 Call fAutocorrectOptions("Replace1st")
1009 '-------------------------------------------------------------------------
1011 testcase tToolsAutocorrectOptions_7
1013 Dim testContent as String
1014 Dim hopeResult as String
1015 Dim hopeResultBeforeAutoformat as String
1016 Dim hopeResultAfterAutoformat as String
1018 printLog "Replace 1/2 ... with ½ ... "
1019 '/// Replace 1/2 ... with ½ ...
1022 '/// M:Y T:Y (default)
1025 Call wTypeKeys testContent
1027 Call wTypeKeys "<BACKSPACE><Shift Home>"
1029 if GetClipboardText <> hopeResult then Warnlog "Something wrong in Replace 1/2 ... with ½ ... M:Y T:Y"
1031 Call wTypeKeys "<DELETE>"
1035 hopeResultBeforeAutoformat = "1/2"
1036 hopeResultAfterAutoformat = "½"
1038 Call fAutocorrectOptions("Replace1/2")
1039 Call wTypeKeys testContent
1041 Call wTypeKeys "<BACKSPACE><Shift Home>"
1043 if GetClipboardText <> hopeResultBeforeAutoformat then
1044 Warnlog "The content should NOT be changed before Autoformat! M:Y T:N"
1048 Call wTypeKeys "<ESCAPE>"
1049 FormatAutoformatApply
1050 Call wTypeKeys "<Shift End>"
1052 if GetClipboardText <> hopeResultAfterAutoformat then
1053 Warnlog "The content should be changed after Autoformat!M:Y T:N"
1057 Call wTypeKeys "<DELETE>"
1063 Call fAutocorrectOptions("Replace1/2")
1064 Call wTypeKeys testContent
1066 Call wTypeKeys "<BACKSPACE><Shift Home>"
1068 if GetClipboardText <> hopeResult then Warnlog "Something wrong in Replace 1/2 ... with ½ ... when M:N T:Y"
1070 Call wTypeKeys "<DELETE>"
1074 hopeResultBeforeAutoformat = "1/2"
1075 hopeResultAfterAutoformat = "1/2"
1077 Call fAutocorrectOptions("Replace1/2")
1079 Call wTypeKeys testContent
1081 Call wTypeKeys "<BACKSPACE><Shift Home>"
1083 if GetClipboardText <> hopeResultBeforeAutoformat then
1084 Warnlog "The content should NOT be changed before Autoformat! M:N T:N"
1088 Call wTypeKeys "<ESCAPE>"
1089 FormatAutoformatApply
1090 Call wTypeKeys "<Shift End>"
1092 if GetClipboardText <> hopeResultAfterAutoformat then
1093 Warnlog "The content should NOT be changed after Autoformat! M:N T:N"
1098 '/// Recover to the default
1099 Call fAutocorrectOptions("Replace1/2")
1106 '-------------------------------------------------------------------------
1108 testcase tToolsAutocorrectOptions_8
1110 Dim testContent as String
1111 Dim hopeResult as String
1112 Dim hopeResultBeforeAutoformat
1113 Dim hopeResultAfterAutoformat as String
1115 printLog "Replace dashes"
1119 '/// M:Y T:Y (default)
1120 testContent = "Bla - Bla"
1121 hopeResult = "Bla – Bla"
1122 Call wTypeKeys testContent
1124 Call wTypeKeys "<BACKSPACE><Shift Home>"
1126 if GetClipboardText <> hopeResult then Warnlog "Something wrong in Replace dashes M:Y T:Y"
1128 Call wTypeKeys "<DELETE>"
1131 testContent = "Bla - Bla"
1132 hopeResultBeforeAutoformat = "Bla - Bla"
1133 hopeResultAfterAutoformat = "Bla – Bla"
1135 Call fAutocorrectOptions("ReplaceDashes")
1136 Call wTypeKeys testContent
1138 Call wTypeKeys "<BACKSPACE><Shift Home>"
1140 if GetClipboardText <> hopeResultBeforeAutoformat then
1141 Warnlog "The content should NOT be changed before Autoformat! M:Y T:N"
1145 Call wTypeKeys "<ESCAPE>"
1146 FormatAutoformatApply
1147 Call wTypeKeys "<Shift End>"
1149 if GetClipboardText <> hopeResultAfterAutoformat then
1150 Warnlog "The content should be changed after Autoformat!M:Y T:N"
1154 Call wTypeKeys "<DELETE>"
1157 testContent = "Bla - Bla"
1158 hopeResult = "Bla – Bla"
1160 Call fAutocorrectOptions("ReplaceDashes")
1161 Call wTypeKeys testContent
1163 Call wTypeKeys "<BACKSPACE><Shift Home>"
1165 if GetClipboardText <> hopeResult then Warnlog "Something wrong in Replace dashes when M:N T:Y"
1167 Call wTypeKeys "<DELETE>"
1170 testContent = "Bla - Bla"
1171 hopeResultBeforeAutoformat = "Bla - Bla"
1172 hopeResultAfterAutoformat = "Bla - Bla"
1174 Call fAutocorrectOptions("ReplaceDashes")
1176 Call wTypeKeys testContent
1178 Call wTypeKeys "<BACKSPACE><Shift Home>"
1180 if GetClipboardText <> hopeResultBeforeAutoformat then
1181 Warnlog "The content should NOT be changed before Autoformat! M:N T:N"
1185 Call wTypeKeys "<ESCAPE>"
1186 FormatAutoformatApply
1187 Call wTypeKeys "<Shift End>"
1189 if GetClipboardText <> hopeResultAfterAutoformat then
1190 Warnlog "The content should NOT be changed after Autoformat! M:N T:N"
1195 '/// Recover to the default
1196 Call fAutocorrectOptions("ReplaceDashes")
1202 '-------------------------------------------------------------------------
1204 testcase tToolsAutocorrectOptions_11
1206 Dim testContent as String
1207 Dim hopeResult as String
1209 printLog "Ignore double spaces"
1210 '/// Ignore double spaces
1213 '/// + T:N (default)
1214 testContent = "Two Space"
1215 hopeResult = "Two Space"
1216 Call wTypeKeys testContent
1217 Call wTypeKeys "<Shift Home>"
1219 if GetClipboardText <> hopeResult then Warnlog "Should NOT ignore spaces T:N"
1221 Call wTypeKeys "<DELETE>"
1224 testContent = "Two Space"
1225 hopeResult = "Two Space"
1227 Call fAutocorrectOptions("IgnoreDoulbeSpaces")
1228 Call wTypeKeys testContent
1229 Call wTypeKeys "<Shift Home>"
1232 if GetClipboardText <> hopeResult then Warnlog "Should ignore spaces T:Y"
1234 Call wTypeKeys "<ESCAPE>"
1236 '/// Recover to the default
1237 Call fAutocorrectOptions("IgnoreDoulbeSpaces")
1243 '-------------------------------------------------------------------------
1245 testcase tToolsAutocorrectOptions_12
1247 Dim firstLine as String
1248 Dim testContent as String
1249 Dim hopeResult as String
1251 printLog "Apply numbering"
1252 '/// Apply numbering
1256 '/// + T:Y (default)
1258 firstLine = "1. FirstLine"
1259 testContent = "Test1"
1260 hopeResult = "1.Test1"
1262 Call wTypeKeys firstLine
1263 Call wTypeKeys "<Return>"
1264 Call wTypeKeys testContent
1265 Call wTypeKeys "<Return><Up><Home><Shift End>"
1267 if GetClipboardText <> hopeResult then Warnlog "Should Apply numbering when T:Y "
1270 Call wTypeKeys "<DELETE>"
1271 Call wTypeKeys "<BACKSPACE>",3
1274 testContent = "Test1"
1275 hopeResult = "Test1"
1277 Call fAutocorrectOptions("ApplyNumbering")
1278 Call wTypeKeys firstLine
1279 Call wTypeKeys "<Return>"
1280 Call wTypeKeys testContent
1281 Call wTypeKeys "<Return><Up><Home><Shift End>"
1284 if GetClipboardText <> hopeResult then Warnlog "Should NOT Apply numbering when T:Y"
1286 '/// Recover to the default
1287 Call fAutocorrectOptions("ApplyNumbering")
1293 '-------------------------------------------------------------------------
1295 testcase tToolsAutocorrectOptions_13
1297 Dim testList() as String
1298 Dim testContent as String
1299 Dim hopeResult as String
1302 Dim bottom as String
1304 bottom = "0" + gSeperator + "10" + gMeasurementUnit
1314 j = UBound(testList)
1316 '/// Apply border test , including
1317 '/// + '---' , '___", "===", "***" , "~~~", "###"
1318 printLog "Apply border"
1324 '/// + T:Y (default)
1325 testContent = testlist(i)
1327 Call wTypeKeys testContent
1328 Call wTypeKeys "<Return><Up><Home><Shift End>"
1331 Warnlog "Apply border is NOT correct when T:Y " +testlist(i)
1335 fFormatParagraph("TabUmrandung")
1337 Unten.SetText bottom
1339 Warnlog "Apply border is NOT correct when T:Y " +testlist(i)
1343 Call wTypeKeys "<Down>"
1346 testContent = testlist(i)
1347 hopeResult = testlist(i)
1349 Call fAutocorrectOptions("ApplyBorder")
1350 Call wTypeKeys testContent
1351 Call wTypeKeys "<Return><Up><Home><Shift End>"
1354 if GetClipboardText <> hopeResult then Warnlog "Something wrong when T:N "+testlist(i)
1356 fFormatParagraph("TabUmrandung")
1358 Unten.SetText bottom
1359 Warnlog "Apply border is NOT correct when T:N "+testlist(i)
1364 '/// Recover to the default
1365 Call fAutocorrectOptions("ApplyBorder")
1373 '-------------------------------------------------------------------------
1375 testcase tToolsAutocorrectOptions_14
1377 Dim testContent as String
1378 Dim hopeResult as String
1380 printLog "Create Table"
1384 '/// + T:Y (default)
1385 testContent = "+---+"
1386 Call wTypeKeys testContent
1387 Call wTypeKeys "<Return><Up><Home><Shift End>"
1390 Warnlog "Something wrong in create table T:Y"
1398 Warnlog "Can't delete table ,T:Y"
1402 testContent = "+---+"
1403 hopeResult = "+---+"
1405 Call fAutocorrectOptions("CreateTable")
1406 Call wTypeKeys testContent
1407 Call wTypeKeys "<Return><Up><Home><Shift End>"
1410 if GetClipboardText <> hopeResult then Warnlog "Something wrong when T:N"
1415 Warnlog "Should NOT generate table when T:N"
1419 '/// Recover to the default
1420 Call fAutocorrectOptions("CreateTable")
1426 '-------------------------------------------------------------------------
1428 testcase tToolsAutocorrectOptions_16
1430 Dim testContent1 as String
1431 Dim testContent2 as String
1432 Dim hopeResultAfterAutoformat1 as String
1433 Dim hopeResultAfterAutoformat2 as String
1435 testContent1 = "ABCD1234"
1436 testContent2 = "EFGH5678"
1438 hopeResultAfterAutoformat1 = "ABCD1234"
1439 hopeResultAfterAutoformat2 = "EFGH5678"
1442 printLog "Remove Blank Paragraphs"
1443 '/// Remove Blank Paragraphs
1448 wTypeKeys testContent1
1449 wTypeKeys "<Return>",2
1450 wTypeKeys testContent2
1452 FormatAutoformatApply
1454 wTypeKeys "<Up><Up><Home><Shift End>"
1457 if GetClipboardText <> hopeResultAfterAutoformat1 then Warnlog "the first line's content is NOT correct when M:N"
1459 wTypeKeys "<Down><Home><Shift End>"
1462 Warnlog "the second line's content is NOT correct when M:N"
1466 wTypeKeys "<Down><Home><Shift End>"
1469 if GetClipboardText <> hopeResultAfterAutoformat2 then Warnlog "the third line's content is NOT correct when M:N"
1476 Call fAutocorrectOptions("RemoveBlankParagraphs")
1478 wTypeKeys testContent1
1479 wTypeKeys "<Return>",2
1480 wTypeKeys testContent2
1482 FormatAutoformatApply
1484 wTypeKeys "<Up><Up><Home><Shift End>"
1487 if GetClipboardText <> hopeResultAfterAutoformat1 then Warnlog "the first line's content is NOT correct when M:Y"
1489 wTypeKeys "<Down><Home><Shift End>"
1492 if GetClipboardText <> hopeResultAfterAutoformat2 then Warnlog "the second line's content is NOT correct when M:Y"
1494 '/// Recover to the default
1495 Call fAutocorrectOptions("RemoveBlankParagraphs")
1501 '-------------------------------------------------------------------------
1503 testcase tToolsAutocorrectOptions_18
1505 Dim testContent as String
1506 Dim hopeResultBeforeAutoformat as String
1507 Dim hopeResultAfterAutoformat as String
1509 printLog "Replace bullets with •"
1510 '/// Replace bullets with •
1515 printLog "M:Y (default)"
1516 testContent = "+ Hello"
1517 hopeResultBeforeAutoformat = "+ Hello"
1518 hopeResultAfterAutoformat = "• Hello"
1520 wTypeKeys testContent
1522 wTypeKeys "<Shift Home>"
1524 GetClipboardText = ""
1526 if GetClipboardText <> hopeResultBeforeAutoformat then Warnlog "should NOT change before autoformat "
1528 FormatAutoformatApply
1530 wTypeKeys "<Home><Shift End>"
1532 GetClipboardText = ""
1535 if GetClipboardText <> hopeResultAfterAutoformat then Warnlog "should change after autoformat "
1543 testContent = "+ Hello"
1544 hopeResultBeforeAutoformat = "+ Hello"
1545 hopeResultAfterAutoformat = "+ Hello"
1547 Call fAutocorrectOptions("ReplaceBullets")
1549 wTypeKeys testContent
1551 wTypeKeys "<Shift Home>"
1553 GetClipboardText = ""
1555 if GetClipboardText <> hopeResultBeforeAutoformat then Warnlog "Should NOT change before autoformat "
1557 FormatAutoformatApply
1559 wTypeKeys "<Home><Shift End>"
1561 GetClipboardText = ""
1563 if GetClipboardText <> hopeResultAfterAutoformat then Warnlog "Should NOT change after autoformat "
1565 '/// Recover to the default
1566 Call fAutocorrectOptions("ReplaceBullets")
1572 '-------------------------------------------------------------------------
1574 testcase tToolsAutocorrectOptions_19
1576 Dim testContent as String
1577 Dim hopeResultBeforeAutoformat as String
1578 Dim hopeResultAfterAutoformat as String
1580 printLog "Replace standard quotes with custom quotes"
1581 '/// Replace standard quotes with custom quotes
1587 hopeResultBeforeAutoformat = "'"
1588 hopeResultAfterAutoformat = "["
1592 Active.SetPage TabTypografisch
1593 Kontext "TabTypografisch"
1594 EinfacheErsetzen.UnCheck
1595 EinfachWortAnfang.Click
1596 Kontext "Sonderzeichen"
1597 Schriftliste.TypeKeys "<PageUp><Home>"
1598 Schriftliste.TypeKeys "<Right>", 59 ' is [
1599 Schriftliste.TypeKeys "<Space>"
1602 Kontext "TabTypografisch"
1605 wTypeKeys (testContent + "Hello")
1607 wTypeKeys "<Home><Shift Right>"
1610 if GetClipboardText <> hopeResultBeforeAutoformat then Warnlog "Should NOT change before autoformat "
1612 FormatAutoformatApply
1614 wTypeKeys "<Home><Shift Right>"
1617 if GetClipboardText <> hopeResultAfterAutoformat then Warnlog "Should change after autoformat "
1625 hopeResultBeforeAutoformat = "'"
1626 hopeResultAfterAutoformat = "'"
1628 Call fAutocorrectOptions("ReplaceQuotes")
1630 wTypeKeys (testContent + "Hello")
1632 wTypeKeys "<Home><Shift Right>"
1635 if GetClipboardText <> hopeResultBeforeAutoformat then Warnlog "Should NOT change before autoformat "
1637 FormatAutoformatApply
1639 wTypeKeys "<Home><Shift Right>"
1642 if GetClipboardText <> hopeResultAfterAutoformat then Warnlog "Should NOT change after autoformat "
1644 '/// Recover to the default
1645 Call fAutocorrectOptions("ReplaceQuotes")
1649 Active.Setpage TabTypografisch
1650 Kontext "TabTypografisch"
1651 EinfacheErsetzen.Check
1652 EinfachStandard.Click