summaryrefslogtreecommitdiff
path: root/testautomation/writer/optional/includes/fields/w_fields7.inc
blob: 70dfedc620855af905dd16ed313f1b4aed61394d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
'encoding UTF-8  Do not remove or change this line!
'**************************************************************************
' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
'
' Copyright 2000, 2010 Oracle and/or its affiliates.
'
' OpenOffice.org - a multi-platform office productivity suite
'
' This file is part of OpenOffice.org.
'
' OpenOffice.org is free software: you can redistribute it and/or modify
' it under the terms of the GNU Lesser General Public License version 3
' only, as published by the Free Software Foundation.
'
' OpenOffice.org is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
' GNU Lesser General Public License version 3 for more details
' (a copy is included in the LICENSE file that accompanied this code).
'
' You should have received a copy of the GNU Lesser General Public License
' version 3 along with OpenOffice.org.  If not, see
' <http://www.openoffice.org/license.html>
' for a copy of the LGPLv3 License.
'
'/************************************************************************
'*
'* owner : helge.delfs@sun.com
'*
'* short description : Fields - L10N test
'*
'\***********************************************************************

sub w_fields7

    Call tL10NtestAboveBelow
    Call tL10NtestDate
    Call tL10NtestTime

end sub

'-----------------------------------------------------------------

testcase tL10NtestAboveBelow

    if iSprache <> 1 then
        QaErrorLog "Currently no any other language than English. Aborting."
        exit sub
    end if
    
    Dim sTestFile as String
    Dim sAbove() as String
    Dim sBelow() as String
    Dim iCountry() as Integer
    Dim i as Integer
    Dim j as Integer
    
    Dim sUILanguage as integer, sLocale as integer
    Dim sCurrency as integer, sWestern as integer, sAsian as integer, sCTL as integer
    Dim sAsiancb as boolean, sCTLcb as boolean
    Dim sAsiancbChecked as boolean, sCTLcbChecked as boolean
    
    if iSprache <> 01 then
        QAErrorlog "This is a English-only testcase"
    end if
    
    Call hNewDocument
    ' Get current settings on language tabpage and remember
    ToolsOptions
    Call hToolsOptions("LANGUAGESETTINGS","LANGUAGES")
    sUILanguage = UILanguage.GetSelIndex
    sLocale = Gebietsschema.GetSelIndex
    sCurrency = StandardWaehrung.GetSelIndex
    sWestern = Westlich.GetSelIndex
    if Asiatisch.IsEnabled then sAsian = Asiatisch.GetSelIndex
    if LanguageComplexScript.IsEnabled then sCTL = LanguageComplexScript.GetSelIndex
    sAsiancb = Aktivieren.IsEnabled
    sCTLcb = ComplexScriptEnabled.IsEnabled
    sAsiancbChecked = Aktivieren.IsChecked
    sCTLcbChecked = ComplexScriptEnabled.IsChecked
    Kontext "ExtrasOptionenDlg"
    ExtrasOptionenDlg.Cancel
    Call hCloseDocument
    
    sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\fields\AboveBelow.sxw")
    
    sBelow  = Array( _
               "below"    , _
               "infra"    , _
               "abajo"    , _
               "sotto"    , _
               "ovan"     , _
               "unten"    , _
               "abaixo"   , _
               "後述"    , _
               "아래"    , _
               "下面"    , _
               "下面"    , _
              )
    sAbove  = Array( _
               "above"    , _
               "supra"    , _
               "arriba"   , _
               "sopra"    , _
               "nedan"    , _
               "oben"     , _
               "acima"    , _
               "前述"    , _
               "위"       , _
               "上面"    , _
               "上面"    , _
              )
    iCountry = Array ( 1 , 33 , 34 , 39 , 46 , 49 , _
                 55, 81 , 82 , 86 , 88 )
    
    printlog "L10N test - above/below"
    '/// <b> L10N test - above/below </b>
    
    Call hNewDocument
    
    '/// Open test file AboveBelow.sxw
    Call hFileOpen(sTestFile)
    Call sMakeReadOnlyDocumentEditable
    
    '/// Check if reference above/below is changed after language is changed
    
    j = UBound(iCountry)
    for i = 0 to j
        Call wTypeKeys "<MOD1 Home>"
        fSetLocale(fGetLanguageName(iCountry(i)))
        if iCountry(i) < 80 then
            fSetWestern(fGetLanguageName(iCountry(i)))
            fSetAsian("Null")
        else
            fSetWestern("Null")
            fSetAsian(fGetLanguageName(iCountry(i)))
        end if
    
        Call wTypeKeys "<F9>"
        Call wTypeKeys "<Shift Right>"
        if fGetFieldContent() <> sBelow(i) then
            Warnlog "Should get " & sBelow(i) & " but get " & fGetFieldContent()
        end if
        Call wTypeKeys "<MOD1 End>"
        Call wTypeKeys "<Shift Left>"
        if fGetFieldContent() <> sAbove(i) then
            Warnlog i & " - Should get " & sAbove(i) & " but get " & fGetFieldContent()
        end if
    next i
    
    ' set back language tabpage values
    ToolsOptions
    Call hToolsOptions("LANGUAGESETTINGS","LANGUAGES")
    UILanguage.Select sUILanguage
    Gebietsschema.Select sLocale
    StandardWaehrung.Select sCurrency
    Westlich.Select sWestern
    if sAsiancb = true then
        if sAsiancbChecked = true then Aktivieren.IsChecked
    end if
    
    if sCTLcb = true then
        if sCTLcbChecked = true then ComplexScriptEnabled.IsChecked
    end if

    if Asiatisch.IsEnabled and sAsian > 0 then Asiatisch.Select sAsian
    if LanguageComplexScript.IsEnabled and sCTL > 0 then LanguageComplexScript.Select sCTL

    Kontext "ExtrasOptionenDlg"
    ExtrasOptionenDlg.Ok
    
    Call hCloseDocument

