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_chinesetranslate1.inc,v $
13 '* last change: $Author: vg $ $Date: 2008-08-18 12:24:05 $
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 : Chinese Translation test
38 '************************************************************************
40 ' #1 tDefaultSetting_1 'Default settings for different Chinese language
41 ' #1 tDefaultSetting_2 'Default settings
42 ' #1 tDefaultSetting_3 'Cursor's position
43 ' #1 tChineseTranslate_1 'Translation for selected text
44 ' #1 tChineseTranslate_2 'Translation for NO-selected document
45 ' #1 tChineseTranslate_3 'Translation direction : T Chinese to S Chinese
46 ' #1 tChineseTranslate_4 'Translation direction : S Chinese to T Chinese
47 ' #1 tChineseTranslate_5 ''Use Taiwan , Hongkong SAR...'s statue
50 '\***********************************************************************
52 testcase tDefaultSetting_1
54 printlog "Default settings for different Chinese language"
58 printlog " Set default language(asian) for document is 'Simplified Chinese'"
59 fSetAsian(fGetLanguageName(86))
61 printlog " Tools/language / Chinese translation"
62 ToolsLanguageChineseTranslation
63 Kontext "ChineseTranslation"
65 printlog " 'Traditional Chinese to Simplified Chinese' should be Checked by default"
66 if NOT TChineseToSChinese.IsChecked then
67 Warnlog "'Traditional Chinese to Simplified Chinese' should be Checked by default !"
69 ChineseTranslation.Cancel
71 printlog " Set default language(asian) for document is 'Traditional Chinese'"
72 fSetAsian(fGetLanguageName(88))
74 printlog " Tools/language / Chinese translation"
75 ToolsLanguageChineseTranslation
76 Kontext "ChineseTranslation"
78 printlog " 'Simplified Chinese to Traditional Chinese' should be Checked by default"
79 if NOT SChineseToTChinese.IsChecked then
80 QAErrorlog "#i96768# 'Simplified Chinese to Traditional Chinese' should be Checked by default !"
82 ChineseTranslation.Cancel
87 '-----------------------------------------------------------------
89 testcase tDefaultSetting_2
91 printlog "Default settings "
95 fSetAsian(fGetLanguageName(86))
97 printlog " Tools/language / Chinese translation"
98 ToolsLanguageChineseTranslation
99 Kontext "ChineseTranslation"
101 ' printlog " Use Taiwan,Hongkong SAR , and Macao SAR character variants"
102 ' printlog " + should NOT be Checked by default"
103 ' if UseSARCharacter.IsChecked then
104 ' Warnlog "'Use Taiwan,Hongkong SAR , and Macao SAR character variants' should NOT be Checked by default !"
107 printlog " 'Common Terms' should NOT be Checked by default"
108 if TranslateCommonTerms.IsChecked then
109 Warnlog "'Common Terms' should NOT be Checked by default !"
112 printlog " Click 'Edit terms' button"
114 Kontext "ChineseDictionary"
116 printlog " 'Traditional Chinese to Simplified Chinese' should be Checked by default"
117 if NOT TChineseToSChinese.IsChecked then
118 Warnlog "'Traditional Chinese to Simplified Chinese' should be Checked by default !"
121 printlog " 'Reverse mapping' should NOT be Checked by default"
122 if ReverseMapping.IsChecked then
123 Warnlog "'Reverse mapping' should NOT be Checked by default !"
126 printlog " 'Property' should be 'other' by default"
127 if Property.GetSelIndex <> 1 then
128 Warnlog "'Property' should be 'Other' by default !"
130 ChineseDictionary.Cancel
132 Kontext "ChineseTranslation"
133 ChineseTranslation.Cancel
138 '-----------------------------------------------------------------
140 testcase tDefaultSetting_3
142 Dim sChinese as String
143 Dim sExpect as String
148 printlog "Cursor position"
152 fSetAsian(fGetLanguageName(86))
154 printlog " Input some chinese and set cursor in the beginning"
155 Call wTypeKeys sChinese
156 Call wTypeKeys "<Home>"
158 printlog " Tools/language / Chinese translation , check"
159 printlog " + 'Simplified Chinese to Traditional Chinese', press OK"
160 ToolsLanguageChineseTranslation
161 Kontext "ChineseTranslation"
162 SChineseToTChinese.Check
163 ChineseTranslation.OK
165 printlog " Check if the cursor's position is changed -- Should NOT"
166 Call wTypeKeys "<Shift Right>"
169 if GetClipboardText <> sExpect then
170 Warnlog "Hope to get " & sExpect & " but get " & GetClipboardText
173 Warnlog "Cursor's position is changed - 117787"
179 '-----------------------------------------------------------------
181 testcase tChineseTranslate_1
183 Dim sChinese as String
184 Dim sExpect as String
189 printlog "Translation for selected text"
193 fSetAsian(fGetLanguageName(86))
195 printlog " Input some chinese and select part of input"
196 Call wTypeKeys sChinese
197 Call wTypeKeys "<Home>"
198 Call wTypeKeys "<Shift Right>" , 2
200 printlog " Tools/language / Chinese translation , check"
201 printlog " + 'Simplified Chinese to Traditional Chinese', press OK"
202 ToolsLanguageChineseTranslation
203 Kontext "ChineseTranslation"
204 SChineseToTChinese.Check
205 ChineseTranslation.OK
207 printlog " Check if the only selected text is translated -- Should be"
208 Call wTypeKeys "<Home>"
209 Call wTypeKeys "<Shift End>"
211 if GetClipboardText <> sExpect then
212 Warnlog "Hope to get " & sExpect & " but get " & GetClipboardText
218 '-----------------------------------------------------------------
220 testcase tChineseTranslate_2
222 Dim sChinese as String
223 Dim sExpect as String
228 printlog "Translation for NO-selected document"
232 fSetAsian(fGetLanguageName(86))
234 printlog " Input some chinese"
235 Call wTypeKeys sChinese
237 printlog " Tools/language / Chinese translation , check"
238 printlog " + 'Simplified Chinese to Traditional Chinese' , press OK"
239 ToolsLanguageChineseTranslation
240 Kontext "ChineseTranslation"
241 SChineseToTChinese.Check
242 ChineseTranslation.OK
244 printlog " Check if all document is translated -- Should"
245 Call wTypeKeys "<Home>"
246 Call wTypeKeys "<Shift End>"
248 if GetClipboardText <> sExpect then
249 Warnlog "Hope to get " & sExpect & " but get " & GetClipboardText
255 '-----------------------------------------------------------------
257 testcase tChineseTranslate_3
259 Dim sChinese as String
260 Dim sExpect as String
265 printlog "Translation direction : T Chinese to S Chinese"
269 fSetAsian(fGetLanguageName(88))
271 printlog " Input some chinese , include some"
272 printlog " + tradition chinese and simplified chinese"
273 Call wTypeKeys sChinese
275 printlog " Tools/language / Chinese translation , check"
276 printlog " + 'Traditional Chinese to Simplified Chinese' , press OK"
277 ToolsLanguageChineseTranslation
278 Kontext "ChineseTranslation"
279 TChineseToSChinese.Check
280 ChineseTranslation.OK
282 printlog " Check if only traditional chinese is translated -- Should"
283 Call wTypeKeys "<Home>"
284 Call wTypeKeys "<Shift End>"
286 if GetClipboardText <> sExpect then
287 Warnlog "Hope to get " & sExpect & " but get " & GetClipboardText
293 '-----------------------------------------------------------------
295 testcase tChineseTranslate_4
297 Dim sChinese as String
298 Dim sExpect as String
303 printlog "Translation direction : S Chinese to T Chinese"
307 fSetAsian(fGetLanguageName(86))
309 printlog " Input some chinese , include some"
310 printlog " + tradition chinese and simplified chinese"
311 Call wTypeKeys sChinese
313 printlog " Tools/language / Chinese translation , check"
314 printlog " + 'Simplified Chinese to Traditional Chinese' , press OK"
315 ToolsLanguageChineseTranslation
316 Kontext "ChineseTranslation"
317 SChineseToTChinese.Check
318 ChineseTranslation.OK
320 printlog " Check if only simplified chinese is translated -- Should"
321 Call wTypeKeys "<Home>"
322 Call wTypeKeys "<Shift End>"
324 if GetClipboardText <> sExpect then
325 Warnlog "Hope to get " & sExpect & " but get " & GetClipboardText
331 '-----------------------------------------------------------------
333 testcase tChineseTranslate_5
334 if bAsianLan <> True then
335 'This testcase might only run with 'Use Taiwan , Hongkong SAR...'s status.
336 QaErrorLog "Testing with Asian languages only"
340 printlog "'Use Taiwan , Hongkong SAR...'s statue"
344 fSetAsian(fGetLanguageName(88))
346 printlog " Tools/language / Chinese translation"
347 printlog " Check Traditional Chinese to Simplified Chinese"
348 printlog " + 'Use Taiwan , Hongkong SAR...' should be disabled"
349 ToolsLanguageChineseTranslation
350 Kontext "ChineseTranslation"
351 TChineseToSChinese.Check
353 UseSARCharacter.Check
354 Warnlog "'Use Taiwan , Hongkong SAR and ...' should be disabled !"
358 printlog " Check Simplified Chinese to Traditional Chinese"
359 printlog " + 'Use Taiwan , Hongkong SAR...' should be enabled"
360 SChineseToTChinese.Check
362 UseSARCharacter.Check
364 Warnlog "'Use Taiwan , Hongkong SAR and ...' should be enabled !"
367 printlog " UnCheck 'Use Taiwan , Hongkong SAR...'"
368 UseSARCharacter.UnCheck
370 printlog " Check Translate Common Terms"
371 TranslateCommonTerms.Check
373 printlog " 'Use Taiwan , Hongkong SAR...' should be checked automatically"
374 if NOT UseSARCharacter.IsChecked then
375 Warnlog "'Use Taiwan , Hongkong SAR and ...' should be checked !"
377 ChineseTranslation.OK
379 printlog " Close the dialog and reopen it"
380 printlog " 'Use Taiwan , Hongkong SAR...' and 'Translate Common Terms'"
381 printlog " + should be checked"
382 ToolsLanguageChineseTranslation
383 Kontext "ChineseTranslation"
384 if NOT UseSARCharacter.IsChecked then
385 Warnlog "'Use Taiwan , Hongkong SAR and ...' should be checked ! - 117802 "
387 if NOT TranslateCommonTerms.IsChecked then
388 Warnlog "'Translate common terms' should be checked ! - 117802 "
390 ChineseTranslation.Cancel
395 '-----------------------------------------------------------------
397 function fSetAsian(sAsian as String) as String
399 'This function is set CJK language in Tools/Options/Language Settings / Languages
401 Call hToolsOptions("LANGUAGESETTINGS","LANGUAGES")
402 fSetAsian = Asiatisch.GetSelText
403 if sAsian = "Null" then
407 Asiatisch.Select sAsian
411 Kontext "ExtrasOptionenDlg"