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: hhConversion1.inc,v $
13 '* last change: $Author: vg $ $Date: 2008-08-18 12:29:51 $
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 Hangul/Hanja Conversion - 1
38 '************************************************************************
40 ' #1 tHHNoSelction_1 'No selection
41 ' #1 tHHNoSelction_2 'Multi languages -1 (Korean before Chinese)
42 ' #1 tHHNoSelction_3 'Multi languages -2 (Chinese before Korean)
43 ' #1 tHHNoSelction_4 'Multi languages -3 (no Chinese and Korean)
44 ' #1 tHHNoSelction_5 'Cursor's position is in the end of the document
45 ' #1 tHHNoSelction_6 'Notconvertible Hangul character
46 ' #1 tHHNoSelction_7 'Notconvertible Hanja character
47 ' #1 tHHSingleSelction_1 'Single selection
48 ' #1 tHHMultiSelction_1 'Multi selection
49 ' #1 tHHTextBox_1 'Hangul character in text box
50 ' #1 tHHDrawBox_1 'Hangul character in draw box
52 '\***********************************************************************
54 testcase tHHNoSelction_1
56 Dim sTestFile as String
59 sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\hangulhanjaonversion\hangul.sxw")
64 printlog "- No Selection "
65 '/// <b> If no selection is made in the document , </b>
66 '/// + <b> the Hangul/Hanja conversion will start </b>
67 '/// + <b> exactly at the cursor's location. </b>
71 '/// Open a test file , which includes some Korean characters
72 '/// + and some Chinese characters
73 Call hFileOpen(sTestFile)
75 '/// Set focus before the 3rd character
76 Call wTypeKeys "<MOD1 Home>"
77 Call wTypeKeys "<Down>"
79 '/// Tools / HangulHanjaConversion
80 ToolsLanguageHangulHanjaConversion
81 Kontext "HangulHanjaConversion"
83 '/// Press Peplace button
84 if Replace.IsEnabled then
87 Warnlog "Replace button is disabled !"
88 HangulHanjaConversion.Close
94 HangulHanjaConversion.Close
96 '/// Check if conversion really happens at cursor's location
97 Call wTypeKeys "<Home>"
98 Call wTypeKeys "<Shift Right>",2
102 Warnlog "#116346#Hangul/Hanja selection to begin of line impossible after closing hhc dialog"
103 Call wTypeKeys "<MOD1 Home>"
104 Call wTypeKeys "<Right>" , 4
105 Call wTypeKeys "<Shift Home>"
110 if GetClipboardText <> sResult then
111 Warnlog "Conversion result not: " & sResult & " but: " & GetClipboardText
118 '-----------------------------------------------------------------
120 testcase tHHNoSelction_2
122 Dim sTestFile as String
123 Dim sResult as String
125 sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\hangulhanjaonversion\multiLanguage_K.sxw")
126 sResult = "English sèction säction ピンイン Numérico 書翰中"
128 GetClipboardText = ""
130 printlog "- Multi languages -1 (Korean before Chinese) "
131 '/// <b> In multiple-script/language selections/words, </b>
132 '/// + <b> only the Korean and Chinese part will be selected for conversion.</b>
136 '/// Open a test file , which includes some English ,
137 '/// + Germany , French , Korean and Chinese characters
138 '/// + (Korean is before Chinese)
139 Call hFileOpen(sTestFile)
141 '/// Set focus to the beginning
142 Call wTypeKeys "<MOD1 Home>"
144 '/// Tools / HangulHanjaConversion
145 ToolsLanguageHangulHanjaConversion
146 Kontext "HangulHanjaConversion"
148 '/// Press Peplace button
149 if Replace.IsEnabled then
157 if HangulHanjaConversion.Exists then HangulHanjaConversion.Close
159 '/// Check if Korean is converted
160 Call wTypeKeys "<Home>"
161 Call wTypeKeys "<Shift End>"
164 if GetClipboardText <> sResult then
165 Warnlog "Conversion result not: " & sResult & " but: " & GetClipboardText
172 '-----------------------------------------------------------------
174 testcase tHHNoSelction_3
176 Dim sTestFile as String
177 Dim sResult as String
179 sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\hangulhanjaonversion\multiLanguage_C.sxw")
180 sResult = "English sèction säction ピンイン Numérico 중서한"
182 GetClipboardText = ""
184 printlog "- Multi languages -2 (Chinese before Korean) "
185 '/// <b> In multiple-script/language selections/words, </b>
186 '/// + <b> only the Korean and Chinese part will be selected for conversion.</b>
190 '/// Open a test file , which includes some English ,
191 '/// + Germany , French , Korean and Chinese characters
192 '/// + (Chinese is before Korean)
193 Call hFileOpen(sTestFile)
195 '/// Set focus to the beginning
196 Call wTypeKeys "<MOD1 Home>"
198 '/// Tools / HangulHanjaConversion
199 ToolsLanguageHangulHanjaConversion
200 Kontext "HangulHanjaConversion"
202 '/// Press Peplace button
203 if Replace.IsEnabled then
211 HangulHanjaConversion.Close
214 '/// Check if Chinese is converted
215 Call wTypeKeys "<Home>"
216 Call wTypeKeys "<Shift End>"
219 if GetClipboardText <> sResult then
220 Warnlog "Conversion result not: " & sResult & " but: " & GetClipboardText
227 '-----------------------------------------------------------------
229 testcase tHHNoSelction_4
231 Dim sTestFile as String
233 sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\hangulhanjaonversion\noKoreanAndChinese.sxw")
235 printlog "- Multi languages -3 (no Chinese and Korean) "
236 '/// <b> In multiple-script/language selections/words, </b>
237 '/// + <b> only the Korean and Chinese part will be selected for conversion.</b>
241 '/// Open a test file , which includes some English ,
242 '/// + Germany , French characters .
243 '/// + There are no Chinese and Korean
244 Call hFileOpen(sTestFile)
246 '/// Set focus to the beginning
247 Call wTypeKeys "<MOD1 Home>"
249 '/// Tools / HangulHanjaConversion ,
250 '/// + nothing should happen
251 ToolsLanguageHangulHanjaConversion
252 Kontext "HangulHanjaConversion"
254 if HangulHanjaConversion.Exists then
255 HangulHanjaConversion.Close
256 QAErrorlog "#i39017#Conversion dialog should NOT appear !"
263 '-----------------------------------------------------------------
265 testcase tHHNoSelction_5
267 Dim sTestFile as String
268 Dim sResult as String
270 sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\hangulhanjaonversion\hangul.sxw")
273 printlog "- Cursor's position is in the end of the document "
274 '/// <b> If the cursor resides at the end of a paragraph </b>
275 '/// + <b> the first available word/character in the file </b>
276 '/// + <b> will be chosen. </b>
280 '/// Open a test file , which includes some Chinese and Korean
281 Call hFileOpen(sTestFile)
283 '/// Set focus to the end of the file
284 Call wTypeKeys "<MOD1 End>"
286 '/// Tools / HangulHanjaConversion ,
287 ToolsLanguageHangulHanjaConversion
288 Kontext "HangulHanjaConversion"
290 if Word.GetText <> sResult then
291 Warnlog "Hope to get " & sResult & " but get " & Word.GetText
293 HangulHanjaConversion.Close
299 '-----------------------------------------------------------------
301 testcase tHHNoSelction_6
303 Dim sTestFile as String
304 Dim sResult as String
306 sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\hangulhanjaonversion\notConvertHangulHanja.sxw")
309 printlog "- notconvertible Hangul character"
310 '/// <b> When the Hangul conversion is invoked on </b>
311 '/// + <b> a notconvertible Hangul character , the </b>
312 '/// + <b> dialogue will start with with an empty suggestion </b>
313 '/// + <b> and the buttons "Replace" and "Always Replace" will be disabled </b>
317 '/// Open a test file , which includes some Chinese and Korean,
318 '/// + the 3rd character in 1st line isn't convertible
319 Call hFileOpen(sTestFile)
321 '/// Set focus to the 3rd character (korean)
322 Call wTypeKeys "<MOD1 Home>"
323 Call wTypeKeys "<Right>" , 2
325 '/// Tools / HangulHanjaConversion , Replace and Always Replace
326 '/// + should be disabled , "suggestion" should be empty .
327 '/// + Press Ignore button will jump to the next convertible Hangul/Hanja character
328 ToolsLanguageHangulHanjaConversion
329 Kontext "HangulHanjaConversion"
330 if Suggestions.GetItemCount <> 0 then
331 Warnlog "Suggestion should be empty !"
335 Warnlog "Replace button should NOT work !"
337 Warnlog "Always Replace button should NOT work !"
345 if HangulHanjaConversion.Exists then HangulHanjaConversion.Close
347 '/// Check if the result is correct
348 Call wTypeKeys "<MOD1 Home>"
349 Call wTypeKeys "<Shift End>"
352 if GetClipboardText <> sResult then
353 Warnlog "Conversion doesn't work well !"
360 '-----------------------------------------------------------------
362 testcase tHHNoSelction_7
364 Dim sTestFile as String
365 Dim sResult as String
367 sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\hangulhanjaonversion\notConvertHangulHanja.sxw")
370 printlog "- notconvertible Hangul character"
371 '/// <b> When the Hanja conversion is invoked on </b>
372 '/// + <b> a notconvertible Hanja character the </b>
373 '/// + <b> dialogue will start with with an empty suggestion </b>
374 '/// + <b> and the buttons "Replace" and "Always Replace" will be disabled </b>
378 '/// Open a test file , which includes some Chinese and Korean,
379 '/// + the 3rd character in 2nd line isn't convertible
380 Call hFileOpen(sTestFile)
382 '/// Set focus to the 3rd chinese character
383 Call wTypeKeys "<MOD1 Home><Down><Home>"
384 Call wTypeKeys "<Right>" , 2
386 '/// Tools / HangulHanjaConversion ,
387 '/// + Press Peplace button
388 '/// Tools / HangulHanjaConversion , Replace and Always Replace
389 '/// + should be disabled , "suggestion" should be empty .
390 '/// + Press Ignore button will jump to the next convertible Hangul/Hanja character
391 ToolsLanguageHangulHanjaConversion
392 Kontext "HangulHanjaConversion"
393 if Suggestions.GetItemCount <> 0 then
394 Warnlog "Suggestion should be empty !"
398 Warnlog "Replace button should NOT work !"
400 Warnlog "Always Replace button should NOT work !"
408 HangulHanjaConversion.Close
410 '/// Check if the result is correct
411 Call wTypeKeys "<Home>"
412 Call wTypeKeys "<Shift End>"
415 if GetClipboardText <> sResult then
416 Warnlog "Conversion doesn't work well !"
423 '-----------------------------------------------------------------
425 testcase tHHSingleSelction_1
427 Dim sTestFile as String
428 Dim sResult as String
430 sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\hangulhanjaonversion\notConvertHangulHanja.sxw")
434 printlog "- Single selection"
435 '/// <b> Single selection </b>
436 '/// <b> Depending on the replacement setting </b>
437 '/// + <b>(by word or by character) progressing </b>
438 '/// + <b>(step by step) suggestions will be made </b>
439 '/// + <b> until the end of selection. </b>
443 '/// Open a test file , which includes some Chinese and Korean
444 Call hFileOpen(sTestFile)
446 '/// Select from 4th to 7th character
447 Call wTypeKeys "<MOD1 Home>"
448 Call wTypeKeys "<Right>" , 3
449 Call wTypeKeys "<Shift Right>" , 4
451 '/// Tools / HangulHanjaConversion ,
452 '/// + Press Peplace button
453 ToolsLanguageHangulHanjaConversion
454 Kontext "HangulHanjaConversion"
455 if Replace.IsEnabled then
464 '/// Check if the result is correct
465 Call wTypeKeys "<MOD1 Home>"
466 Call wTypeKeys "<Shift End>"
469 if GetClipboardText <> sResult then
470 Warnlog "Conversion result not: " & sResult & " but: " & GetClipboardText
473 Warnlog "Replace-Button is disabled!"
481 '----------------------------------------------------------------
483 testcase tHHMultiSelction_1
485 Dim sTestFile as String
486 Dim sResult as String
487 Dim sMultiWord as String
489 sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\hangulhanjaonversion\multiSelection.sxw")
490 sResult = "를入力를에서한자와기호를入力"
493 printlog "- Multi selection"
494 '/// <b> Multi selection </b>
495 '/// <b> conversion will jump after finishing </b>
496 '/// + <b> selection to next selection until end. </b>
500 '/// Open a test file , which includes some Korean chacters
501 Call hFileOpen(sTestFile)
503 '/// Do a multi Selectiong to the charcters -- 입력
504 Call fFindWord(sMultiWord)
506 '/// Tools / HangulHanjaConversion ,
507 '/// + Press Peplace button
508 ToolsLanguageHangulHanjaConversion
509 Kontext "HangulHanjaConversion"
515 '/// Check if the result is correct
516 Call wTypeKeys "<MOD1 Home>"
517 Call wTypeKeys "<Shift End>"
520 if GetClipboardText <> sResult then
521 Warnlog "Conversion doesn't work well !"
528 '----------------------------------------------------------------
530 testcase tHHTextBox_1
532 Dim sTestFile as String
534 sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\hangulhanjaonversion\textBox.sxw")
536 printlog "- Hangul character in text box"
537 '/// <b> Hangul character in text box </b>
541 '/// Open a test file , which includes a text box and
542 '/// + some Korean chacters in the text box
543 Call hFileOpen(sTestFile)
545 '/// Tools / HangulHanjaConversion , the below 4 checkboxes ralated
546 '/// + ruby should be disabled .
547 '/// -> 'Hanja As Ruby Above Hangul'
548 '/// -> 'Hanja As Ruby Below Hangul'
549 '/// -> 'Hangul As Ruby Above Hanja'
550 '/// -> 'Hangul As Ruby Below Hanja'
552 ToolsLanguageHangulHanjaConversion
553 Kontext "HangulHanjaConversion"
554 if NOT HangulHanjaConversion.Exists then
555 Warnlog "Hangul/Hanja Conversion dialogue isn't poped up !"
560 Warnlog "- Format / HangulHanjaConversion is disabled or hidden!"
566 HanjaAsRubyAbove.Check
567 Warnlog "'Hanja As Ruby Above Hangul' should be disabled!"
572 HanjaAsRubyBelow.Check
573 Warnlog "'Hanja As Ruby Below Hangul' should be disabled!"
578 HangulAsRubyAbove.Check
579 Warnlog "'Hangul As Ruby Above Hanja' should be disabled!"
584 HangulAsRubyBelow.Check
585 Warnlog "'Hangul As Ruby Below Hanja' should be disabled!"
589 HangulHanjaConversion.Close
596 '----------------------------------------------------------------
598 testcase tHHDrawBox_1
600 Dim sTestFile as String
602 sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\hangulhanjaonversion\drawBox.sxw")
604 printlog "- Hangul character in draw box"
605 '/// <b> Hangul character in draw box </b>
609 '/// Open a test file , which includes a draw box and
610 '/// + some Korean chacters in the text box
611 Call hFileOpen(sTestFile)
613 '/// Tools / HangulHanjaConversion , the below 4 checkboxes ralated
614 '/// + ruby should be disabled .
615 '/// -> 'Hanja As Ruby Above Hangul'
616 '/// -> 'Hanja As Ruby Below Hangul'
617 '/// -> 'Hangul As Ruby Above Hanja'
618 '/// -> 'Hangul As Ruby Below Hanja'
620 ToolsLanguageHangulHanjaConversion
621 Kontext "HangulHanjaConversion"
622 if NOT HangulHanjaConversion.Exists then
623 Warnlog "Hangul/Hanja Conversion dialogue isn't poped up !"
628 Warnlog "- Format / HangulHanjaConversion is disabled or hidden!"
634 HanjaAsRubyAbove.Check
635 Warnlog "'Hanja As Ruby Above Hangul' should be disabled!"
640 HanjaAsRubyBelow.Check
641 Warnlog "'Hanja As Ruby Below Hangul' should be disabled!"
646 HangulAsRubyAbove.Check
647 Warnlog "'Hangul As Ruby Above Hanja' should be disabled!"
652 HangulAsRubyBelow.Check
653 Warnlog "'Hangul As Ruby Below Hanja' should be disabled!"
657 HangulHanjaConversion.Close