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 2000, 2010 Oracle and/or its affiliates.
7 ' OpenOffice.org - a multi-platform office productivity suite
9 ' This file is part of OpenOffice.org.
11 ' OpenOffice.org is free software: you can redistribute it and/or modify
12 ' it under the terms of the GNU Lesser General Public License version 3
13 ' only, as published by the Free Software Foundation.
15 ' OpenOffice.org is distributed in the hope that it will be useful,
16 ' but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ' GNU Lesser General Public License version 3 for more details
19 ' (a copy is included in the LICENSE file that accompanied this code).
21 ' You should have received a copy of the GNU Lesser General Public License
22 ' version 3 along with OpenOffice.org. If not, see
23 ' <http://www.openoffice.org/license.html>
24 ' for a copy of the LGPLv3 License.
26 '/************************************************************************
28 '* owner : thorsten.bosbach@oracle.com
30 '* short description : CJK Collation Dialogue Design Draft
32 '\***********************************************************************
34 testcase tLanguageTest_1
36 Dim sLanguageIDEnglishUSA ,sLanguageIDSChinese, sLanguageIDTChinese , sLanguageIDJapanese , sLanguageIDKoren as String
37 Dim sKeyTypeEnglishUSA ,sKeyTypeSChinese , sKeyTypeTChinese , sKeyTypeJapanese , sKeyTypeKoren as String
40 '/// Check if the default setting for "key type" is right for CJK when alphanumeric is chosen in English
43 case 01 :' English (USA)
44 sKeyTypeEnglishUSA = "Alphanumeric"
45 sKeyTypeSChinese = "Character set"
46 sKeyTypeTChinese = "Numeric"
47 sKeyTypeJapanese = "Character set"
48 sKeyTypeKoren = "Character set"
50 sKeyTypeEnglishUSA = "Alphanumerisch"
51 sKeyTypeSChinese = "Numerisch"
52 sKeyTypeTChinese = "Numerisch"
53 sKeyTypeJapanese = "Numerisch"
54 sKeyTypeKoren = "Numerisch"
56 sKeyTypeEnglishUSA = "Alfanumerično"
57 sKeyTypeSChinese = "Nabor znakov"
58 sKeyTypeTChinese = "Numerično"
59 sKeyTypeJapanese = "Nabor znakov"
60 sKeyTypeKoren = "Nabor znakov"
62 sKeyTypeEnglishUSA = "Alfanumérico"
63 sKeyTypeSChinese = "Conjunto de caracteres"
64 sKeyTypeTChinese = "numérico"
65 sKeyTypeJapanese = "Conjunto de caracteres"
66 sKeyTypeKoren = "Conjunto de caracteres"
68 sKeyTypeEnglishUSA = "英数字"
69 sKeyTypeSChinese = "ピンイン(中国語のローマ字表記法)"
70 sKeyTypeTChinese = "ピンイン(中国語のローマ字表記法)"
71 sKeyTypeJapanese = "数字"
74 ' sKeyTypeEnglishUSA = 1 'alphanumeric
75 ' sKeyTypeSChinese = 1 'Character set
76 ' sKeyTypeTChinese = 3 'Pin yin
77 ' sKeyTypeJapanese = 2 'Character set
78 ' sKeyTypeKoren = 3 'Character set
79 case 86 :' Chinese (simplified)
80 sKeyTypeEnglishUSA = "字母数字式"
81 sKeyTypeSChinese = "字符集"
82 sKeyTypeTChinese = "拼音"
83 sKeyTypeJapanese = "字符集"
85 case 88 :' Chinese (traditional)
86 sKeyTypeEnglishUSA = "字母數字式"
87 sKeyTypeSChinese = "字型"
88 sKeyTypeTChinese = "拼音"
89 sKeyTypeJapanese = "字型"
92 PrintLog "The test does not support the language " + iSprache
96 sLanguageIDEnglishUSA = fGetCountryName(01)
97 sLanguageIDSChinese = fGetCountryName(86)
98 sLanguageIDTChinese = fGetCountryName(88)
99 sLanguageIDJapanese = fGetCountryName(81)
100 sLanguageIDKoren = fGetCountryName(82)
104 DocumentWriter.TypeKeys "test"
105 DocumentWriter.TypeKeys "<Shift Home>"
112 '/// Choose language: English and key type: alphanumeric
114 Sprache.Select (sLanguageIDEnglishUSA)
116 qaErrorLog "Can't select: '" + sLanguageIDEnglishUSA + "'"
117 ' try fallback to 'English (USA)'
119 Sprache.Select ("English (USA)")
121 qaErrorLog "Can't select even tha fallback: 'English (USA)'"
125 Schluesseltyp1.Select sKeyTypeEnglishUSA
127 qaErrorLog "Can't select: '" + sKeyTypeEnglishUSA + "'"
128 ' try fallback to 'English (USA)'
129 for i = 1 to Schluesseltyp1.getItemCount
130 printlog "" + i + ": '" + Schluesseltyp1.getItemText(i) + "'"
134 '/// Check to simplified Chinese
136 Sprache.Select (sLanguageIDSChinese)
138 qaErrorLog "Can't select: '" + sLanguageIDSChinese + "'"
139 ' try fallback to 'Chinese (simplyfied)'
141 Sprache.Select ("Chinese (simplyfied)")
143 qaErrorLog "Can't select even tha fallback: 'Chinese (simplyfied)'"
149 Sprache.Select (sLanguageIDEnglishUSA)
151 qaErrorLog "Can't select: '" + sLanguageIDEnglishUSA + "'"
152 ' try fallback to 'English (USA)'
154 Sprache.Select ("English (USA)")
156 qaErrorLog "Can't select even tha fallback: 'English (USA)'"
160 Schluesseltyp1.Select sKeyTypeEnglishUSA
162 qaErrorLog "Can't select: '" + sKeyTypeEnglishUSA + "'"
165 '/// Check to traditional Chinese
167 Sprache.Select (sLanguageIDTChinese)
169 qaErrorLog "Can't select: '" + sLanguageIDTChinese + "'"
170 ' try fallback to 'Chinese (traditional)'
172 Sprache.Select ("Chinese (traditional)")
174 qaErrorLog "Can't select even tha fallback: 'Chinese (traditional)'"
175 for i = 1 to Sprache.getItemCount
176 printlog "("+i+"/"+ Sprache.getItemCount + "): '"+Sprache.getItemText(i)+"'"
183 Sprache.Select (sLanguageIDEnglishUSA)
185 qaErrorLog "Can't select: '" + sLanguageIDEnglishUSA + "'"
186 ' try fallback to 'English (USA)'
188 Sprache.Select ("English (USA)")
190 qaErrorLog "Can't select even tha fallback: 'English (USA)'"
194 Schluesseltyp1.Select sKeyTypeEnglishUSA
196 qaErrorLog "Can't select: '" + sKeyTypeEnglishUSA + "'"
199 '/// Check to Japanese
201 Sprache.Select (sLanguageIDJapanese)
203 qaErrorLog "Can't select: '" + sLanguageIDJapanese + "'"
204 ' try fallback to 'Japanese'
206 Sprache.Select ("Japanese")
208 qaErrorLog "Can't select even tha fallback: 'Japanese'"
212 if Schluesseltyp1.GetSelText <> sKeyTypeJapanese then
213 warnlog "The default key type for Japanese should be: '" + sKeyTypeJapanese + "' but is: '" + Schluesseltyp1.GetSelText + "'"
217 Sprache.Select (sLanguageIDEnglishUSA)
219 qaErrorLog "Can't select: '" + sLanguageIDEnglishUSA + "'"
220 ' try fallback to 'English (USA)'
222 Sprache.Select ("English (USA)")
224 qaErrorLog "Can't select even tha fallback: 'English (USA)'"
228 Schluesseltyp1.Select sKeyTypeEnglishUSA
230 qaErrorLog "Can't select: '" + sKeyTypeEnglishUSA + "'"
235 Sprache.Select (sLanguageIDKoren)
237 qaErrorLog "Can't select: '" + sLanguageIDKoren + "'"
238 ' try fallback to 'Korean (RoK)'
240 Sprache.Select ("Korean (RoK)")
242 qaErrorLog "Can't select even tha fallback: 'Korean (RoK)'"
243 for i = 1 to Sprache.getItemCount
244 printlog "("+i+"/"+ Sprache.getItemCount + "): '"+Sprache.getItemText(i)+"'"
249 if Schluesseltyp1.GetSelText <> sKeyTypeKoren then
250 warnlog "The default key type for Korean should be " + sKeyTypeKoren + " but get " + Schluesseltyp1.GetSelText
259 '-------------------------------------------------------------------------
261 testcase tLanguageTest_2
263 Dim sLanguageIDEnglishUSA ,sLanguageIDSChinese, sLanguageIDTChinese , sLanguageIDJapanese , sLanguageIDKoren as String
264 Dim sKeyTypeEnglishUSA ,sKeyTypeSChinese , sKeyTypeTChinese , sKeyTypeJapanese , sKeyTypeKoren as String
267 '/// Check if the default setting for "key type" is right for CJK when numeric is chosen in English
270 case 01 :' English (USA)
271 sKeyTypeEnglishUSA = "Numeric"
272 sKeyTypeSChinese = "Numeric"
273 sKeyTypeTChinese = "Numeric"
274 sKeyTypeJapanese = "Numeric"
275 sKeyTypeKoren = "Numeric"
277 sKeyTypeEnglishUSA = "Numerisch"
278 sKeyTypeSChinese = "Numerisch"
279 sKeyTypeTChinese = "Numerisch"
280 sKeyTypeJapanese = "Numerisch"
281 sKeyTypeKoren = "Numerisch"
283 sKeyTypeEnglishUSA = "Alfanumerično"
284 sKeyTypeSChinese = "Nabor znakov"
285 sKeyTypeTChinese = "Numerično"
286 sKeyTypeJapanese = "Nabor znakov"
287 sKeyTypeKoren = "Nabor znakov"
289 sKeyTypeEnglishUSA = "numérico"
290 sKeyTypeSChinese = "numérico"
291 sKeyTypeTChinese = "numérico"
292 sKeyTypeJapanese = "numérico"
293 sKeyTypeKoren = "numérico"
295 sKeyTypeEnglishUSA = "数字"
296 sKeyTypeSChinese = "数字"
297 sKeyTypeTChinese = "数字"
298 sKeyTypeJapanese = "数字"
301 ' sKeyTypeEnglishUSA = 2 'numeric
302 ' sKeyTypeSChinese = 4 'numeric
303 ' sKeyTypeTChinese = 4 'numeric
304 ' sKeyTypeJapanese = 4 'numeric
305 ' sKeyTypeKoren = 4 'numeric
306 case 86 :' Chinese (simplified)
307 sKeyTypeEnglishUSA = "数字"
308 sKeyTypeSChinese = "数字"
309 sKeyTypeTChinese = "数字"
310 sKeyTypeJapanese = "数字"
312 case 88 :' Chinese (traditional)
313 sKeyTypeEnglishUSA = "數字"
314 sKeyTypeSChinese = "數字"
315 sKeyTypeTChinese = "數字"
316 sKeyTypeJapanese = "數字"
318 case else :' Fallback
319 printLog "The test does not support the language " + iSprache
323 sLanguageIDEnglishUSA = fGetCountryName(01)
324 sLanguageIDSChinese = fGetCountryName(86)
325 sLanguageIDTChinese = fGetCountryName(88)
326 sLanguageIDJapanese = fGetCountryName(81)
327 sLanguageIDKoren = fGetCountryName(82)
331 DocumentWriter.TypeKeys "123"
332 DocumentWriter.TypeKeys "<Shift Home>"
339 '/// Choose language: English and key type: Numeric
341 Sprache.Select (sLanguageIDEnglishUSA)
343 qaErrorLog "Can't select: '" + sLanguageIDEnglishUSA + "'"
344 ' try fallback to 'English (USA)'
346 Sprache.Select ("English (USA)")
348 qaErrorLog "Can't select even tha fallback: 'English (USA)'"
349 for i = 1 to Sprache.getItemCount
350 printlog "" + i + ": '" + Sprache.getItemText(i) + "'"
355 Schluesseltyp1.Select sKeyTypeEnglishUSA
357 qaErrorLog "Can't select: '" + sKeyTypeEnglishUSA + "'"
358 ' try fallback to 'English (USA)'
359 for i = 1 to Schluesseltyp1.getItemCount
360 printlog "" + i + ": '" + Schluesseltyp1.getItemText(i) + "'"
364 '/// Check to simplified Chinese
366 Sprache.Select (sLanguageIDSChinese)
368 qaErrorLog "Can't select: '" + sLanguageIDSChinese + "'"
369 ' try fallback to 'Chinese (simplyfied)'
371 Sprache.Select ("Chinese (simplyfied)")
373 qaErrorLog "Can't select even tha fallback: 'Chinese (simplyfied)'"
377 if Schluesseltyp1.GetSelText <> sKeyTypeSChinese then
378 warnlog "The default key type for Simplified Chinese should be: '" + sKeyTypeSChinese + "' but is '" + Schluesseltyp1.GetSelText + "'"
382 Sprache.Select (sLanguageIDEnglishUSA)
384 qaErrorLog "Can't select: '" + sLanguageIDEnglishUSA + "'"
385 ' try fallback to 'English (USA)'
387 Sprache.Select ("English (USA)")
389 qaErrorLog "Can't select even tha fallback: 'English (USA)'"
393 Schluesseltyp1.Select sKeyTypeEnglishUSA
395 qaErrorLog "Can't select: '" + sKeyTypeEnglishUSA + "'"
398 '/// Check to traditional Chinese
400 Sprache.Select (sLanguageIDTChinese)
402 qaErrorLog "Can't select: '" + sLanguageIDTChinese + "'"
403 ' try fallback to 'Chinese (traditional)'
405 Sprache.Select ("Chinese (traditional)")
407 qaErrorLog "Can't select even tha fallback: 'Chinese (traditional)'"
411 if Schluesseltyp1.GetSelText <> sKeyTypeTChinese then
412 warnlog "The default key type for traditional Chinese should be " + sKeyTypeTChinese + " but get " + Schluesseltyp1.GetSelText
416 Sprache.Select (sLanguageIDEnglishUSA)
418 qaErrorLog "Can't select: '" + sLanguageIDEnglishUSA + "'"
419 ' try fallback to 'English (USA)'
421 Sprache.Select ("English (USA)")
423 qaErrorLog "Can't select even tha fallback: 'English (USA)'"
427 Schluesseltyp1.Select sKeyTypeEnglishUSA
429 qaErrorLog "Can't select: '" + sKeyTypeEnglishUSA + "'"
432 '/// Check to Japanese
434 Sprache.Select (sLanguageIDJapanese)
436 qaErrorLog "Can't select: '" + sLanguageIDJapanese + "'"
437 ' try fallback to 'Japanese'
439 Sprache.Select ("Japanese")
441 qaErrorLog "Can't select even tha fallback: 'Japanese'"
445 if Schluesseltyp1.GetSelText <> sKeyTypeJapanese then
446 warnlog "The default key type for Japanese should be: '" + sKeyTypeJapanese + "' but is: '" + Schluesseltyp1.GetSelText + "'"
450 Sprache.Select (sLanguageIDEnglishUSA)
452 qaErrorLog "Can't select: '" + sLanguageIDEnglishUSA + "'"
453 ' try fallback to 'English (USA)'
455 Sprache.Select ("English (USA)")
457 qaErrorLog "Can't select even tha fallback: 'English (USA)'"
461 Schluesseltyp1.Select sKeyTypeEnglishUSA
463 qaErrorLog "Can't select: '" + sKeyTypeEnglishUSA + "'"
468 Sprache.Select (sLanguageIDKoren)
470 qaErrorLog "Can't select: '" + sLanguageIDKoren + "'"
471 ' try fallback to 'Korean (RoK)'
473 Sprache.Select ("Korean (RoK)")
475 qaErrorLog "Can't select even tha fallback: 'Korean (RoK)'"
479 if Schluesseltyp1.GetSelText <> sKeyTypeKoren then
480 warnlog "The default key type for Korean should be " + sKeyTypeKoren + " but get " + Schluesseltyp1.GetSelText
488 '-------------------------------------------------------------------------
492 Dim testFile as String
493 Dim sLanguageIDSChinese as String
494 Dim sKeyTypeSChinese as String
495 Dim aCorrectSequence() as String
499 testFile = gTesttoolPath & "framework\optional\input\CJK\sortTest.sxw"
500 testFile = convertpath( testFile )
501 aCorrectSequence = Array( "1" , "2" , "3" , "4" ,"5" )
503 j = UBound(aCorrectSequence)
506 case 01 : ' English (USA)
507 sKeyTypeSChinese = "Stroke"
509 sKeyTypeSChinese = "Stroke"
510 case 50 : ' Slovenian
511 sKeyTypeSChinese = "Poteza"
512 case 55 : ' Brazilian
513 sKeyTypeSChinese = "Traço"
515 sKeyTypeSChinese = "総画数"
516 case 86 : ' Chinese (simplified)
517 sKeyTypeSChinese = "笔画"
518 case 88 : ' Chinese (simplified)
519 sKeyTypeSChinese = "筆畫"
520 case else : ' Fallback
521 printLog "Now, the test does not support for the language " +iSprache
525 sLanguageIDSChinese = fGetCountryName(86)
527 '/// Check Stroke sort for Simplified Chinese
530 '/// Open a test file and check <i>No Grid</i> checkbox
531 hFileOpenLocally( testfile )
532 hUseAsyncSlot( "EditSelectAll" )
534 '/// Open <i>Tools/Sort</i>
538 '/// Choose language: Simplified Chinese and key type <i>Stroke</i>
540 Sprache.Select (sLanguageIDSChinese)
542 qaErrorLog "Can't select: '" + sLanguageIDSChinese + "'"
543 ' try fallback to 'Chinese (simplyfied)'
545 Sprache.Select ("Chinese (simplyfied)")
547 qaErrorLog "Can't select even tha fallback: 'Chinese (simplyfied)'"
551 Schluesseltyp1.Select sKeyTypeSChinese
553 qaErrorLog "Can't select: '" + sKeyTypeSChinese + "'"
554 for i = 1 to Schluesseltyp1.getItemCount
555 printlog "" + i + ": '" + Schluesseltyp1.getItemText(i) + "'"
561 Kontext "DocumentWriter"
562 DocumentWriter.TypeKeys "<MOD1 Home>"
565 DocumentWriter.TypeKeys "<End>"
566 DocumentWriter.TypeKeys "<Shift Left>"
569 if GetClipboardText <> aCorrectSequence(i) then Warnlog "The Stroke sort is wrong , should be " + aCorrectSequence(i) + " ,but get " +GetClipboardText
571 DocumentWriter.TypeKeys "<Down>"
575 hFileDelete( gLastWorkFile )
579 '-------------------------------------------------------------------------
583 Dim testFile as String
584 Dim sLanguageIDSChinese as String
585 Dim sKeyTypeSChinese as String
586 Dim aCorrectSequence() as String
590 testFile = gTesttoolPath & "framework\optional\input\CJK\sortTest.sxw"
591 testFile = convertpath( testFile )
593 aCorrectSequence = Array( "2" , "3" , "4" , "1" , "5" )
595 j = UBound(aCorrectSequence)
598 case 01 : ' English (USA)
599 sKeyTypeSChinese = "Pinyin"
601 sKeyTypeSChinese = "Pinyin"
602 case 50 : ' Slovenian
603 sKeyTypeSChinese = "Pinjin"
604 case 55 : ' Brazilian
605 sKeyTypeSChinese = "Pinyin"
607 sKeyTypeSChinese = "ピンイン(中国語のローマ字表記法)"
608 case 86 : ' Chinese (simplified)
609 sKeyTypeSChinese = "拼音"
610 case 88 : ' Chinese (simplified)
611 sKeyTypeSChinese = "拼音"
612 case else : ' Fallback
613 printLog "Now, the test does not support for the language " +iSprache
617 sLanguageIDSChinese = fGetCountryName(86)
619 '/// Check <i>Pinyin</i> sort for Simplified Chinese
622 '/// Open a test file and check <i>No Grid</i> checkbox
623 hFileOpenLocally( testfile )
624 hUseAsyncSlot( "EditSelectAll" )
626 '/// Open <i>Tools/Sort</i>
630 '/// Choose language: Simplified Chinese and key type <i>Pin yin</i>
632 Sprache.Select (sLanguageIDSChinese)
634 qaErrorLog "Can't select: '" + sLanguageIDSChinese + "'"
635 ' try fallback to 'Chinese (simplyfied)'
637 Sprache.Select ("Chinese (simplyfied)")
639 qaErrorLog "Can't select even tha fallback: 'Chinese (simplyfied)'"
643 Schluesseltyp1.Select sKeyTypeSChinese
645 qaErrorLog "Can't select: '" + sKeyTypeSChinese + "'"
646 for i = 1 to Schluesseltyp1.getItemCount
647 printlog "" + i + ": '" + Schluesseltyp1.getItemText(i) + "'"
653 Kontext "DocumentWriter"
654 DocumentWriter.TypeKeys "<MOD1 Home>"
657 DocumentWriter.TypeKeys "<End>"
658 DocumentWriter.TypeKeys "<Shift Left>"
661 if GetClipboardText <> aCorrectSequence(i) then
662 Warnlog "The Pin yin sort is wrong, should be: '" + aCorrectSequence(i) + "' ,but is: '" +GetClipboardText + "'"
665 DocumentWriter.TypeKeys "<Down>"
669 hFileDelete( gLastWorkFile )
673 '-------------------------------------------------------------------------
675 testcase tSortOptionTest_1
678 Dim asList() as String
682 if iSystemSprache <> 81 then goto NOTest
683 asList = Array( "Sun,Mon,Tue,Wed,Thu,Fri,Sat" , "Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday" , "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec" , "January,February,March,April,May,June,July,August,September,October,November,December" , "日,月,火,水,木,金,土" , "日曜日,月曜日,火曜日,水曜日,木曜日,金曜日,土曜日" , )
685 if iSystemSprache <> 82 then goto NOTest
686 asList = Array( "일,월,화,수,목,금,토" ,"일요일,월요일,화요일,수요일,목요일,금요일,토요일" ,"1,2,3,4,5,6,7,8,9,10,11,12" , "日,月,火,水,木,金,土" , "日曜日,月曜日,火曜日,水曜日,木曜日,金曜日,土曜日" , )
687 case 86 :' Chinese (simplified)
688 if iSystemSprache <> 86 then goto NOTest
689 asList = Array( "日,一,二,三,四,五,六" , "星期日,星期一,星期二,星期三,星期四,星期五,星期六" , "一,二,三,四,五,六,七,八,九,十,十一,十二" , "一月,二月,三月,四月,五月,六月,七月,八月,九月,十月,十一月,十二月" , )
690 case 88 :' Chinese (traditional)
691 if iSystemSprache <> 88 then goto NOTest
692 asList = Array( "日,一,二,三,四,五,六" , "星期日,星期一,星期二,星期三,星期四,星期五,星期六" , "一,二,三,四,五,六,七,八,九,十,十一,十二" , "一月,二月,三月,四月,五月,六月,七月,八月,九月,十月,十一月,十二月" , )
693 case else :' Fallback
695 printLog "The test does not support for the language " +iSprache + " System language " + iSystemSprache
699 '/// Check if the entries in custom sort order is right in CJK version
703 '/// Open <i>Data/Sort</i> -> tabpage <i>option</i>
708 active.SetPage TabSortierenOptionen
709 Kontext "TabSortierenOptionen"
711 BenutzerdefinierteSortierreihenfolge.Check
713 For i = 1 to SortierreihenfolgeListe.GetItemCount
714 if SortierreihenfolgeListe.GetItemText(i) <> asList(i-1) then
715 warnlog "Should get " +asList(i) + " but get " +SortierreihenfolgeListe.GetItemText(i)
719 TabSortierenOptionen.Cancel
725 '----------------------------------------------------------------