1 '**************************************************************************
2 '* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 '* Copyright 2008 by Sun Microsystems, Inc.
6 '* OpenOffice.org - a multi-platform office productivity suite
8 '* $RCSfile: w_contextmenu1.inc,v $
12 '* last change: $Author: vg $ $Date: 2008-08-18 12:25:37 $
14 '* This file is part of OpenOffice.org.
16 '* OpenOffice.org is free software: you can redistribute it and/or modify
17 '* it under the terms of the GNU Lesser General Public License version 3
18 '* only, as published by the Free Software Foundation.
20 '* OpenOffice.org is distributed in the hope that it will be useful,
21 '* but WITHOUT ANY WARRANTY; without even the implied warranty of
22 '* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 '* GNU Lesser General Public License version 3 for more details
24 '* (a copy is included in the LICENSE file that accompanied this code).
26 '* You should have received a copy of the GNU Lesser General Public License
27 '* version 3 along with OpenOffice.org. If not, see
28 '* <http://www.openoffice.org/license.html>
29 '* for a copy of the LGPLv3 License.
31 '/************************************************************************
33 '* owner : helge.delfs@sun.com
35 '* short description : Pick context for context menus
37 '\***********************************************************************
42 Call tPickSimpleTextMultiselection
48 Call tPickDrawingObjects
52 ' -----------------------------------------------------------------------------
54 testcase tPickSimpleText
56 Dim SetThisFontSize as string
57 Dim GetThisFontSize as string
58 printlog "Open context menu on unselected text"
59 printlog " Open a new text document"
61 printlog " Set zoom to 100%"
63 printlog " Write down 'This is a test'"
64 Call wTypeKeys "This is a test"
65 printlog " In text document select word 'test'"
66 Call wTypeKeys "<End>"
67 Call wTypeKeys "<Mod1 Shift Left>"
68 printlog " Open context menu in word 'This'"
69 Call wTypeKeys "<Mod1 Left>", 3
70 Call wTypeKeys "<Right>"
71 Call wTypeKeys "<Shift F10>"
72 printlog " Change font size for word 'This'"
76 SetThisFontSize = hMenuItemGetText(MenuGetItemCount)
77 Call hMenuSelectNr(MenuGetItemCount)
79 Warnlog "Unable to open context menu"
82 Call wTypeKeys "<Home>"
83 printlog " Check if font size has changed for word 'This' and not for word 'test'"
84 Call wTypeKeys "<Right>"
87 Active.Setpage TabFont
89 if gAsianSup = True or gCTLSup = True then
90 GetThisFontSize = SizeWest.GetSelText
92 GetThisFontSize = Size.GetSelText
96 if GetThisFontSize <> SetThisFontSize then Warnlog "Fontsize for word 'This' has not correctly been set"
98 Call wTypeKeys "<Mod1 Right>", 3
99 Call wTypeKeys "<Right>"
102 Active.Setpage TabFont
104 if gAsianSup = True or gCTLSup = True then
105 GetThisFontSize = SizeWest.GetSelText
107 GetThisFontSize = Size.GetSelText
111 if GetThisFontSize = SetThisFontSize then Warnlog "Fontsize for word 'test' has been set"
115 ' -----------------------------------------------------------------------------
117 testcase tPickSimpleTextMultiselection
118 Dim SetThisFontSize as string
119 Dim GetThisFontSize as string
120 printlog " Open context menu on unselected text"
122 Printlog " Set zoom to 100%"
124 Printlog " Write down 'This is a test'"
125 Call wTypeKeys "This is a test"
127 Printlog " In text document select word 'test' and 'This'"
128 Call wTypeKeys "<End>"
129 Call wTypeKeys "<Mod1 Shift Left>"
130 Printlog " Open context menu in word 'This'"
131 Printlog " Shift + F8 changes selection mode in writer"
132 Call wTypeKeys "<Shift F8>"
133 Call wTypeKeys "<Mod1 Left>", 3
134 Call wTypeKeys "<Mod1 Shift Right>"
135 Call wTypeKeys "<Shift F8>"
136 Call wTypeKeys "<Shift F10>"
138 Printlog " Change font size"
140 Call hMenuSelectNr(3)
142 SetThisFontSize = hMenuItemGetText(MenuGetItemCount)
143 Call hMenuSelectNr(MenuGetItemCount)
145 Warnlog "Unable to open context menu"
148 Call wTypeKeys "<Home>"
149 Printlog "Check if font size has changed for words 'This' and 'test'"
150 Call wTypeKeys "<Right>"
153 Active.Setpage TabFont
155 if gAsianSup = True or gCTLSup = True then
156 GetThisFontSize = SizeWest.GetSelText
158 GetThisFontSize = Size.GetSelText
162 if GetThisFontSize <> SetThisFontSize then Warnlog "Fontsize for word 'This' has not correctly been set"
164 Call wTypeKeys "<Mod1 Right>", 3
165 Call wTypeKeys "<Right>"
168 Active.Setpage TabFont
170 if gAsianSup = True or gCTLSup = True then
171 GetThisFontSize = SizeWest.GetSelText
173 GetThisFontSize = Size.GetSelText
177 if GetThisFontSize <> SetThisFontSize then Warnlog "Fontsize for word 'test' has not correctly been set"
178 printlog " Close text document"
182 ' -----------------------------------------------------------------------------
184 testcase tPickGraphic
186 printlog "Open context menu on not focussed graphic"
188 Printlog " Set zoom to 100%"
190 Printlog " Insert a graphic into writerdocument"
191 Call hGrafikEinfuegen ( gTesttoolPath + "writer\optional\input\menu\drums.jpg" )
192 Printlog " Deselect graphic with 'Escape' and insert some text in text document"
193 Call wTypeKeys "<Escape>"
194 Call wTypeKeys "Don't be afraid !"
196 Call DocumentWriter.MouseMove 50,30
197 Printlog " Open context menu upon graphic with mouse"
198 Call wOpenContextMenu(true)
200 printlog " Select 'ImageMap' in context menu"
202 CALL hMenuFindSelect (".uno:ImageMapDialog", true, 9, true) 'Find "ImageMap" and call the slot.
205 Warnlog "Unable to open context menu"
209 Printlog " The graphic has to be selected and the context menu has to show graphics related commands"
210 Kontext "ImageMapEditor"
211 if Not ImageMapEditor.Exists(3) then
212 Warnlog "Unfortunately not the context menu from graphics has been used!"
215 Active.Setpage TabFont
223 if Active.Exists then
224 if Active.GetRT = 304 then Active.No
228 Kontext "DocumentWriter"
232 Active.Setpage TabType
236 Warnlog "Graphic has not been selected!"
238 printlog " Close text document"
242 ' -----------------------------------------------------------------------------
244 testcase tPickHyperlink
246 printlog " Context menu on hyperlinks"
247 printlog " Open a new text document"
249 printlog " Set zoom to 100%"
251 printlog " Empty clipboard"
253 printlog " Insert a hyperlink in document"
254 Call wTypeKeys "www.sun.com"
256 Call wTypeKeys "<HOME>"
257 printlog " Open context menu on hyperlink"
258 Call wTypeKeys "<SHIFT F10>"
259 printlog " Last entry in menu has to be 'Open hyperlink' ...."
260 CALL hMenuFindSelect (10955, true, 17, true) 'Find "Hyperlink-dialog" and call the slot.
261 kontext "TabHyperlinkInternet"
262 if TabHyperlinkInternet.Exists(3) then
263 Warnlog "Hyperlink-Dialog opened!"
264 TabHyperlinkInternet.Close
266 printlog " Close text document"
270 ' -----------------------------------------------------------------------------
272 testcase tHyperlinkEdit
274 printlog "Context menu on hyperlinks"
275 printlog " Open a new text document"
277 printlog " Set zoom to 100%"
279 printlog " Empty clipboard"
281 printlog " Insert a hyperlink in document"
282 Call wTypeKeys "www.openoffice.org"
284 Call wTypeKeys "<HOME>"
285 printlog " Open context menu on hyperlink"
286 Call wTypeKeys "<SHIFT F10>"
288 printlog " Open contextmenu, find the entry 'Edit Hyperlink', and call the slot..."
289 CALL hMenuFindSelect (21835, true, 18, true) 'Find "Edit Hyperlink" and call the slot.
290 printlog " Check if the Hyperlink-dialogue comes up correctly."
291 kontext "TabHyperlinkInternet"
292 if NOT TabHyperlinkInternet.Exists(3) then
293 Warnlog "No Hyperlink-Dialog visible!"
295 TabHyperlinkInternet.Close
297 printlog " Close text document"
301 ' -----------------------------------------------------------------------------
303 testcase tHyperlinkRemove
305 printlog "Context menu on hyperlinks"
306 printlog " Open a new text document"
308 kontext "TabHyperlinkInternet"
309 if TabHyperlinkInternet.Exists then
310 TabHyperlinkInternet.Close
312 Kontext "DocumentWriter"
313 printlog " Set zoom to 100%"
315 printlog " Empty clipboard"
317 printlog " Insert a hyperlink in document"
318 Call wTypeKeys "www.openoffice.org"
320 Call wTypeKeys "<HOME>"
321 printlog " Open context menu on hyperlink"
322 Call wTypeKeys "<SHIFT F10>"
323 printlog " Find the entry 'Remove hyperlink' in the menu... Check the position of the entry, and call it."
324 CALL hMenuFindSelect (21839, true, 20, true) 'Find "Remove hyperlink" and call the slot.
325 Printlog " Check that the hyperlink formatting has been removed and 'Format - Character - Hyperlink - URL' is empty."
326 Call wTypeKeys "<HOME>"
327 printlog " Open context menu on the hyperlink."
328 Call wTypeKeys "<SHIFT F10>"
329 printlog " Check that the Menu has less than 18 entries, otherwise the pasted content is wrong."
330 if MenuGetItemCount > 18 then
331 Warnlog " Either error or the contextmenu has changed - contact testowner."
332 CALL hMenuFindSelect (21839, false, 20, false) 'Check if "Remove hyperlink" exists in the menu.
333 kontext "TabHyperlinkInternet"
334 if TabHyperlinkInternet.Exists(3) then
335 Warnlog " ERROR. The Hyperlink-Status of the text wasn't removed. BUG!"
336 TabHyperlinkInternet.Close
339 printlog " Close text document"
343 ' -----------------------------------------------------------------------------
345 testcase tHyperlinkCopy
347 printlog "Context menu on hyperlinks"
348 printlog " Open a new text document"
350 printlog " If the Hyperlink-Dialog is open - Close it."
351 kontext "TabHyperlinkInternet"
352 if TabHyperlinkInternet.Exists then
353 TabHyperlinkInternet.Close
355 kontext "DocumentWriter"
356 printlog " Set zoom to 100%"
358 printlog " Empty clipboard"
360 printlog " Insert a hyperlink in document"
361 Call wTypeKeys "www.openoffice.org"
363 Call wTypeKeys "<HOME><RIGHT RIGHT RIGHT>"
364 printlog " Open context menu on hyperlink"
365 Call wTypeKeys "<SHIFT F10>"
366 printlog " Select 'Copy Hyperlink Location'..."
367 CALL hMenuFindSelect (21840, true, 19, true) 'Find "Copy Hyperlink Location" and call the slot.
368 printlog " Check that the Clipboard contains something/the string we wanted to copy."
369 if GetClipboard = "" then
370 warnlog " Clipboard empty, notify testowner and check if the Hyperlink Copy-function works."
372 printlog " Set the cursor somwhere else in the document."
373 Call wTypeKeys "<END>"
374 Call wTypeKeys "<RETURN>", 10
377 printlog " Check that the hyperlink URL is pasted as plain text."
378 printlog " Mark the text we just pasted."
379 Call wTypeKeys "<HOME><RIGHT RIGHT RIGHT>"
380 printlog " We do this by opening the context menu on the text-string."
381 Call wTypeKeys "<SHIFT F10>"
382 printlog " Check if the contextmenu contains anything about 'Hyperlink'."
383 CALL hMenuFindSelect (10955, true, 17, false) 'Try to find and call "Open Hyperlink".
384 kontext "TabHyperlinkInternet"
385 if TabHyperlinkInternet.Exists(3) then
386 Warnlog " Seemingly, the copy wasn't plaintext, but also a hyperlink. BUG!"
388 printlog " Close text document"
392 ' -----------------------------------------------------------------------------
394 testcase tPickDrawingObjects
396 printlog "Context menu on drawing objects"
397 printlog " Open a new text document"
399 printlog " If the Hyperlink-Dialog is open - Close it."
400 kontext "TabHyperlinkInternet"
401 if TabHyperlinkInternet.Exists then
402 TabHyperlinkInternet.Close
404 kontext "DocumentWriter"
405 printlog " Set zoom to 100%"
407 printlog " empty clipboard"
409 printlog " Insert 2 drawing objects (rectangle)"
411 Call wZeichenobjektEinfuegen ( "Rechteck", 35, 40, 52, 52 )
412 Call wTypeKeys "<Escape>"
414 Call wZeichenobjektEinfuegen ( "Rechteck", 35, 35, 50, 50 )
415 Call wTypeKeys "<Escape>"
417 printlog " Select both objects"
418 Call wObjektSelektieren ( 32, 32, 60, 60 )
421 printlog " Open context menu on 1. drawing object"
422 Call DocumentWriter.MouseMove 51, 51
423 Call wOpenContextMenu(true)
424 printlog " Normally 'copy' is last menu entry"
425 CALL hMenuFindSelect (5711, true, 15, true) 'Find "Copy" and call the slot.
427 printlog " Both drawing objects have to leave selected"
432 Warnlog "Drawing objects did not leave selected after context menu opened"
435 printlog " Close text document"
439 ' -----------------------------------------------------------------------------