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: g_load_save.inc,v $
13 '* last change: $Author: rt $ $Date: 2008-08-28 11:42:51 $
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 : wolfram.garten@sun.com
36 '* short description :
38 '**************************************************************************************
43 ' #1 tTestDXF255CharBug
45 ' #1 tSaveLoadLayoutOLE
46 ' #1 tSaveLoadLayoutEmpty
47 ' #1 tSaveLoadLayoutText
48 ' #1 tSaveLoadLayoutOutline
49 ' #1 tSaveLoadLayoutPicture
50 ' #1 tSaveLoadLayoutChart
51 ' #1 tSaveLoadLayoutSpreadsheet
52 '\*************************************************************************************
53 testcase tFileOpenSaveEtc
57 Dokument$ = ConvertPath ( gOfficePath + "user\work\test1")
58 Dokument2$ = ConvertPath ( gOfficePath + "user\work\test1_2")
60 if (gApplication = "IMPRESS") then
61 ExtensionString = "odp"
63 ExtensionString = "odg"
66 '/// delete previous created documents: 'user\\work\\test1*.od?' ///'
67 if Dir (Dokument$ + ".odp") <> "" then kill (Dokument$ + ".odp")
68 if Dir (Dokument2$ + ".odg") <> "" then kill (Dokument2$ + ".odg")
70 '/// open application ///'
73 '/// create a textframe with content ///'
74 Call hTextrahmenErstellen ( "This is a test",20,20,40,30 )
75 '/// save file as 'test1' ///'
76 hFileSaveAsKill (Dokument$ + "." + ExtensionString)
78 '/// close Document ///'
80 printlog "- Document Saved and Closed"
82 '/// load document 'test1' ///'
83 hFileOpen (Dokument$ + "." + ExtensionString)
86 '/// close Document ///'
88 printlog "- document Loaded and closed"
90 '/// load document 'test1' ///'
91 hFileOpen (Dokument$ + "." + ExtensionString)
92 ' check if the document is writable
93 if fIsDocumentWritable = false then
94 ' make the document writable and check if it's succesfull
95 if fMakeDocumentWritable = false then
96 warnlog "The document can't be make writeable. Test stopped."
102 '/// create another textbox with content ///'
103 Call hTextrahmenerstellen ( "Change",60,60,80,80 )
104 '/// File->Close needn't work, just say CANCEL to the question about saving changes! ///'
106 Kontext ' message about 'something changed should i [overwrite discard cancel]?'
107 if Messagebox.exists (5) then
108 printlog "2:"+messagebox.gettext
111 Warnlog "Mesagebox is missing :-("
113 printlog "- Document loaded, changed and closed discarding all changes"
115 printlog "- Last version"
117 FileReload '/// File Reload ///'
119 kontext "documentimpress"
121 FileReload '/// File Reload ///'
123 warnlog "Damn reload ?? Why ? BREAKPOINT! File reload doesn't work. Create new object and try again :-("
129 gMouseDoubleClick 70,70
130 hTypeKeys "<Down>", 3
131 hTypeKeys "<SHIFT LEFT>",10
134 if GetClipboardText = "Change" then Warnlog "- Last version not loaded. Changes in the document still in."
135 printlog "- Change document, save it under different name"
136 Kontext "DocumentImpress"
137 Call hTextrahmenErstellen ("Change2",10,10,50,20 ) '/// new textbox ///'
141 Kontext "SpeichernDlg"
142 Dateiname.SetText Dokument2$
144 kontext "AlienWarning"
145 if AlienWarning.exists(5) then
146 warnlog "#i41983# Alien Warning on export not allowed"
150 if Messagebox.Exists(2) then Messagebox.Yes
152 FileClose '/// Close document ///'
155 if Messagebox.Exists Then
156 Warnlog "- Document saved, but Msgbox appeared, even no changes were made: " + Messagebox.GetText
160 printlog "- Loading write protected file"
161 FileOpen '/// Open write protected file ///'
163 Dateiname.SetText (Dokument2$ + "." + ExtensionString)
167 ' check if the document is writable
169 Call hTextrahmenErstellen ( "Hello",85,85,95,95 ) '/// attempt to create a textbox ///'
170 hTypeKeys "<SHIFT LEFT>",5
173 if GetClipboardText = "Hello" then Warnlog "Write protected document could be edited"
175 Printlog "- Write protected document could not be edited"
178 FileClose '/// Close document ///'
180 endcase 'tFileOpenSaveEtc
181 '--------------------------------------------------------
182 testcase tFileProperties
184 qaerrorlog "#i88163#, File/properties/user defined fields get mixed up."
187 Call hTextrahmenErstellen ("This is a document to test the Menupoint in File/Properties",30,30,60,40)
189 if (gApplication = "IMPRESS") then
190 ExtensionString = "odp"
192 ExtensionString = "odg"
198 active.SetPage TabDokumentinfo
199 Kontext "TabDokumentinfo"
200 Titel.SetText "Properties"
201 Thema.SetText "Documentproperties"
202 Schluesselworte.SetText "None"
204 qaerrorlog "#i95523#"
206 'active.SetPage TabBenutzer
207 'Kontext "TabBenutzer"
208 'Info2.SetText "Thorsten Peters"
211 'Kontext "InfonamenBearbeiten"
212 'Namen2.SetText "Name"
213 'InfonamenBearbeiten.OK
216 active.SetPage TabInternet
217 Kontext "TabInternet"
218 RefreshThisDocument.Check
222 hFileSaveAsKill ConvertPath (gOfficePath + "user\work\eigen." & ExtensionString)
226 if Active.Exists(2) then Active.Yes
228 PrintLog "- File / Properties compare"
230 hFileOpen ConvertPath (gOfficePath + "user\work\eigen." + ExtensionString)
232 ' check if the document is writable
233 if fIsDocumentWritable = false then
234 ' make the document writable and check if it's succesfull
235 if fMakeDocumentWritable = false then
236 warnlog "The document can't be make writeable. Test stopped."
242 active.SetPage TabDokumentinfo
243 Kontext "TabDokumentinfo"
244 if Titel.GetText <> "Properties" then Warnlog "Description / Titel is wrong"
245 if Thema.GetText <> "Documentproperties" then Warnlog "Description / Thema is wrong"
246 if Schluesselworte.GetText <> "None" then Warnlog "Description / Keywords is wrong"
248 qaerrorlog "#i95523#"
250 'active.SetPage TabBenutzer
251 'Kontext "TabBenutzer"
252 'if Info2.GetText <> "Thorsten Peters" then Warnlog "User Defined / Info2 is wrong"
256 'Kontext "InfonamenBearbeiten"
257 'if Namen2.GetText <> "Name" then Warnlog "Edit Field Names / Info2 is wrong"
258 'InfonamenBearbeiten.OK
261 active.SetPage TabInternet
262 Kontext "TabInternet"
263 if RefreshThisDocument.IsChecked = FALSE then Warnlog "Internet / 'Refresh this document' is not checked"
270 '********************************************************************************************
272 testcase tFilePassword52
279 sExt = array("d","a")
280 ' passwo52.sd d-preas a-draw
282 Datei$ = ConvertPath ( gTesttoolPath + "graphics\required\input\passwo52.sd"+sExt(i) )
285 Kontext "passwordFileOpen"
286 if passwordFileOpen.exists(5) then
287 PasswortName.SetText "12345"
289 Printlog "Ok, password dialog came up :-) for file : '" + datei$ + "'"
291 Warnlog "No password dialog came up :-( for file : '" + datei$ + "'"
294 if Messagebox.Exists(2) then
295 Warnlog "messagebox ?: '" + Messagebox.GetText + "'"
301 '********************************************************************************************
303 testcase tFileOpenImport
308 Dateiname.SetText (ConvertPath (gTesttoolpath + "graphics\required\input\imsusmap.cgm"))
311 ' check if the document is writable
312 if fIsDocumentWritable = false then
313 ' make the document writable and check if it's succesfull
314 if fMakeDocumentWritable = false then
315 warnlog "The document can't be make writeable. Test stopped."
319 kontext "DocumentImpress"
320 if DocumentImpress.exists(5) then
321 DocumentImpress.TypeKeys ("<Tab>")
323 warnlog "Not loaded in impress"
326 ContextPositionAndSize
328 messagebox.setpage TabPositionAndSize
330 TabPositionAndSize.Close
332 warnlog "Documents of Type 'ComputerGraphicsMetafile' can't get loaded :-("
335 if (gApplication="DRAW") then
340 '********************************************************************************************
341 testcase tTestDXF255CharBug
343 '/// tries to load a DXF-document which has a string-leght of 255 characters. ///'
346 InsertGraphicsFromFile '/// insert graphic ///'
350 if Active.Exists Then
354 Kontext "GrafikEinfuegenDlg"
356 '/// Dateiname.SetText (ConvertPath (gTesttoolpath + "graphics\required\input\255chars.dxf")) ///'
357 Dateiname.SetText (ConvertPath (gTesttoolpath + "graphics\required\input\255chars.dxf"))
361 if gApplication = "DRAW" then
362 Kontext "Documentdraw"
363 if Documentdraw.exists(5) then
364 Documentdraw.TypeKeys ("<Tab>")
366 warnlog "Not loaded in draw"
369 Kontext "DocumentImpress"
370 if DocumentImpress.exists(5) then
371 DocumentImpress.TypeKeys ("<Tab>")
373 warnlog "Not loaded in impress"
378 ContextPositionAndSize
380 messagebox.setpage TabPositionAndSize
382 TabPositionAndSize.Close
384 warnlog "DXF-Document could not be loaded :-("
388 endcase 'tTestDXF255CharBug
389 '********************************************************************************************
390 testcase tDeletedTemplate
395 dim SavedActiveMessage as string
398 if (gApplication = "IMPRESS") then
399 ExtensionString = "odp"
401 ExtensionString = "odg"
404 Dokument1$ = ConvertPath ( gOfficePath + "user\work\test1." & ExtensionString)
405 Dokument2$ = ConvertPath ( gOfficePath + "user\work\test2." & ExtensionString)
409 '/// delete previous created documents: 'user\\work\\test*.odp' ///'
410 if Dir (Dokument1$) <> "" then kill Dokument1$
411 if Dir (Dokument2$) <> "" then kill Dokument2$
413 '/// open application ///'
416 '/// create a textframe with content ///'
417 Call hTextrahmenErstellen ( "This is the first file",20,20,40,30 )
418 '/// save file as 'test1.odp' ///'
419 hFileSaveAsKill (Dokument1$)
421 '/// close Document ///'
423 printlog "- Document 'test1.odp' Saved and Closed"
425 '/// open application again ///'
428 '/// create another textframe with content ///'
429 Call hTextrahmenErstellen ( "This is the second file",20,20,40,30 )
430 '/// save file as 'test2.odp' ///'
431 hFileSaveAsKill (Dokument2$)
433 '/// close Document ///'
435 printlog "- Document 'test2.odp' Saved and Closed"
437 '/// Delete the first file ///'
440 Printlog " Correctly deleted the file: " + Dokument1$
442 warnlog "Could not delete the file: " + Dokument1$
445 '/// File => New => Presentation ///'
446 FileAutopilotPresentation '/// new document-autopilot ///'
447 Kontext "AutopilotPraesentation1"
449 Existingpresentation.Check
452 if active.exists then
453 SavedActiveMessage = Active.GetText
454 QaErrorLog "Message: " + SavedActiveMessage
456 Kontext "AutopilotPraesentation1"
457 if Existinglist.GetSelText = "test1.odp" then
458 warnlog " The deleted File was found. Messagebox said: " + SavedActiveMessage
460 SavedActiveMessage = ""
462 Kontext "AutopilotPraesentation1"
463 Existinglist.TypeKeys "<HOME>"
466 for i = 1 to Existinglist.GetItemCount
468 if active.exists then
469 SavedActiveMessage = Active.GetText
472 Kontext "AutopilotPraesentation1"
473 if Existinglist.GetSelText = "test1.odp" then
475 if SavedActiveMessage <> "" then
476 warnlog " The deleted File was found. Messagebox said: " + SavedActiveMessage
478 warnlog " The deleted File was found. However without any messagebox."
481 Existinglist.TypeKeys "<DOWN>"
484 if found = true then warnlog " An error-message showed up. Eventually a result of '138498'"
485 AutopilotPraesentation1.Cancel
487 '/// Delete the second file ///'
490 Printlog " Correctly deleted the file: " + Dokument2$
492 warnlog "Could not delete the file: " + Dokument2$
495 endcase 'tDeletedTemplate
496 '****************************************************************************************************
498 testcase tSaveLoadLayoutEmpty
499 Dim NewFileDir as String
501 NewFileDir = ConvertPath (gOfficePath + "user\work\LayoutTest\")
503 printlog " Will try to create the directory: " + NewFileDir
507 gApplication = "IMPRESS"
510 printlog "Choose and Insert an empty Layout."
514 LayoutsPreview.TypeKeys "<HOME>"
515 kontext "Pagelayout_UndoDeleteWarning"
516 if Pagelayout_UndoDeleteWarning.exists then
517 Pagelayout_UndoDeleteWarning.ok
520 LayoutsPreview.TypeKeys "<RETURN>"
523 call fSaveLoadAllFormats (NewFileDir) 'Runs the Function below.
525 printlog " Will try to delete the directory: " + NewFileDir
528 endcase 'tSaveLoadLayoutEmpty
530 '****************************************************************************************************
532 testcase tSaveLoadLayoutOLE
533 qaerrorlog "not yet ready"
535 Dim NewFileDir as String
537 NewFileDir = ConvertPath (gOfficePath + "user\work\LayoutTest\")
539 printlog " Will try to create the directory: " + NewFileDir
543 gApplication = "IMPRESS"
546 printlog "Choose and Insert an Layout with an OLE."
550 LayoutsPreview.TypeKeys "<HOME>"
551 kontext "Pagelayout_UndoDeleteWarning"
552 if Pagelayout_UndoDeleteWarning.exists then
553 Pagelayout_UndoDeleteWarning.ok
556 LayoutsPreview.TypeKeys ("<RIGHT>",12)
558 LayoutsPreview.TypeKeys ("<Return>")
560 hTypeKeys ("<TAB><TAB><TAB>")
561 hTypeKeys ("<Return>")
564 kontext "OLEObjektInsert"
566 OLEObjektInsert.Cancel
567 Printlog "Inserted a layout with an 'Insert OLE-Object'-frame. Correct."
569 warnlog "Ole wasn't selected :-("
575 call fSaveLoadAllFormats (NewFileDir) 'Runs the Function below.
577 printlog " Will try to delete the directory: " + NewFileDir
578 app.rmDir ConvertPath (gOfficePath + "user\work\LayoutTest\")' NewFileDir
580 endcase 'tSaveLoadLayoutOLE
582 '****************************************************************************************************
584 testcase tSaveLoadLayoutText
585 qaerrorlog "not yet ready"
587 Dim NewFileDir as String
589 NewFileDir = ConvertPath (gOfficePath + "user\work\LayoutTest\")
591 printlog " Will try to create the directory: " + NewFileDir
595 gApplication = "IMPRESS"
598 printlog "Choose and Insert an Layout with a Text-field."
602 LayoutsPreview.TypeKeys "<HOME>"
603 kontext "Pagelayout_UndoDeleteWarning"
604 if Pagelayout_UndoDeleteWarning.exists then
605 Pagelayout_UndoDeleteWarning.ok
608 LayoutsPreview.TypeKeys ("<RIGHT>")
610 LayoutsPreview.TypeKeys ("<Return>")
612 hTypeKeys ("<TAB><TAB><TAB>")
613 hTypeKeys ("<Return>")
614 hTypeKeys ("<ESCAPE>")
615 ' LayoutsPreview.TypeKeys "<RETURN>"
618 call fSaveLoadAllFormats (NewFileDir) 'Runs the Function below.
620 printlog " Will try to delete the directory: " + NewFileDir
621 app.rmDir ConvertPath (gOfficePath + "user\work\LayoutTest\")' NewFileDir
623 endcase 'tSaveLoadLayoutText
625 '****************************************************************************************************
627 testcase tSaveLoadLayoutOutline
628 qaerrorlog "not yet ready"
630 Dim NewFileDir as String
632 NewFileDir = ConvertPath (gOfficePath + "user\work\LayoutTest\")
634 printlog " Will try to create the directory: " + NewFileDir
638 gApplication = "IMPRESS"
641 printlog "Choose and Insert an Layout with a Outline-field."
645 LayoutsPreview.TypeKeys "<HOME>"
646 kontext "Pagelayout_UndoDeleteWarning"
647 if Pagelayout_UndoDeleteWarning.exists then
648 Pagelayout_UndoDeleteWarning.ok
651 LayoutsPreview.TypeKeys ("<RIGHT>",3)
653 LayoutsPreview.TypeKeys ("<Return>")
655 hTypeKeys ("<TAB><TAB><TAB>")
656 hTypeKeys ("<Return>")
657 hTypeKeys ("<ESCAPE>")
660 call fSaveLoadAllFormats (NewFileDir) 'Runs the Function below.
662 printlog " Will try to delete the directory: " + NewFileDir
663 app.rmDir ConvertPath (gOfficePath + "user\work\LayoutTest\")' NewFileDir
665 endcase 'tSaveLoadLayoutOutline
667 '****************************************************************************************************
669 testcase tSaveLoadLayoutPicture
670 qaerrorlog "not yet ready"
672 Dim NewFileDir as String
674 NewFileDir = ConvertPath (gOfficePath + "user\work\LayoutTest\")
676 printlog " Will try to create the directory: " + NewFileDir
680 gApplication = "IMPRESS"
683 printlog "Choose and Insert an Layout with a Graphic-field."
687 LayoutsPreview.TypeKeys "<HOME>"
688 kontext "Pagelayout_UndoDeleteWarning"
689 if Pagelayout_UndoDeleteWarning.exists then
690 Pagelayout_UndoDeleteWarning.ok
693 LayoutsPreview.TypeKeys ("<RIGHT>",8)
695 LayoutsPreview.TypeKeys ("<Return>")
697 hTypeKeys ("<TAB><TAB><TAB>")
698 hTypeKeys ("<Return>")
699 hTypeKeys ("<ESCAPE>")
702 call fSaveLoadAllFormats (NewFileDir) 'Runs the Function below.
704 printlog " Will try to delete the directory: " + NewFileDir
705 app.rmDir ConvertPath (gOfficePath + "user\work\LayoutTest\")' NewFileDir
707 endcase 'tSaveLoadLayoutPicture
709 '****************************************************************************************************
711 testcase tSaveLoadLayoutChart
712 qaerrorlog "not yet ready"
714 Dim NewFileDir as String
716 NewFileDir = ConvertPath (gOfficePath + "user\work\LayoutTest\")
718 printlog " Will try to create the directory: " + NewFileDir
722 gApplication = "IMPRESS"
725 printlog "Choose and Insert an Layout with a Chart-field."
729 LayoutsPreview.TypeKeys "<HOME>"
730 kontext "Pagelayout_UndoDeleteWarning"
731 if Pagelayout_UndoDeleteWarning.exists then
732 Pagelayout_UndoDeleteWarning.ok
735 LayoutsPreview.TypeKeys ("<RIGHT>",6)
737 LayoutsPreview.TypeKeys ("<Return>")
739 hTypeKeys ("<TAB><TAB><TAB>")
740 hTypeKeys ("<Return>")
741 hTypeKeys ("<ESCAPE>")
744 call fSaveLoadAllFormats (NewFileDir) 'Runs the Function below.
746 printlog " Will try to delete the directory: " + NewFileDir
747 app.rmDir ConvertPath (gOfficePath + "user\work\LayoutTest\")' NewFileDir
749 endcase 'tSaveLoadLayoutChart
751 '****************************************************************************************************
753 testcase tSaveLoadLayoutSpreadsheet
754 qaerrorlog "not yet ready"
756 Dim NewFileDir as String
758 NewFileDir = ConvertPath (gOfficePath + "user\work\LayoutTest\")
760 printlog " Will try to create the directory: " + NewFileDir
764 gApplication = "IMPRESS"
767 printlog "Choose and Insert an Layout with a Spreadsheet-field."
771 LayoutsPreview.TypeKeys "<HOME>"
772 kontext "Pagelayout_UndoDeleteWarning"
773 if Pagelayout_UndoDeleteWarning.exists then
774 Pagelayout_UndoDeleteWarning.ok
777 LayoutsPreview.TypeKeys ("<RIGHT>",7)
779 LayoutsPreview.TypeKeys ("<Return>")
781 hTypeKeys ("<TAB><TAB><TAB>")
782 hTypeKeys ("<Return>")
783 hTypeKeys ("<ESCAPE>")
786 call fSaveLoadAllFormats (NewFileDir) 'Runs the Function below.
788 printlog " Will try to delete the directory: " + NewFileDir
789 app.rmDir ConvertPath (gOfficePath + "user\work\LayoutTest\")' NewFileDir
791 endcase 'tSaveLoadLayoutSpreadsheet
793 '****************************************************************************************************