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
|
'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 : thorsten.bosbach@oracle.com
'*
'* short description : CJK Ruby Dialogue Proposal Test
'*
'\***********************************************************************
testcase tRubyDialog_1
Dim sBaseText , sRubyText as String
Dim sBaseText1 , sRubyText1 as String
sBaseText = "BaseText"
sRubyText = "RubyText"
sBaseText1 = "BaseText1"
sRubyText1 = "RubyText1"
'/// Check Apply and Close button in Ruby dialogue
Call hNewDocument
'/// Check close button.
'/// open ruby dialogue , input base text and ruby text , then press close button
'/// 1) check if the ruby dialogue is closed
'/// 2) check if the base text and ruby text is recorded
FormatRuby
Kontext "RubyDialog"
Sleep 3
BasisText1.SetText sBaseText
Sleep 1
RubyText1.SetText sRubyText
Sleep 1
DialogClose.Click
Sleep 1
if RubyDialog.Exists then
Warnlog "The Ruby dialogue is NOT closed !"
end if
FormatRuby
Kontext "RubyDialog"
Sleep 3
if Len(BasisText1.GetText) <> 0 then Warnlog "The base text should not been inputed"
if Len(RubyText1.SetText) <> 0 then Warnlog "The ruby text should not been inputed"
'/// Check Apply button -- Normally , we think it is RubyDialog.OK
'/// open ruby dialogue , input base text and ruby text , then press close button
'/// Press Apply button , then press close button
'/// check if the base text and ruby text is recorded
BasisText1.SetText sBaseText1
Sleep 1
RubyText1.SetText sRubyText1
Sleep 1
RubyDialog.OK
Sleep 2
DialogClose.Click
Sleep 1
EditSelectAll
Sleep 1
FormatRuby
Kontext "RubyDialog"
Sleep 3
if BasisText1.GetText <> sBaseText1 then Warnlog "The base text should be "+sBaseText1 + " but get " + BasisText1.GetText
if RubyText1.GetText <> sRubyText1 then Warnlog "The ruby text should be "+sRubyText1 + " but get " + RubyText1.GetText
DialogClose.Click
Sleep 1
Call hCloseDocument
endcase
'-------------------------------------------------------------------------
testcase tRubyDialog_2
Dim sBaseText as String
sBaseText = "test1 test2 test3 test4 test5 test6 test7 test8 test9"
'/// Test scrollbar in Ruby dialog
Call hNewDocument
'/// when there is less basetext, the scrollbar should appear
FormatRuby
Kontext "RubyDialog"
if RubyDialog.HasScrollbar <> TRUE then warnlog "The Scrollbar should appear when less basetext!"
DialogClose.Click
Sleep 1
'/// when there is more basetext(here is >4), the scrollbar should appear
Kontext "DocumentWriter"
DocumentWriter.TypeKeys sBaseText
DocumentWriter.TypeKeys "<Shift Home>"
FormatRuby
Kontext "RubyDialog"
if RubyDialog.HasScrollbar <> TRUE then warnlog "The Scrollbar should appear when more basetext!"
DialogClose.Click
Sleep 1
Call hCloseDocument
endcase
'-------------------------------------------------------------------------
testcase tRubyDialog_3
Dim sTestText as String
Dim sBaseText1, sBaseText2 as String
sTestText = "Test1 Test2"
sBaseText1 = "Test1"
sBaseText2 = "Test2"
'/// The list in ruby dialogure will be updated as soon as the uses
'/// selects new or further words of his text.
'/// The update will be done once the user changes his focus
'/// back to the Ruby-Dialogue from the text
Call hNewDocument
'/// input 2 test words, and mark the second
DocumentWriter.TypeKeys sTestText
DocumentWriter.TypeKeys "<Shift Left>" , 5
'/// There should be only the second test word in basetext1 in ruby dialogue
FormatRuby
Kontext "RubyDialog"
Sleep 2
if BasisText1.GetText <> sBaseText2 then warnlog "The BaseText1 should be:" +sBaseText2 + " but get "+BasisText1.GetText
'/// Mark 2 test words
Kontext "DocumentWriter"
try
DocumentWriter.TypeKeys "<Shift Home>"
Sleep 2
catch
warnlog "The ruby dialogue is MODE less dialogue , the document can be edited!"
endcatch
'/// Check if the 2 test words are all in the ruby dialogue when set forcus back to the dialogue
Kontext "RubyDialog"
Sleep 1
'this step is meaningless, just let the focus back to ruby dialogue
Adjust.Select 1
Sleep 8
if BasisText1.GetText <> sBaseText1 then warnlog "The BaseText1 should be:" +sBaseText1 + " but get "+BasisText1.GetText
Sleep 1
if BasisText2.GetText <> sBaseText2 then warnlog "The BaseText2 should be:" +sBaseText2 + " but get "+BasisText2.GetText
DialogClose.Click
Sleep 1
Call hCloseDocument
endcase
'-------------------------------------------------------------------------
testcase tRubyDialog_4
Dim sCharacterStyle as String
dim i as integer
'/// Check default setting for Character Style of Ruby Text
select case iSprache
case 01 : sCharacterStyle = "Rubies"
case 33 : sCharacterStyle = "Rubys"
case 34 : sCharacterStyle = "Rubys"
case 39 : sCharacterStyle = "Testo Ruby"
case 46 : sCharacterStyle = "Rubytext"
case 49 : sCharacterStyle = "Rubys"
case 50 : sCharacterStyle = "Rubys"
case 55 : sCharacterStyle = "Rubys"
case 81 : sCharacterStyle = "ふりがな"
case 82 : sCharacterStyle = "윗주 달기" ' not sure TBO
case 86 : sCharacterStyle = "拼音和注音符号"
case 88 : sCharacterStyle = "注音符號"
case else :' QAErrorLog "Now, the test does not support for the language " +iSprache
Goto endsub
end select
Call hNewDocument
FormatRuby
Kontext "RubyDialog"
Sleep 3
if CharacterStyle.GetSelText <> sCharacterStyle then
warnlog "Default setting for Character Style of Ruby Text isn't right, should be "+sCharacterStyle + " but get "+CharacterStyle.GetSelText
for i = 1 to CharacterStyle.getItemCount
printlog "("+i+"/"+CharacterStyle.getItemCount+"): '"+CharacterStyle.getItemText(i)+"'"
next i
endif
DialogClose.Click
Sleep 1
Call hCloseDocument
endcase
'-------------------------------------------------------------------------
testcase tRubyDialog_5
Dim sCharacterStyle as String
Dim sStyleName as String
Dim i as Integer
dim iCount as integer
dim bError as boolean
dim bWileExit as boolean
'/// Check stylist
select case iSprache
case 01 : sCharacterStyle = "Rubies"
case 33 : sCharacterStyle = "Rubys"
case 34 : sCharacterStyle = "Rubys"
case 39 : sCharacterStyle = "Testo Ruby"
case 46 : sCharacterStyle = "Rubytext"
case 49 : sCharacterStyle = "Rubys"
case 50 : sCharacterStyle = "Rubys"
case 55 : sCharacterStyle = "Rubys"
case 81 : sCharacterStyle = "ふりがな"
case 82 : sCharacterStyle = "윗주 달기" ' not sure TBO was "덧말"
case 86 : sCharacterStyle = "拼音和注音符号"
case 88 : sCharacterStyle = "注音符號"
case else :' QAErrorLog "Now, the test does not support for the language " +iSprache
Goto endsub
end select
sStyleName = "ZZZ-Test-ZZZ"
Call hNewDocument
'/// Open ruby dialogue
FormatRuby
Kontext "RubyDialog"
'/// Click stylist button
CallStylist.Click
Sleep 2
Kontext "Stylist"
if Stylist.NotExists then
Warnlog "No Stylist with clicking Stylist button!"
end if
'/// click Character Style
Zeichenvorlagen.Click
' needed to update the listbox count :-(
Vorlagenliste.typeKeys ("<end><up><down>")
iCount = Vorlagenliste.getItemCount
printlog iCount
i=1
bWileExit = Vorlagenliste.getItemText (i) <> sCharacterStyle
while ((i<iCount+1) AND (bWileExit))
printlog "" + (i) + ": " + Vorlagenliste.getItemText (i)
bWileExit = Vorlagenliste.getItemText (i) <> sCharacterStyle
inc (i)
wEnd
if (i = iCount+1) then
warnlog "Style (Rubies) not found: '" + sCharacterStyle + "' inside of entries: " + iCount
bError = true
else
printlog "Style (Rubies) found: '" + sCharacterStyle + "' @ position: ("+(i)+"/"+icount+")"
Vorlagenliste.select (i)
bError = false
endif
if (NOT bError) then
'/// find entry ruby and add a new entry
AusSelektion.OpenMenu
Sleep 1
printlog "hMenuSelect 1"
hMenuSelectNr(1)
printlog "hMenuSelect 1 survived"
Sleep 1
Kontext "VorlageErzeugen"
Sleep 1
Vorlagenname.SetText sStyleName
Sleep 1
VorlageErzeugen.OK
Sleep 2
'/// check if the new entry is in the Character Style list box in ruby dialogue
Kontext "RubyDialog"
' needed to update the listbox count :-(
CharacterStyle.typeKeys ("<end><up><down>")
iCount = CharacterStyle.GetItemCount
i=0
bWileExit = true
while ((i<(iCount+1)) AND (bWileExit))
bWileExit = CharacterStyle.getItemText (i+1) <> sStyleName
inc (i)
printlog "" + (i) + ": " + CharacterStyle.getItemText (i)
wEnd
printlog CharacterStyle.GetItemCount
if ((i = iCount) AND bWileExit) then
warnlog "New created entry not found: '" + sStyleName + "' inside of entries: " + iCount
bError = true
else
printlog "New created entry found: '" + sStyleName + "' @ position: ("+(i)+"/"+icount+")"
CharacterStyle.select (i)
bError = false
endif
if (NOT bError) then
Kontext "Stylist"
iCount = Vorlagenliste.getItemCount
i=0
while ((i<iCount) AND (Vorlagenliste.getItemText (i+1) <> sStyleName))
inc (i)
printlog "" + (i) + ": " + Vorlagenliste.getItemText (i)
wEnd
if (i = iCount) then
warnlog "Style (Rubies) not found for deleting: '" + sStyleName + "' inside of entries: " + iCount
bError = true
else
printlog "Style (Rubies) found, will delete it now: '" + sStyleName + "' @ position: ("+i+"/"+icount+")"
Vorlagenliste.select (i+1)
bError = false
iCount = Vorlagenliste.getItemCount
Vorlagenliste.TypeKeys "<Delete>"
sleep(1)
Kontext "Active"
if active.exists(5) then
printlog "active about deleting; say yes to: '" + active.getText + "'"
Active.Yes
else
warnlog "No warning, before deleting style."
endif
sleep 1
Kontext "Stylist"
i = Vorlagenliste.getItemCount
if ( (iCount-1) <> i) then
warnlog "Style wasn't deleted; count is still the same: " + i + "/" + iCount
else
printlog "Style was deleted; Count is OK: " + i + "/" + iCount
endif
endif
endif
endif
Kontext "Stylist"
Stylist.Close
Sleep 1
Kontext "RubyDialog"
DialogClose.Click
Sleep 1
Call hCloseDocument
endcase
|