summaryrefslogtreecommitdiff
path: root/testautomation/framework/optional/includes/w_grid_layout1.inc
blob: 8909045f288b4f24f5ef6a7f314668d0349ab375 (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
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
'encoding UTF-8  Do not remove or change this line!
'**************************************************************************
'* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
'* 
'* Copyright 2008 by Sun Microsystems, Inc.
'*
'* OpenOffice.org - a multi-platform office productivity suite
'*
'* $RCSfile: w_grid_layout1.inc,v $
'*
'* $Revision: 1.2 $
'*
'* last change: $Author: jsk $ $Date: 2008-06-17 07:50:24 $
'*
'* 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@sun.com
'*
'* short description : Grid Layout for CJK test in Writer
'*
'\***********************************************************************

private const SOURCE_PATH = "framework\optional\input\CJK\"

testcase tTextGridDialog_1

 if iSystemSprache <> 81 AND iSystemSprache <> 82 AND iSystemSprache <> 86 AND iSystemSprache <> 88 then
   Call CheckAsianLanguageSupport("Off")
   hNewDocument()
   FormatPageWriter
   try
      Kontext
      Active.SetPage TabGrid
      Kontext "TabGrid"
      TabGrid.Cancel
      warnlog "Shouldn't get Tabpage: Grid Text"
   catch
      Kontext
      Active.SetPage TabSeite
      Kontext "TabSeite"
      TabSeite.Cancel
   endcatch
 end if

   Call CheckAsianLanguageSupport("On")

   sleep 5
   FormatPageWriter
   Kontext
   if Active.exists (10) then
   try
      Kontext
      Active.SetPage TabGrid
      Kontext "TabGrid"
      TabGrid.Cancel
   catch
      Kontext
      Active.SetPage TabSeite
      Kontext "TabSeite"
      TabSeite.Cancel
      warnlog "Couldn't get Tabpage: Grid Text"
   endcatch
   else
      warnlog "FormatPageWriter didn't bring up ndialog"
   endif
   hCloseDocument()
endcase

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

testcase tTextGridDialog_2
   Dim testFile , sCorrectResult as String

   testFile       = "gridtest.sxw"
   sCorrectResult = "1"

   Call hNewDocument

   Call hFileOpen ( gTesttoolPath + SOURCE_PATH + testFile )
   sMakeReadOnlyDocumentEditable
   
    FormatPageWriter
    Kontext
    if active.exists(5) then
        Active.SetPage TabGrid
    endif
     Kontext "TabGrid"
     NoGrid.Check
     Sleep 1
    TabGrid.OK
    Sleep 1

    Kontext
    ViewNavigator
     Kontext "NavigatorWriter"

     Seitennummer.SetText "2"
     Sleep 5
    fCloseNavigator

    Kontext "DocumentWriter"
    Call DocumentWriter.TypeKeys  "<End>"
    Sleep 1
    Call DocumentWriter.TypeKeys  "<Shift Left>"
    Editcopy

    if GetClipboardText <> sCorrectResult then Warnlog "Something wrong when choosing NoGrid option!"

   Call hCloseDocument
endcase

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

testcase tTextGridDialog_3
   Dim testFile  , sCorrectResult , sLinesPerPage as String

   testFile       = "gridtest.sxw"
   sCorrectResult = "G"
   sLinesPerPage  = "10"

   Call hNewDocument

   Call hFileOpen ( gTesttoolPath + SOURCE_PATH + testFile )
   sMakeReadOnlyDocumentEditable
    FormatPageWriter
    Kontext
    if active.exists(5) then
        Active.SetPage TabGrid
    endif
     Kontext "TabGrid"
     LinesGrid.Check
     LinesPerPage.SetText sLinesPerPage
     Sleep 1
    TabGrid.OK
    Sleep 1

    Kontext
    ViewNavigator
     Kontext "NavigatorWriter"

     Seitennummer.SetText "2"
     Sleep 5
    fCloseNavigator

    Kontext "DocumentWriter"
    Call DocumentWriter.TypeKeys  "<End>"
    Sleep 1
    Call DocumentWriter.TypeKeys  "<Shift Left>"
    Editcopy

    if GetClipboardText <> sCorrectResult then Warnlog "Something wrong when choosing Grid(lines only) option!"

   Call hCloseDocument
endcase

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

testcase tTextGridDialog_4
   Dim testFile      , sCorrectResult as String
   Dim sLinesPerPage , sCharsPerLine  as String

   testFile       = "gridtest.sxw"
   sCorrectResult = "E"
   sLinesPerPage  = "10"
   sCharsPerLine  = "9"

   Call hNewDocument

   Call hFileOpen ( gTesttoolPath + SOURCE_PATH + testFile )
   sMakeReadOnlyDocumentEditable
    FormatPageWriter
    Kontext
    if active.exists(5) then
        Active.SetPage TabGrid
    endif
     Kontext "TabGrid"
     CharsGrid.Check
     LinesPerPage.SetText sLinesPerPage
     CharsPerLine.SetText sCharsPerLine
     Sleep 1
    TabGrid.OK
    Sleep 1

    Kontext
    ViewNavigator
     Kontext "NavigatorWriter"

     Seitennummer.SetText "2"
     Sleep 5
    fCloseNavigator

    Kontext "DocumentWriter"
    Call DocumentWriter.TypeKeys  "<End>"
    Sleep 1
    Call DocumentWriter.TypeKeys  "<Shift Left>"
    Editcopy

    if GetClipboardText <> sCorrectResult then Warnlog "Something wrong when choosing Grid(lines and characters) option!"

   Call hCloseDocument
endcase

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

testcase  tGridDisplay_1
   Call hNewDocument

    FormatPageWriter
    Kontext
    if active.exists(5) then
        Active.SetPage TabGrid
    endif
     Kontext "TabGrid"
     CharsGrid.Check
     Display.Check
     Sleep 1
     PrintGrid.Check
     Sleep 1
    TabGrid.OK
    Sleep 1

    FilePrint
    Kontext "Active"
    if Active.Exists(5) then
      if Active.GetRT = 304 then
        Active.Ok
        QAErrorLog "No Default-Printer!"
        Kontext "DruckenDlg"
        Sleep 1
        DruckenDlg.Cancel
      end if
    else
      Kontext "DruckenDlg"
      Sleep 1
      DruckenDlg.OK
      Sleep 5
      kontext
      if active.exists(5) then
          qaErrorLog active.getText
          active.ok
      end if
    end if

    FormatPageWriter
    Kontext
    if active.exists(5) then
        Active.SetPage TabGrid
    endif
     Kontext "TabGrid"
     CharsGrid.Check
     Display.Check
     Sleep 1
     PrintGrid.UnCheck
     Sleep 1
    TabGrid.OK
    Sleep 1

    FilePrint
    Kontext "Active"
    if Active.Exists(5) then
      if Active.GetRT = 304 then
        Active.Ok
        QAErrorLog "No Default-Printer!"
        Kontext "DruckenDlg"
        Sleep 1
        DruckenDlg.Cancel
      end if
    else
      Kontext "DruckenDlg"
      Sleep 1
      DruckenDlg.OK
      Sleep 5
      kontext
      if active.exists(5) then
          qaErrorLog active.getText
          active.ok
      end if
    end if

   Call hCloseDocument
endcase

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

testcase tFontSizeChanges_1
    Dim testFile      , sCorrectResult as String
    Dim sLinesPerPage , sCharsPerLine  as String
    dim sTemp as string

    testFile       = "FontSizeChanges_1.sxw"
    sCorrectResult = "1"
    sLinesPerPage  = "2"
    sCharsPerLine  = "9"

    Call hFileOpen ( gTesttoolPath + SOURCE_PATH + testFile )
    sMakeReadOnlyDocumentEditable
    Kontext "DocumentWriter"
    Call DocumentWriter.TypeKeys  "<Shift Right>"

    Kontext "FormatObjectbar"
        Schriftgroesse.Select   "60"
        Schriftgroesse.TypeKeys "<Return>"
        Sleep 1

    Kontext "DocumentWriter"
    FormatPageWriter
        Kontext
        if active.exists(5) then
            Active.SetPage TabGrid
        endif
        Kontext "TabGrid"
        if TabGrid.exists(5) then
            sTemp = LinesPerPage.GetText
            if sTemp <> sLinesPerPage then 
                Warnlog "The lines per page should be: '" + sLinesPerPage + "'; but get: '" + sTemp + "'"
            endif
            sTemp = CharsPerLine.GetText
            if sTemp <> sCharsPerLine then 
                Warnlog "The chars per line should be: '" + sCharsPerLine + "'; but get: '" +sTemp + "'"
            endif
            TabGrid.Cancel
        else
            warnlog "TabGrid is not available."
        endif

    Kontext
    ViewNavigator
    Kontext "NavigatorWriter"
    if NavigatorWriter.exists(5) then
        Seitennummer.SetText "2"
        Sleep 5
    else
        warnlog "Navigator not available"
    endif
    fCloseNavigator

    Kontext "DocumentWriter"
    sleep 3
    Call DocumentWriter.TypeKeys  "<Shift Right>"
    sleep 3
    Editcopy
    sTemp = GetClipboardText
    if sTemp <> sCorrectResult then 
        Warnlog "Don't get the expected result , hope to be: '" + sCorrectResult + "'; but get: '" + sTemp + "'"
    endif

    Call hCloseDocument
endcase

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

testcase tRubyText_1
   Dim testFile , sRubyText as String

   testFile   = "rubytest.sxw"
   sRubyText  = "Ruby Test Text ....................."

   Call hNewDocument

   Call hFileOpen ( gTesttoolPath + SOURCE_PATH + testFile )
    sMakeReadOnlyDocumentEditable
   Kontext "DocumentWriter"
   Call DocumentWriter.TypeKeys  "<Shift Right>"
   Sleep 1

    FormatRuby
    Kontext "RubyDialog"
     Sleep 3
     RubyText1.setText sRubyText
     Sleep 2
     RubyDialog.OK
     Sleep 2
    DialogClose.Click
    Sleep 1

    Kontext "DocumentWriter"
    FormatAutoformatApply
    Sleep 2
    Call DocumentWriter.TypeKeys  "<End>"
    Sleep 2
    Call DocumentWriter.TypeKeys  "<Shift Left>"
    Editcopy

    if NOT(GetClipboardText = "5" OR GetClipboardText = "6") then
        Warnlog "Don't get the correct result after inserting ruby text! Get " + GetClipboardText
    end if

   Call hCloseDocument
endcase

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

testcase tIndentsTest_1
   Dim testFile , sCorrectPage1 , sCorrectPage2 as String

   testFile       = "IndentsTest.sxw"
   sCorrectPage1  = "1"
   sCorrectPage2  = "2"

   Call hNewDocument

   Call hFileOpen ( gTesttoolPath + SOURCE_PATH + testFile )
    sMakeReadOnlyDocumentEditable
   Kontext "DocumentWriter"
   Call DocumentWriter.TypeKeys  "<Down>"
   Sleep 1
   Call DocumentWriter.TypeKeys  "<Tab>"
   Sleep 1
   Call DocumentWriter.TypeKeys  "<End>"
   Sleep 1

    Kontext
    ViewNavigator
     Kontext "NavigatorWriter"
     if Seitennummer.GetText <> sCorrectPage1 then Warnlog "First test :Something wrong in indents test!"
    fCloseNavigator

    Kontext "DocumentWriter"
    Call DocumentWriter.TypeKeys  "<Home>"
    Sleep 1
    Call DocumentWriter.TypeKeys  "<Tab>"
    Sleep 1
    Call DocumentWriter.TypeKeys  "<End>"
    Sleep 1

    Kontext
    ViewNavigator
     Kontext "NavigatorWriter"
     if Seitennummer.GetText <> sCorrectPage2 then Warnlog "Second test :Something wrong in indents test!"
    fCloseNavigator

   Call hCloseDocument
endcase

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