Merge lp:~aacid/unity-2d/unity-2d_tests_for_rtl into lp:unity-2d

Proposed by Albert Astals Cid
Status: Merged
Approved by: Gerry Boland
Approved revision: 885
Merged at revision: 895
Proposed branch: lp:~aacid/unity-2d/unity-2d_tests_for_rtl
Merge into: lp:unity-2d
Diff against target: 1345 lines (+740/-536)
3 files modified
tests/launcher/autohide_show_tests.rb (+68/-536)
tests/launcher/autohide_show_tests_common.rb (+498/-0)
tests/launcher/autohide_show_tests_rtl.rb (+174/-0)
To merge this branch: bzr merge lp:~aacid/unity-2d/unity-2d_tests_for_rtl
Reviewer Review Type Date Requested Status
Michał Sawicz Approve
Gerry Boland (community) Needs Fixing
Review via email: mp+90849@code.launchpad.net

Description of the change

[test] Add RTL tests

Generalized from the non rtl ones, some commented because don't work

To post a comment you must log in.
Revision history for this message
Gerry Boland (gerboland) wrote :

Will we get rid of the credit in the copyrights? I see I'm there.

Everything looks good (except tests fail with multi-monitor, but that's a corner case for now) otherwise.

Massive work, thank you!

review: Needs Information
Revision history for this message
Albert Astals Cid (aacid) wrote :

Well, you are there because you were there in the file I copied most of the contents from, but O'll remove it if you want.

Revision history for this message
Gerry Boland (gerboland) wrote :

Yep, that's better. Thank you, approving!

review: Approve
Revision history for this message
Gerry Boland (gerboland) wrote :

Your friendly manual-merger will report the following error (already having merged the 3 existing MR in the queue):

+N tests/launcher/autohide_show_tests_common.rb
+N tests/launcher/autohide_show_tests_rtl.rb
 M tests/launcher/autohide_show_tests.rb
Text conflict in tests/launcher/autohide_show_tests.rb
1 conflicts encountered.

See https://pastebin.canonical.com/59199/

review: Needs Fixing
Revision history for this message
Michał Sawicz (saviq) wrote :

Looks good.

review: Approve
882. By Albert Astals Cid

merge

883. By Albert Astals Cid

merge

884. By Albert Astals Cid

merge

885. By Albert Astals Cid

merge

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tests/launcher/autohide_show_tests.rb'
--- tests/launcher/autohide_show_tests.rb 2012-02-03 17:28:33 +0000
+++ tests/launcher/autohide_show_tests.rb 2012-02-06 10:04:19 +0000
@@ -27,11 +27,49 @@
27require 'xdo/keyboard'27require 'xdo/keyboard'
28require 'xdo/mouse'28require 'xdo/mouse'
29require 'tmpwindow'29require 'tmpwindow'
30require $library_path + '/../../launcher/autohide_show_tests_common.rb'
3031
31############################# Test Suite #############################32############################# Test Suite #############################
32context "Launcher Autohide and Show Tests" do33context "Launcher Autohide and Show Tests" do
33 launcher_favorites = ""34 launcher_favorites = ""
3435
36 def verify_launcher_visible(timeout, message = '')
37 verify_equal( 0, timeout, message ) {
38 @app.Unity2dPanel()['x_absolute'].to_i
39 }
40 end
41
42 def verify_launcher_hidden(timeout, message = '')
43 verify_equal( -LAUNCHER_WIDTH, timeout, message ) {
44 @app.Unity2dPanel()['x_absolute'].to_i
45 }
46 end
47
48 def open_overlapping_window()
49 xid = TmpWindow.open_window_at(10,100)
50 return xid
51 end
52
53 def move_mouse_to_screen_edge()
54 XDo::Mouse.move(0, 200, 0, true)
55 end
56
57 def move_mouse_to_launcher_inner_border()
58 XDo::Mouse.move(LAUNCHER_WIDTH-1,200)
59 end
60
61 def move_mouse_to_just_outside_launcher()
62 XDo::Mouse.move(LAUNCHER_WIDTH,200)
63 end
64
65 def move_window_just_overlapping(xid)
66 xid.move(LAUNCHER_WIDTH - 1 , 100)
67 end
68
69 def move_window_just_not_overlapping(xid)
70 xid.move(LAUNCHER_WIDTH, 100)
71 end
72
35 # Run once at the beginning of this test suite73 # Run once at the beginning of this test suite
36 startup do74 startup do
37 $SUT.execute_shell_command 'killall unity-2d-launcher'75 $SUT.execute_shell_command 'killall unity-2d-launcher'
@@ -54,8 +92,8 @@
5492
55 # Execute the application 93 # Execute the application
56 @app = $SUT.run( :name => UNITY_2D_LAUNCHER, 94 @app = $SUT.run( :name => UNITY_2D_LAUNCHER,
57 :arguments => "-testability", 95 :arguments => "-testability",
58 :sleeptime => 2 )96 :sleeptime => 2 )
59 # Make certain application is ready for testing97 # Make certain application is ready for testing
60 verify{ @app.Unity2dPanel() }98 verify{ @app.Unity2dPanel() }
61 end99 end
@@ -72,570 +110,64 @@
72 #####################################################################################110 #####################################################################################
73 # Test cases111 # Test cases
74112
75
76 # Test case objectives:
77 # * Check the Launcher position on Empty desktop
78 # Pre-conditions
79 # * Desktop with no running applications
80 # Test steps
81 # * Verify Launcher is #{LAUNCHER_WIDTH} pixels wide
82 # * Verify Launcher showing
83 # Post-conditions
84 # * None
85 # References
86 # * None
87 test "Position with Empty Desktop" do113 test "Position with Empty Desktop" do
88 # check width before proceeding114 test_position_with_empty_desktop()
89 verify_equal( LAUNCHER_WIDTH, TIMEOUT, "Launcher is not #{LAUNCHER_WIDTH} pixels wide on screen!" ) {
90 @app.Unity2dPanel()['width'].to_i
91 }
92
93 verify_equal( 0, TIMEOUT, 'Launcher hiding on empty desktop, should be visible' ) {
94 @app.Unity2dPanel()['x_absolute'].to_i
95 }
96 end115 end
97116
98
99 # Test case objectives:
100 # * Check the Launcher position on desktop with window not in way
101 # Pre-conditions
102 # * Desktop with no running applications
103 # Test steps
104 # * Open application in position not overlapping Launcher
105 # * Verify Launcher showing
106 # Post-conditions
107 # * None
108 # References
109 # * None
110 test "Position with Window not in the way" do117 test "Position with Window not in the way" do
111 # Open Terminal with position 100x100118 test_position_width_window_not_in_the_way()
112 xid = TmpWindow.open_window_at(100,100)
113 verify_equal( 0, TIMEOUT, 'Launcher hiding when window not in the way, should be visible' ) {
114 @app.Unity2dPanel()['x_absolute'].to_i
115 }
116 xid.close!
117 end119 end
118120
119
120 # Test case objectives:
121 # * Check the Launcher position on desktop with window in the way
122 # Pre-conditions
123 # * Desktop with no running applications
124 # Test steps
125 # * Open application in position overlapping Launcher
126 # * Verify Launcher hides
127 # Post-conditions
128 # * None
129 # References
130 # * None
131 test "Position with Window in the way" do121 test "Position with Window in the way" do
132 # Open Terminal with position 40x100122 test_position_with_window_in_the_way()
133 xid = TmpWindow.open_window_at(40,100)
134 verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher visible when window in the way, should be hidden' ) {
135 @app.Unity2dPanel()['x_absolute'].to_i
136 }
137 xid.close!
138 end123 end
139124
140
141 # Test case objectives:
142 # * Check Launcher autohide working
143 # Pre-conditions
144 # * Desktop with no running applications
145 # Test steps
146 # * Open application in position not overlapping Launcher
147 # * Verify Launcher showing
148 # * Move application window to position overlapping Launcher
149 # * Verify Launcher hides
150 # * Move application window to position not overlapping Launcher
151 # * Verify Launcher shows again
152 # Post-conditions
153 # * None
154 # References
155 # * None
156 test "Move window positioning to check launcher action" do125 test "Move window positioning to check launcher action" do
157 # Open Terminal with position 100x100126 test_move_window_positioning_to_check_launcher_action()
158 xid = TmpWindow.open_window_at(100,100)
159 verify_equal( 0, TIMEOUT, 'Launcher hiding when window not in the way, should be visible' ) {
160 @app.Unity2dPanel()['x_absolute'].to_i
161 }
162
163 xid.move(LAUNCHER_WIDTH-1,100)
164 verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher visible when window in the way, should be hidden' ) {
165 @app.Unity2dPanel()['x_absolute'].to_i
166 }
167
168 xid.move(LAUNCHER_WIDTH,100)
169 verify_equal( 0, TIMEOUT, 'Launcher hiding when window not in the way, should be visible' ) {
170 @app.Unity2dPanel()['x_absolute'].to_i
171 }
172 xid.close!
173 end127 end
174128
175
176 # Test case objectives:
177 # * Check Launcher reveal using mouse works
178 # Pre-conditions
179 # * Desktop with no running applications
180 # Test steps
181 # * Open application in position overlapping Launcher
182 # * Verify Launcher hiding
183 # * Move mouse to left of screen to reveal Launcher
184 # * Verify Launcher shows but not immediately
185 # * Move mouse to the right, but still over the Launcher
186 # * Verify Launcher still showing
187 # * Move mouse further right to not overlap Launcher
188 # * Verify Launcher hides but not immediately
189 # Post-conditions
190 # * None
191 # References
192 # * None
193 test "Reveal hidden Launcher with mouse" do129 test "Reveal hidden Launcher with mouse" do
194 xid = TmpWindow.open_window_at(10,100)130 test_reveal_hidden_launcher_with_mouse()
195 verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher visible with window in the way, should be hidden' ) {131 end
196 @app.Unity2dPanel()['x_absolute'].to_i132
197 }133 test "Press Super key to toggle launcher" do
198134 test_press_super_to_toggle_launcher()
199 XDo::Mouse.move(0,200)135 end
200 sleep 0.4136
201 verify_equal( -LAUNCHER_WIDTH, 0, 'Launcher should not be visible immediately after mouse moves to the left edge, has to wait 0.5 seconds to show' ) {
202 @app.Unity2dPanel()['x_absolute'].to_i
203 }
204 verify_equal( 0, TIMEOUT, 'Launcher hiding when mouse at left edge of screen' ) {
205 @app.Unity2dPanel()['x_absolute'].to_i
206 }
207
208 XDo::Mouse.move(LAUNCHER_WIDTH-1,200)
209 verify_equal( 0, TIMEOUT, 'Launcher should still be visible as mouse over it' ) {
210 @app.Unity2dPanel()['x_absolute'].to_i
211 }
212
213 XDo::Mouse.move(LAUNCHER_WIDTH,200)
214 sleep 0.9
215 verify_equal( 0, 0, 'Launcher should still be visible as it should take 1 second to hide after mouse is not over it' ) {
216 @app.Unity2dPanel()['x_absolute'].to_i
217 }
218 verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher visible with window in the way and mouse moved out, should be hidden' ) {
219 @app.Unity2dPanel()['x_absolute'].to_i
220 }
221 xid.close!
222 end
223
224
225 # Test case objectives:
226 # * Check Launcher reveal when dash is invoked
227 # Pre-conditions
228 # * None
229 # Test steps
230 # * Open application in position overlapping Launcher
231 # * Verify Launcher hiding
232 # * Press Super key
233 # * Verify Launcher shows
234 # * Press Super key
235 # * Verify Launcher hides
236 # Post-conditions
237 # * None
238 # References
239 # * None
240 test "Press Super key to reveal launcher, press again to hide" do
241 xid = TmpWindow.open_window_at(10,100)
242 verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher visible with window in the way, should be hidden' ) {
243 @app.Unity2dPanel()['x_absolute'].to_i
244 }
245
246 XDo::Keyboard.simulate('{SUPER}')
247 verify_equal( 0, TIMEOUT, 'Launcher hiding when Super Key pressed, should be visible' ) {
248 @app.Unity2dPanel()['x_absolute'].to_i
249 }
250
251 XDo::Keyboard.simulate('{SUPER}')
252 verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher visible with window in the way and mouse moved out, should be hidden' ) {
253 @app.Unity2dPanel()['x_absolute'].to_i
254 }
255 xid.close!
256 end
257
258
259 # Test case objectives:
260 # * Check Launcher reveal with Super key works
261 # Pre-conditions
262 # * None
263 # Test steps
264 # * Open application in position overlapping Launcher
265 # * Verify Launcher hiding
266 # * Hold down Super key
267 # * Verify Launcher shows
268 # * Verify Tile shortcut numbers are showing
269 # * Release Super key
270 # * Verify Launcher hides
271 # Post-conditions
272 # * None
273 # References
274 # * None
275 test "Hold Super key down to reveal launcher and shortcut keys" do137 test "Hold Super key down to reveal launcher and shortcut keys" do
276 xid = TmpWindow.open_window_at(10,100)138 test_hold_super_launcher_shortcuts()
277 verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher visible with window in the way, should be hidden' ) {
278 @app.Unity2dPanel()['x_absolute'].to_i
279 }
280
281 sleep 1 #launcher seems not ready to accept Super key, need a pause
282 XDo::Keyboard.key_down('SUPER')
283 verify_equal( 0, TIMEOUT, 'Launcher hiding when Super Key held, should be visible' ) {
284 @app.Unity2dPanel()['x_absolute'].to_i
285 }
286 verify_equal( 'true', TIMEOUT, 'Shortcut on Home Folder icon not displaying with Super key held' ) {
287 @app.LauncherList( :name => 'main' ) \
288 .QDeclarativeItem( :name => 'Home Folder' ) \
289 .QDeclarativeRectangle() \
290 .QDeclarativeText()['visible']
291 }
292
293 XDo::Keyboard.key_up('SUPER')
294 verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher visible with window in the way and mouse moved out, should be hidden' ) {
295 @app.Unity2dPanel()['x_absolute'].to_i
296 }
297 xid.close!
298 end139 end
299140
300
301 # Test case objectives:
302 # * Alt+F1 gives keyboard focus to Launcher, escape removes it
303 # Pre-conditions
304 # * Desktop with no running applications
305 # Test steps
306 # * Open application in position overlapping Launcher
307 # * Verify Launcher hiding
308 # * Press Alt+F1
309 # * Verify Launcher shows
310 # * Verify Dash icon is highlighted
311 # * Press Escape
312 # * Verify Launcher hides
313 # Post-conditions
314 # * None
315 # References
316 # * None
317 test "Press Alt+F1 to focus Launcher" do141 test "Press Alt+F1 to focus Launcher" do
318 xid = TmpWindow.open_window_at(10,100)142 test_alt_f1_focus_launcher()
319 verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher visible with window in the way, should be hidden' ) {
320 @app.Unity2dPanel()['x_absolute'].to_i
321 }
322
323 XDo::Keyboard.alt_F1 #Must use uppercase F to indicate function keys
324 verify_equal( 0, TIMEOUT, 'Launcher hiding after Alt+F1 pressed, should be visible' ) {
325 @app.Unity2dPanel()['x_absolute'].to_i
326 }
327 verify_equal( 'true', TIMEOUT, 'Dash icon not highlighted after Alt+F1 pressed' ){
328 @app.LauncherList( :name => 'main' ).LauncherList( :isBfb => true ).QDeclarativeImage( :name => 'selectionOutline' )['visible']
329 }
330
331 XDo::Keyboard.escape
332 verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher visible with window in the way and mouse moved out, should be hidden' ) {
333 @app.Unity2dPanel()['x_absolute'].to_i
334 }
335 xid.close!
336 end143 end
337144
338
339 # Test case objectives:
340 # * Alt+F1 takes & gives keyboard focus to the Launcher
341 # Pre-conditions
342 # * Desktop with no running applications
343 # Test steps
344 # * Open application in position overlapping Launcher
345 # * Verify Launcher hiding
346 # * Verify application has keyboard focus
347 # * Press Alt+F1
348 # * Verify Launcher shows
349 # * Verify Dash icon is highlighted
350 # * Verify application does not have keyboard focus
351 # * Press Alt+F1
352 # * Verify Launcher hides
353 # * Verify application has keyboard focus
354 # Post-conditions
355 # * None
356 # References
357 # * None
358 test "Press Alt+F1 to focus/unfocus Launcher" do145 test "Press Alt+F1 to focus/unfocus Launcher" do
359 xid = TmpWindow.open_window_at(10,100)146 test_alt_f1_focus_unfocus_launcher()
360 verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher visible with window in the way, should be hidden' ) {147 end
361 @app.Unity2dPanel()['x_absolute'].to_i148
362 }149 xtest "Press Alt+F1, esc to focus/unfocus Launcher when dash is open" do
363 assert_equal( xid.id, XDo::XWindow.active_window, \150 test_alt_f1_esc_focus_unfocus_launcher_when_dash_open()
364 'terminal should have focus after starting it' )151 end
365152
366 XDo::Keyboard.alt_F1 #Must use uppercase F to indicate function keys153 xtest "Press Alt+F1 to focus Launcher when dash is open, Alt+F1 to unfocus" do
367 verify_equal( 0, TIMEOUT, 'Launcher hiding after Alt+F1 pressed, should be visible' ) {154 test_alt_f1_toggle_focus_launcher_when_dash_open()
368 @app.Unity2dPanel()['x_absolute'].to_i155 end
369 }156
370 verify_equal( 'true', TIMEOUT, 'Dash icon not highlighted after Alt+F1 pressed' ) {
371 @app.LauncherList( :name => 'main' ).LauncherList( :isBfb => true ).QDeclarativeImage( :name => 'selectionOutline' )['visible']
372 }
373 assert_not_equal( xid.id, XDo::XWindow.active_window, \
374 'terminal has focus when it should be in the launcher' )
375
376 XDo::Keyboard.alt_F1
377 verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher visible with window in the way and mouse moved out, should be hidden' ){
378 @app.Unity2dPanel()['x_absolute'].to_i
379 }
380 assert_equal( xid.id, XDo::XWindow.active_window, \
381 'terminal does not have focus when it should' )
382 xid.close!
383 end
384
385
386 # Test case objectives:
387 # * Alt+F1 gives keyboard focus to the Launcher when dash was open, escape removes it
388 # Pre-conditions
389 # * Desktop with no running applications
390 # Test steps
391 # * Open application in position overlapping Launcher
392 # * Verify Launcher hiding
393 # * Verify application has keyboard focus
394 # * Press Super to invoke the Dash
395 # * Verify Launcher is shown
396 # * Press Alt+F1
397 # * Verify Launcher shows
398 # * Verify Dash icon is highlighted
399 # * Verify application does not have keyboard focus
400 # * Press Escape
401 # * Verify Launcher hides
402 # * Verify application has keyboard focus
403 # Post-conditions
404 # * None
405 # References
406 # * None
407 xtest "Press Alt+F1 to focus/unfocus Launcher when dash is open" do
408 xid = TmpWindow.open_window_at(10,100)
409 verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher visible with window in the way, should be hidden' ) {
410 @app.Unity2dPanel()['x_absolute'].to_i
411 }
412 assert_equal( xid.id, XDo::XWindow.active_window, \
413 'terminal should have focus after starting it' )
414
415 XDo::Keyboard.simulate('{SUPER}')
416 verify_equal( 0, TIMEOUT, 'Launcher hiding after Super pressed, should be visible' ) {
417 @app.Unity2dPanel()['x_absolute'].to_i
418 }
419
420 XDo::Keyboard.alt_F1 #Must use uppercase F to indicate function keys
421 verify_equal( 'true', TIMEOUT, 'Dash icon not highlighted after Alt+F1 pressed' ) {
422 @app.LauncherList( :name => 'main' ) \
423 .QDeclarativeItem( :name => 'Dash home' ) \
424 .QDeclarativeImage( :name => 'selectionOutline' )['visible']
425 }
426 assert_not_equal( xid.id, XDo::XWindow.active_window, \
427 'terminal has focus when it should be in the launcher' )
428
429 XDo::Keyboard.escape
430 verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher visible with window in the way and mouse moved out, should be hidden' ){
431 @app.Unity2dPanel()['x_absolute'].to_i
432 }
433 assert_equal( xid.id, XDo::XWindow.active_window, \
434 'terminal does not have focus when it should' )
435 xid.close!
436 end
437
438
439 # Test case objectives:
440 # * Alt+F1 takes & gives keyboard focus to the Launcher when dash was open
441 # Pre-conditions
442 # * Desktop with no running applications
443 # Test steps
444 # * Open application in position overlapping Launcher
445 # * Verify Launcher hiding
446 # * Verify application has keyboard focus
447 # * Press Super to invoke the Dash
448 # * Verify Launcher is shown
449 # * Press Alt+F1
450 # * Verify Launcher shows
451 # * Verify Dash icon is highlighted
452 # * Verify application does not have keyboard focus
453 # * Press Alt+F1
454 # * Verify Launcher hides
455 # * Verify application has keyboard focus
456 # Post-conditions
457 # * None
458 # References
459 # * None
460 xtest "Press Alt+F1 to focus Launcher when dash is open, escape to unfocus" do
461 xid = TmpWindow.open_window_at(10,100)
462 verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher visible with window in the way, should be hidden' ) {
463 @app.Unity2dPanel()['x_absolute'].to_i
464 }
465 assert_equal( xid.id, XDo::XWindow.active_window, \
466 'terminal should have focus after starting it' )
467
468 XDo::Keyboard.simulate('{SUPER}')
469 verify_equal( 0, TIMEOUT, 'Launcher hiding after Super pressed, should be visible' ) {
470 @app.Unity2dPanel()['x_absolute'].to_i
471 }
472
473 XDo::Keyboard.alt_F1 #Must use uppercase F to indicate function keys
474 verify_equal( 'true', TIMEOUT, 'Dash icon not highlighted after Alt+F1 pressed' ) {
475 @app.LauncherList( :name => 'main' ) \
476 .QDeclarativeItem( :name => 'Dash home' ) \
477 .QDeclarativeImage( :name => 'selectionOutline' )['visible']
478 }
479 assert_not_equal( xid.id, XDo::XWindow.active_window, \
480 'terminal has focus when it should be in the launcher' )
481
482 XDo::Keyboard.alt_F1
483 verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher visible with window in the way and mouse moved out, should be hidden' ){
484 @app.Unity2dPanel()['x_absolute'].to_i
485 }
486 assert_equal( xid.id, XDo::XWindow.active_window, \
487 'terminal does not have focus when it should' )
488 xid.close!
489 end
490
491
492 # Test case objectives:
493 # * Launcher displays when 'show desktop' engages
494 # Pre-conditions
495 # * Desktop with no running applications
496 # Test steps
497 # * Open application in position overlapping Launcher
498 # * Verify Launcher hiding
499 # * Engage "Show Desktop" mode
500 # * Verify Launcher showing
501 # * Disengage "Show Desktop" mode
502 # * Verify Launcher hides
503 # Post-conditions
504 # * None
505 # References
506 # * None
507 test "Launcher visible on show-desktop" do157 test "Launcher visible on show-desktop" do
508 xid = TmpWindow.open_window_at(10,100)158 test_launcher_visible_show_desktop()
509 verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher visible with window in the way, should be hidden' ) {
510 @app.Unity2dPanel()['x_absolute'].to_i
511 }
512
513 XDo::XWindow.toggle_minimize_all # This is effectively the show-desktop shortcut
514 verify_equal( 0, TIMEOUT, 'Launcher hiding after triggering show-desktop, should be visible' ) {
515 @app.Unity2dPanel()['x_absolute'].to_i
516 }
517
518 XDo::XWindow.toggle_minimize_all
519 verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher visible with window in the way, should be hidden' ) {
520 @app.Unity2dPanel()['x_absolute'].to_i
521 }
522 xid.close!
523 end159 end
524160
525 # Test case objectives:
526 # * Launcher is around for 1 second after removing a tile
527 # Pre-conditions
528 # * Desktop with at least one application not running
529 # Test steps
530 # * Open application in position overlapping Launcher
531 # * Verify Launcher hiding
532 # * Right click on a non running application tile
533 # * Wait enough time ( > 1 sec) so that the timer that would close the launcher
534 # if the menu was not open triggers
535 # * Click on the last menu item (Remove)
536 # * Verify Launcher stays away for a second
537 # Post-conditions
538 # * None
539 # References
540 # * None
541 test "Launcher hide delay on tile removal" do161 test "Launcher hide delay on tile removal" do
542 xid = TmpWindow.open_window_at(10,100)162 test_launcher_hide_delay_on_tile_removal()
543 tiles = ""
544 verify( 0, 'Could not find any non running application tile to remove' ) {
545 tiles = @app.LauncherList( :name => 'main' ).children( { :running => 'false', :desktopFile => /^.*.desktop$/ } )
546 }
547 if !tiles.empty?
548 tile = tiles[0]
549 XDo::Mouse.move(0, 200, 0, true)
550 verify_equal( 0, TIMEOUT, 'Launcher hiding when mouse at left edge of screen' ) {
551 @app.Unity2dPanel()['x_absolute'].to_i
552 }
553 XDo::Mouse.move(tile['x_absolute'].to_i + 1, tile['y_absolute'].to_i + 1, 0, true)
554 XDo::Mouse.click(nil, nil, :right)
555 menu = @app.LauncherContextualMenu( :folded => false );
556 XDo::Mouse.move(menu['x_absolute'].to_i + 20, menu['y_absolute'].to_i + menu['height'].to_i - 10, 0, true)
557 sleep 1.5
558 XDo::Mouse.click()
559 sleep 0.9
560 verify_equal( 0, 0, 'Launcher hiding after icon removal, should be visible for 1 second' ) {
561 @app.Unity2dPanel()['x_absolute'].to_i
562 }
563 verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher visible with window in the way, should be hidden' ) {
564 @app.Unity2dPanel()['x_absolute'].to_i
565 }
566 xid.close!
567 end
568 end163 end
569164
570 # Test case objectives:
571 # * Launcher does not hide after toggling the dash
572 # Pre-conditions
573 # * Desktop with no running applications
574 # Test steps
575 # * Open application in position overlapping Launcher
576 # * Verify Launcher hiding
577 # * Move mouse to the left
578 # * Verify Launcher showing
579 # * Click twice in the bfb
580 # * Verify Launcher showing during 1.5 seconds
581 # Post-conditions
582 # * None
583 # References
584 # * None
585 test "Launcher visible after toggling dash" do165 test "Launcher visible after toggling dash" do
586 xid = TmpWindow.open_window_at(10,100)166 test_launcher_visible_after_toggling_dash()
587 verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher visible with window in the way, should be hidden' ) {
588 @app.Unity2dPanel()['x_absolute'].to_i
589 }
590
591 bfb = @app.LauncherList( :name => 'main' ).LauncherList( :isBfb => true );
592 XDo::Mouse.move(0, 200, 0, true)
593 verify_equal( 0, TIMEOUT, 'Launcher hiding when mouse at left edge of screen' ) {
594 @app.Unity2dPanel()['x_absolute'].to_i
595 }
596 bfb.move_mouse()
597 bfb.tap()
598 bfb.tap()
599 verify_not(0, 'Launcher hiding after hovering mouse over bfb and clicking twice') {
600 verify_equal( -LAUNCHER_WIDTH, 2 ) {
601 @app.Unity2dPanel()['x_absolute'].to_i
602 }
603 }
604
605 xid.close!
606 end167 end
607168
608 # Test case objectives:
609 # * Launcher does not hide on Esc after Alt+F1 with overlapping window
610 # Pre-conditions
611 # * Desktop with no running applications
612 # Test steps
613 # * Open application in position overlapping Launcher
614 # * Verify Launcher hiding
615 # * Press Alt+F1
616 # * Verify Launcher showing
617 # * Move mouse over the launcher
618 # * Press Esc
619 # * Verify Launcher does not hide
620 # Post-conditions
621 # * None
622 # References
623 # * None
624 test "Launcher does not hide on Esc after Alt+F1 with overlapping window" do169 test "Launcher does not hide on Esc after Alt+F1 with overlapping window" do
625 xid = TmpWindow.open_window_at(10,100)170 test_launcher_does_not_hide_on_esc_after_alt_f1_with_overlapping_window()
626 verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher visible with window in the way, should be hidden' ) {
627 @app.Unity2dPanel()['x_absolute'].to_i
628 }
629 XDo::Keyboard.alt_F1 #Must use uppercase F to indicate function keys
630 bfb = @app.LauncherList( :name => 'main' ).LauncherList( :isBfb => true );
631 bfb.move_mouse()
632 XDo::Keyboard.escape
633 verify_not(0, 'Launcher hiding after hovering mouse over bfb and clicking twice') {
634 verify_equal( -LAUNCHER_WIDTH, 2 ) {
635 @app.Unity2dPanel()['x_absolute'].to_i
636 }
637 }
638 xid.close!
639 end171 end
640172
641end173end
642174
=== added file 'tests/launcher/autohide_show_tests_common.rb'
--- tests/launcher/autohide_show_tests_common.rb 1970-01-01 00:00:00 +0000
+++ tests/launcher/autohide_show_tests_common.rb 2012-02-06 10:04:19 +0000
@@ -0,0 +1,498 @@
1=begin
2/*
3 * This file is part of unity-2d
4 *
5 * Copyright 2011 Canonical Ltd.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 3.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19=end
20
21# Test case objectives:
22# * Check the Launcher position on Empty desktop
23# Pre-conditions
24# * Desktop with no running applications
25# Test steps
26# * Verify Launcher is #{LAUNCHER_WIDTH} pixels wide
27# * Verify Launcher showing
28# Post-conditions
29# * None
30# References
31# * None
32def test_position_with_empty_desktop()
33 # check width before proceeding
34 verify_equal( LAUNCHER_WIDTH, TIMEOUT, "Launcher is not #{LAUNCHER_WIDTH} pixels wide on screen!" ) {
35 @app.Unity2dPanel()['width'].to_i
36 }
37
38 verify_launcher_visible(TIMEOUT, 'Launcher hiding on empty desktop, should be visible')
39end
40
41
42# Test case objectives:
43# * Check the Launcher position on desktop with window not in way
44# Pre-conditions
45# * Desktop with no running applications
46# Test steps
47# * Open application in position not overlapping Launcher
48# * Verify Launcher showing
49# Post-conditions
50# * None
51# References
52# * None
53def test_position_width_window_not_in_the_way()
54 # Open Terminal with position 100x100
55 xid = TmpWindow.open_window_at(100,100)
56 verify_launcher_visible(TIMEOUT, 'Launcher hiding when window not in the way, should be visible')
57 xid.close!
58end
59
60
61# Test case objectives:
62# * Check the Launcher position on desktop with window in the way
63# Pre-conditions
64# * Desktop with no running applications
65# Test steps
66# * Open application in position overlapping Launcher
67# * Verify Launcher hides
68# Post-conditions
69# * None
70# References
71# * None
72def test_position_with_window_in_the_way()
73 # Open Terminal with position 40x100
74 xid = open_overlapping_window()
75 verify_launcher_hidden(TIMEOUT, 'Launcher visible when window in the way, should be hidden')
76 xid.close!
77end
78
79
80# Test case objectives:
81# * Check Launcher autohide working
82# Pre-conditions
83# * Desktop with no running applications
84# Test steps
85# * Open application in position not overlapping Launcher
86# * Verify Launcher showing
87# * Move application window to position overlapping Launcher
88# * Verify Launcher hides
89# * Move application window to position not overlapping Launcher
90# * Verify Launcher shows again
91# Post-conditions
92# * None
93# References
94# * None
95def test_move_window_positioning_to_check_launcher_action()
96 # Open Terminal with position 100x100
97 xid = TmpWindow.open_window_at(100,100)
98 verify_launcher_visible(TIMEOUT, 'Launcher hiding when window not in the way, should be visible')
99
100 move_window_just_overlapping(xid)
101 verify_launcher_hidden(TIMEOUT, 'Launcher visible when window in the way, should be hidden')
102
103 move_window_just_not_overlapping(xid)
104 verify_launcher_visible(TIMEOUT, 'Launcher hiding when window not in the way, should be visible')
105 xid.close!
106end
107
108
109# Test case objectives:
110# * Check Launcher reveal using mouse works
111# Pre-conditions
112# * Desktop with no running applications
113# Test steps
114# * Open application in position overlapping Launcher
115# * Verify Launcher hiding
116# * Move mouse to left of screen to reveal Launcher
117# * Verify Launcher shows but not immediately
118# * Move mouse to the right, but still over the Launcher
119# * Verify Launcher still showing
120# * Move mouse further right to not overlap Launcher
121# * Verify Launcher hides but not immediately
122# Post-conditions
123# * None
124# References
125# * None
126def test_reveal_hidden_launcher_with_mouse()
127 xid = open_overlapping_window()
128 verify_launcher_hidden(TIMEOUT, 'Launcher visible with window in the way, should be hidden')
129
130 move_mouse_to_screen_edge()
131 sleep 0.4
132 verify_launcher_hidden(0, 'Launcher should not be visible immediately after mouse moves to the edge, has to wait 0.5 seconds to show')
133 verify_launcher_visible(TIMEOUT, 'Launcher hiding when mouse at edge of screen')
134
135 move_mouse_to_launcher_inner_border()
136 verify_launcher_visible(TIMEOUT, 'Launcher should still be visible as mouse over it')
137
138 move_mouse_to_just_outside_launcher()
139 sleep 0.9
140 verify_launcher_visible(0, 'Launcher should still be visible as it should take 1 second to hide after mouse is not over it')
141 verify_launcher_hidden(TIMEOUT, 'Launcher visible with window in the way and mouse moved out, should be hidden' )
142 xid.close!
143end
144
145
146# Test case objectives:
147# * Check Launcher reveal when dash is invoked
148# Pre-conditions
149# * None
150# Test steps
151# * Open application in position overlapping Launcher
152# * Verify Launcher hiding
153# * Press Super key
154# * Verify Launcher shows
155# * Press Super key
156# * Verify Launcher hides
157# Post-conditions
158# * None
159# References
160# * None
161def test_press_super_to_toggle_launcher()
162 xid = open_overlapping_window()
163 verify_launcher_hidden(TIMEOUT, 'Launcher visible with window in the way, should be hidden')
164
165 XDo::Keyboard.simulate('{SUPER}')
166 verify_launcher_visible(TIMEOUT, 'Launcher hiding when Super Key pressed, should be visible')
167
168 XDo::Keyboard.simulate('{SUPER}')
169 verify_launcher_hidden(TIMEOUT, 'Launcher visible with window in the way and mouse moved out, should be hidden')
170 xid.close!
171end
172
173
174# Test case objectives:
175# * Check Launcher reveal with Super key works
176# Pre-conditions
177# * None
178# Test steps
179# * Open application in position overlapping Launcher
180# * Verify Launcher hiding
181# * Hold down Super key
182# * Verify Launcher shows
183# * Verify Tile shortcut numbers are showing
184# * Release Super key
185# * Verify Launcher hides
186# Post-conditions
187# * None
188# References
189# * None
190def test_hold_super_launcher_shortcuts()
191 xid = open_overlapping_window()
192 verify_launcher_hidden(TIMEOUT, 'Launcher visible with window in the way, should be hidden')
193
194 sleep 1 #launcher seems not ready to accept Super key, need a pause
195 XDo::Keyboard.key_down('SUPER')
196 verify_launcher_visible(TIMEOUT, 'Launcher hiding when Super Key help, should be visible')
197 verify_equal( 'true', TIMEOUT, 'Shortcut on Home Folder icon not displaying with Super key held' ) {
198 @app.LauncherList( :name => 'main' ) \
199 .QDeclarativeItem( :name => 'Home Folder' ) \
200 .QDeclarativeRectangle() \
201 .QDeclarativeText()['visible']
202 }
203
204 XDo::Keyboard.key_up('SUPER')
205 verify_launcher_hidden(TIMEOUT, 'Launcher visible with window in the way and mouse moved out, should be hidden')
206 xid.close!
207end
208
209
210# Test case objectives:
211# * Alt+F1 gives keyboard focus to Launcher, escape removes it
212# Pre-conditions
213# * Desktop with no running applications
214# Test steps
215# * Open application in position overlapping Launcher
216# * Verify Launcher hiding
217# * Press Alt+F1
218# * Verify Launcher shows
219# * Verify Dash icon is highlighted
220# * Press Escape
221# * Verify Launcher hides
222# Post-conditions
223# * None
224# References
225# * None
226def test_alt_f1_focus_launcher()
227 xid = open_overlapping_window()
228 verify_launcher_hidden(TIMEOUT, 'Launcher visible with window in the way, should be hidden')
229
230 XDo::Keyboard.alt_F1 #Must use uppercase F to indicate function keys
231 verify_launcher_visible(TIMEOUT, 'Launcher visible with window in the way, should be hidden')
232 verify_equal( 'true', TIMEOUT, 'Dash icon not highlighted after Alt+F1 pressed' ){
233 @app.LauncherList( :name => 'main' ).LauncherList( :isBfb => true ).QDeclarativeImage( :name => 'selectionOutline' )['visible']
234 }
235
236 XDo::Keyboard.escape
237 verify_launcher_hidden(TIMEOUT, 'Launcher visible with window in the way and mouse moved out, should be hidden')
238 xid.close!
239end
240
241
242# Test case objectives:
243# * Alt+F1 takes & gives keyboard focus to the Launcher
244# Pre-conditions
245# * Desktop with no running applications
246# Test steps
247# * Open application in position overlapping Launcher
248# * Verify Launcher hiding
249# * Verify application has keyboard focus
250# * Press Alt+F1
251# * Verify Launcher shows
252# * Verify Dash icon is highlighted
253# * Verify application does not have keyboard focus
254# * Press Alt+F1
255# * Verify Launcher hides
256# * Verify application has keyboard focus
257# Post-conditions
258# * None
259# References
260# * None
261def test_alt_f1_focus_unfocus_launcher()
262 xid = open_overlapping_window()
263 verify_launcher_hidden(TIMEOUT, 'Launcher visible with window in the way, should be hidden')
264 assert_equal( xid.id, XDo::XWindow.active_window, \
265 'terminal should have focus after starting it' )
266
267 XDo::Keyboard.alt_F1 #Must use uppercase F to indicate function keys
268 verify_launcher_visible(TIMEOUT, 'Launcher hiding after Alt+F1 pressed, should be visible')
269 verify_equal( 'true', TIMEOUT, 'Dash icon not highlighted after Alt+F1 pressed' ) {
270 @app.LauncherList( :name => 'main' ).LauncherList( :isBfb => true ).QDeclarativeImage( :name => 'selectionOutline' )['visible']
271 }
272 assert_not_equal( xid.id, XDo::XWindow.active_window, \
273 'terminal has focus when it should be in the launcher' )
274
275 XDo::Keyboard.alt_F1
276 verify_launcher_hidden(TIMEOUT, 'Launcher visible with window in the way and mouse moved out, should be hidden')
277 assert_equal( xid.id, XDo::XWindow.active_window, \
278 'terminal does not have focus when it should' )
279 xid.close!
280end
281
282
283# Test case objectives:
284# * Alt+F1 gives keyboard focus to the Launcher when dash was open, escape removes it
285# Pre-conditions
286# * Desktop with no running applications
287# Test steps
288# * Open application in position overlapping Launcher
289# * Verify Launcher hiding
290# * Verify application has keyboard focus
291# * Press Super to invoke the Dash
292# * Verify Launcher is shown
293# * Press Alt+F1
294# * Verify Launcher shows
295# * Verify Dash icon is highlighted
296# * Verify application does not have keyboard focus
297# * Press Escape
298# * Verify Launcher hides
299# * Verify application has keyboard focus
300# Post-conditions
301# * None
302# References
303# * None
304def test_alt_f1_esc_focus_unfocus_launcher_when_dash_open()
305 xid = open_overlapping_window()
306 verify_launcher_hidden(TIMEOUT, 'Launcher visible with window in the way, should be hidden')
307 assert_equal( xid.id, XDo::XWindow.active_window, \
308 'terminal should have focus after starting it' )
309
310 XDo::Keyboard.simulate('{SUPER}')
311 verify_launcher_visible(TIMEOUT, 'Launcher hiding after Super pressed, should be visible')
312
313 XDo::Keyboard.alt_F1 #Must use uppercase F to indicate function keys
314 verify_equal( 'true', TIMEOUT, 'Dash icon not highlighted after Alt+F1 pressed' ) {
315 @app.LauncherList( :name => 'main' ).LauncherList( :isBfb => true ).QDeclarativeImage( :name => 'selectionOutline' )['visible']
316 }
317 assert_not_equal( xid.id, XDo::XWindow.active_window, \
318 'terminal has focus when it should be in the launcher' )
319
320 XDo::Keyboard.escape
321 verify_launcher_hidden(TIMEOUT, 'Launcher visible with window in the way and mouse moved out, should be hidden')
322 assert_equal( xid.id, XDo::XWindow.active_window, \
323 'terminal does not have focus when it should' )
324 xid.close!
325end
326
327
328# Test case objectives:
329# * Alt+F1 takes & gives keyboard focus to the Launcher when dash was open
330# Pre-conditions
331# * Desktop with no running applications
332# Test steps
333# * Open application in position overlapping Launcher
334# * Verify Launcher hiding
335# * Verify application has keyboard focus
336# * Press Super to invoke the Dash
337# * Verify Launcher is shown
338# * Press Alt+F1
339# * Verify Launcher shows
340# * Verify Dash icon is highlighted
341# * Verify application does not have keyboard focus
342# * Press Alt+F1
343# * Verify Launcher hides
344# * Verify application has keyboard focus
345# Post-conditions
346# * None
347# References
348# * None
349def test_alt_f1_toggle_focus_launcher_when_dash_open()
350 xid = open_overlapping_window()
351 verify_launcher_hidden(TIMEOUT, 'Launcher visible with window in the way, should be hidden')
352 assert_equal( xid.id, XDo::XWindow.active_window, \
353 'terminal should have focus after starting it' )
354
355 XDo::Keyboard.simulate('{SUPER}')
356 verify_launcher_visible(TIMEOUT, 'Launcher hiding after Super pressed, should be visible')
357
358 XDo::Keyboard.alt_F1 #Must use uppercase F to indicate function keys
359 verify_equal( 'true', TIMEOUT, 'Dash icon not highlighted after Alt+F1 pressed' ) {
360 @app.LauncherList( :name => 'main' ).LauncherList( :isBfb => true ).QDeclarativeImage( :name => 'selectionOutline' )['visible']
361 }
362 assert_not_equal( xid.id, XDo::XWindow.active_window, \
363 'terminal has focus when it should be in the launcher' )
364
365 XDo::Keyboard.alt_F1
366 verify_launcher_hidden(TIMEOUT, 'Launcher visible with window in the way and mouse moved out, should be hidden')
367 assert_equal( xid.id, XDo::XWindow.active_window, \
368 'terminal does not have focus when it should' )
369 xid.close!
370end
371
372
373# Test case objectives:
374# * Launcher displays when 'show desktop' engages
375# Pre-conditions
376# * Desktop with no running applications
377# Test steps
378# * Open application in position overlapping Launcher
379# * Verify Launcher hiding
380# * Engage "Show Desktop" mode
381# * Verify Launcher showing
382# * Disengage "Show Desktop" mode
383# * Verify Launcher hides
384# Post-conditions
385# * None
386# References
387# * None
388def test_launcher_visible_show_desktop()
389 xid = open_overlapping_window()
390 verify_launcher_hidden(TIMEOUT, 'Launcher visible with window in the way, should be hidden')
391
392 XDo::XWindow.toggle_minimize_all # This is effectively the show-desktop shortcut
393 verify_launcher_visible(TIMEOUT, 'Launcher hiding after triggering show-desktop, should be visible')
394
395 XDo::XWindow.toggle_minimize_all
396 verify_launcher_hidden(TIMEOUT, 'Launcher visible with window in the way, should be hidden')
397 xid.close!
398end
399
400# Test case objectives:
401# * Launcher is around for 1 second after removing a tile
402# Pre-conditions
403# * Desktop with at least one application not running
404# Test steps
405# * Open application in position overlapping Launcher
406# * Verify Launcher hiding
407# * Right click on a non running application tile
408# * Wait enough time ( > 1 sec) so that the timer that would close the launcher
409# if the menu was not open triggers
410# * Click on the last menu item (Remove)
411# * Verify Launcher stays away for a second
412# Post-conditions
413# * None
414# References
415# * None
416def test_launcher_hide_delay_on_tile_removal()
417 xid = open_overlapping_window()
418 tiles = ""
419 verify( 0, 'Could not find any non running application tile to remove' ) {
420 tiles = @app.LauncherList( :name => 'main' ).children( { :running => 'false', :desktopFile => /^.*.desktop$/ } )
421 }
422 if !tiles.empty?
423 tile = tiles[0]
424 move_mouse_to_screen_edge()
425 verify_launcher_visible(TIMEOUT, 'Launcher hiding when mouse at edge of screen, should be visible')
426 tile.move_mouse()
427 XDo::Mouse.click(nil, nil, :right)
428 menu = @app.LauncherContextualMenu( :folded => false );
429 XDo::Mouse.move(menu['x_absolute'].to_i + 20, menu['y_absolute'].to_i + menu['height'].to_i - 10, 0, true)
430 sleep 1.5
431 XDo::Mouse.click()
432 sleep 0.9
433 verify_launcher_visible(0, 'Launcher hiding after icon removal, should be visible for 1 second')
434 verify_launcher_hidden(TIMEOUT, 'Launcher visible with window in the way, should be hidden')
435 xid.close!
436 end
437end
438
439# Test case objectives:
440# * Launcher does not hide after toggling the dash
441# Pre-conditions
442# * Desktop with no running applications
443# Test steps
444# * Open application in position overlapping Launcher
445# * Verify Launcher hiding
446# * Move mouse to the left
447# * Verify Launcher showing
448# * Click twice in the bfb
449# * Verify Launcher showing during 1.5 seconds
450# Post-conditions
451# * None
452# References
453# * None
454def test_launcher_visible_after_toggling_dash()
455 xid = open_overlapping_window()
456 verify_launcher_hidden(TIMEOUT, 'Launcher visible with window in the way, should be hidden')
457
458 bfb = @app.LauncherList( :name => 'main' ).LauncherList( :isBfb => true );
459 move_mouse_to_screen_edge()
460 verify_launcher_visible(TIMEOUT, 'Launcher hiding when mouse at edge of screen, should be visible')
461 bfb.move_mouse()
462 bfb.tap()
463 bfb.tap()
464 verify_not(0, 'Launcher hiding after hovering mouse over bfb and clicking twice') {
465 verify_launcher_hidden(2)
466 }
467
468 xid.close!
469end
470
471# Test case objectives:
472# * Launcher does not hide on Esc after Alt+F1 with overlapping window
473# Pre-conditions
474# * Desktop with no running applications
475# Test steps
476# * Open application in position overlapping Launcher
477# * Verify Launcher hiding
478# * Press Alt+F1
479# * Verify Launcher showing
480# * Move mouse over the launcher
481# * Press Esc
482# * Verify Launcher does not hide
483# Post-conditions
484# * None
485# References
486# * None
487def test_launcher_does_not_hide_on_esc_after_alt_f1_with_overlapping_window()
488 xid = open_overlapping_window()
489 verify_launcher_hidden(TIMEOUT, 'Launcher visible with window in the way, should be hidden')
490 XDo::Keyboard.alt_F1 #Must use uppercase F to indicate function keys
491 bfb = @app.LauncherList( :name => 'main' ).LauncherList( :isBfb => true );
492 bfb.move_mouse()
493 XDo::Keyboard.escape
494 verify_not(0, 'Launcher hiding after on Esc after Alt+F1 with mouse over bfb') {
495 verify_launcher_hidden(2)
496 }
497 xid.close!
498end
0499
=== added file 'tests/launcher/autohide_show_tests_rtl.rb'
--- tests/launcher/autohide_show_tests_rtl.rb 1970-01-01 00:00:00 +0000
+++ tests/launcher/autohide_show_tests_rtl.rb 2012-02-06 10:04:19 +0000
@@ -0,0 +1,174 @@
1#!/usr/bin/env ruby1.8
2=begin
3/*
4 * This file is part of unity-2d
5 *
6 * Copyright 2011 Canonical Ltd.
7 *
8 * Authors:
9 * - Gerry Boland <gerry.boland@canonical.com>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; version 3.
14 *
15 * This program 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 General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 */
23=end
24
25require '../run-tests.rb' unless $INIT_COMPLETED
26require 'xdo/xwindow'
27require 'xdo/keyboard'
28require 'xdo/mouse'
29require 'tmpwindow'
30require $library_path + '/../../launcher/autohide_show_tests_common.rb'
31
32############################# Test Suite #############################
33context "Launcher Autohide and Show Tests on RTL" do
34 launcher_favorites = ""
35
36 def verify_launcher_visible(timeout, message = '')
37 verify_equal( XDo::XWindow.display_geometry[0] - LAUNCHER_WIDTH, timeout, message ) {
38 @app.Unity2dPanel()['x_absolute'].to_i
39 }
40 end
41
42 def verify_launcher_hidden(timeout, message = '')
43 verify_equal( XDo::XWindow.display_geometry[0], timeout, message ) {
44 @app.Unity2dPanel()['x_absolute'].to_i
45 }
46 end
47
48 def open_overlapping_window()
49 xid = TmpWindow.open_window_at(100, 100)
50 xid.move(XDo::XWindow.display_geometry[0] - xid.size[0] - 10 , 100)
51 return xid
52 end
53
54 def move_mouse_to_screen_edge()
55 XDo::Mouse.move(XDo::XWindow.display_geometry[0], 200, 0, true)
56 end
57
58 def move_mouse_to_launcher_inner_border()
59 XDo::Mouse.move(XDo::XWindow.display_geometry[0] - LAUNCHER_WIDTH, 200)
60 end
61
62 def move_mouse_to_just_outside_launcher()
63 XDo::Mouse.move(XDo::XWindow.display_geometry[0] - LAUNCHER_WIDTH - 1, 200)
64 end
65
66 def move_window_just_overlapping(xid)
67 xid.move(XDo::XWindow.display_geometry[0] - xid.size[0] - LAUNCHER_WIDTH - 1 , 100)
68 end
69
70 def move_window_just_not_overlapping(xid)
71 xid.move(XDo::XWindow.display_geometry[0] - xid.size[0]- LAUNCHER_WIDTH - 2, 100)
72 end
73
74 # Run once at the beginning of this test suite
75 startup do
76 $SUT.execute_shell_command 'killall unity-2d-launcher'
77 $SUT.execute_shell_command 'killall unity-2d-launcher'
78
79 # Minimize all windows
80 XDo::XWindow.toggle_minimize_all
81 end
82
83 # Run once at the end of this test suite
84 shutdown do
85 end
86
87 # Run before each test case begins
88 setup do
89 #Ensure mouse out of the way
90 XDo::Mouse.move(200,200,10,true)
91
92 launcher_favorites = $SUT.execute_shell_command 'gsettings get com.canonical.Unity.Launcher favorites'
93
94 # Execute the application
95 @app = $SUT.run( :name => UNITY_2D_LAUNCHER,
96 :arguments => "-testability,-reverse",
97 :sleeptime => 2 )
98 # Make certain application is ready for testing
99 verify{ @app.Unity2dPanel() }
100 end
101
102 # Run after each test case completes
103 teardown do
104 TmpWindow.close_all_windows
105 #@app.close
106 #Need to kill Launcher as it does not shutdown when politely asked
107 $SUT.execute_shell_command 'pkill -nf unity-2d-launcher'
108 $SUT.execute_shell_command "gsettings set com.canonical.Unity.Launcher favorites \"" + launcher_favorites + "\""
109 end
110
111 #####################################################################################
112 # Test cases
113
114 test "Position with Empty Desktop" do
115 test_position_with_empty_desktop()
116 end
117
118 test "Position with Window not in the way" do
119 test_position_width_window_not_in_the_way()
120 end
121
122 test "Position with Window in the way" do
123 test_position_with_window_in_the_way()
124 end
125
126 test "Move window positioning to check launcher action" do
127 test_move_window_positioning_to_check_launcher_action()
128 end
129
130 xtest "Reveal hidden Launcher with mouse" do
131 test_reveal_hidden_launcher_with_mouse()
132 end
133
134 test "Press Super key to toggle launcher" do
135 test_press_super_to_toggle_launcher()
136 end
137
138 test "Hold Super key down to reveal launcher and shortcut keys" do
139 test_hold_super_launcher_shortcuts()
140 end
141
142 test "Press Alt+F1 to focus Launcher" do
143 test_alt_f1_focus_launcher()
144 end
145
146 test "Press Alt+F1 to focus/unfocus Launcher" do
147 test_alt_f1_focus_unfocus_launcher()
148 end
149
150 xtest "Press Alt+F1, esc to focus/unfocus Launcher when dash is open" do
151 test_alt_f1_esc_focus_unfocus_launcher_when_dash_open()
152 end
153
154 xtest "Press Alt+F1 to focus Launcher when dash is open, Alt+F1 to unfocus" do
155 test_alt_f1_toggle_focus_launcher_when_dash_open()
156 end
157
158 test "Launcher visible on show-desktop" do
159 test_launcher_visible_show_desktop()
160 end
161
162 xtest "Launcher hide delay on tile removal" do
163 test_launcher_hide_delay_on_tile_removal()
164 end
165
166 xtest "Launcher visible after toggling dash" do
167 test_launcher_visible_after_toggling_dash()
168 end
169
170 test "Launcher does not hide on Esc after Alt+F1 with overlapping window" do
171 test_launcher_does_not_hide_on_esc_after_alt_f1_with_overlapping_window()
172 end
173
174end

Subscribers

People subscribed via source and target branches