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_autocorrect2.inc,v $
13 '* last change: $Author: vg $ $Date: 2008-08-18 12:23:31 $
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 AutoCorrect/AutoFormat/Word Completion
38 '************************************************************************
40 ' #1 tToolsAutocorrectWordCompletion_1
41 ' #1 tToolsAutocorrectWordCompletion_2
42 ' #1 tToolsAutocorrectWordCompletion_3
43 ' #1 tToolsAutocorrectWordCompletion_4
44 ' #1 tToolsAutocorrectWordCompletion_5
46 '\***********************************************************************
48 sub w_autocorrect_autoformat_2
50 printLog Chr(13) + "- Test the AutoCorrect/AutoFormat Word Completion features"
51 Call tToolsAutocorrectWordCompletion_1 'Check the default settings
52 Call tToolsAutocorrectWordCompletion_2 'Check entries
53 Call tToolsAutocorrectWordCompletion_3 'Check list of suggestions can be "scrolled"
54 Call tToolsAutocorrectWordCompletion_4 'Test Max entries
55 Call Ttoolsautocorrectwordcompletion_5 'Check 'When closing a document, save the list for later use in other documents'
59 '-------------------------------------------------------------------------
61 testcase tToolsAutocorrectWordCompletion_1
63 Dim iAcceptWith as String
64 Dim iEntriesNumber as Integer
65 Dim sMinWordLength as String
66 Dim sMaxEntries as String
67 Dim sMinMaxEntries as String
75 'Delete all entries in the list
78 printLog "Check the default settings"
79 '/// Check the default settings
80 '/// - Check box "Enable word completion" (default: checked)
81 '/// - Check box "Append Space" (default: unchecked)
82 '/// - Check box "Show as tip" (default: unchecked)
83 '/// - Check box "Collect Words" (default: checked)
84 '/// - Check box "When closing a document, save the list for later use in other documents" (default: checked)
85 '/// - List box "Accept with" (Default = "Return")
86 '/// - Spin box "minimal number of characters" default = 10
87 '/// - Spin box "Max. entries" (default =500, minimum = 50)
88 '/// - Box: "List of words collected" -- should be empty after Office restart.
93 Active.Setpage TabWortergaenzung
94 Kontext "TabWortergaenzung"
96 if WoerterErgaenzen.IsChecked <> TRUE then Warnlog "Complete words should be checked ."
97 if AppendSpace.IsChecked = TRUE then Warnlog "Append space should be UNchecked ."
98 if AlsTipphilfe.IsChecked = TRUE then Warnlog "Show as tip should be UNchecked ."
99 if VorschlaegeSammeln.IsChecked <> TRUE then Warnlog "Collect suggestions should be checked ."
100 if KeepList.IsChecked <> TRUE then Warnlog "When closing a document, save the list for later use in other documents should be checked ."
101 if AnnehmenMit.GetSelIndex <> iAcceptWith then Warnlog "The Accept with should be 'Enter' ."
102 if MinWortlaenge.GetText <> sMinWordLength then Warnlog "#i40540# Min word length should be " + sMinWordLength
103 if MaxEintraege.GetText <> sMaxEntries then Warnlog "Max entries should be " + sMaxEntries
104 if GesammelteWorte.GetItemCount <> iEntriesNumber then Warnlog "Entries number should be " + iEntriesNumber
106 MaxEintraege.SetText "49"
111 Active.Setpage TabWortergaenzung
112 Kontext "TabWortergaenzung"
113 if MaxEintraege.GetText <> sMinMaxEntries then Warnlog "Max entries should be " + sMinMaxEntries
114 MaxEintraege.SetText sMaxEntries
121 '-------------------------------------------------------------------------
123 testcase tToolsAutocorrectWordCompletion_2
125 Dim iDefaultEntriesNumber as Integer
126 Dim iEntriesNumber as Integer
128 Dim sMinWordLength as String
130 iDefaultEntriesNumber = 0
134 'Delete all entries in the list
137 printLog "Check the default settings"
139 '/// delete all entries first
140 '/// input some test words
141 '/// check if some words should are remembered in the entries
142 '/// delete all entries
143 '/// close and reopen dialog, check entries again
148 Active.Setpage TabWortergaenzung
149 Kontext "TabWortergaenzung"
150 if GesammelteWorte.GetItemCount <> iDefaultEntriesNumber then
151 Warnlog "Entries number should be " + iDefaultEntriesNumber
152 Warnlog "No test for this case"
153 TabWortergaenzung.Cancel
156 MinWortlaenge.SetText sMinWordLength
159 Call wTypeKeys "Hello World ! This is a StarOffice Test .<Return>"
163 Active.Setpage TabWortergaenzung
164 Kontext "TabWortergaenzung"
165 if GesammelteWorte.GetItemCount <> iEntriesNumber then Warnlog "Entries number should be " + iEntriesNumber
166 for i = 1 to GesammelteWorte.GetItemCount
167 GesammelteWorte.Select 1
168 if EintragLoeschen.IsEnabled then
169 EintragLoeschen.Click
171 i = GesammelteWorte.GetItemCount + 1
178 Active.Setpage TabWortergaenzung
179 Kontext "TabWortergaenzung"
180 if GesammelteWorte.GetItemCount <> iDefaultEntriesNumber then Warnlog "Entries number should be " + iDefaultEntriesNumber
181 TabWortergaenzung.Cancel
188 '-------------------------------------------------------------------------
190 testcase tToolsAutocorrectWordCompletion_3
192 Dim aTestWord() as String
193 Dim sPartOfTestWord as String
202 j = UBound(aTestWord)
204 sPartOfTestWord = "acc"
206 printLog "Check list of suggestions can be 'scrolled'"
207 '/// Check list of suggestions can be 'scrolled'
209 '/// input some test words with first 3 letters are same
210 '/// forward with <CTRL-Tab>
211 '/// backwards with <SHIFT-CTRL-Tab>
212 '/// endless loop test
214 'Delete all entries in the list
219 'forward with <CTRL-Tab>
221 Call wTypeKeys aTestWord(i)
222 Call wTypeKeys "<Return>"
227 Call wTypeKeys sPartOfTestWord
229 if i > 0 then Call wTypeKeys "<MOD1 TAB>", i
232 Call wTypeKeys "<Return>"
234 Call wTypeKeys "<Shift Home>"
238 if GetClipboardText <> aTestWord(i) then Warnlog "#102535# Should be " +aTestWord(i) +" but get " +GetClipboardText
239 Call wTypeKeys "<Delete>"
243 Call wTypeKeys sPartOfTestWord
244 Call wTypeKeys "<MOD1 TAB>", j+1
246 Call wTypeKeys "<Return>"
248 Call wTypeKeys "<Shift Home>"
252 if GetClipboardText <> aTestWord(0) then Warnlog "#102535# Should be " +aTestWord(0) +" but get " +GetClipboardText
253 Call wTypeKeys "<Delete>"
255 'backwards with <SHIFT-CTRL-Tab>
256 For i = j to 0 step -1
257 Call wTypeKeys sPartOfTestWord
259 Call wTypeKeys "<MOD1 TAB>", j
261 if i > 0 then Call wTypeKeys "<Shift MOD1 TAB>", i
264 Call wTypeKeys "<Return>"
266 Call wTypeKeys "<Shift Home>"
270 if GetClipboardText <> aTestWord(j-i) then Warnlog "#102535# Should be " +aTestWord(j-i) +" but get " +GetClipboardText
271 Call wTypeKeys "<Delete>"
275 Call wTypeKeys sPartOfTestWord
276 Call wTypeKeys "<Shift MOD1 TAB>"
278 Call wTypeKeys "<Return>"
280 Call wTypeKeys "<Shift Home>"
284 if GetClipboardText <> aTestWord(j) then Warnlog "#102535# Should be " +aTestWord(j) +" but get " +GetClipboardText
290 '-------------------------------------------------------------------------
292 testcase tToolsAutocorrectWordCompletion_4
294 Dim sDefaultMaxEntries as String
295 Dim sTestMaxEntries as String
296 Dim sTestFile as String
297 Dim iTestMaxEntries as Integer
299 sDefaultMaxEntries = "500"
300 sTestMaxEntries = "50"
301 sTestFile = "tToolsAutocorrectWordCompletion_4.sxw"
304 printLog "Test Max entries"
305 '/// Test Max entries
307 '/// Delete all entries in the list
308 '/// set Max entries to 50
309 '/// Open the test file ( The entries number is > 50 when Max entries is 500)
310 '/// check the number of entries.
312 'Delete all entries in the list
318 Active.Setpage TabWortergaenzung
319 Kontext "TabWortergaenzung"
320 MaxEintraege.SetText sTestMaxEntries
323 Call hFileOpen ( gTesttoolPath + "writer\optional\input\advanced\" + sTestFile )
327 Active.Setpage TabWortergaenzung
328 Kontext "TabWortergaenzung"
329 if GesammelteWorte.GetItemCount > iTestMaxEntries then Warnlog "Entries number should be less than " + iTestMaxEntries
332 MaxEintraege.SetText sDefaultMaxEntries
339 '-------------------------------------------------------------------------
341 testcase tToolsAutocorrectWordCompletion_5
343 Dim sTestWord1 as String
344 Dim sTestWord2 as String
345 Dim sTestWord3 as String
346 Dim iEntriesNumber_Checked as Integer
347 Dim iEntriesNumber_UnChecked as Integer
349 sTestWord1 = "kilometer "
350 sTestWord2 = "entertainment "
351 sTestWord3 = "education "
352 iEntriesNumber_Checked = 3
353 iEntriesNumber_UnChecked = 1
355 printLog "Check 'When closing a document, save the list for later use in other documents'"
356 '/// Check 'When closing a document, save the list for later use in other documents'
357 '/// delete all entries first.
358 '/// 1) check when the checkbox is checked
359 '/// a) Open a file, type "kilometer"
360 '/// b) Open 2nd file, type "entertainment" and "education"
361 '/// c) Close 2nd file, the number of entries in first file should be 3
362 '/// 2) check when the checkbox is Unchecked
363 '/// delete all entries , and Uncheck the testing checkbox
364 '/// a) Open a file, type "kilometer"
365 '/// b) Open 2nd file, type "entertainment" and "education"
366 '/// c) Close 2nd file, the number of entries in first file should be 1
368 'Test when checkbox is checkec -- default
373 'Delete all entries in the list
376 Call wTypeKeys sTestWord1
381 Call wTypeKeys sTestWord2
382 Call wTypeKeys sTestWord3
385 Active.Setpage TabWortergaenzung
386 Kontext "TabWortergaenzung"
387 if GesammelteWorte.GetItemCount <> iEntriesNumber_Checked then
388 Warnlog "Checked:Entries number should be equal " + iEntriesNumber_Checked + " in 2nd file ,but get " +GesammelteWorte.GetItemCount
390 TabWortergaenzung.Cancel
396 Active.Setpage TabWortergaenzung
397 Kontext "TabWortergaenzung"
398 if GesammelteWorte.GetItemCount <> iEntriesNumber_Checked then
399 Warnlog "Checked:Entries number should be equal " + iEntriesNumber_Checked + " in 1st file ,but get " +GesammelteWorte.GetItemCount
401 TabWortergaenzung.Cancel
405 'Test when checkbox is Unchecked
409 'Delete all entries in the list
413 Active.Setpage TabWortergaenzung
414 Kontext "TabWortergaenzung"
419 Call wTypeKeys sTestWord1
424 Call wTypeKeys sTestWord2
425 Call wTypeKeys sTestWord3
428 Active.Setpage TabWortergaenzung
429 Kontext "TabWortergaenzung"
430 if GesammelteWorte.GetItemCount <> iEntriesNumber_Checked then
431 Warnlog "UnChecked:Entries number should be equal " + iEntriesNumber_Checked + " in 2nd file ,but get " +GesammelteWorte.GetItemCount
433 TabWortergaenzung.Cancel
439 Active.Setpage TabWortergaenzung
440 Kontext "TabWortergaenzung"
441 if GesammelteWorte.GetItemCount <> iEntriesNumber_UnChecked then
442 Warnlog "UnChecked:Entries number should be equal " + iEntriesNumber_UnChecked + " in 2nd file ,but get " +GesammelteWorte.GetItemCount
444 TabWortergaenzung.Cancel
446 'Recover to the default
448 Active.Setpage TabWortergaenzung
449 Kontext "TabWortergaenzung"
458 '-------------------------------------------------------------------------
460 testcase tToolsAutocorrectWordCompletion_x
462 Dim sTestWord as String
463 Dim sPartOfTestWord as String
465 sTestWord = "StarOffice"
466 sPartOfTestWord = "Sta"
468 printLog "Check Show as Tip"
469 '/// Check Show as Tip
471 '/// When uncheck ( default) , the left word will be highlight
472 '/// When check , the left word will NOT be appeared, <--- can test
473 '/// and a help tip will appear <--- no way to test yet
475 'Show as Tip -- uncheck (default)
478 Call wTypeKeys sTestWord
479 Call wTypeKeys "<Return>"
481 Call wTypeKeys sPartOfTestWord
483 Call wTypeKeys "<Return>"
484 Call wTypeKeys "<Shift Home>"
487 Call wTypeKeys "StaS"
489 Call wTypeKeys "<Return>"