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_clipboard.inc,v $
13 '* last change: $Author: jsi $ $Date: 2008-06-16 10:42:39 $
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 '**************************************************************************************
42 ' #1 tiEditPasteSpecial_HTML
43 ' #1 tdEditPasteSpecial_Text
44 ' #1 tdEditPasteSpecial_Graphic
45 ' #1 tdEditPasteSpecial_Circle
46 ' #1 tiEditPasteSpecial
47 '\*************************************************************************************
52 Dim Ueber_Text_1 as string
54 if (gApplication = "IMPRESS") then
55 ExtensionString = "odp"
57 ExtensionString = "odg"
60 sDatei = gTesttoolPath + "graphics\required\input\leer."+ExtensionString
62 hFileOpen ConvertPath (sDatei)
64 printlog "Checking for readonly state. If so, make it editable."
65 sMakeReadOnlyDocumentEditable
67 hTypeKeys "<TAB><TAB>"
69 ContextPositionAndSize
71 if Messagebox.exists (5) then
72 Messagebox.SetPage TabPositionAndSize
76 Kontext "TabPositionAndSize"
77 Ueber_Text_1=PositionX.GetText '/// defining variable for original position of object ///'
78 TabPositionAndSize.Cancel
83 ContextArrangeBringBackward '/// Bring Object backward ///'
90 hTypeKeys "<TAB><TAB>"
94 ContextPositionAndSize '/// Open Position and Size dialog, checking position ///'
96 Messagebox.SetPage TabPositionAndSize
97 Kontext "TabPositionAndSize"
98 if PositionX=0 Then Warnlog " Command was not completely executed, and it could not be undone."
99 TabPositionAndSize.Cancel
104 EditUndo '/// Edit Undo for BringBackward ///'
110 hTypeKeys "<TAB><TAB>"
114 ContextPositionAndSize '/// Again checking position using Position and Size dialog ///'
116 Messagebox.SetPage TabPositionAndSize
117 kontext "TabPositionAndSize"
118 if PositionX.GetText = Ueber_Text_1 then
119 printlog "OK, last order could be redone"
121 warnlog "Last order could not be redone"
123 TabPositionAndSize.Cancel
125 Call hCloseDocument '/// Close document ///'
129 '-------------------------------------------------------------------------------
135 if (gApplication = "IMPRESS") then
136 ExtensionString = "odp"
138 ExtensionString = "odg"
141 Datei$ = gTesttoolPath + "graphics\required\input\leer."+ExtensionString
143 hFileOpen ConvertPath (Datei$) '/// Open test document (leer.od?) ///'
145 ' check if the document is writable
146 if fIsDocumentWritable = false then
147 ' make the document writable and check if it's succesfull
148 if fMakeDocumentWritable = false then
149 warnlog "The document can't be make writeable. Test stopped."
158 ContextPositionAndSize
161 Messagebox.SetPage TabPositionAndSize
162 Kontext "TabPositionAndSize"
163 Ueber_Text_1=PositionX.GetText
164 TabPositionAndSize.Cancel
168 ContextArrangeBringBackward '/// move object behind other object ///'
174 ContextPositionAndSize
177 Messagebox.SetPage TabPositionAndSize '/// checking new position values ///'
178 Kontext "TabPositionAndSize"
179 if PositionX.GetText = Ueber_Text_1 Then Warnlog " Nothing changed, so nothing can be undone"
180 TabPositionAndSize.Cancel
183 EditUndo '/// Edit Undo///'
187 ContextPositionAndSize
190 Messagebox.SetPage TabPositionAndSize '/// checking again position ///'
191 kontext "TabPositionAndSize"
192 if PositionX.GetText <> Ueber_Text_1 Then Warnlog " Undo didn't worked, so repeat last action wont work either"
193 TabPositionAndSize.Cancel
195 EditRedo '/// Edit Redo ///'
201 ContextPositionAndSize
204 Messagebox.SetPage TabPositionAndSize
205 kontext "TabPositionAndSize"
206 if PositionX.GetText <> Ueber_Text_1 then '/// checking position ///'
207 printlog "Action Undo repeated"
209 warnlog "Action Undo not repeated"
211 TabPositionAndSize.OK
213 call hCloseDocument '/// close document ///'
217 '-------------------------------------------------------------------------------
218 testcase tiEditClipboard
220 Dim Ueber_Text_4 as string
223 '/// open application ///'
227 '/// Create rectangle ///'
228 Call hRechteckErstellen ( 65, 65, 80, 80 )
230 '///+ RightClick onto rectangle///'
233 Ueber_Text_4 = fGetPositionX() '/// Get values for position variables ///'
235 '/// <b> Edit->Copy </b> ///'
237 '///+ Type Key [Deletee] ///'
239 '///+ <i> Edit->Paste </i> ///'
242 '///+ Edit->Select All ///'
244 sTemp = fGetPositionX()
245 if LiberalMeasurement(sTemp, Ueber_Text_4) then '/// TabPositionAndSize: comparing position with original position ///'
246 printlog "OK EditCopy and EditPaste"
248 warnlog "- Edit paste did not work; is: '" + sTemp + "' ; should: '" + Ueber_Text_4 + "'"
251 '/// Type Keys [escape], + EditSelectAll (to deselect object and to select again) ///'
255 '/// <b> Edit->Cut </b>///'
260 '///+ - Format->Position And Size -> HAS TO FAIL / IS NOT AVAILABLE !!! '///'
261 ContextPositionAndSize
263 '///+ - select TabPage 'Position And Size' ///'
264 Messagebox.SetPage TabPositionAndSize
265 Kontext "TabPositionAndSize"
266 if TabPositionAndSize.NOTexists then
267 warnlog "TabPositionAndSize isn't up ?!!"
269 '///+ - Ok dialog 'Position And Size' ///'
270 TabPositionAndSize.Ok
271 warnlog "TabPositionAndSize IS up :-( Doesn't have to be, because object should be deleted !!!"
273 Printlog " - There is no object in the document anymore :-)"
276 '///+ <i> Edit->Paste </i> ///'
279 sTemp = fGetPositionX()
280 if LiberalMeasurement(sTemp, Ueber_Text_4) then
281 printlog "OK Edit paste"
283 warnlog "- Edit paste did not work; is: '" + sTemp + "' ; should: '" + Ueber_Text_4 + "'"
286 '/// close application ///'
290 '-------------------------------------------------------------------------------
291 testcase tiEditPasteSpecial_HTML
293 dim Zaehler as integer
294 Kontext "Standardbar"
296 Call hFileOpen ConvertPath (gTesttoolPath + "graphics\required\input\frame1.htm") '/// Load html document ///'
299 Kontext "DocumentWriter"
300 DocumentWriter.MouseDown 10,10
301 DocumentWriter.MouseUp 10,10
305 EditCopy '/// Copy selection ///'
307 FileClose '/// Close document ///'
309 Call hNewDocument '/// Create new Impress document ///'
311 EditPasteSpecial '/// Edit paste special ///'
313 Kontext "InhaltEinfuegen"
314 For Zaehler = 1 to Auswahl.GetItemCount
315 Auswahl.select Zaehler
316 printlog Zaehler, ". Selection = ", Auswahl.GetSelText
319 if Auswahl.GetItemCount <> 4 then '/// Controlling number of possible formats ///'
320 warnlog "formats for inserting Html <> 4"
322 printlog "OK 4 formats for HTML-Document"
326 InhaltEinfuegen.OK '/// Paste clipboard content ///'
329 EditCopy '/// Copy object back into clipboard ///'
331 Warnlog "- Nothing inserted into document"
334 Call hCloseDocument '/// Close document ///'
338 '-------------------------------------------------------------------------------
339 testcase tdEditPasteSpecial_Text
341 printlog "Insert Text"
342 call hNewDocument '/// new document ///'
343 SetClipboard "I am a cool test-text in the Clipboard" '/// put text into clipboard ///'
344 EditPasteSpecial '/// edit paste special ///'
346 Kontext "InhaltEinfuegen"
347 Auswahl.Select 1 '/// select list entree 1 ///'
348 printlog "Selection = ", Auswahl.GetSelText
350 if Auswahl.GetItemCount <> 1 then
351 warnlog "Selectionformat <> 1"
353 printlog "Format Text OK"
355 InhaltEinfuegen.OK '/// close dialog ///'
358 Call hCloseDocument '/// close document ///'
361 '-------------------------------------------------------------------------------
362 testcase tdEditPasteSpecial_Graphic
364 dim Zaehler as integer
366 call hNewDocument '/// ^new document ///'
367 printlog "Insert graphic file"
368 InsertGraphicsFromFile '/// insert graphic (sample.bmp)///'
370 Kontext "GrafikEinfuegenDlg"
371 Dateiname.SetText ConvertPath (gTesttoolPath + "global\input\graf_inp\enter.bmp")
374 EditSelectAll '/// select graphic ///'
375 EditCut '/// cut graphic ///'
376 EditPasteSpecial '/// edit paste special ///'
378 Kontext "InhaltEinfuegen"
379 For Zaehler = 1 to Auswahl.GetItemCount '/// get item count for Auswahl ///'
380 Auswahl.select Zaehler
381 printlog Zaehler, ". Selection = ", Auswahl.GetSelText
384 if Auswahl.GetItemCount <> 4 then '/// check if item count = 4 ///'
385 warnlog "Format for insert graphic files should be 4, but is: " + Auswahl.GetItemCount
387 printlog "There are " + Auswahl.GetItemCount + " formats for graphic files"
389 InhaltEinfuegen.OK '/// insert graphic from clipboard ///'
392 Call hCloseDocument '/// close document ///'
395 '-------------------------------------------------------------------------------
396 testcase tdEditPasteSpecial_Circle
398 dim Zaehler as integer
399 call hNewDocument '/// new document ///'
401 printlog "Insert circle" '/// create circle ///'
405 gMouseMove (20,20,80,80)
409 EditSelectAll '/// select circle ///'
411 EditCut '/// cut circle ///'
413 EditPasteSpecial '/// edit paste special ///'
415 Kontext "InhaltEinfuegen"
416 if EinfuegenAls.IsVisible Then EinfuegenAls.Check '/// check "EinfuegenAls" ///'
417 For Zaehler = 1 to Auswahl.GetItemCount '/// get item count for Auswahl ///'
418 Auswahl.select Zaehler
419 printlog Zaehler, ". Selection = ", Auswahl.GetSelText
421 if Auswahl.GetItemCount <> 4 then '/// check if item count = 4 ///'
422 warnlog "Number of possible formats <> 4"
424 printlog "There are 4 formats for circle"
427 InhaltEinfuegen.OK '/// paste circle ///'
429 Call hCloseDocument '/// close document ///'
432 '-------------------------------------------------------------------------------
433 testcase tiEditPasteSpecial
437 ' warnlog "TODOTBO: from draw, impress, math..."
438 '/// go into writer, type a text, select all, Edit->Cut, close writer ///'
439 '/// go into application to test, insert every format you can get from Edit->Paste->Special :-) ///'
440 gApplication = "WRITER"
442 kontext "DocumentWriter"
443 DocumentWriter.TypeKeys "abc<shift home>"
446 gApplication = "IMPRESS"
450 Printlog " get count of possibilities: "
453 Kontext "InhaltEinfuegen"
454 x = Auswahl.GetItemCount
456 printlog " - " + i + " - " + Auswahl.GetItemText (i)
458 InhaltEinfuegen.Cancel
460 Printlog " insert every possibility"
462 Printlog " - processing number: "+i
465 Kontext "InhaltEinfuegen"
471 Call hCloseDocument '/// close document ///'
474 '-------------------------------------------------------------------------------