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: TableDesign.inc,v $
13 '* last change: $Author: obo $ $Date: 2008-07-22 12:35:23 $
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 : test the Main Table Design Application Window
38 '************************************************************************
50 '\***********************************************************************************
53 printlog "------------------ TableDesign.inc ---------------------"
55 printlog "-------------------- main menu -------------------------"
58 printlog "--------------------- toolbar --------------------------"
68 '-------------------------------------------------------------------------
71 '/// open a new table design
72 printlog "open a new table design"
75 '/// insert a fieldname
76 printlog "insert a fieldname"
77 Kontext "TableDesignTable"
78 Fieldname.setText "hello"
80 '/// click on the save button
81 printlog "click on the save button"
85 '/// check if the save dialog appear
86 printlog "check if the save dialog appear"
87 Kontext "DatabaseTableSaveAs"
88 if ( not DatabaseTableSaveAs.exists(3) ) then
89 warnlog "the save dialog doesn't appear."
91 '/// cancel the save dialog
92 printlog "cancel the save dialog"
93 DatabaseTableSaveAs.Cancel
95 '/// close tables design and the database
96 printlog "close tables design and the database"
97 call fCloseTableDesign
101 '-------------------------------------------------------------------------
102 testcase tIndexDesign
104 '/// open a new table design
105 printlog "open a new table design"
108 '/// insert a fieldname
109 printlog "insert a fieldname"
110 Kontext "TableDesignTable"
111 Fieldname.setText "hello"
113 '/// click on the save button
114 printlog "click on the save button"
119 Kontext "DatabaseTableSaveAs"
120 if ( not DatabaseTableSaveAs.exists(3) ) then
121 warnlog "the save dialog doesn't appear."
124 '/// save with the default name
125 printlog "save with the default name"
126 Kontext "DatabaseTableSaveAs"
127 TableName.setText("testtable1")
128 DatabaseTableSaveAs.OK
130 '/// click on the index design icon
131 printlog "click on the index design icon"
136 '/// close the index design
137 printlog "close the index design"
138 Kontext "DatabaseIndexes"
139 DatabaseIndexesClose.click
141 '/// close the table design
142 printlog "close the table design"
143 call fCloseTableDesign
145 '/// delete the created table
146 printlog "delete the created table"
147 call fDeleteTable("testtable1")
149 '/// close the database
150 printlog "close the database"
154 '-------------------------------------------------------------------------
157 '/// open a new tabledesign
158 printlog "open a new tabledesign"
161 '/// insert a field name
162 printlog "insert a field name"
163 Kontext "TableDesignTable"
164 TableDesignTable.TypeKeys "hello" , true
166 '/// select the field name with SHIFT HOME
167 printlog "select the field name with SHIFT HOME"
168 TableDesignTable.TypeKeys "<SHIFT HOME>" , true
171 '/// click on the cut button
172 printlog "click on the cut button"
177 '/// check if the text is in the clipboard
178 printlog "check if the text is in the clipboard"
179 if getClipboard <> "hello" then
180 warnlog "The Cut button doesn't work"
183 '/// check if the fieldname is cutted
184 printlog "check if the fieldname is cutted"
185 Kontext "TableDesignTable"
186 if ( Fieldname.getText <> "" ) then
187 warnlog "the text was not cutted"
190 '/// close the table design and the database
191 printlog "close the table design and the database"
192 call fCloseTableDesign
196 '-------------------------------------------------------------------------
198 '/// open a new tabledesign
199 printlog "open a new tabledesign"
201 '/// insert a field name
202 printlog "insert a field name"
203 Kontext "TableDesignTable"
204 TableDesignTable.TypeKeys "hello" , true
206 '/// select the field name with SHIFT HOME
207 printlog "select the field name with SHIFT HOME"
208 TableDesignTable.TypeKeys "<SHIFT HOME>" , true
211 '/// click on the copy icon
212 printlog "click on the copy icon"
217 '/// check if the text is in the clipboard
218 printlog "check if the text is in the clipboard"
219 if getClipboard <> "hello" then
220 warnlog "The Cut button doesn't work"
222 '/// close the table design and the database
223 printlog "close the table design and the database"
224 call fCloseTableDesign
228 '-------------------------------------------------------------------------
231 '/// opene new table design
232 printlog "opene new table design"
235 '/// set a string to the clipboard
236 printlog "set a string to the clipboard"
239 '/// press the cursor left key
240 printlog "press the cursor left key"
241 Kontext "TableDesignTable"
242 TableDesignTable.TypeKeys "<LEFT>" , true
244 '/// paste the text from the clipbaord
245 printlog "paste the text from the clipbaord"
249 '/// check if the text is pasted to the fieldname
250 printlog "check if the text is pasted to the fieldname"
251 Kontext "TableDesignTable"
252 if Fieldname.getText <> "word" then
253 warnlog "the paste button doesn't work"
255 '/// close the table design and the database
256 printlog "close the table design and the database"
257 call fCloseTableDesign
261 '-------------------------------------------------------------------------
264 '/// opene new table design
265 printlog "opene new table design"
268 '/// set a string to the clipboard
269 printlog "set a string to the clipboard"
272 Kontext "TableDesignTable"
273 TableDesignTable.TypeKeys "" , true
275 '/// paste the text from the clipbaord
276 printlog "paste the text from the clipbaord"
280 '/// check if the text is pasted to the fieldname
281 printlog "check if the text is pasted to the fieldname"
282 Kontext "TableDesignTable"
283 if Fieldname.getText <> "word" then
284 warnlog "the paste button doesn't work"
287 '/// click the undo icon
288 printlog "click the undo icon"
293 '/// check if the fieldname is empty again(undo work)
294 printlog "check if the fieldname is empty again(undo work)"
295 Kontext "TableDesignTable"
296 TableDesignTable.TypeKeys "<LEFT>" , true
297 if Fieldname.getText <> "" then
298 warnlog "the undo button doesn't work"
300 '/// close the table design and the database
301 printlog "close the table design and the database"
302 call fCloseTableDesign
307 '-------------------------------------------------------------------------
310 '/// opene new table design
311 printlog "opene new table design"
314 '/// set a string to the clipboard
315 printlog "set a string to the clipboard"
318 '/// press the cursor left key
319 printlog "press the cursor left key"
320 Kontext "TableDesignTable"
321 TableDesignTable.TypeKeys "<LEFT>" , true
323 '/// paste the text from the clipbaord
324 printlog "paste the text from the clipbaord"
329 '/// check if the text is pasted to the fieldname
330 printlog "check if the text is pasted to the fieldname"
331 Kontext "TableDesignTable"
332 if Fieldname.getText <> "word" then
333 warnlog "the paste button doesn't work"
336 '/// click the undo icon
337 printlog "click the undo icon"
342 '/// press the cursor left key
343 printlog "press the cursor left key"
344 Kontext "TableDesignTable"
345 TableDesignTable.TypeKeys "<LEFT>" , true
346 if Fieldname.getText <> "" then
347 warnlog "the undo button doesn't work"
350 '/// click the redo icon
351 printlog "click the redo icon"
356 '/// press the cursor left key
357 printlog "press the cursor left key"
358 Kontext "TableDesignTable"
359 TableDesignTable.TypeKeys "<LEFT>" , true
360 if Fieldname.getText <> "word" then
361 warnlog "the redo button doesn't work"
364 '/// close the tabledesign and the database
365 printlog "close the tabledesign and the database"
366 call fCloseTableDesign
371 '-------------------------------------------------------------------------
372 '-------------------------------------------------------------------------
373 testcase tMainMenuBar
375 dim iCount as integer ' the numbers of the items in the menu.
379 Kontext "TableDesignTable"
380 TableDesignTable.UseMenu
382 '/// check if there are between 8 and 12 items in the file menu.
383 printlog "check if there are between 8 and 12 items in the file menu."
384 '/// + there different count related to the file pick list.
385 printlog "+ there different count related to the file pick list."
386 hMenuSelectNr(1) ' the file menu
387 iCount = getMenuItemCount()
388 if ( lcase( gPlatform ) = "osx" ) then
389 if ( iCount <> 7 ) then
390 warnlog( "File menu: 7 items expected, found " & iCount )
393 if (iCount <> 8 ) then
394 warnlog "There should between 8 and 12 items in the file menu but there are " + iCount + " items."
398 '/// check if there are 12 items in the FILE/NEW menu.
399 printlog "check if there are 12 items in the FILE/NEW menu."
400 printlog "check the FILE/NEW"
401 hMenuSelectNr(1) ' FILE/NEW menu
402 iCount = hMenuItemGetCount()
403 if (iCount <> 12) then
404 warnlog "There should 12 items in the FILE/NEW menu but there are " + iCount + " items."
406 call hMenuClose() ' close the FILE menu
408 '/// check the FILE/AUTOPILOTS
409 printlog "check the FILE/AUTOPILOTS"
410 TableDesignTable.UseMenu
411 hMenuSelectNr(1) ' the file menu
412 hMenuSelectNr(3) ' the autopilots menu
413 iCount = hMenuItemGetCount()
414 if (iCount <> 8) then
415 warnlog "There should 8 items in the FILE/AUTOPILOTS menu but there are " + iCount + " items."
419 '/// check if there are 5 items in the edit menu.
420 printlog "check if there are 5 items in the edit menu."
421 TableDesignTable.UseMenu
423 iCount = hMenuItemGetCount()
424 if (iCount <> 5) then
425 warnlog "There should 5 items in the edit menu but there are " + iCount + " items."
429 '/// check if there are 2 items in the view menu.
430 printlog "check if there are 2 items in the view menu."
431 TableDesignTable.UseMenu
433 iCount = hMenuItemGetCount()
434 if (iCount <> 2) then
435 warnlog "There should 2 items in the edit menu but there are " + iCount + " items."
439 '/// check if there are 5 items in the tools menu.
440 printlog "check if there are 5 items in the tools menu."
441 TableDesignTable.UseMenu
443 iCount = hMenuItemGetCount()
444 if ( lcase( gPlatform ) = "osx" ) then
445 if ( iCount <> 4 ) then
446 warnlog( "Tools menu: 4 items expected, found " & iCount )
449 if (iCount <> 5) then
450 warnlog "There should 5 items in the tools menu but there are " + iCount + " items."
455 '/// check if there are 4 items in the TOOLS/MACRO menu.
456 printlog "check if there are 4 items in the TOOLS/MACRO menu."
457 TableDesignTable.UseMenu
460 iCount = hMenuItemGetCount()
461 if (iCount <> 4) then
462 warnlog "There should 4 items in the TOOLS/MACRO menu but there are " + iCount + " items."
466 call fCloseTableDesign
471 '-------------------------------------------------------------------------
472 '-------------------------------------------------------------------------
473 '-------------------------------------------------------------------------
474 function getMenuItemCount as Integer
475 'use this function becasue this doesn't count the pick list
476 Dim i, j, Ende, nID as Integer
479 for i=1 to MenuGetItemCount
480 if NOT MenuIsSeperator ( i ) then
482 s = Mid(MenuGetItemText( MenuGetItemID(i)),3,1)
484 'printlog "MenuGetItemText( MenuGetItemID(i)) = " + MenuGetItemText( MenuGetItemID(i))
492 '-------------------------------------------------------------------------
495 hFileOpen( gOfficePath & "user/database/biblio.odb" )
499 Database.MouseDown(50,50)
500 Database.MouseUp(50,50)