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_ole.inc,v $
13 '* last change: $Author: jsi $ $Date: 2008-06-16 10:42:40 $
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: includefile for Ole-testing
38 '**************************************************************************************
42 '\*************************************************************************************
45 qaerrorlog "not running due to reconstruction"
47 printlog "Test to see if three different OLEs can be copied and identified correctly."
49 dim writerfilename1 as string
50 writerfilename1 = ConvertPath (gTesttoolPath + "graphics\required\input\oletest.odg")
52 printlog "Open draw-file" & writerfilename1
56 Dateiname.SetText (writerfilename1)
60 printlog "When messagebox about Update all links shows up - press yes."
62 if Messagebox.exists then
68 printlog "Select first object. Use EditCopy to copy it to the clipboard"
70 kontext "DocumentDraw"
71 DocumentDraw.mousedown (10,10)
72 DocumentDraw.mouseup (10,10)
74 DocumentDraw.Typekeys "<TAB>"
77 printlog "Close document. Open new Impress-Document. Paste the OLE-Object."
79 gApplication = "IMPRESS"
83 printlog "Select object and check via the Context-menu what it has been opened as."
85 Kontext "DocumentImpress"
90 printlog "Count the number of entries. If 5 (including a menuseparator), then its a spreadsheet"
91 if MenuGetItemCount <> 5 then
92 Warnlog "This doesn't seem to be recognized as a Metafile. It has " + MenuGetItemCount + " entries."
95 printlog "Close Context menu. Then check if a Edit-line for the Cells is visible."
97 MenuSelect (1) 'Default
99 Kontext "RechenleisteCalc"
100 if RechenleisteCalc.Exists then
101 Printlog "This is a spreadsheet-Document. Good"
104 Kontext "DocumentImpress"
105 printlog "Click outside the OLE to deactivate it. Then close the Document "
106 DocumentImpress.mousedown (10,10)
107 DocumentImpress.mouseup (10,10)
111 printlog "Open Draw-file "
115 Dateiname.SetText (writerfilename1)
119 printlog " When messagebox about Update all links shows up - press yes."
121 if Messagebox.exists then
126 printlog "Select second object. Use EditCopy to copy it to the clipboard."
127 gApplication = "DRAW"
129 kontext "DocumentDraw"
130 DocumentDraw.mousedown (10,10)
131 DocumentDraw.mouseup (10,10)
133 DocumentDraw.Typekeys "<TAB><TAB>"
136 printlog "Close document. Open new Impress-Document. Paste the OLE-Object."
138 DocumentDraw.mousedown (10,10)
139 DocumentDraw.mouseup (10,10)
143 gApplication = "IMPRESS"
147 printlog "Select the object, and check via the Context-menu what it has been opened as."
149 Kontext "DocumentImpress"
154 printlog "Count the number of entries. If 5 (including a menuseparator), then its a spreadsheet"
155 if MenuGetItemCount <> 5 then
156 Warnlog "This doesn't seem to be recognized as a Metafile. It has " + MenuGetItemCount + " entries."
159 printlog "Close Context menu. Then check if a Edit-line for the Cells is visible."
161 MenuSelect (1) 'Default
163 Kontext "RechenleisteCalc"
164 if RechenleisteCalc.Exists then
165 Printlog "This is a spreadsheet-Document. Good"
168 kontext "DocumentImpress"
170 DocumentImpress.mousedown (10,10)
171 DocumentImpress.mouseup (10,10)
174 printlog "Close document"
177 printlog "Open draw-file"
181 Dateiname.SetText (writerfilename1)
185 printlog "When messagebox about Update all links shows up - press yes."
186 if Messagebox.exists then
191 printlog "Select third object. Use EditCopy to copy it to the clipboard."
192 gApplication = "DRAW"
194 kontext "DocumentDraw"
195 DocumentDraw.mousedown (10,10)
196 DocumentDraw.mouseup (10,10)
198 DocumentDraw.Typekeys "<TAB><TAB><TAB>"
201 printlog "Close the Document. Open new Impress-Document. Paste the OLE-Object."
203 DocumentDraw.mousedown (10,10)
204 DocumentDraw.mouseup (10,10)
208 gApplication = "IMPRESS"
212 printlog "Select the object, and check via the Context-menu what it has been opened as."
213 Kontext "DocumentImpress"
218 printlog "Count the number of entries. If 5 (including a menuseparator), then its a spreadsheet"
219 if MenuGetItemCount <> 5 then
220 Warnlog "This doesn't seem to be recognized as a Metafile. It has " + MenuGetItemCount + " entries."
223 printlog "Close Context menu. Then check if a Edit-line for the Cells is visible."
225 MenuSelect (1) 'Default
227 Kontext "RechenleisteCalc"
228 if RechenleisteCalc.Exists then
229 Printlog "This is a spreadsheet-Document. Good"
232 printlog "Close Context menu. Then close the Document"
236 '-----------------------------------------------------------------------------------------------------------'
237 testcase tOLE_SaveLoad
239 printlog "Test to see if an OLE can be inserted, saved and loaded correctly."
240 dim filename as string
241 dim filetype as string
242 dim filetype2 as string
244 if (gApplication = "IMPRESS") then
245 ExtensionString = "odp"
247 ExtensionString = "odg"
250 filename = ConvertPath (gOfficePath + "user\work\oletest." & ExtensionString)
251 printlog "Create a new document."
253 printlog "Insert->Object->OLE Object..."
254 InsertObjectOLEObject
255 Kontext "OLEObjektInsert"
257 printlog "Choose create new. Select Writer."
260 printlog "Click OK to close dialog and insert OLE."
263 printlog "Deselect object."
265 kontext "DocumentImpress"
266 DocumentImpress.mousedown (10,10)
267 DocumentImpress.mouseup (10,10)
269 printlog "Select object."
272 printlog "Count number of context menu entries. If 20 (including menuseparators), then its a OLE."
273 if MenuGetItemCount <> 20 then
274 Warnlog "This doesnt seem to be a Writer-OLE. It has " + MenuGetItemCount + " entries."
276 printlog "Right number of context menu entries for OLE."
278 printlog "Closing Context Menu"
280 printlog "Save the File."
283 Kontext "SpeichernDlg"
284 Dateiname.Settext (filename)
285 printlog "Saving as: " & filename
288 printlog "If the file already exists - press yes to overwrite it."
291 if Messagebox.exists then
296 printlog "Getting type of OLE from save as dialog."
299 Kontext "SpeichernDlg"
300 filetype = Dateityp.GetSelText (1)
301 printlog "Filetype is " & Dateityp.GetSelText (1)
304 printlog "Close Document."
308 Kontext "DocumentImpress"
309 printlog "Open saved file."
310 Call hFileOpen (filename)
315 Kontext "SpeichernDlg"
316 filetype2 = Dateityp.GetSelText
318 printlog "Check if it has the same number of context menu entries."
319 Printlog "The OLE created was a: " + filetype + " and the one which was loaded was a: " + filetype2
320 if ((left(right(filetype,4),3))) <> ((left(right(filetype2,4),3))) then
321 warnlog "The first was a: " + ((left(right(filetype,4),3))) + " and second was a: " + ((left(right(filetype2,4),3)))
323 printlog "Good: the first one was a: " + ((left(right(filetype,4),3))) + "-file, and second one was a: " + ((left(right(filetype2,4),3))) + "-file."
325 printlog "Closing document."
329 'testcase tOLE_DragDrop
330 printlog " Create OLE, drag n drop within the document. "
331 printlog " If Impress, drag and drop from document to another slide. "
332 'endcase 'tOLE_DragDrop
335 '-------------------------------------------------------------------------------
336 testcase tiOpenOLECrash
338 dim sFileodp as string
341 printlog "Testing for bug nr: i70019"
343 printlog "Open Application"
346 printlog "1. Open file: generic_de.ppt"
350 printlog " Use file: graphics\\optional\\input\\generic_de.ppt "
351 oFile = ConvertPath (gTesttoolPath + "graphics\required\input\generic_de.ppt")
352 Printlog "file: '" + oFile + "'"
353 Dateiname.SetText (oFile)
354 printlog "2. Save this document as an *.odp -file."
356 kontext "DocumentImpress"
366 if DocumentImpress.StatusIsProgress AND i > 19 then
367 warnlog " Took over 20 seconds to load the document Document. Stalled?"
371 Kontext "SpeichernDlg"
372 sFileodp = (ConvertPath(gOfficePath + "user\work\generic_de"))
373 Dateiname.SetText (sFileodp)
377 if Messagebox.Exists(2) then
379 Kontext "AlienWarning"
380 if AlienWarning.Exists(2) then
381 Warnlog "Should not be any alienwarning when saving in our own format!"
384 printlog "Saved as: " + sFileodp
387 kontext "DocumentImpress"
388 printlog "3. Close Impress."
391 printlog "4.Reopen the *.odp file again"
394 Dateiname.SetText (sFileodp + ".odp")
397 if Active.exists (5) then
398 Printlog "ACTIVE: "+active.gettext
400 Warnlog "failed to open file? :-("
412 if DocumentImpress.StatusIsProgress AND i > 19 then
413 warnlog "Took over 20 seconds to load the document Document. Stalled?"
416 printlog "5. Right-click on the second slide and click on New slide. "
418 SlidesControl.TypeKeys "<PAGEDOWN>" 'Goto second slide. (and get the focus right)
419 SlidesControl.TypeKeys "<SHIFT F10>" 'OpenContextMenu (True) 'Open Context-menu
420 hMenuSelectNr (1) 'New Slide
422 printlog "6. Change the title-(the text was F�r den TCM-Test, but this should irrelevant... ;) )."
423 hTypeKeys "<TAB>" 'To select the title.
424 hTypeKeys "Fuer den TCM-Test" 'To enter text
425 printlog " 7. Clicked two times on the Click twice to insert object "
428 hTypeKeys "<TAB><TAB>" '(to select the second object)
432 printlog "8. Choose OpenOffice.org 2.0 Formular"
433 Kontext "OLEObjektInsert"
436 PrintLog " Object: " + Objekttyp.GetSelText + " will be inserted."
437 printlog "Leave dialog 'Insert OLE Object' with OK"
441 kontext "CommandsMath"
442 Commands.TypeKeys "A over B + FACT 6 = x"
444 'printlog " Leave edit mode by typing key [Escape] "
445 'Comment: If I do this, the bug wont occur...
446 'hTypeKeys "<ESCAPE>"
448 printlog "10. Click on the Save button."
449 kontext "Standardbar"
452 printlog "11. Click on the X to close the window while the OLE-object still in Edit-mode."
454 endcase 'tiOpenOLECrash