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_sorting2.inc,v $
13 '* last change: $Author: vg $ $Date: 2008-08-18 12:36:02 $
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 : Sort functionality test
38 '************************************************************************
43 '\***********************************************************************
47 Dim contentInTable() as String
50 Dim sKeyType as String
51 Dim sLanguage as String
52 Dim TestFile as string
54 if iSprache <> 01 then
55 QaErrorLog "Aborting test since this test currently only work with English."
59 PrintLog "- Tools / Sorting in table - Ascending mode "
63 PrintLog "- 1.test for Alphanumeric"
64 contentInTable = Array( _
65 "FIRST NAME", "LAST NAME", "PHONE HOME", "PHONE WORK" , _
66 "Alan" , "Brown" , "212121" , "(407) 555-5454" , _
67 "Julie" , "Clark" , "321123" , "(040) 555-007" , _
68 "Patricia" , "Fisher" , "121212" , "(202) 555-4455" , _
69 "Peter" , "Arnold" , "432104" , "(212) 555-9876 Ext. 543" , _
71 TestFile = gTesttoolPath & "writer\optional\input\sorting\phonelist.odt"
72 sKeyType = fGetKeyType(01)
73 sLanguage = fGetCountryName(01)
75 PrintLog "- 2.test for Phonebook"
76 contentInTable = Array( _
77 "FIRST NAME", "LAST NAME", "PHONE HOME", "PHONE WORK" , _
78 "Alan" , "Brown" , "212121" , "(407) 555-5454" , _
79 "Julie" , "Clark" , "321123" , "(040) 555-007" , _
80 "Patricia" , "Fisher" , "121212" , "(202) 555-4455" , _
81 "Peter" , "Arnold" , "432104" , "(212) 555-9876 Ext. 543" , _
83 TestFile = gTesttoolPath + "writer\optional\input\sorting\phonelist.odt"
84 sKeyType = fGetKeyType(49)
85 sLanguage = fGetCountryName(49)
87 PrintLog "- 3.test for pinyin"
88 contentInTable = Array( _
89 "姓名" , "电话(家)" , "电话(单位)" , _
90 "钱二" , "212121" , "(407) 555-5454" , _
91 "孙三" , "432104" , "(212) 555-9876 Ext. 543" , _
92 "张四" , "321123" , "(040) 555-007" , _
93 "赵一" , "121212" , "(202) 555-4455" , _
95 TestFile = gTesttoolPath + "writer\optional\input\sorting\phonelist_sc.odt"
96 sKeyType = fGetKeyType(86)
97 sLanguage = fGetCountryName(86)
101 printlog " open a test file"
102 Call hFileOpen ( TestFile )
103 Call sMakeReadOnlyDocumentEditable
105 printlog " select all table"
106 Call wTypeKeys "<Mod1 a>", 2
108 printlog " Tools/Sort , choose Ascending mode"
109 printlog " choose English in language and Alphanumeric in keytype"
112 Sprache.Select sLanguage
115 Schluesseltyp1.Select sKeyType
122 Call wTypeKeys "<Mod1 a>" ,2
124 For i = 0 to UBound(contentInTable)
125 Call wTypeKeys "<Mod1 a>"
128 if GetClipboardText <> contentInTable(i) then
129 Warnlog "The content in table is Wrong! We hope to get " + contentInTable(i) + " But get " + GetClipboardText
131 Call wTypeKeys "<Escape><TAB>"
138 '-------------------------------------------------------------------------
142 Dim contentInTable() as String
145 Dim sKeyType as String
146 Dim sLanguage as String
147 Dim TestFile as string
149 if iSprache <> 01 then
150 QaErrorLog "Aborting test since this test currently only work with English."
154 PrintLog "- Tools / Sorting in table - Descending mode "
158 PrintLog "- 1.test for Alphanumeric"
159 contentInTable = Array( _
160 "FIRST NAME", "LAST NAME", "PHONE HOME", "PHONE WORK" , _
161 "Peter" , "Arnold" , "432104" , "(212) 555-9876 Ext. 543" , _
162 "Patricia" , "Fisher" , "121212" , "(202) 555-4455" , _
163 "Julie" , "Clark" , "321123" , "(040) 555-007" , _
164 "Alan" , "Brown" , "212121" , "(407) 555-5454" , _
166 TestFile = gTesttoolPath & "writer\optional\input\sorting\phonelist.odt"
167 sKeyType = fGetKeyType(01)
168 sLanguage = fGetCountryName(01)
170 PrintLog "- 2.test for Phonebook"
171 contentInTable = Array( _
172 "FIRST NAME", "LAST NAME", "PHONE HOME", "PHONE WORK" , _
173 "Peter" , "Arnold" , "432104" , "(212) 555-9876 Ext. 543" , _
174 "Patricia" , "Fisher" , "121212" , "(202) 555-4455" , _
175 "Julie" , "Clark" , "321123" , "(040) 555-007" , _
176 "Alan" , "Brown" , "212121" , "(407) 555-5454" , _
178 TestFile = gTesttoolPath + "writer\optional\input\sorting\phonelist.odt"
179 sKeyType = fGetKeyType(49)
180 sLanguage = fGetCountryName(49)
182 PrintLog "- 3.test for pinyin"
183 contentInTable = Array( _
184 "姓名" , "电话(家)" , "电话(单位)" , _
185 "赵一" , "121212" , "(202) 555-4455" , _
186 "张四" , "321123" , "(040) 555-007" , _
187 "孙三" , "432104" , "(212) 555-9876 Ext. 543" , _
188 "钱二" , "212121" , "(407) 555-5454" , _
190 TestFile = gTesttoolPath + "writer\optional\input\sorting\phonelist_sc.odt"
191 sKeyType = fGetKeyType(86)
192 sLanguage = fGetCountryName(86)
195 printlog " open a test file"
196 Call hFileOpen ( TestFile )
197 Call sMakeReadOnlyDocumentEditable
199 printlog " select all table"
200 Call wTypeKeys "<Mod1 a>", 2
202 printlog " Tools/Sort , choose Ascending mode."
203 printlog " choose English in language and Alphanumeric in keytype."
206 Sprache.Select sLanguage
209 Schluesseltyp1.Select sKeyType
216 Call wTypeKeys "<Mod1 a>" ,2
218 For i = 0 to UBound(contentInTable)
219 Call wTypeKeys "<Mod1 a>"
222 if GetClipboardText <> contentInTable(i) then
223 Warnlog "The content in table is Wrong! We hope to get " + contentInTable(i) + " But get " + GetClipboardText
225 Call wTypeKeys "<Escape><TAB>"
232 '--------------------------------------------------------------
234 function fGetCountryName( CountryID as Integer ) as String
237 case 01 : ' English (USA)
238 select case CountryID
239 case 1: fGetCountryName = "English (USA)"
240 case 49: fGetCountryName = "German (Germany)"
241 case 86: fGetCountryName = "Chinese (simplified)"
243 QAErrorLog "Now, the test does not support for the language " +iSprache
248 select case CountryID
249 case 1: fGetCountryName = "Engels (VS)"
250 case 49: fGetCountryName = "Duits (Duitsland)"
251 case 86: fGetCountryName = "Chinees (vereenvoudigd)"
253 QAErrorLog "Now, the test does not support for the language " +iSprache
258 select case CountryID
259 case 1: fGetCountryName = "Englisch (USA)"
260 case 49: fGetCountryName = "Deutsch (Deutschland)"
261 case 86: fGetCountryName = "Chinesisch (einfach)"
263 QAErrorLog "Now, the test does not support for the language " +iSprache
267 select case CountryID
268 case 1: fGetCountryName = "英語(米国)"
269 case 49: fGetCountryName = "ドイツ語(ドイツ)"
270 case 86: fGetCountryName = "中国語(簡体字)"
272 QAErrorLog "Now, the test does not support for the language " +iSprache
276 case 86 : ' Chinese (simplified)
277 select case CountryID
278 case 1: fGetCountryName = "英语(美国)"
279 case 49: fGetCountryName = "德语(德国)"
280 case 86: fGetCountryName = "中文(简体字)"
282 QAErrorLog "Now, the test does not support for the language " +iSprache
286 case 88 : ' Chinese (traditional)
287 select case CountryID
288 case 1: fGetCountryName = "英語(美國)"
289 case 49: fGetCountryName = "德語(德國)"
290 case 86: fGetCountryName = "中文(簡體字)"
292 QAErrorLog "Now, the test does not support for the language " +iSprache
295 case else : ' Fallback
296 QAErrorLog "Now, the test does not support for the language " +iSprache
301 '-------------------------------------------------------
303 function fGetKeyType( KeyType as Integer ) as String
308 case 1: fGetKeyType = "Alphanumeric"
309 case 49: fGetKeyType = "Phone book"
310 case 86: fGetKeyType = "Pinyin"
312 QAErrorLog "Now, the test does not support for the language " +iSprache
318 case 1: fGetKeyType = "英数字"
319 case 49: fGetKeyType = "電話帳"
320 case 86: fGetKeyType = "ピンイン(中国語のローマ字表記法)"
322 QAErrorLog "Now, the test does not support for the language " +iSprache
326 case 86 :' Chinese (simplified)
328 case 1: fGetKeyType = "字母数字式"
329 case 49: fGetKeyType = "电话簿"
330 case 86: fGetKeyType = "拼音"
332 QAErrorLog "Now, the test does not support for the language " +iSprache
336 case 88 :' Chinese (traditional)
338 case 1: fGetKeyType = "字母數字式"
339 case 49: fGetKeyType = "電話簿"
340 case 86: fGetKeyType = "拼音"
342 QAErrorLog "Now, the test does not support for the language " +iSprache
346 case else :' Fallback
347 QAErrorLog "The test does not support the language " + iSprache