summaryrefslogtreecommitdiff
path: root/testautomation/dbaccess/optional/includes/wiz_CopyTableWizard.inc
blob: fefc6b169e201657385025fa62a791231c5a9861 (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
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
'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 : marc.neumann@sun.com
'*
'* short description : Copy Table Autopilot
'*
'\**************************************************************************************
Dim sDSName as string
Dim sTabName as string
dim i as integer

sub wiz_CopyTableWizard

	printlog "------------------- wiz_CopyTableWizard.inc ------------------------"
	
	call tCopy_Table_Dialog_Definition_and_data        
    call tCopy_Table_Dialog_Definition        
    call tCopy_Table_Dialog_Attach_data        
    call tCopy_Table_from_Text_Document        
    call tCopy_Table_from_Calc_Document
    ' because of issue 68334 I need to restart the office
    call ExitRestartTheOffice
    call tCopy_Table_from_hsql_to_dBase
    ' test issue 81299
    call tCopy_Table_Paste_Special
    
end sub
'--------------------------------------------------------------------
testcase tCopy_Table_Dialog_Definition_and_data

    Dim sTableDimension as string
    Dim iRowCount as integer
    Dim iColumnCount as integer
	
    '/// open the bibliography database
    printlog "open the bibliography database"	
    call fOpenDatabase(gOfficePath + ConvertPath("user/database/biblio.odb"))

    '///Make sure that there isn't a biblio2 table
    printlog "Make sure that there isn't a biblio2 table"
    If fFindtable("biblio2") = true then
       call fDeleteTable("biblio2")
    EndIf
    
    '/// select the biblio table
    printlog "select the biblio table"
    call fFindtable("biblio")

    '/// press CTRL + C to copy the table and CTRL + V to paste the table again
    printlog "press CTRL + C to copy the table and CTRL + V to paste the table again"
    Kontext "DATABASE"
        Database.typeKeys("<MOD1 C>",true)
        sleep(1)
        Database.typeKeys("<MOD1 V>",true)
        sleep(1)

    '/// the copy table dialog appear
    printlog "the copy table dialog appear"	
	Kontext "CopyDatabaseTable"
        if not CopyDatabaseTable.Exists(3) then
            warnlog "the Copy Table Autopilot doesn't appear"
            goto endsub
        endif
    
    '/// select the Definition and Data option
    printlog "select the Definition and Data option"
    Kontext "TabCopyDatabaseTable"
        DefinitionAndData.Check
        
    '/// change the table name to biblio
    printlog "change the table name to biblio" 
	Kontext "TabCopyDatabaseTable"	
	    TableName.setText "biblio"        
        
    '/// click next
    printlog "click next"
	Kontext "CopyDatabaseTable"
	    NextBt.Click
    '/// there should be a message that the table name already exists.
    printlog "there should be a message that the table name already exists."	
	Kontext "MessageBox"
	    If not MessageBox.Exists(1) then
            warnlog "There have to be an error messages that the table name already exists"
        else
            MessageBox.OK
        endif
	
    '/// change the table name to biblio2
    printlog "change the table name to biblio2" 
	Kontext "TabCopyDatabaseTable"	
	    TableName.setText "biblio2"
        DefinitionAndData.Check
    
    '/// click next
    printlog "click next"
	Kontext "CopyDatabaseTable"        	
        NextBt.Click

	sleep(1)

    '/// add all columns
    printlog "add all columns"	
	Kontext "TabColumnSelect"
	    AddAll.Click
        sleep(1)

    '/// click next
    printlog "click next"	
	Kontext "CopyDatabaseTable"
	    NextBt.Click
        sleep(1)

    '/// click OK
    printlog "click OK"	
	Kontext "CopyDatabaseTable"
        CopyDatabaseTable.OK
        sleep(1)
        
    qaerrorlog "because of issue 76051 this copied table is not checked"
    '///Check if the table is copied correct
    'printlog "Check, if the table is copied correct"
    'sTableDimension = fCreateRefFile("Bibliography", "t" , "biblio2" , "#")
    'if (sTableDimension = "") then
    '    printlog "Problem while creating Reference File"
    'else
    '    'printlog sTableDimension       'Debugcode
    '    iColumnCount = CInt(Left(sTableDimension, instr(sTableDimension,",")))+1
    '    'printlog "Number of Columns: " & iColumnCount  'Debugcode
    '    iRowCount = CInt(Right(sTableDimension, (Len(sTableDimension) - instr(sTableDimension,","))))+1
    '    'printlog "Number of Rows: " & iRowCount    'Debugcode
    '    call tCompareMatrixValues("Bibliography", "user/work/biblio2.ttr", "t", "biblio", iRowCount, iColumnCount, "#")
    'endif        
       

    '/// delete the copy table
    printlog "delete the copy table"
    call fDeleteTable("biblio2")

	'/// close the database
    printlog "close the database"
	call fCloseDatabase()
    
endcase
'--------------------------------------------------------------------
testcase tCopy_Table_Dialog_Definition
    
    '/// open the bibliography database
    printlog "open the bibliography database"
    call fOpenDatabase(gOfficePath + ConvertPath("user/database/biblio.odb"))

    '/// select the biblio table
    printlog "select the biblio table"
    call fFindtable("biblio")
    
    '/// press CTRL + C to copy the table and CTRL + V to paste the table again
    printlog "press CTRL + C to copy the table and CTRL + V to paste the table again"
    Kontext "DATABASE"
        Database.typeKeys("<MOD1 C>",true)
        sleep(1)
        Database.typeKeys("<MOD1 V>",true)
        sleep(1)


    '/// the copy table dialog appear
    printlog "the copy table dialog appear"	
	Kontext "CopyDatabaseTable"
        if not CopyDatabaseTable.Exists(3) then
            warnlog "the Copy Table Autopilot doesn't appear"
            goto endsub
        endif
    '/// check definition
    printlog "check definition"
    Kontext "TabCopyDatabaseTable"
        Definition.Check

    '/// change the table name to biblio2
    printlog "change the table name to biblio2" 
	Kontext "TabCopyDatabaseTable"	
	    TableName.setText "biblio2"
        DefinitionAndData.Check
    '/// click next
    printlog "click next"
	Kontext "CopyDatabaseTable"	
        NextBt.Click
	sleep(1)

    '/// add all columns
    printlog "add all columns"	
	Kontext "TabColumnSelect"
	    AddAll.Click
        sleep(1)

    '/// click next
    printlog "click next"	
	Kontext "CopyDatabaseTable"
	    NextBt.Click
        sleep(1)

    '/// click OK
    printlog "click OK"
    Kontext "CopyDatabaseTable"	
        CopyDatabaseTable.OK	
        sleep(1)

    'TODO: check if the table is copied correct

    '/// delete the copy table
    printlog "delete the copy table"    
    call fDeleteTable("biblio2")

    '/// close the database
    printlog "close the database"
	call fCloseDatabase()
    
endcase
'--------------------------------------------------------------------
testcase tCopy_Table_Dialog_Attach_data

    '/// open the bibliography database
    printlog "open the bibliography database"    
    call fOpenDatabase(gOfficePath + ConvertPath("user/database/biblio.odb"))

    '/// select the biblio table
    printlog "select the biblio table"    
    call fFindtable("biblio")
    
    '/// press CTRL + C to copy the table and CTRL + V to paste the table again
    printlog "press CTRL + C to copy the table and CTRL + V to paste the table again"
    Kontext "DATABASE"
        Database.typeKeys("<MOD1 C>",true)
        sleep(1)
        Database.typeKeys("<MOD1 V>",true)
        sleep(1)

    '/// the copy table dialog appear
    printlog "the copy table dialog appear"	
	Kontext "CopyDatabaseTable"
        if not CopyDatabaseTable.Exists(3) then
            warnlog "the Copy Table Autopilot doesn't appear"
            goto endsub
        endif

    '/// check definition
    Kontext "TabCopyDatabaseTable"
        Definition.Check

    '/// change the table name to biblio3
    printlog "change the table name to biblio3" 
	Kontext "TabCopyDatabaseTable"	
	    TableName.setText "biblio3"
        DefinitionAndData.Check
    
    '/// click next
    printlog "click next"
	Kontext "CopyDatabaseTable"	
        NextBt.Click
        sleep(1)

    '/// add all columns
    printlog "add all columns"	
	Kontext "TabColumnSelect"
	    AddAll.Click
        sleep(1)

    '/// click next
    printlog "click next"	
	Kontext "CopyDatabaseTable"
	    NextBt.Click
        sleep(1)

    '/// click OK
    printlog "click OK"	
	Kontext "CopyDatabaseTable"
        CopyDatabaseTable.OK	
        sleep(1)

    '/// select the biblio table
    printlog "select the biblio table"
    call fFindtable("biblio")

    '/// press CTRL + C to copy the table and CTRL + V to paste the table again
    printlog "press CTRL + C to copy the table and CTRL + V to paste the table again"
    Kontext "DATABASE"
        Database.typeKeys("<MOD1 C>",true)
        sleep(1)
        Database.typeKeys("<MOD1 V>",true)
        sleep(1)

    '/// the copy table dialog appear
    printlog "the copy table dialog appear"	
	Kontext "CopyDatabaseTable"
        if not CopyDatabaseTable.Exists(3) then
            warnlog "the Copy Table Autopilot doesn't appear"
            goto endsub
        endif    	
    '/// change the table name to biblio3 and choose attach data
    printlog "change the table name to biblio3" 
	Kontext "TabCopyDatabaseTable"	
	    TableName.setText "biblio3"
        AttachData.Check

    '/// click next
    printlog "click next"
	Kontext "CopyDatabaseTable"	
        NextBt.Click
        sleep(1)
    
    '/// click OK
    printlog "click OK"
    Kontext "CopyDatabaseTable"	
        CopyDatabaseTable.OK	
        sleep(1)

    'TODO: check if the table is copied correct

    '/// delete the copy table
    call fDeleteTable("biblio3")

    '/// close the database
    call fCloseDatabase()
    
endcase
'--------------------------------------------------------------------
testcase tCopy_Table_from_Text_Document

    '/// open a new document
    printlog "open a new document"
	call hNewDocument

    '/// insert a table and insert some data
    printlog "insert a table and insert some data"	
    InsertTableWriter
    Sleep 2
    Kontext "TabelleEinfuegenWriter"
        wait 500
        TabelleEinfuegenWriter.OK
        Sleep 1
    Kontext "DocumentWriter"
        DocumentWriter.TypeKeys "field1" , true
        DocumentWriter.TypeKeys "<TAB>" , true
        DocumentWriter.TypeKeys "field2" , true
        DocumentWriter.TypeKeys "<TAB>" , true
        DocumentWriter.TypeKeys "field3" , true
        DocumentWriter.TypeKeys "<TAB>" , true
        DocumentWriter.TypeKeys "field4" , true
        DocumentWriter.TypeKeys "<TAB>" , true
        DocumentWriter.TypeKeys "field5" , true
        DocumentWriter.TypeKeys "<TAB>" , true
        DocumentWriter.TypeKeys "1" , true
        DocumentWriter.TypeKeys "<TAB>" , true
        DocumentWriter.TypeKeys "value1" , true
        DocumentWriter.TypeKeys "<TAB>" , true
        DocumentWriter.TypeKeys "value2" , true
        DocumentWriter.TypeKeys "<TAB>" , true
        DocumentWriter.TypeKeys "31.7.2003" , true
        DocumentWriter.TypeKeys "<TAB>" , true
		EditSelectAll
        sleep(1)
        DocumentWriter.TypeKeys "<MOD1 C>" , true    
    sleep(2)
    
    '/// open database for past to
    call fOpenDatabase(gOfficePath + ConvertPath("user/database/biblio.odb"))

    '/// select the biblio table    
    call fFindtable("biblio")

    '/// press CTRL + V to paste the table
    Kontext "DATABASE"
        Database.typeKeys("<MOD1 V>",true)
        sleep(1)

    '/// the copy table dialog appear
    printlog "the copy table dialog appear"	
	Kontext "CopyDatabaseTable"
	if not CopyDatabaseTable.Exists(3) then
		warnlog "the Copy Table Autopilot doesn't appear"
		goto endsub
	endif
    '/// change the table name to biblio2
    printlog "change the table name to biblio2"
	Kontext "TabCopyDatabaseTable"	
	    TableName.setText "biblio2"

    '/// select Definition and Data
    printlog "select Definition and Data"	
	DefinitionAndData.Check

    '/// click next
    printlog "click next"
	Kontext "CopyDatabaseTable"
        NextBt.Click
        sleep(1)

    '/// add all columns
    printlog "add all columns"	
	Kontext "TabColumnSelect"
        AddAll.Click
        sleep(1)

    '/// click next
    printlog "click next"	
	Kontext "CopyDatabaseTable"
        NextBt.Click
        sleep(1)

    '/// click OK
    printlog "click OK"
	CopyDatabaseTable.OK	
	sleep(1)	

    'TODO: check if the table is copied correct

    '/// delete the copy table
    printlog "delete the copy table"
    call fDeleteTable("biblio2")
    
    '/// close the database
    printlog "close the database"
    call fCloseDatabase

    '/// close the document
    printlog "close the document"
    call hCloseDocument

endcase
'--------------------------------------------------------------------
testcase tCopy_Table_from_Calc_Document

    '/// open a new calc document
    printlog "open a calc new document"
	gApplication = "CALC"
    call hNewDocument    

    '/// insert some data
    printlog "insert some data"
    Kontext "DocumentCalc"
        DocumentCalc.TypeKeys "Field1" , true
        DocumentCalc.TypeKeys "<TAB>" , true
        DocumentCalc.TypeKeys "Field2" , true
        DocumentCalc.TypeKeys "<TAB>" , true
        DocumentCalc.TypeKeys "Field3" , true
        DocumentCalc.TypeKeys "<TAB>" , true
        DocumentCalc.TypeKeys "Field4" , true
        DocumentCalc.TypeKeys "<TAB>" , true
        DocumentCalc.TypeKeys "Field5" , true
        DocumentCalc.TypeKeys "<TAB>" , true
        DocumentCalc.TypeKeys "<RETURN>" , true
        DocumentCalc.TypeKeys "<HOME>" , true
        DocumentCalc.TypeKeys "1" , true
        DocumentCalc.TypeKeys "<TAB>" , true
        DocumentCalc.TypeKeys "value1" , true
        DocumentCalc.TypeKeys "<TAB>" , true
        DocumentCalc.TypeKeys "value2" , true
        DocumentCalc.TypeKeys "<TAB>" , true
        DocumentCalc.TypeKeys "31.7.2003" , true
        DocumentCalc.TypeKeys "<TAB>" , true
        '/// select all and press CTRL + C to copy the data to the clipboard
        printlog "select all and press CTRL + C to copy the data to the clipboard"
		EditSelectALL
        sleep(1)        
        DocumentCalc.TypeKeys "<MOD1 C>" , true    
    sleep(2)

    '/// open database for paste to
    printlog "open database for paste to"
    app.FileCopy gTesttoolPath + ConvertPath("dbaccess/optional/input/hsql_datasource/TT_hsqldb.odb"),gOfficePath + ConvertPath("user/work/TT_hsqldb.odb")    
    call fOpendatabase(ConvertPath(gOfficePath + "user/work/TT_hsqldb.odb"))    

    '/// open the tables container
    printlog "open the tables container"
    call fFindtable("biblio2")

    '/// press CTRL + V to paste the table again
    Kontext "DATABASE"
        Database.typeKeys("<MOD1 V>",true)
        sleep(1)

    '/// the copy table dialog appear
    printlog "the copy table dialog appear"	
	Kontext "CopyDatabaseTable"
	if not CopyDatabaseTable.Exists(3) then
		warnlog "the Copy Table Autopilot doesn't appear"
		goto endsub
	endif
    '/// change the table name to biblio2
    printlog "change the table name to biblio2"	
	Kontext "TabCopyDatabaseTable"	
	    TableName.setText "biblio2"

    '/// select Definition and Data
    printlog "select Definition and Data"	
	DefinitionAndData.Check
    
    '/// let the wizard create a primary key
    printlog "let the wizard create a primary key"
    CreatePrimaryKey.Check
    '/// check if the default text for the primary key is available
    printlog "check if the default text for the primary key is available"
    if ( PrimaryKeyName.getText = "" ) then
        warnlog "the automatic default text for the primary key doesn't work"        
    endif    

    '/// change the default text to ID111
    printlog "change the default text to ID111"
    PrimaryKeyName.setText("ID1111")

    '/// click next
    printlog "click next"
	Kontext "CopyDatabaseTable"
    	NextBt.Click
        sleep(1)

    '/// add all columns
    printlog "add all columns"	
	Kontext "TabColumnSelect"
        AddAll.Click
        sleep(1)

    '/// click next
    printlog "click next"	
	Kontext "CopyDatabaseTable"
	NextBt.Click
	sleep(1)

    '/// click OK
    printlog "click OK"
	CopyDatabaseTable.OK	
	sleep(1)

    '/// ceck if the table is copied correct
    printlog "ceck if the table is copied correct"
    call fOpenTableInDesign("biblio2")
    
    Kontext "TableDesignTable"
        dim s as String
        s = Fieldname.getText()
        printlog s
        if s <> "ID1111" then
            warnlog "the first field is wrong. It should ID1111 but it is " + s
        endif
        TableDesignTable.TypeKeys("<DOWN>")
        s = Fieldname.getText()
        printlog s
        if s <> "Field1" then
            warnlog "the second field is wrong. It should Field1 but it is " + s
        endif
        TableDesignTable.TypeKeys("<DOWN>")
        s = Fieldname.getText()
        printlog s
        if s <> "Field2" then
            warnlog "the third field is wrong. It should Field2 but it is " + s
        endif
        TableDesignTable.TypeKeys("<DOWN>")
        s = Fieldname.getText()
        printlog s
        if s <> "Field3" then
            warnlog "the 4. field is wrong. It should Field3 but it is " + s
        endif
        TableDesignTable.TypeKeys("<DOWN>")
        s = Fieldname.getText()
        printlog s
        if s <> "Field4" then
            warnlog "the 5. field is wrong. It should Field4 but it is " + s
        endif
        TableDesignTable.TypeKeys("<DOWN>")
        s = Fieldname.getText()
        printlog s
        if s <> "Field5" then
            warnlog "the 6. field is wrong. It should Field5 but it is " + s
        endif
        TableDesignTable.TypeKeys("<DOWN>")

    '/// close the table design
    printlog "close the table design"
    call fCloseTableDesign

    '/// delete the copy table
    printlog "delete the copy table"
    call fDeleteTable("biblio2")
    
    '/// close the database
    printlog "close the database"
    call fCloseDatabase

    '/// close the spreadsheet document
    printlog "close the spreadsheet document"    
    call hCloseDocument

    gApplication = "WRITER"

endcase
'--------------------------------------------------------------------
testcase tCopy_Table_from_hsql_to_dBase

    '/// copy the database file to a local path
    printlog "copy the database file to a local path"
    app.FileCopy gTesttoolPath + ConvertPath("dbaccess/optional/input/hsql_datasource/TT_hsqldb.odb"),gOfficePath + ConvertPath("user/work/TT_hsqldb.odb")

    '/// open a hsql database
    printlog "open a hsql database"
    call fOpendatabase(ConvertPath(gOfficePath + "user/work/TT_hsqldb.odb"))
    sleep(5)

    '/// select the tabel TT_CopyTest
    printlog "select the tabel TT_CopyTest"
    call fFindTable("TT_1")

    '/// press CTRL + C to copy the table
    printlog "press CTRL + C to copy the table"
    Kontext "DATABASE"
        Database.typeKeys("<MOD1 C>",true)

    '/// open the bibliography database
    printlog "open the bibliography database"
    call fOpenDatabase(gOfficePath + "user/database/biblio.odb")

    call fDeleteTable("TT_1") ' delete the table TT_1 if the table exists.

    '/// select the biblio table
    printlog "select the biblio table"
    call fFindTable("biblio")
    
    '/// press CTRL + V to paste the table
    Kontext "DATABASE"
        Database.typeKeys("<MOD1 V>",true)

    '/// the copy table dialog appear
    printlog "the copy table dialog appear"	
	Kontext "CopyDatabaseTable"
	if not CopyDatabaseTable.Exists(3) then
		warnlog "the Copy Table Autopilot doesn't appear"
		goto endsub
	endif

    '/// select Definition and Data
    printlog "select Definition and Data"
	Kontext "TabCopyDatabaseTable"	
	    TableName.setText("TT_1")
        DefinitionAndData.Check

    '/// click next
    printlog "click next"
	Kontext "CopyDatabaseTable"
        NextBt.Click

    '/// add all columns
    printlog "add all columns"	
	Kontext "TabColumnSelect"
        AddAll.Click

    ' there is a messages box about missing compatible field type.    
    Kontext "MessageBox"
    if MessageBox.exists(3) then
        printlog "There is a messageBox. " + MessageBox.getText
        MessageBox.OK        
    endif
    
    '/// click next
    printlog "click next"	
	Kontext "CopyDatabaseTable"
	    NextBt.Click
	
    '/// click OK
    printlog "click OK"
	CopyDatabaseTable.OK	
	sleep(1)

    Kontext "MessageBox"
    if MessageBox.exists(3) then
        printlog "There is a messageBox. " + MessageBox.getText
        MessageBox.Yes        
    endif

    if MessageBox.exists(3) then
        printlog "There is a messageBox. " + MessageBox.getText
        MessageBox.OK        
    endif
    
    '/// delete the copied table
    printlog "delete the copied table"
    call fDeleteTable("TT_1")

    '/// close the database
    printlog "close the database"
    call fCloseDatabase()

    '/// close the other database
    printlog "close the other database"
    call fCloseDatabase()
    
endcase
'--------------------------------------------------------------------
testcase tCopy_Table_Paste_Special
    
    Dim sTableDimension as string
    Dim iRowCount as integer
    Dim iColumnCount as integer
	
    '/// open the bibliography database
    printlog "open the bibliography database"	
    call fOpenDatabase(gOfficePath + ConvertPath("user/database/biblio.odb"))

    '///Make sure that there isn't a biblio2 table
    printlog "Make sure that there isn't a biblio2 table"
    If fFindtable("biblio2") = true then
       call fDeleteTable("biblio2")
    EndIf
    
    '/// select the biblio table
    printlog "select the biblio table"
    call fFindtable("biblio")

    '/// press CTRL + C to copy the table and CTRL + V to paste the table again
    printlog "press CTRL + C to copy the table and CTRL + V to paste the table again"
    Kontext "DATABASE"
        Database.typeKeys("<MOD1 C>",true)
        sleep(1) 
        Database.UseMenu
        hMenuSelectNr(2)
        hMenuSelectNr(5)                
        sleep(1)
        Kontext "InhaltEinfuegen"
            InhaltEinfuegen.OK
                
    '/// the copy table dialog appear
    printlog "the copy table dialog appear"	
	Kontext "CopyDatabaseTable"
        if not CopyDatabaseTable.Exists(3) then
            warnlog "the Copy Table Autopilot doesn't appear"
            goto endsub
        endif
    
    '/// change the table name to biblio
    printlog "change the table name to biblio" 
	Kontext "TabCopyDatabaseTable"	
	    TableName.setText "biblio"        
        
    '/// click next
    printlog "click next"
	Kontext "CopyDatabaseTable"
	    NextBt.Click
    '/// there should be a message that the table name already exists.
    printlog "there should be a message that the table name already exists."	
	Kontext "MessageBox"
	    If not MessageBox.Exists(1) then
            warnlog "There have to be an error messages that the table name already exists"
        else
            MessageBox.OK
        endif
	
    '/// change the table name to biblio2
    printlog "change the table name to biblio2" 
	Kontext "TabCopyDatabaseTable"	
	    TableName.setText "biblio2"
        DefinitionAndData.Check
    
    '/// click next
    printlog "click next"
	Kontext "CopyDatabaseTable"        	
        NextBt.Click

	sleep(1)

    '/// add all columns
    printlog "add all columns"	
	Kontext "TabColumnSelect"
	    AddAll.Click
        sleep(1)

    '/// click next
    printlog "click next"	
	Kontext "CopyDatabaseTable"
	    NextBt.Click
        sleep(1)

    '/// click OK
    printlog "click OK"	
	Kontext "CopyDatabaseTable"
        CopyDatabaseTable.OK
        sleep(1)
        
    qaerrorlog "because of issue 76051 this copied table is not checked"
    '///Check if the table is copied correct
    'printlog "Check, if the table is copied correct"
    'sTableDimension = fCreateRefFile("Bibliography", "t" , "biblio2" , "#")
    'if (sTableDimension = "") then
    '    printlog "Problem while creating Reference File"
    'else
    '    'printlog sTableDimension       'Debugcode
    '    iColumnCount = CInt(Left(sTableDimension, instr(sTableDimension,",")))+1
    '    'printlog "Number of Columns: " & iColumnCount  'Debugcode
    '    iRowCount = CInt(Right(sTableDimension, (Len(sTableDimension) - instr(sTableDimension,","))))+1
    '    'printlog "Number of Rows: " & iRowCount    'Debugcode
    '    call tCompareMatrixValues("Bibliography", "user/work/biblio2.ttr", "t", "biblio", iRowCount, iColumnCount, "#")
    'endif        
       

    '/// delete the copy table
    printlog "delete the copy table"
    call fDeleteTable("biblio2")

	'/// close the database
    printlog "close the database"
	call fCloseDatabase()
    
endcase