endcase

'-----------------------------------------------------------------

testcase tL10NtestDate
    if iSprache <> 1 then
        QaErrorLog "Currently no any other language than English. Aborting."
        exit sub
    end if
    
    Dim sTestFile    as String
    Dim sOriginalFile as string
    Dim sDate()      as String
    Dim iCountry()   as Integer
    Dim i , j        as Integer

    Dim sUILanguage as integer, sLocale as integer
    Dim sCurrency as integer, sWestern as integer, sAsian as integer, sCTL as integer
    Dim sAsiancb as boolean, sCTLcb as boolean
    Dim sAsiancbChecked as boolean, sCTLcbChecked as boolean
    
    if iSprache <> 01 then
        QAErrorlog "This is a English-only testcase"
        goto endsub
    end if
    
    Call hNewDocument
    ' Get current settings on language tabpage and remember
    ToolsOptions
    Call hToolsOptions("LANGUAGESETTINGS","LANGUAGES")
    sUILanguage = UILanguage.GetSelIndex
    sLocale = Gebietsschema.GetSelIndex
    sCurrency = StandardWaehrung.GetSelIndex
    sWestern = Westlich.GetSelIndex
    if Asiatisch.IsEnabled then sAsian = Asiatisch.GetSelIndex
    if LanguageComplexScript.IsEnabled then sCTL = LanguageComplexScript.GetSelIndex
    sAsiancb = Aktivieren.IsEnabled
    sCTLcb = ComplexScriptEnabled.IsEnabled
    sAsiancbChecked = Aktivieren.IsChecked
    sCTLcbChecked = ComplexScriptEnabled.IsChecked
    Kontext "ExtrasOptionenDlg"
    ExtrasOptionenDlg.Cancel
    Call hCloseDocument
  
  	sTestFile   = Convertpath (gOfficepath + "user\work\Date.sxw")
	sOriginalFile   = Convertpath (gTesttoolpath + "writer\optional\input\fields\Date.sxw")
	' document has to be copied to local file system to avoid opening a read-only file
	' because all field data gets lost if documents write-protection is removed via 'sMakeReadOnlyDocumentEditable'
	FileCopy (sOriginalFile, sTestFile)
	if FileExists ( sTestFile ) = false then
		Warnlog "Test document couldn't be copied to local file system. Test aborted!"
		goto endsub
	end if
    
    
    sDate  = Array( _
           "Tuesday, August 3, 2004"    , _
           "mardi 3 août 2004"    , _
           "martes, 3 de agosto de 2004"    , _
           "martedì 3 agosto 2004"    , _
           "tisdag 3 augusti 2004"    , _
           "Dienstag, 3. August 2004"    , _
           "Terça-feira, 3 de Agosto de 2004"    , _
           "2004年8月3日(火曜日)"    , _
           "04-8-3 화요일"    , _
           "2004年8月3日 星期二"    , _
           "中華民國93年8月3日 星期二"    , _
          )
    iCountry = Array ( 1 , 33 , 34 , 39 , 46 , 49 , _
             55, 81 , 82 , 86 , 88 )

    printlog "L10N test - Date"
    '/// <b> L10N test - Date </b>
    
    Call hNewDocument
    
    '/// Open test file Date.sxw
    Call hFileOpen(sTestFile)
    
    '/// Check if Date is changed after language is changed
    j = UBound(iCountry)
    for i = 0 to j
        Call wTypeKeys "<MOD1 Home>"
        fSetLocale(fGetLanguageName(iCountry(i)))
        if iCountry(i) < 80 then
            fSetWestern(fGetLanguageName(iCountry(i)))
            fSetAsian("Null")
        else
            fSetWestern("Null")
            fSetAsian(fGetLanguageName(iCountry(i)))
        end if
    
        Call wTypeKeys "<F9>"
        Call wTypeKeys "<Shift Right>"
        if fGetFieldContent() <> sDate(i) then
            Warnlog i & " - Should get " & sDate(i) & " but get " & fGetFieldContent()
        end if
    next i
    
    ' set back language tabpage values
    ToolsOptions
    Call hToolsOptions("LANGUAGESETTINGS","LANGUAGES")
    UILanguage.Select sUILanguage
    Gebietsschema.Select sLocale
    StandardWaehrung.Select sCurrency
    Westlich.Select sWestern
    if sAsiancb = true then
        if sAsiancbChecked = true then Aktivieren.IsChecked
    end if
    
    if sCTLcb = true then    
        if sCTLcbChecked = true then ComplexScriptEnabled.IsChecked
    end if

    if Asiatisch.IsEnabled and sAsian > 0 then Asiatisch.Select sAsian
    if LanguageComplexScript.IsEnabled and sCTL > 0 then LanguageComplexScript.Select sCTL

    Kontext "ExtrasOptionenDlg"
    ExtrasOptionenDlg.Ok

    Call hCloseDocument

