summaryrefslogtreecommitdiff
path: root/testautomation/writer/optional/includes/sorting/w_sorting1.inc
blob: 9567827272a4ca35677c207810b42a018e82f9cd (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
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
'**************************************************************************
 * 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 : Sorting functions in Writer
'*
'************************************************************************
'*
' #1 tToolsSort1                         ' Text in one Column and 1 Key
' #1 tToolsSort2                         ' Numbers in 1 Column and 1 Key
' #1 tToolsSort3                         ' Text in several Columns and 3 Keys
' #1 tToolsSort4                         ' Table with Header ( Text and Numbers mixed )
' #1 tToolsSort5                         ' Table without Header ( Text and Numbers mixed )
' #1 tToolsSort6                         ' Copy sorted table in another table
'*
'\***********************************************************************

sub w_sorting

    Call tToolsSort1                         ' Text in one Column and 1 Key
    Call tToolsSort2                         ' Numbers in 1 Column and 1 Key
    Call tToolsSort3                         ' Text in several Columns and 3 Keys
    Call tToolsSort4                         ' Table with Header ( Text and Numbers mixed )
    Call tToolsSort5                         ' Table without Header ( Text and Numbers mixed )
    Call tToolsSort6                         ' Copy sorted table in another table

end sub


testcase tToolsSort1
    PrintLog "- Tools / Sort normal Text ( 1. Column )"    
    Printlog "   - alphanumeric ascending ( Key 1 )"
    Call hNewDocument
    Call wTypeKeys "Ohallo<Return>Ahallo<Return>Ghallo<Return>Zhallo<Return>Shallo"
    Call wTypeKeys ( "<Mod1 a>" )
    ToolsSort
    Kontext "Sortieren"
    Schluessel1.Check
    Schluessel2.UnCheck
    Schluessel3.UnCheck
    Spalte1.SetText "1"
    Schluesseltyp1.Select 1
    Aufsteigend1.Check
    Sortieren.OK
    Call AufsteigendKontrollieren ( FALSE )

    Printlog "   - alphanumeric descending ( Key 1 )"
    Call wTypeKeys ( "<Mod1 a>" )
    ToolsSort
    Kontext "Sortieren"
    Schluessel1.Check
    Spalte1.SetText "1"
    Schluesseltyp1.Select 1
    Absteigend1.Check
    Sortieren.OK
    AbsteigendKontrollieren ( FALSE )

    Printlog "   - alphanumeric ascending ( Key 2 )"
    Call wTypeKeys "<Mod1 a>"
    Call wTypeKeys "<Delete>"
    Sleep 1
    Call wTypeKeys "Ohallo<Return>Ahallo<Return>Ghallo<Return>Zhallo<Return>Shallo"
    Call wTypeKeys ( "<Mod1 a>" )
    ToolsSort
    Kontext "Sortieren"
    Schluessel2.Check
    Schluessel1.Uncheck
    Schluessel3.UnCheck
    Spalte2.SetText "1"
    Schluesseltyp2.Select 1
    Aufsteigend2.Check
    Sortieren.OK
    Call AufsteigendKontrollieren ( FALSE )

    Printlog "   - alphanumeric descending ( Key 2 )"
    Call wTypeKeys "<Mod1 a>"
    ToolsSort
    Kontext "Sortieren"
    Spalte2.SetText "1"
    Schluesseltyp2.Select 1
    Absteigend2.Check
    Sortieren.OK
    AbsteigendKontrollieren ( FALSE )

    Printlog "   - alphanumeric ascending ( Key 3 )"
    Call wTypeKeys "<Mod1 a>"
    Call wTypeKeys "<Delete>"
    Sleep 1
    Call wTypeKeys "Ohallo<Return>Ahallo<Return>Ghallo<Return>Zhallo<Return>Shallo"
    Call wTypeKeys ( "<Mod1 a>" )
    ToolsSort
    Kontext "Sortieren"
    Schluessel3.Check
    Schluessel1.UnCheck
    Schluessel2.UnCheck
    Spalte3.SetText "1"
    Schluesseltyp3.Select 1
    Aufsteigend3.Check
    Sortieren.OK
    Call AufsteigendKontrollieren ( FALSE )

    Printlog "   - alphanumeric descending ( Key 3 )"
    Call wTypeKeys "<Mod1 a>"
    ToolsSort
    Kontext "Sortieren"
    Schluessel3.Check
    Schluessel1.Uncheck
    Schluessel2.UnCheck
    Spalte3.SetText "1"
    Schluesseltyp3.Select 1
    Absteigend3.Check
    Sortieren.OK
    Call AbsteigendKontrollieren ( FALSE )

    Call hCloseDocument
endcase

' *******************************************************************

testcase tToolsSort2
    PrintLog "- Tools / Sorting numbers ( 1. Column )"

    Printlog "   - numeric ascending ( Key 1 )"
    Call hNewDocument
    Call wTypeKeys "43<Return>54<Return>23<Return>65<Return>56"
    Call wTypeKeys ( "<Mod1 a>" )
    ToolsSort
    Kontext "Sortieren"
    Schluessel1.Check
    Spalte1.SetText "1"
    Schluesseltyp1.Select 2
    Aufsteigend1.Check
    Sortieren.OK
    Call AufsteigendKontrollieren ( TRUE )

    Printlog "   - numeric descending ( Key 1 )"
    Call wTypeKeys ( "<Mod1 a>" )
    ToolsSort
    Kontext "Sortieren"
    Schluessel1.Check
    Spalte1.SetText "1"
    Schluesseltyp1.Select 2
    Absteigend1.Check
    Sortieren.OK
    Call AbsteigendKontrollieren ( TRUE )

    Printlog "   - numeric ascending ( Key 2 )"
    Call wTypeKeys "<Mod1 a>"
    Call wTypeKeys "<Delete>"
    Sleep 1
    Call wTypeKeys "43<Return>54<Return>23<Return>65<Return>56"
    Call wTypeKeys ( "<Mod1 a>" )
    ToolsSort
    Kontext "Sortieren"
    Schluessel1.Uncheck
    Schluessel2.Check
    Spalte2.SetText "1"
    Schluesseltyp2.Select 2
    Aufsteigend2.Check
    Sortieren.OK
    Call AufsteigendKontrollieren ( TRUE )
    
    Printlog "   - numeric descending ( Key 2 )"
    Call wTypeKeys ( "<Mod1 a>" )
    ToolsSort
    Kontext "Sortieren"
    Schluessel1.Uncheck
    Schluessel2.Check
    Spalte2.SetText "1"
    Schluesseltyp2.Select 2
    Absteigend2.Check
    Sortieren.OK
    Call AbsteigendKontrollieren ( TRUE )

    Printlog "   - numeric ascending ( Key 3 )"
    Call wTypeKeys ( "<Mod1 a>" )
    Call wTypeKeys ( "<Delete>" )
    Sleep 1
    Call wTypeKeys "43<Return>54<Return>23<Return>65<Return>56"
    Call wTypeKeys ( "<Mod1 a>" )
    ToolsSort
    Kontext "Sortieren"
    Schluessel1.Uncheck
    Schluessel2.UnCheck
    Schluessel3.Check
    Spalte3.SetText "1"
    Schluesseltyp3.Select 2
    Aufsteigend3.Check
    Sortieren.OK
    Call AufsteigendKontrollieren ( TRUE )

    Printlog "   - numeric descending ( Key 3 )"
    Call wTypeKeys ( "<Mod1 a>" )
    ToolsSort
    Kontext "Sortieren"
    Schluessel1.Uncheck
    Schluessel2.UnCheck
    Schluessel3.Check
    Spalte3.SetText "1"
    Schluesseltyp3.Select 2
    Absteigend3.Check
    Sortieren.OK
    Call AbsteigendKontrollieren ( TRUE )

    Call hCloseDocument
endcase

' *******************************************************************

testcase tToolsSort3
    Dim i as Integer
    PrintLog "- Tools / Sorting text in several lines"
    for i=1 to 3
        select case i
            case 1: Printlog "  - Seperator is a tabulator"
            case 2: Printlog "  - Seperator is a semicolon"
                    Trennzeichen = ";"
            case 3: Printlog "  - Seperator is a '|'"
                     Trennzeichen = "|"
        end select
        if gApplication = "WRITER" then
            Call hFileOpen ( gTesttoolPath + "writer\optional\input\sorting\sort2.odt" )
            Call sMakeReadOnlyDocumentEditable
        else
            Call hFileOpen ( gTesttoolPath + "writer\optional\input\sorting\sort2.odm" )
            Call sMakeReadOnlyDocumentEditable
        end if

        if i <> 1 then TrennzeichenSetzen ( Trennzeichen )

        Printlog "     - alphanumeric ascending after 1.Column, followed by 4.Column and 3. Column"
        Call wTypeKeys ( "<Mod1 a>" )
        ToolsSort
        Kontext "Sortieren"
        Schluessel1.Check
        Spalte1.SetText "1"
        Schluesseltyp1.Select 1
        Aufsteigend1.Check

        Schluessel2.Check
        Spalte2.SetText "4"
        Schluesseltyp2.Select 1
        Aufsteigend2.Check

        Schluessel3.Check
        Spalte3.SetText "3"
        Schluesseltyp3.Select 1
        Aufsteigend3.Check

        if i=1 then
            Tabulator.Check
        else
            Zeichen.Check
            ZeichenText.SetText Trennzeichen
        end if
        Sortieren.OK
        Call AufSortierungPruefen(i)
        Call UndoRichtigBeiSortierung

        Printlog "     - alphanumeric descending 1.Column, followed by 4. column and 3. column"
        ToolsSort
        Kontext "Sortieren"
        Schluessel1.Check
        Spalte1.SetText "1"
        Schluesseltyp1.Select 1

        Schluessel2.Check
        Spalte2.SetText "4"
        Schluesseltyp2.Select 1

        Schluessel3.Check
        Spalte3.SetText "3"
        Schluesseltyp3.Select 1

        Absteigend1.Check
        Absteigend2.Check
        Absteigend3.Check
        if i=1 then
            Tabulator.Check
        else
            Zeichen.Check
            ZeichenText.SetText Trennzeichen
        end if
        Sortieren.OK
        Call AbSortierungPruefen(i)
        Call UndoRichtigBeiSortierung
        Call hCloseDocument
    next i

   'Call hCloseDocument
endcase

' *******************************************************************

testcase tToolsSort4
    PrintLog "- Tools / Sorting in table with header"
    if gApplication = "WRITER" then
        Call hFileOpen ( gTesttoolPath + "writer\optional\input\sorting\sort1.odt" )
        Call sMakeReadOnlyDocumentEditable
    else
        Call hFileOpen ( gTesttoolPath + "writer\optional\input\sorting\sort1.odm" )
        Call sMakeReadOnlyDocumentEditable
    end if
    Call wTypeKeys "<Mod1 a>", 2

    Printlog "   - 3. column alphanum., 1. column num., 3. column alphanum. ascending"
    ToolsSort
    Kontext "Sortieren"
    Schluessel1.Check
    Spalte1.SetText "3"
    Schluesseltyp1.Select 1

    Schluessel2.Check
    Spalte2.SetText "1"
    Schluesseltyp2.Select 2

    Schluessel3.Check
    Spalte3.SetText "2"
    Schluesseltyp3.Select 1
    Aufsteigend1.Check
    Aufsteigend2.Check
    Aufsteigend3.Check
    if Tabulator.IsEnabled then Warnlog "Tabs is active"
    if Zeichen.IsEnabled then Warnlog "Char is active"
    Sortieren.OK

    Printlog "   - Check"
    Call wTypeKeys "<Mod1 a>", 3   ' Umstellung zur 5.0 Cursor steht nach Sortierung in der letzten Zelle, mit 3*Ctrl_A kommt man in die 1.
    wait 100
    EditCopy
    if GetClipboardText <> "1" then Warnlog "Header of the first column has been sorted"
    if ZelleRuntertesten("2") = FALSE then Warnlog "1/2 is wrong"
    if ZelleRuntertesten("4") = FALSE then Warnlog "1/3 is wrong"
    if ZelleRuntertesten("5") = FALSE then Warnlog "1/4 is wrong"
    if ZelleRuntertesten("3") = FALSE then Warnlog "1/5 is wrong"
    if ZelleRuntertesten("6") = FALSE then Warnlog "1/6 is wrong"
    Call wTypeKeys "<Right>"
    Call wTypeKeys "<up>", 5
    Call wTypeKeys "<Mod1 a>"
    Wait 100
    EditCopy
    if GetClipboardText <> "a" then Warnlog "Header of the 2. column has not been sorted"
    if ZelleRuntertesten("a") = FALSE then Warnlog "2/2 is wrong"
    if ZelleRuntertesten("b") = FALSE then Warnlog "2/3 is wrong"
    if ZelleRuntertesten("c") = FALSE then Warnlog "2/4 is wrong"
    if ZelleRuntertesten("b") = FALSE then Warnlog "2/5 is wrong"
    if ZelleRuntertesten("c") = FALSE then Warnlog "2/6 is wrong"
    Call wTypeKeys "<Right>"
    Call wTypeKeys "<up>", 5
    Call wTypeKeys "<Mod1 a>"
    Wait 100
    EditCopy
    if GetClipboardText <> "zz" then Warnlog "Header der 3. column has not been sorted"
    if ZelleRuntertesten("xx") = FALSE then Warnlog "3/2 is wrong"
    if ZelleRuntertesten("xx") = FALSE then Warnlog "3/3 is wrong"
    if ZelleRuntertesten("xx") = FALSE then Warnlog "3/4 is wrong"
    if ZelleRuntertesten("zz") = FALSE then Warnlog "3/5 is wrong"
    if ZelleRuntertesten("zz") = FALSE then Warnlog "3/6 is wrong"

    Printlog "   - 3. column alphanum., 1. column num., 3. column alphanum. descending"
    Call wTypeKeys "<Left Right>"
    Call wTypeKeys "<Mod1 a>", 2
    Sleep 2
    ToolsSort
    Kontext "Sortieren"
    Schluessel1.Check
    Spalte1.SetText "3"
    Schluesseltyp1.Select 1

    Schluessel2.Check
    Spalte2.SetText "1"
    Schluesseltyp2.Select 2

    Schluessel3.Check
    Spalte3.SetText "2"
    Schluesseltyp3.Select 1
    Absteigend1.Check
    Absteigend2.Check
    Absteigend3.Check
    Sortieren.OK

    Printlog "   - check"
    Call wTypeKeys "<up><Left>", 6
    Call wTypeKeys "<Mod1 a>"
    wait 100
    EditCopy
    if GetClipboardText <> "1" then Warnlog "Header of the 1. column has been sorted"
    if ZelleRuntertesten("6") = FALSE then Warnlog "1/2 is wrong"
    if ZelleRuntertesten("3") = FALSE then Warnlog "1/3 is wrong"
    if ZelleRuntertesten("5") = FALSE then Warnlog "1/4 is wrong"
    if ZelleRuntertesten("4") = FALSE then Warnlog "1/5 is wrong"
    if ZelleRuntertesten("2") = FALSE then Warnlog "1/6 is wrong"
    Call wTypeKeys "<Right>"
    Call wTypeKeys "<up>", 5
    Call wTypeKeys "<Mod1 a>"
    Wait 100
    EditCopy
    if GetClipboardText <> "a" then Warnlog "Header of the 2. column has not been sorted"
    if ZelleRuntertesten("c") = FALSE then Warnlog "2/2 is wrong"
    if ZelleRuntertesten("b") = FALSE then Warnlog "2/3 is wrong"
    if ZelleRuntertesten("c") = FALSE then Warnlog "2/4 is wrong"
    if ZelleRuntertesten("b") = FALSE then Warnlog "2/5 is wrong"
    if ZelleRuntertesten("a") = FALSE then Warnlog "2/6 is wrong"
    Call wTypeKeys "<Right>"
    Call wTypeKeys "<up>", 5
    Call wTypeKeys "<Mod1 a>"
    Wait 100
    EditCopy
    if GetClipboardText <> "zz" then Warnlog "Header of the 3. column has not been sorted"
    if ZelleRuntertesten("zz") = FALSE then Warnlog "3/2 is wrong"
    if ZelleRuntertesten("zz") = FALSE then Warnlog "3/3 is wrong"
    if ZelleRuntertesten("xx") = FALSE then Warnlog "3/4 is wrong"
    if ZelleRuntertesten("xx") = FALSE then Warnlog "3/5 is wrong"
    if ZelleRuntertesten("xx") = FALSE then Warnlog "3/6 is wrong"
    Call hCloseDocument
endcase

' *******************************************************************

testcase tToolsSort5
    PrintLog "- Tools / Sorting in table without header"
    if gApplication = "WRITER" then
        Call hFileOpen ( gTesttoolPath + "writer\optional\input\sorting\sort1.odt" )
        Call sMakeReadOnlyDocumentEditable
    else
        Call hFileOpen ( gTesttoolPath + "writer\optional\input\sorting\sort1.odm" )
        Call sMakeReadOnlyDocumentEditable
    end if

    Call wNavigatorAuswahl (2, 2)
    Call wTypeKeys "<Mod1 a>", 2
    Printlog "   - 3. column alphanum., 1. column num., 2. column alphanum. ascending"
    ToolsSort
    Kontext "Sortieren"
    Schluessel1.Check
    Spalte1.SetText "3"
    Schluesseltyp1.Select 1

    Schluessel2.Check
    Spalte2.SetText "1"
    Schluesseltyp2.Select 2

    Schluessel3.Check
    Spalte3.SetText "2"
    Schluesseltyp3.Select 1
    Aufsteigend1.Check
    Aufsteigend2.Check
    Aufsteigend3.Check
    if Tabulator.IsEnabled then Warnlog "'Tabs' is active when table is selected"
    if Zeichen.IsEnabled then Warnlog "'Character' is active when table is selected"
    Sortieren.OK

    Printlog "   - check"
    Call wNavigatorAuswahl (2, 2)
    Call wTypeKeys "<Mod1 a>"
    wait 100
    EditCopy

    if GetClipboardText <> "2" then Warnlog "1/1 is wrong!"
    if ZelleRuntertesten("4") = FALSE then Warnlog "1/2 is wrong"
    if ZelleRuntertesten("5") = FALSE then Warnlog "1/3 is wrong"
    if ZelleRuntertesten("1") = FALSE then Warnlog "1/4 is wrong"
    if ZelleRuntertesten("3") = FALSE then Warnlog "1/5 is wrong"
    if ZelleRuntertesten("6") = FALSE then Warnlog "1/6 is wrong"
    Call wTypeKeys "<Right>"
    Call wTypeKeys "<up>", 5
    Call wTypeKeys "<Mod1 a>"
    Wait 100
    EditCopy
    if GetClipboardText <> "a" then Warnlog "2/1 is wrong!"
    if ZelleRuntertesten("b") = FALSE then Warnlog "2/2 is wrong"
    if ZelleRuntertesten("c") = FALSE then Warnlog "2/3 is wrong"
    if ZelleRuntertesten("a") = FALSE then Warnlog "2/4 is wrong"
    if ZelleRuntertesten("b") = FALSE then Warnlog "2/5 is wrong"
    if ZelleRuntertesten("c") = FALSE then Warnlog "2/6 is wrong"
    Call wTypeKeys "<Right>"
    Call wTypeKeys "<up>", 5
    Call wTypeKeys "<Mod1 a>"
    Wait 100
    EditCopy
    if GetClipboardText <> "xx" then Warnlog "3/1 is wrong!"
    if ZelleRuntertesten("xx") = FALSE then Warnlog "3/2 is wrong"
    if ZelleRuntertesten("xx") = FALSE then Warnlog "3/3 is wrong"
    if ZelleRuntertesten("zz") = FALSE then Warnlog "3/4 is wrong"
    if ZelleRuntertesten("zz") = FALSE then Warnlog "3/5 is wrong"
    if ZelleRuntertesten("zz") = FALSE then Warnlog "3/6 is wrong"


    Printlog "   - 3. column alphanum., 1. column num., 2. column alphanum. descending"
    Call wNavigatorAuswahl (2, 2)
    Call wTypeKeys "<Mod1 a>", 2
    Sleep 2
    ToolsSort
    Kontext "Sortieren"
    Schluessel1.Check
    Spalte1.SetText "3"
    Schluesseltyp1.Select 1

    Schluessel2.Check
    Spalte2.SetText "1"
    Schluesseltyp2.Select 2

    Schluessel3.Check
    Spalte3.SetText "2"
    Schluesseltyp3.Select 1
    Absteigend1.Check
    Absteigend2.Check
    Absteigend3.Check
    Sortieren.OK

    Printlog "   - check"
    Call wNavigatorAuswahl (2, 2)
    Call wTypeKeys "<Mod1 a>"
    wait 100
    EditCopy
    if GetClipboardText <> "6" then Warnlog "1/1 is wrong!"
    if ZelleRuntertesten("3") = FALSE then Warnlog "1/2 is wrong"
    if ZelleRuntertesten("1") = FALSE then Warnlog "1/3 is wrong"
    if ZelleRuntertesten("5") = FALSE then Warnlog "1/4 is wrong"
    if ZelleRuntertesten("4") = FALSE then Warnlog "1/5 is wrong"
    if ZelleRuntertesten("2") = FALSE then Warnlog "1/6 is wrong"
    Call wTypeKeys "<Right>"
    Call wTypeKeys "<up>", 5
    Call wTypeKeys "<Mod1 a>"
    Wait 100
    EditCopy
    if GetClipboardText <> "c" then Warnlog "2/1 is wrong!"
    if ZelleRuntertesten("b") = FALSE then Warnlog "2/2 is wrong"
    if ZelleRuntertesten("a") = FALSE then Warnlog "2/3 is wrong"
    if ZelleRuntertesten("c") = FALSE then Warnlog "2/4 is wrong"
    if ZelleRuntertesten("b") = FALSE then Warnlog "2/5 is wrong"
    if ZelleRuntertesten("a") = FALSE then Warnlog "2/6 is wrong"
    Call wTypeKeys "<Right>"
    Call wTypeKeys "<up>", 5
    Call wTypeKeys "<Mod1 a>"
    Wait 100
    EditCopy
    if GetClipboardText <> "zz" then Warnlog "3/1 is wrong!"
    if ZelleRuntertesten("zz") = FALSE then Warnlog "3/2 is wrong"
    if ZelleRuntertesten("zz") = FALSE then Warnlog "3/3 is wrong"
    if ZelleRuntertesten("xx") = FALSE then Warnlog "3/4 is wrong"
    if ZelleRuntertesten("xx") = FALSE then Warnlog "3/5 is wrong"
    if ZelleRuntertesten("xx") = FALSE then Warnlog "3/6 is wrong"
    Call hCloseDocument
endcase

' *******************************************************************

testcase tToolsSort6
    PrintLog "- Tools / Sort a sorted table and copy in another one"

    if gApplication = "WRITER" then
        Call hFileOpen ( gTesttoolPath + "writer\optional\input\sorting\sort3.odt" )
        Call sMakeReadOnlyDocumentEditable
    else
        Call hFileOpen ( gTesttoolPath + "writer\optional\input\sorting\sort3.odm" )
        Call sMakeReadOnlyDocumentEditable
    end if
    Call wTypeKeys "<Mod1 a>", 2

    Printlog "   - Sort 1. column numeric descending"
    ToolsSort
    Kontext "Sortieren"
    Schluessel1.Check
    Spalte1.SetText "1"
    Schluesseltyp1.Select 2
    Absteigend1.Check
    Absteigend2.Check
    Absteigend3.Check
    Sortieren.OK

    Printlog "   - check"
    Call wTypeKeys "<Mod1 a>", 3
    wait 100
    EditCopy
    if GetClipboardText <> "4" then Warnlog "Header of the 1. column has not been sorted"
    if ZelleRuntertesten("3") = FALSE then Warnlog "1/2 is wrong"
    if ZelleRuntertesten("2") = FALSE then Warnlog "1/3 is wrong"
    if ZelleRuntertesten("1") = FALSE then Warnlog "1/4 is wrong"
    Call wTypeKeys "<Tab>"
    Call wTypeKeys "<up>", 3
    Call wTypeKeys "<Mod1 a>"
    Wait 100
    EditCopy
    if GetClipboardText <> "dd" then Warnlog "Header of the 2. column has not been sorted"
    if ZelleRuntertesten("cc") = FALSE then Warnlog "2/2 is wrong"
    if ZelleRuntertesten("bb") = FALSE then Warnlog "2/3 is wrong"
    if ZelleRuntertesten("aa") = FALSE then Warnlog "2/4 is wrong"
    Call wTypeKeys "<Tab>"
    Call wTypeKeys "<up>", 3
    Call wTypeKeys "<Mod1 a>"
    Wait 100
    EditCopy
    if GetClipboardText <> "ww" then Warnlog "Header of the 3 column has not been sorted"
    if ZelleRuntertesten("xx") = FALSE then Warnlog "3/2 is wrong"
    if ZelleRuntertesten("yy") = FALSE then Warnlog "3/3 is wrong"
    if ZelleRuntertesten("zz") = FALSE then Warnlog "3/4 is wrong"

    Printlog "   - copy table"
    Call wTypeKeys "<Left Right>"
    Call wTypeKeys "<Mod1 a>", 2
    Sleep 1
    EditCopy
    Sleep 1
    Printlog "   - insert table"
    Call wTypeKeys "<Down>", 10
    Call wTypeKeys "<Up>", 4
    EditPaste
    Sleep 1

    Printlog "   - check"
    Call wTypeKeys "<Mod1 a>"
    wait 100
    EditCopy
    if GetClipboardText <> "4" then Warnlog "Header of the 1. column has not been sorted"
    if ZelleRuntertesten("3") = FALSE then Warnlog "1/2 is wrong"
    if ZelleRuntertesten("2") = FALSE then Warnlog "1/3 is wrong"
    if ZelleRuntertesten("1") = FALSE then Warnlog "1/4 is wrong"
    Call wTypeKeys "<Tab>"
    Call wTypeKeys "<up>", 3
    Call wTypeKeys "<Mod1 a>"
    Wait 100
    EditCopy
    if GetClipboardText <> "dd" then Warnlog "Header of the 2. column has not been sorted"
    if ZelleRuntertesten("cc") = FALSE then Warnlog "2/2 is wrong"
    if ZelleRuntertesten("bb") = FALSE then Warnlog "2/3 is wrong"
    if ZelleRuntertesten("aa") = FALSE then Warnlog "2/4 is wrong"
    Call wTypeKeys "<Tab>"
    Call wTypeKeys "<up>", 3
    Call wTypeKeys "<Mod1 a>"
    Wait 100
    EditCopy
    if GetClipboardText <> "ww" then Warnlog "Header of the 3 column has not been sorted"
    if ZelleRuntertesten("xx") = FALSE then Warnlog "3/2 is wrong"
    if ZelleRuntertesten("yy") = FALSE then Warnlog "3/3 is wrong"
    if ZelleRuntertesten("zz") = FALSE then Warnlog "3/4 is wrong"
    Call hCloseDocument
endcase