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 2000, 2010 Oracle and/or its affiliates.
7 ' OpenOffice.org - a multi-platform office productivity suite
9 ' This file is part of OpenOffice.org.
11 ' OpenOffice.org is free software: you can redistribute it and/or modify
12 ' it under the terms of the GNU Lesser General Public License version 3
13 ' only, as published by the Free Software Foundation.
15 ' OpenOffice.org is distributed in the hope that it will be useful,
16 ' but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ' GNU Lesser General Public License version 3 for more details
19 ' (a copy is included in the LICENSE file that accompanied this code).
21 ' You should have received a copy of the GNU Lesser General Public License
22 ' version 3 along with OpenOffice.org. If not, see
23 ' <http://www.openoffice.org/license.html>
24 ' for a copy of the LGPLv3 License.
26 '/***********************************************************************
28 '* owner : oliver.craemer@oracle.com
30 '* short description : Resource Test - File Menu
32 '************************************************************************
34 ' #1 tFileNewSpreadsheet
35 ' #1 tFileNewSpreadsheetFromTemplate
40 ' #1 tFileRecentDocuments
48 '\***********************************************************************
52 Printlog Chr(13) + "--------- FILE Menu (c_upd_filemenu.inc) ---------"
54 Call tFileNewSpreadsheet
55 Call tFileNewSpreadsheetFromTemplate
60 Call tFileRecentDocuments
71 '-----------------------------------------------------------
73 testcase tFileNewSpreadsheet
75 '/// Opening new spreadsheet document for getting defined starting environment
76 Printlog " Opening new spreadsheet document for getting defined starting environment"
78 '/// Open new document via Menu FILE-NEW-SPREADSHEET
79 Printlog " Open new document via Menu FILE-NEW-SPREADSHEET"
80 Kontext "DocumentCalc"
81 DocumentCalc.UseMenu 'Selecting Menubar
82 hMenuSelectNr(1) 'Using first entry on Menubar (FILE)
83 hMenuSelectNr(1) 'Using first entry on menu (NEW)
84 hMenuSelectNr(2) 'Using second entry on menu (SPREADSHEET)
85 Kontext "DocumentCalc"
86 Call DialogTest (DocumentCalc)
88 Printlog " Close document"
90 '/// Close starting document
91 Printlog " Close starting document"
96 '-----------------------------------------------------------
98 testcase tFileNewSpreadsheetFromTemplate
100 '/// Opening new spreadsheet document for getting defined starting environment
101 Printlog " Opening new spreadsheet document for getting defined starting environment"
103 '/// Open new document via Menu FILE-NEW-TEMPLATES AND DOCUMENTS
104 Printlog " Open new document via Menu FILE-NEW-FROM TEMPLATES AND DOCUMENTS"
105 Kontext "DocumentCalc"
106 DocumentCalc.UseMenu 'Selecting Menubar
107 hMenuSelectNr(1) 'Using first entry on Menubar (FILE)
108 hMenuSelectNr(1) 'Using first entry on menu (NEW)
109 hMenuSelectNr(12) 'Using second entry on menu (TEMPLATES AND DOCUMENTS)
110 Kontext "TemplateAndDocuments"
111 Call DialogTest (TemplateAndDocuments)
113 Printlog " Cancel dialog"
114 TemplateAndDocuments.Cancel
115 '/// Opening TemplateAndDocuments-Dialog via slot FileNewFromTemplate
116 Printlog " Opening TemplateAndDocuments-Dialog via slot FileNewFromTemplate"
117 Kontext "DocumentCalc"
119 Kontext "TemplateAndDocuments"
120 Call DialogTest (TemplateAndDocuments)
122 Printlog " Cancel dialog"
123 TemplateAndDocuments.Cancel
124 '/// Close starting document
125 Printlog " Close starting document"
130 '-----------------------------------------------------------
134 '/// Opening new spreadsheet document for getting defined starting environment
135 Printlog " Opening new spreadsheet document for getting defined starting environment"
137 '/// Open File-Open-dialog
138 Printlog " Open File-Open-dialog"
141 Call DialogTest ( OeffnenDlg )
142 '/// Click "Up one level"
143 Printlog " Click Up one level"
144 UebergeordneterOrdner.Click
145 '/// Click "Default directory"
146 Printlog " Click Default directory"
148 '/// Click "New Folder"
149 Printlog " Click New Folder"
151 Kontext "NeuerOrdner"
152 Call DialogTest ( NeuerOrdner )
153 '/// Cancel New Folder
154 Printlog " Cancel New Folder"
157 '/// Check "Read only"
158 Printlog " Check Read only"
160 '/// Close File-Open-dialog with Cancel
161 Printlog " Close File-Open-dialog with Cancel"
163 '/// Close starting document
164 Printlog " Close starting document"
169 '-----------------------------------------------------------
171 testcase tFileOpenCSV
173 dim sTestFile as string
175 sTestFile = convertpath(gTesttoolPath & "spreadsheet/required/input/tFileOpen_CSV.csv"
176 Printlog " Opening new spreadsheet document for getting defined starting environment"
178 Printlog " Open File-Open-dialog"
181 Printlog " Enter filename spreadsheet/required/input/tFileOpen_CSV.csv"
182 Dateiname.settext (sTestFile)
183 Printlog " Click on Open"
185 Printlog " Check existence of CSV import dialog"
187 if Not TextImport.exists(2) then
188 'Verify if the file will be loaded in Writer instead
189 Kontext "ASCIIFilterOptionen"
190 if ASCIIFilterOptionen.exists(2) then
191 warnlog "Filterdetection for CSV is broken. Textfilter is used instead"
192 ASCIIFilterOptionen.Cancel
196 Kontext "DocumentWriter"
197 if DocumentWriter.exists(2) then
198 warnlog "CSV import has failed, file is loaded in Writer"
199 'Close Writer document
201 'Close starting document
206 if Active.exists then
214 Call Dialogtest (TextImport)
216 Printlog " Use every control"
217 CharacterSet.GetItemCount
218 Language.GetItemCount
227 OtherText.SetText "a"
229 TextDelimiter.GetItemCount
231 DetectSpecialNumbers.Check
232 Printlog " Cancel Text Import dialog"
234 Printlog " Open File-Open-dialog"
237 Printlog " Enter filename spreadsheet/required/input/tFileOpen_CSV.csv"
238 Dateiname.settext (sTestFile)
239 Printlog " Click on Open"
244 Printlog " - CSV import dialog is in function"
246 Kontext "DocumentCalc"
247 printlog " Close document"
252 '-----------------------------------------------------------
254 testcase tFileOpenDBF
256 dim sTestFile as string
258 sTestFile = convertpath(gTesttoolPath & "spreadsheet/required/input/tFileOpen_DBF.dbf"
259 '/// Opening new spreadsheet document for getting defined starting environment
260 Printlog " Opening new spreadsheet document for getting defined starting environment"
262 '/// Open File-Open-dialog
263 Printlog " Open File-Open-dialog"
266 '/// Enter filename spreadsheet/required/input/tFileOpen_DBF.dbf
267 Printlog " Enter filename spreadsheet/required/input/tFileOpen_DBF.dbf"
268 Dateiname.settext (sTestFile)
270 Printlog " Click on Open"
272 '/// Check if there is no Text document opened
273 Printlog " Check if there is no Text document opened"
274 Kontext "DocumentWriter"
275 if DocumentWriter.exists(2) then
276 warnlog "Filter detection is broken. Text file opened in writer although DBF filter was selected."
278 '/// Close starting document
279 Printlog " Close starting document"
283 '/// Check existence of import dialog
284 Printlog " Check existence of import dialog"
286 Call Dialogtest (ExportCalc)
287 if ExportCalc.exists(2) then
289 Printlog " - Import dialog is in function"
290 Kontext "DocumentCalc"
293 warnlog "DBF Import failed"
294 '/// Close starting document
295 Printlog " Close starting document"
301 '-----------------------------------------------------------
303 testcase tFileOpenHTML
305 Dim sTestFile as string
306 Dim sTestFilter1 as string
307 Dim sTestFilter2 as string
309 sTestFile = convertpath(gTesttoolPath & "spreadsheet/required/input/HTML_Doc_Numberformats_in_table.html"
310 sTestFilter1 = hGetUIFiltername ("HTML (StarCalc)")
311 sTestFilter2 = hGetUIFiltername ("calc_HTML_WebQuery")
313 Printlog " Opening new spreadsheet document for getting defined starting environment"
315 Printlog " Open File-Open-dialog"
319 Printlog " Enter filename spreadsheet/required/input/HTML_Doc_Numberformats_in_table.html"
320 Dateiname.settext (sTestFile)
321 Printlog " Choose Calc HTML filter"
322 Call hSelectUIFilter (sTestFilter1)
323 Printlog " Click on Open"
325 Kontext "HTMLImportOptions"
326 Printlog " Use every control on dialog Import Options"
328 CustomLanguage.GetItemCount
330 DetectSpecialNumbers.Check
333 Printlog " Close recent document"
335 Printlog " Retry with Calc Web Querry filter"
336 Printlog " Open File-Open-dialog"
340 Printlog " Enter filename spreadsheet/required/input/HTML_Doc_Numberformats_in_table.html"
341 Dateiname.settext (sTestFile)
342 Printlog " Choose Calc Web Query filter"
343 Call hSelectUIFilter (sTestFilter2)
344 Printlog " Click on Open"
346 Kontext "HTMLImportOptions"
347 Printlog " Use every control on dialog Import Options"
349 CustomLanguage.GetItemCount
351 DetectSpecialNumbers.Check
354 Printlog " Close recent document"
359 '-----------------------------------------------------------
361 testcase tFileRecentDocuments
363 if gPlatform = "lin" then
364 warnlog "#110649# Due to bug this testcase is not available"
368 dim sTestFile as string
370 '/// Open new Spreadsheet document
371 Printlog " Open new Spreadsheet document"
374 Printlog " Enter some text"
375 Kontext "DocumentCalc"
376 DocumentCalc.Typekeys "The first doc!<RETURN>"
378 Printlog " Copy Test File spreadsheet/required/input/recentdocument.ods locally"
379 hFileOpenLocally( gTesttoolpath & "spreadsheet\required\input\recentdocument.ods" )
380 sTestFile = gLastWorkFile ' get the new file location
382 'app.FileCopy convertpath(gTesttoolpath & "spreadsheet\required\input\recentdocument.ods"),gOfficePath + ConvertPath("user/work/recentdocument.ods")
383 'Printlog " Load local copied testfile recentdocument.ods"
384 'sTestFile = convertpath(gOfficePath & "user/work/recentdocument.ods")
385 'Call hFileOpen(sTestFile)
386 '/// Close the document.
387 Printlog " Close the document."
388 '/// Now an item in <i>File / Recent Documents</i> should exist
390 '/// Reopen Document using the menu <i>File / Recent Documents</i>
391 Printlog " Reopen Document using the menu File / Recent Documents"
392 Kontext "DocumentCalc"
397 '/// Check that cell A1 has value "Recent document"
398 Printlog " Check that cell A1 has value Recent document"
399 Kontext "DocumentCalc"
400 if fCalcGetCellValue ("A1") = "Recent document" then
401 Printlog " - Loading most recent Document seems to work"
403 'Sometimes the recent doc is loaded in background (#i80533#)
404 if fCalcGetCellValue ("A1") = "The first doc!" then
405 QAErrorLog "Recent document is loaded in background (#i80533#)"
406 Kontext "DocumentCalc"
408 hMenuSelectNr(8) 'Open Window menu
409 hMenuSelectNr(hMenuItemGetCount) 'Select last loaded document
410 'Check that cell A1 has value "Recent document"
411 Call fCalcCompareCellValue ("A1","Recent document")
413 warnlog "Loading most recent Document seems to fail"
416 '/// Close recent document
417 Printlog " Close recent document"
419 '/// Close starting document
420 Printlog " Close starting document"
422 Printlog " Delete local copy of the workfile"
423 hFileDelete( sTestFile )
426 '-----------------------------------------------------------
430 '/// Open new Spreadsheet document
431 Printlog " Open new Spreadsheet document"
434 Printlog " Enter some text"
435 Kontext "DocumentCalc"
436 DocumentCalc.Typekeys "Test <RETURN>"
437 '/// Close document via File / Close
438 Printlog " Close document via File / Close"
440 '/// Close Messagebox via Cancel
441 Printlog " Close Messagebox via Cancel"
444 Kontext "DocumentCalc"
446 '/// Close Messagebox via Save
447 Printlog " Close Messagebox via Save"
450 '///+ Check if Save Dialog exists
451 Printlog " Check if Save Dialog exists"
452 Kontext "SpeichernDlg"
453 if SpeichernDlg.Exists then
457 if Active.Exists then
458 Warnlog Active.Gettext
461 Warnlog "Dialog to Save document isn't up!"
464 Kontext "DocumentCalc"
466 '/// Close Messagebox via Discard
467 Printlog " Close Messagebox via Discard"
473 '-----------------------------------------------------------
477 '/// Opening new spreadsheet document
478 Printlog " Opening new spreadsheet document"
481 Printlog " Enter some text"
482 Kontext "DocumentCalc"
483 DocumentCalc.Typekeys "Test <RETURN>"
484 '///Open SAVE dialog via File-Save
485 Printlog "Open SAVE dialog via File-Save"
487 Kontext "SpeichernDlg"
488 Call DialogTest (SpeichernDlg)
489 '/// Click "Up one level"
490 Printlog " Click Up one level"
491 UebergeordneterOrdner.Click
492 '/// Click "Default directory"
493 Printlog " Click Default directory"
495 '/// Click "New Folder"
496 Printlog " Click New Folder"
498 Kontext "NeuerOrdner"
499 Call DialogTest ( NeuerOrdner )
500 '/// Cancel New Folder
501 Printlog " Cancel New Folder"
503 Kontext "SpeichernDlg"
504 '/// Enable save with passwort
505 Printlog " Enable save with passwort"
507 '/// Enter filename tFileSave
508 Printlog " Enter filename tFileSave"
509 Dateiname.settext "tFileSave"
510 '/// Click on SAVE button
511 Printlog " Click on SAVE button"
513 Kontext "PasswordFileSave"
514 Call DialogTest (PasswordFileSave)
516 Password.SetText "OpenSource"
517 '/// Now enter wrong confirmation
518 PasswordConfirm.SetText "CloseSource"
519 '/// Try to leave dialog with OK
521 '/// MsgBox warning for wrong password confirmation should be visible
523 if Active.exists(4) then
524 if Active.GetRT = 304 then
526 Printlog " - Wrong passwort has been detected successfully."
530 warnlog "There is no messagebox because of a wrong password. Aborting!"
534 Kontext "PasswordFileSave"
535 '/// Leave dialog with Cancel
536 PasswordFileSave.Cancel
537 Kontext "DocumentCalc"
538 '/// Open SAVE dialog via File-Save again
539 Printlog " Open SAVE dialog via File-Save again"
541 Kontext "SpeichernDlg"
542 '/// Close dialog with Cancel
545 Printlog " Close document"
550 '-----------------------------------------------------------
552 testcase tFileSaveAsCSV
554 Dim UIFilter as string
555 Dim bStatus as boolean
557 Printlog " Open new Spreadsheet document"
559 Printlog " Fill two cells (10, Test)"
560 Kontext "DocumentCalc"
561 DocumentCalc.Typekeys "10 <TAB> Test <RETURN>"
562 Printlog " Open 'SaveAs' dialog"
564 Kontext "SpeichernDlg"
565 Printlog " Enter filename 'csv-Test_update'"
566 DateiName.SetText "csv-Test_update"
567 Printlog " Choose file typ CSV"
568 UIFilter = hGetUIFiltername ( "Text - txt - csv (StarCalc)" )
569 bStatus = hSelectUIFilter ( UIFilter )
570 if ( not bStatus ) then
571 warnlog "Filter not found"
576 Printlog " Click on Save button"
578 Printlog " Commit overwrite warning if file already exists"
580 if Active.exists(2) then
583 Printlog " Check alien file format warning"
584 Kontext "AlienWarning"
585 if AlienWarning.exists(2) then
586 Printlog " Commit if exists"
589 warnlog "Alien file format warning is missing -> Check this out!"
591 Printlog " Check existence of export encoding dialog"
593 Call DialogTest (ExportCalc)
594 printlog " Verify that Quote All is disabled by default"
595 if QuoteAll.IsChecked then
596 warnlog " Option Quote All is checked but shouldn't"
598 Printlog " Accept dialog by OK"
601 if Active.exists(2) then
602 Printlog Active.GetText
605 warnlog " Messagebox that only the current sheet is saved is missing"
607 Printlog " Close document"
612 '-----------------------------------------------------------
614 testcase tFileSaveAsDBF
616 Dim UIFilter as string
617 Dim bStatus as boolean
619 Printlog " Open new Spreadsheet document"
621 Printlog " Fill two cells (10, Test)"
622 Kontext "DocumentCalc"
623 DocumentCalc.Typekeys "10 <TAB> Test <RETURN>"
624 Printlog " Open 'SaveAs' dialog"
626 Kontext "SpeichernDlg"
627 Printlog " Enter filename 'dbf-Test_update'"
628 DateiName.SetText "dbf-Test_update"
629 Printlog " Choose file typ dBase"
630 UIFilter = hGetUIFiltername ( "dBase" )
631 bStatus = hSelectUIFilter ( UIFilter )
632 if ( not bStatus ) then
633 warnlog "Filter not found"
638 Printlog " Click on Save button"
640 Printlog " Commit overwrite warning if file already exists"
642 if Active.exists(2) then
645 Printlog " Check alien file format warning"
646 Kontext "AlienWarning"
647 if AlienWarning.exists(2) then
648 Printlog " Commit if exists"
651 warnlog "Alien file format warning is missing -> Check this out!"
653 Printlog " Check existence of export encoding dialog"
655 Call DialogTest (ExportCalc)
656 Printlog " Accept dialog by OK"
659 if Active.exists(2) then
661 warnlog "#i87325# - Unexpected messagebox"
662 Printlog Active.GetText
666 Printlog " Close document"
671 '-----------------------------------------------------------
673 testcase tFileVersions
675 '/// Open new Spreadsheet document
676 Printlog " Open new Spreadsheet document"
679 Printlog " Enter some text"
680 Kontext "DocumentCalc"
681 DocumentCalc.Typekeys "Test <RETURN>"
682 '/// Save document as "user/work/version.ods"
683 Printlog " Save document as 'user/work/version.ods'"
684 Call hFileSaveAsKill convertpath(gOfficePath & "user/work/version.ods")
685 '/// Open File-Versions
686 Printlog " Open File-Versions"
689 Call DialogTest (Versionen)
690 '/// Click 'Save New Versions' button
691 Printlog " Click 'Save New Versions' button"
693 Kontext "VersionskommentarEingeben"
694 '/// Check existence of comments dialog
695 Call DialogTest(VersionskommentarEingeben)
696 '/// Cancel comments dialog
697 Printlog " Cancel comments dialog"
698 VersionskommentarEingeben.Cancel
700 '/// Close versions dialog
701 Printlog " Close versions dialog"
704 Printlog " Close document"
709 '-----------------------------------------------------------
711 testcase tFilePagePreview
713 '/// Open new Spreadsheet document
714 Printlog " Open new Spreadsheet document"
717 Printlog " Enter some text"
718 Kontext "DocumentCalc"
719 DocumentCalc.Typekeys "Test <RETURN>"
720 '/// Open File-PagePreview
721 Printlog " Open File-PagePreview"
724 Call DialogTest (Previewbar)
725 ' Printlog " Switch to fullscreen mode"
726 ' GanzerBildschirm.Click
727 ' Kontext "FullScreenbar"
728 ' printlog " Disable fullscreen mode"
730 ' Kontext "Previewbar"
731 printlog " Enable Margins"
735 warnlog "Pagemargins does not exists."
737 printlog " Check availability of the scaling slider"
738 if Not ScalingFactor.IsEnabled then
739 warnlog "Scalingslider is not available"
741 '/// Close page preview with button in toolbar
742 Printlog " Close page preview with button in toolbar"
745 Printlog " Close document"