endcase

'-----------------------------------------------------------------

testcase tL10NtestTime
    if iSprache <> 1 then
        QaErrorLog "Currently no any other language than English. Aborting."
        goto endsub
    end if

    Dim sTestFile as String
    Dim sOriginalFile as string
    Dim sTime() as String
    Dim iCountry() as Integer
    Dim i as Integer
    Dim j as Integer

    Dim sUILanguage as integer, sLocale as integer
    Dim sCurrency as integer, sWestern as integer, sAsian as integer, sCTL as integer
    Dim sAsiancb as boolean, sCTLcb as boolean
    Dim sAsiancbChecked as boolean, sCTLcbChecked as boolean
    
    if iSprache <> 01 then
        QAErrorlog "This is a English-only testcase"
        goto endsub
    end if
    
    Call hNewDocument
    ' Get current settings on language tabpage and remember
    ToolsOptions
    Call hToolsOptions("LANGUAGESETTINGS","LANGUAGES")
    sUILanguage = UILanguage.GetSelIndex
    sLocale = Gebietsschema.GetSelIndex
    sCurrency = StandardWaehrung.GetSelIndex
    sWestern = Westlich.GetSelIndex
    if Asiatisch.IsEnabled then sAsian = Asiatisch.GetSelIndex
    if LanguageComplexScript.IsEnabled then sCTL = LanguageComplexScript.GetSelIndex
    sAsiancb = Aktivieren.IsEnabled
    sCTLcb = ComplexScriptEnabled.IsEnabled
    sAsiancbChecked = Aktivieren.IsChecked
    sCTLcbChecked = ComplexScriptEnabled.IsChecked
    Kontext "ExtrasOptionenDlg"
    ExtrasOptionenDlg.Cancel
    Call hCloseDocument
  
  	sTestFile   = Convertpath (gOfficepath + "user\work\Time.sxw")
	sOriginalFile   = Convertpath (gTesttoolpath + "writer\optional\input\fields\Time.sxw")
	' document has to be copied to local file system to avoid opening a read-only file
	' because all field data gets lost if documents write-protection is removed via 'sMakeReadOnlyDocumentEditable'
	FileCopy (sOriginalFile, sTestFile)
	if FileExists ( sTestFile ) = false then
		Warnlog "Test document couldn't be copied to local file system. Test aborted!"
		goto endsub
	end if
    
    
    sTime  = Array( _
               "04:46:08 PM"     , _
               "04:46:08 PM"     , _
               "04:46:08 PM"     , _
               "04.46.08 p."     , _
               "04:46:08 em"     , _
               "04:46:08 nachm." , _
               "04:46:08 PM"     , _
               "午後 4:46:08"  , _
               "오후 4시 46분 8초"    , _
               "下午 04:46:08" , _
               "下午 04:46:08" , _
              )
    iCountry = Array ( 1 , 33 , 34 , 39 , 46 , 49 , _
                 55, 81 , 82 , 86 , 88 )
    
    printlog "L10N test - time"
    '/// <b> L10N test - time </b>
    
    Call hNewDocument
    
    '/// Open test file Time.sxw
    Call hFileOpen(sTestFile)
    
    '/// Check if time is changed after language is changed
    j = UBound(iCountry)
    for i = 0 to j
        Call wTypeKeys "<MOD1 Home>"
        fSetLocale(fGetLanguageName(iCountry(i)))
        if iCountry(i) < 80 then
            fSetWestern(fGetLanguageName(iCountry(i)))
            fSetAsian("Null")
        else
            fSetWestern("Null")
            fSetAsian(fGetLanguageName(iCountry(i)))
        end if
    
        Call wTypeKeys "<F9>"
        Call wTypeKeys "<Shift Right>"
        if fGetFieldContent() <> sTime(i) then
            Warnlog i & " - Should get " & sTime(i) & " but get " & fGetFieldContent()
        end if
    next i
    
    ' set back language tabpage values
    ToolsOptions
    Call hToolsOptions("LANGUAGESETTINGS","LANGUAGES")
    UILanguage.Select sUILanguage
    Gebietsschema.Select sLocale
    StandardWaehrung.Select sCurrency
    Westlich.Select sWestern
    if sAsiancb = true then
        if sAsiancbChecked = true then Aktivieren.IsChecked
    end if
    
    if sCTLcb = true then    
        if sCTLcbChecked = true then ComplexScriptEnabled.IsChecked
    end if

    if Asiatisch.IsEnabled and sAsian > 0 then Asiatisch.Select sAsian
    if LanguageComplexScript.IsEnabled and sCTL > 0 then LanguageComplexScript.Select sCTL

    Kontext "ExtrasOptionenDlg"
    ExtrasOptionenDlg.Ok

    Call hCloseDocument

endcase

'-----------------------------------------------------------------