1 'encoding UTF-8 Do not remove or change this line!
2 '**************************************************************************
3 '* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 '* Copyright 2008 by Sun Microsystems, Inc.
7 '* OpenOffice.org - a multi-platform office productivity suite
9 '* $RCSfile: wiz_TableWizard.inc,v $
13 '* last change: $Author: jsi $ $Date: 2008-06-16 07:43:42 $
15 '* This file is part of OpenOffice.org.
17 '* OpenOffice.org is free software: you can redistribute it and/or modify
18 '* it under the terms of the GNU Lesser General Public License version 3
19 '* only, as published by the Free Software Foundation.
21 '* OpenOffice.org is distributed in the hope that it will be useful,
22 '* but WITHOUT ANY WARRANTY; without even the implied warranty of
23 '* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 '* GNU Lesser General Public License version 3 for more details
25 '* (a copy is included in the LICENSE file that accompanied this code).
27 '* You should have received a copy of the GNU Lesser General Public License
28 '* version 3 along with OpenOffice.org. If not, see
29 '* <http://www.openoffice.org/license.html>
30 '* for a copy of the LGPLv3 License.
32 '/************************************************************************
34 '* owner : marc.neumann@sun.com
36 '* short description : Table Wizard
38 '\***********************************************************************
42 call tStartFormWizardFromTableWizard
45 call tCheckSampleTables
49 '-------------------------------------------------------------------------
52 if bAsianLan = true then
53 qaerrorlog "#i62665# Table wizard doesn't work in CJK versions. So some test are left out."
57 if (iSprache = 7) then
58 qaerrorlog "due to issue i94730 this testcase does not work under russian."
63 Dim sTableName as String
65 '/// open Bibliography database
66 printlog "open Bibliography database"
67 if not fOpenDataBase(gOfficePath + ConvertPath("user/database/biblio.odb")) then
68 warnlog "Database " + gOfficePath + ConvertPath("user/database/biblio.odb") + " could not be open."
72 '/// start the table wizard
73 printlog "start the table wizard"
74 if not fStartTableWizard() then
75 warnlog "The table wizard doesn't start. TEST STOPPED"
80 '/// add all fields from the displayed table
81 printlog "add all fields from the displayed table"
91 'remember the table, because we want to delete it later
92 sTableName = TableName.getText
94 printlog "click Finish"
99 '/// close the open table
100 printlog "close the open table"
101 call fCloseTableView()
103 '/// delete the created table
104 printlog "delete the created table"
105 call fDeleteTable sTableName
107 '/// close the database
108 printlog "close the database"
109 call fClosedatabase()
112 '-------------------------------------------------------------------------
113 testcase tCheckSampleTables
115 dim iTablesCount as Integer
116 dim iFieldsCount as Integer
120 '/// open Bibliography database
121 printlog "open Bibliography database"
122 if not fOpenDataBase(gOfficePath + ConvertPath("user/database/biblio.odb")) then
123 warnlog "Database " + gOfficePath + ConvertPath("user/database/biblio.odb") + " could not be open."
127 '/// start the table wizard
128 printlog "start the table wizard"
129 if not fStartTableWizard() then
130 warnlog "The table wizard doesn't start. TEST STOPPED"
134 Kontext "TableWizard"
135 '/// check if there are 22 table in the business category
136 printlog "check if there are 22 table in the business category"
137 iTablesCount = Tables.GetItemCount()
138 if ( iTablesCount <> 22 ) then
139 warnlog "the number of tables in the business category should be 22 but it is : " + iTablesCount
142 '/// check the count of all fields in all table in the business category
143 printlog "check the count of all fields in all table in the business category"
144 for i = 1 to iTablesCount
146 'printlog Tables.getseltext
147 iFieldsCount = iFieldsCount + Fields.getItemCount
148 for ii = 1 to Fields.getItemCount
150 'printlog " " + Fields.getSelText
154 if ( iFieldsCount <> 318 AND iFieldsCount <> 290 ) then
155 warnlog "the number of all fields should be 318 or 290 but it is : " + iFieldsCount
158 Kontext "TableWizard"
159 '/// check the personal radio button
161 '/// check if there are 15 table in the personal category
162 printlog "check if there are 15 table in the personal category"
163 iTablesCount = Tables.GetItemCount()
164 if ( iTablesCount <> 15 ) then
165 warnlog "the number of tables in the personal category should be 15 but it is : " + iTablesCount
168 '/// check the count of all fields in all table in the personal category
169 printlog "check the count of all fields in all table in the personal category"
170 for i = 1 to iTablesCount
172 'printlog Tables.getseltext
173 iFieldsCount = iFieldsCount + Fields.getItemCount
174 for ii = 1 to Fields.getItemCount
176 'printlog " " + Fields.getSelText
180 if ( iFieldsCount <> 480 AND iFieldsCount <> 508 ) then
181 warnlog "the number of all fields should be 480 or 508 but it is : " + iFieldsCount
183 if (iFieldsCount = 480) then
184 qaerrorlog "There have to be 508 fields. Please contact msc."
188 printlog "click CANCEL"
191 '///close the database
192 printlog "close the database"
193 call fClosedatabase()
196 '-------------------------------------------------------------------------
197 testcase tChangeFieldName
199 if (iSprache = 7) then
200 qaerrorlog "due to issue i94730 this testcase does not work under russian."
204 '/// open Bibliography database
205 printlog "open Bibliography database"
206 if not fOpenDataBase(gOfficePath + ConvertPath("user/database/biblio.odb")) then
207 warnlog "Database " + gOfficePath + ConvertPath("user/database/biblio.odb") + " could not be open."
211 '/// delete the table t_wizard if it's allready exists
212 printlog "delete the table t_wizard if it's allready exists"
213 call fDeleteTable ("t_wizard")
215 '/// start the table wizard
216 printlog "start the table wizard"
217 if not fStartTableWizard() then
218 warnlog "The table wizard doesn't start. TEST STOPPED"
222 Kontext "TableWizard"
223 '/// select the first field
224 printlog "select the first field"
226 '/// click the add button
227 printlog "click the add button"
230 printlog "click NEXT"
233 '/// select the first field
234 printlog "select the first field"
236 '/// change the field name for the first field to field_test
237 FieldName.setText("field_test")
238 '/// click the add fields button (the + sign)
239 printlog "click the add fields button (the + sign)"
241 '/// select the second field
242 printlog "select the second field"
244 '/// change the field name for the second field to field_2
245 printlog "change the field name for the second field to field_2"
246 FieldName.setText("field_2")
247 '/// click on field move up button to move the second filed to the first position
248 printlog "click on field move up button to move the second filed to the first position"
251 printlog "click NEXT"
254 '/// change table name to t_wizard
255 printlog "change table name to t_wizard"
256 TableName.settext "t_wizard"
258 printlog "click Finish"
263 '/// close the table view
264 printlog "close the table view"
265 call fCloseTableView()
267 '/// open the table t_wizard in the design view
268 printlog "open the table t_wizard in the design view"
269 call fOpenTableInDesign("t_wizard")
271 Kontext "TableDesignTable"
272 '/// check if the first field is field_2
273 printlog "check if the first field is field_2"
275 s = Fieldname.getText
276 if s <> "field_2" then
277 printlog "the field name of the first field is not 'field_2' it is '" + s + "'."
278 warnlog "the renaming or moving of a field in the wizard doesn't work"
280 printlog "==>> the first field name is field_2 => OK"
282 '/// check the second field
283 TableDesignTable.typeKeys("<DOWN>")
284 s = Fieldname.getText
285 if s <> "field_test" then
286 printlog "the field name of the second field is not 'field_test' it is '" + s + "'."
287 warnlog "the renaming or moving of a field in the wizard doesn't work"
289 printlog "==>> the second field name is field_test => OK"
292 '/// close the table design
293 printlog "close the table design"
294 call fCloseTableDesign
296 '/// delete the table t_wizard we dont't need it anymore
297 printlog "delete the table t_wizard we dont't need it anymore"
298 call fDeleteTable ("t_wizard")
300 '/// close the database
301 printlog "close the database"
302 call fClosedatabase()
305 '-------------------------------------------------------------------------
306 testcase tStartFormWizardFromTableWizard
308 if bAsianLan = true then
309 qaerrorlog "#i62665# Table wizard doesn't work in CJK versions. So some test are left out."
313 if (iSprache = 7) then
314 qaerrorlog "due to issue i94730 this testcase does not work under russian."
319 Dim sTableName as String
321 '/// open Bibliography database
322 printlog "open Bibliography database"
323 if not fOpenDataBase(gOfficePath + ConvertPath("user/database/biblio.odb")) then
324 warnlog "Database " + gOfficePath + ConvertPath("user/database/biblio.odb") + " could not be open."
328 '/// start the table wizard
329 printlog "start the table wizard"
330 if not fStartTableWizard() then
331 warnlog "The table wizard doesn't start. TEST STOPPED"
335 Kontext "TableWizard"
336 '/// add all fields from the displayed table
337 printlog "add all fields from the displayed table"
340 printlog "click NEXT"
344 printlog "click NEXT"
347 'remember the table, because we want to delete it later
348 sTableName = TableName.getText
353 printlog "click Finish"
358 '/// check if the form wizard appear
359 printlog "check if the form wizard appear"
361 if FormWizard.exists(1) then
362 printlog "The formwizard appear ==>> OK"
365 warnlog "The Form Wizard doesn't appear."
368 '/// delete the created table
369 printlog "delete the created table"
370 call fDeleteTable sTableName
372 '/// close the database
373 printlog "close the database"
374 call fClosedatabase()
377 '-------------------------------------------------------------------------
378 testcase tCreateAllTables
380 if bAsianLan = true then
381 qaerrorlog "#i62665# Table wizard doesn't work in CJK versions. So some test are left out."
385 '/// create all tables form the business and personal category
386 printlog "create all tables form the business and personal category"
390 'copy the hsqldb database file to a local path
391 app.FileCopy gTesttoolPath + ConvertPath("dbaccess/optional/input/hsql_datasource/TT_hsqldb.odb"),gOfficePath + ConvertPath("user/work/TT_hsqldb.odb")
393 '/// open a hsql database
394 printlog "open a hsql database"
395 call fOpendatabase(ConvertPath(gOfficePath + "user/work/TT_hsqldb.odb"))
398 '/// check if there are 22 items in the business categoriy
399 if not fStartTableWizard() then
400 warnlog "The table wizard doesn't start. TEST STOPPED"
404 Kontext "TableWizard"
405 dim iCount as integer
406 iCount = Tables.GetItemCount
407 if(iCount <> 22 ) then
408 warnlog "#102019# there are not 22 table in the category business. There are " + iCount
410 call fCloseDatabase()
417 '/// start the table wizard
418 printlog "start the table wizard"
419 if not fStartTableWizard() then
420 warnlog "The table wizard doesn't start. TEST STOPPED"
424 Kontext "TableWizard"
426 dim sTableName as String
427 sTableName = Tables.getSelText
428 printlog "Create table " + sTableName
430 printlog " add all fields"
433 printlog " click Finish"
437 if ( MessageBox.exists(3) ) then
438 warnlog "error while creating table: " + sTableName
440 Kontext "TableWizard"
443 '/// close the open table
444 printlog " close the open table"
445 call fCloseTableView()
449 '/// now create all tables from the personal tables
450 printlog "now create all tables from the personal tables"
452 if not fStartTableWizard() then
453 warnlog "The table wizard doesn't start. TEST STOPPED"
457 Kontext "TableWizard"
459 iCount = Tables.GetItemCount
460 if(iCount <> 15 ) then
461 warnlog "#102019# there are not 15 table in the category business. There are " + iCount
463 call fCloseDatabase()
469 '/// start the table wizard
470 printlog "start the table wizard"
471 if not fStartTableWizard() then
472 warnlog "The table wizard doesn't start. TEST STOPPED"
475 Kontext "TableWizard"
478 sTableName = Tables.getSelText
479 printlog "Create table " + sTableName
481 printlog " add all fields"
484 printlog " click Finish"
488 if ( MessageBox.exists(3) ) then
489 warnlog "error while creating table: " + sTableName
491 Kontext "TableWizard"
494 '/// close the open table
495 printlog " close the open table"
496 call fCloseTableView()
501 '/// close the database
502 printlog "close the database"
503 call fClosedatabase()