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
1=== modified file 'tests/launcher/autohide_show_tests.rb'
2--- tests/launcher/autohide_show_tests.rb 2012-02-03 17:28:33 +0000
3+++ tests/launcher/autohide_show_tests.rb 2012-02-06 10:04:19 +0000
4@@ -27,11 +27,49 @@
5 require 'xdo/keyboard'
6 require 'xdo/mouse'
7 require 'tmpwindow'
8+require $library_path + '/../../launcher/autohide_show_tests_common.rb'
9
10 ############################# Test Suite #############################
11 context "Launcher Autohide and Show Tests" do
12 launcher_favorites = ""
13
14+ def verify_launcher_visible(timeout, message = '')
15+ verify_equal( 0, timeout, message ) {
16+ @app.Unity2dPanel()['x_absolute'].to_i
17+ }
18+ end
19+
20+ def verify_launcher_hidden(timeout, message = '')
21+ verify_equal( -LAUNCHER_WIDTH, timeout, message ) {
22+ @app.Unity2dPanel()['x_absolute'].to_i
23+ }
24+ end
25+
26+ def open_overlapping_window()
27+ xid = TmpWindow.open_window_at(10,100)
28+ return xid
29+ end
30+
31+ def move_mouse_to_screen_edge()
32+ XDo::Mouse.move(0, 200, 0, true)
33+ end
34+
35+ def move_mouse_to_launcher_inner_border()
36+ XDo::Mouse.move(LAUNCHER_WIDTH-1,200)
37+ end
38+
39+ def move_mouse_to_just_outside_launcher()
40+ XDo::Mouse.move(LAUNCHER_WIDTH,200)
41+ end
42+
43+ def move_window_just_overlapping(xid)
44+ xid.move(LAUNCHER_WIDTH - 1 , 100)
45+ end
46+
47+ def move_window_just_not_overlapping(xid)
48+ xid.move(LAUNCHER_WIDTH, 100)
49+ end
50+
51 # Run once at the beginning of this test suite
52 startup do
53 $SUT.execute_shell_command 'killall unity-2d-launcher'
54@@ -54,8 +92,8 @@
55
56 # Execute the application
57 @app = $SUT.run( :name => UNITY_2D_LAUNCHER,
58- :arguments => "-testability",
59- :sleeptime => 2 )
60+ :arguments => "-testability",
61+ :sleeptime => 2 )
62 # Make certain application is ready for testing
63 verify{ @app.Unity2dPanel() }
64 end
65@@ -72,570 +110,64 @@
66 #####################################################################################
67 # Test cases
68
69-
70- # Test case objectives:
71- # * Check the Launcher position on Empty desktop
72- # Pre-conditions
73- # * Desktop with no running applications
74- # Test steps
75- # * Verify Launcher is #{LAUNCHER_WIDTH} pixels wide
76- # * Verify Launcher showing
77- # Post-conditions
78- # * None
79- # References
80- # * None
81 test "Position with Empty Desktop" do
82- # check width before proceeding
83- verify_equal( LAUNCHER_WIDTH, TIMEOUT, "Launcher is not #{LAUNCHER_WIDTH} pixels wide on screen!" ) {
84- @app.Unity2dPanel()['width'].to_i
85- }
86-
87- verify_equal( 0, TIMEOUT, 'Launcher hiding on empty desktop, should be visible' ) {
88- @app.Unity2dPanel()['x_absolute'].to_i
89- }
90+ test_position_with_empty_desktop()
91 end
92
93-
94- # Test case objectives:
95- # * Check the Launcher position on desktop with window not in way
96- # Pre-conditions
97- # * Desktop with no running applications
98- # Test steps
99- # * Open application in position not overlapping Launcher
100- # * Verify Launcher showing
101- # Post-conditions
102- # * None
103- # References
104- # * None
105 test "Position with Window not in the way" do
106- # Open Terminal with position 100x100
107- xid = TmpWindow.open_window_at(100,100)
108- verify_equal( 0, TIMEOUT, 'Launcher hiding when window not in the way, should be visible' ) {
109- @app.Unity2dPanel()['x_absolute'].to_i
110- }
111- xid.close!
112+ test_position_width_window_not_in_the_way()
113 end
114
115-
116- # Test case objectives:
117- # * Check the Launcher position on desktop with window in the way
118- # Pre-conditions
119- # * Desktop with no running applications
120- # Test steps
121- # * Open application in position overlapping Launcher
122- # * Verify Launcher hides
123- # Post-conditions
124- # * None
125- # References
126- # * None
127 test "Position with Window in the way" do
128- # Open Terminal with position 40x100
129- xid = TmpWindow.open_window_at(40,100)
130- verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher visible when window in the way, should be hidden' ) {
131- @app.Unity2dPanel()['x_absolute'].to_i
132- }
133- xid.close!
134+ test_position_with_window_in_the_way()
135 end
136
137-
138- # Test case objectives:
139- # * Check Launcher autohide working
140- # Pre-conditions
141- # * Desktop with no running applications
142- # Test steps
143- # * Open application in position not overlapping Launcher
144- # * Verify Launcher showing
145- # * Move application window to position overlapping Launcher
146- # * Verify Launcher hides
147- # * Move application window to position not overlapping Launcher
148- # * Verify Launcher shows again
149- # Post-conditions
150- # * None
151- # References
152- # * None
153 test "Move window positioning to check launcher action" do
154- # Open Terminal with position 100x100
155- xid = TmpWindow.open_window_at(100,100)
156- verify_equal( 0, TIMEOUT, 'Launcher hiding when window not in the way, should be visible' ) {
157- @app.Unity2dPanel()['x_absolute'].to_i
158- }
159-
160- xid.move(LAUNCHER_WIDTH-1,100)
161- verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher visible when window in the way, should be hidden' ) {
162- @app.Unity2dPanel()['x_absolute'].to_i
163- }
164-
165- xid.move(LAUNCHER_WIDTH,100)
166- verify_equal( 0, TIMEOUT, 'Launcher hiding when window not in the way, should be visible' ) {
167- @app.Unity2dPanel()['x_absolute'].to_i
168- }
169- xid.close!
170+ test_move_window_positioning_to_check_launcher_action()
171 end
172
173-
174- # Test case objectives:
175- # * Check Launcher reveal using mouse works
176- # Pre-conditions
177- # * Desktop with no running applications
178- # Test steps
179- # * Open application in position overlapping Launcher
180- # * Verify Launcher hiding
181- # * Move mouse to left of screen to reveal Launcher
182- # * Verify Launcher shows but not immediately
183- # * Move mouse to the right, but still over the Launcher
184- # * Verify Launcher still showing
185- # * Move mouse further right to not overlap Launcher
186- # * Verify Launcher hides but not immediately
187- # Post-conditions
188- # * None
189- # References
190- # * None
191 test "Reveal hidden Launcher with mouse" do
192- xid = TmpWindow.open_window_at(10,100)
193- verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher visible with window in the way, should be hidden' ) {
194- @app.Unity2dPanel()['x_absolute'].to_i
195- }
196-
197- XDo::Mouse.move(0,200)
198- sleep 0.4
199- 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' ) {
200- @app.Unity2dPanel()['x_absolute'].to_i
201- }
202- verify_equal( 0, TIMEOUT, 'Launcher hiding when mouse at left edge of screen' ) {
203- @app.Unity2dPanel()['x_absolute'].to_i
204- }
205-
206- XDo::Mouse.move(LAUNCHER_WIDTH-1,200)
207- verify_equal( 0, TIMEOUT, 'Launcher should still be visible as mouse over it' ) {
208- @app.Unity2dPanel()['x_absolute'].to_i
209- }
210-
211- XDo::Mouse.move(LAUNCHER_WIDTH,200)
212- sleep 0.9
213- verify_equal( 0, 0, 'Launcher should still be visible as it should take 1 second to hide after mouse is not over it' ) {
214- @app.Unity2dPanel()['x_absolute'].to_i
215- }
216- verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher visible with window in the way and mouse moved out, should be hidden' ) {
217- @app.Unity2dPanel()['x_absolute'].to_i
218- }
219- xid.close!
220- end
221-
222-
223- # Test case objectives:
224- # * Check Launcher reveal when dash is invoked
225- # Pre-conditions
226- # * None
227- # Test steps
228- # * Open application in position overlapping Launcher
229- # * Verify Launcher hiding
230- # * Press Super key
231- # * Verify Launcher shows
232- # * Press Super key
233- # * Verify Launcher hides
234- # Post-conditions
235- # * None
236- # References
237- # * None
238- test "Press Super key to reveal launcher, press again to hide" do
239- xid = TmpWindow.open_window_at(10,100)
240- verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher visible with window in the way, should be hidden' ) {
241- @app.Unity2dPanel()['x_absolute'].to_i
242- }
243-
244- XDo::Keyboard.simulate('{SUPER}')
245- verify_equal( 0, TIMEOUT, 'Launcher hiding when Super Key pressed, should be visible' ) {
246- @app.Unity2dPanel()['x_absolute'].to_i
247- }
248-
249- XDo::Keyboard.simulate('{SUPER}')
250- verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher visible with window in the way and mouse moved out, should be hidden' ) {
251- @app.Unity2dPanel()['x_absolute'].to_i
252- }
253- xid.close!
254- end
255-
256-
257- # Test case objectives:
258- # * Check Launcher reveal with Super key works
259- # Pre-conditions
260- # * None
261- # Test steps
262- # * Open application in position overlapping Launcher
263- # * Verify Launcher hiding
264- # * Hold down Super key
265- # * Verify Launcher shows
266- # * Verify Tile shortcut numbers are showing
267- # * Release Super key
268- # * Verify Launcher hides
269- # Post-conditions
270- # * None
271- # References
272- # * None
273+ test_reveal_hidden_launcher_with_mouse()
274+ end
275+
276+ test "Press Super key to toggle launcher" do
277+ test_press_super_to_toggle_launcher()
278+ end
279+
280 test "Hold Super key down to reveal launcher and shortcut keys" do
281- xid = TmpWindow.open_window_at(10,100)
282- verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher visible with window in the way, should be hidden' ) {
283- @app.Unity2dPanel()['x_absolute'].to_i
284- }
285-
286- sleep 1 #launcher seems not ready to accept Super key, need a pause
287- XDo::Keyboard.key_down('SUPER')
288- verify_equal( 0, TIMEOUT, 'Launcher hiding when Super Key held, should be visible' ) {
289- @app.Unity2dPanel()['x_absolute'].to_i
290- }
291- verify_equal( 'true', TIMEOUT, 'Shortcut on Home Folder icon not displaying with Super key held' ) {
292- @app.LauncherList( :name => 'main' ) \
293- .QDeclarativeItem( :name => 'Home Folder' ) \
294- .QDeclarativeRectangle() \
295- .QDeclarativeText()['visible']
296- }
297-
298- XDo::Keyboard.key_up('SUPER')
299- verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher visible with window in the way and mouse moved out, should be hidden' ) {
300- @app.Unity2dPanel()['x_absolute'].to_i
301- }
302- xid.close!
303+ test_hold_super_launcher_shortcuts()
304 end
305
306-
307- # Test case objectives:
308- # * Alt+F1 gives keyboard focus to Launcher, escape removes it
309- # Pre-conditions
310- # * Desktop with no running applications
311- # Test steps
312- # * Open application in position overlapping Launcher
313- # * Verify Launcher hiding
314- # * Press Alt+F1
315- # * Verify Launcher shows
316- # * Verify Dash icon is highlighted
317- # * Press Escape
318- # * Verify Launcher hides
319- # Post-conditions
320- # * None
321- # References
322- # * None
323 test "Press Alt+F1 to focus Launcher" do
324- xid = TmpWindow.open_window_at(10,100)
325- verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher visible with window in the way, should be hidden' ) {
326- @app.Unity2dPanel()['x_absolute'].to_i
327- }
328-
329- XDo::Keyboard.alt_F1 #Must use uppercase F to indicate function keys
330- verify_equal( 0, TIMEOUT, 'Launcher hiding after Alt+F1 pressed, should be visible' ) {
331- @app.Unity2dPanel()['x_absolute'].to_i
332- }
333- verify_equal( 'true', TIMEOUT, 'Dash icon not highlighted after Alt+F1 pressed' ){
334- @app.LauncherList( :name => 'main' ).LauncherList( :isBfb => true ).QDeclarativeImage( :name => 'selectionOutline' )['visible']
335- }
336-
337- XDo::Keyboard.escape
338- verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher visible with window in the way and mouse moved out, should be hidden' ) {
339- @app.Unity2dPanel()['x_absolute'].to_i
340- }
341- xid.close!
342+ test_alt_f1_focus_launcher()
343 end
344
345-
346- # Test case objectives:
347- # * Alt+F1 takes & gives keyboard focus to the Launcher
348- # Pre-conditions
349- # * Desktop with no running applications
350- # Test steps
351- # * Open application in position overlapping Launcher
352- # * Verify Launcher hiding
353- # * Verify application has keyboard focus
354- # * Press Alt+F1
355- # * Verify Launcher shows
356- # * Verify Dash icon is highlighted
357- # * Verify application does not have keyboard focus
358- # * Press Alt+F1
359- # * Verify Launcher hides
360- # * Verify application has keyboard focus
361- # Post-conditions
362- # * None
363- # References
364- # * None
365 test "Press Alt+F1 to focus/unfocus Launcher" do
366- xid = TmpWindow.open_window_at(10,100)
367- verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher visible with window in the way, should be hidden' ) {
368- @app.Unity2dPanel()['x_absolute'].to_i
369- }
370- assert_equal( xid.id, XDo::XWindow.active_window, \
371- 'terminal should have focus after starting it' )
372-
373- XDo::Keyboard.alt_F1 #Must use uppercase F to indicate function keys
374- verify_equal( 0, TIMEOUT, 'Launcher hiding after Alt+F1 pressed, should be visible' ) {
375- @app.Unity2dPanel()['x_absolute'].to_i
376- }
377- verify_equal( 'true', TIMEOUT, 'Dash icon not highlighted after Alt+F1 pressed' ) {
378- @app.LauncherList( :name => 'main' ).LauncherList( :isBfb => true ).QDeclarativeImage( :name => 'selectionOutline' )['visible']
379- }
380- assert_not_equal( xid.id, XDo::XWindow.active_window, \
381- 'terminal has focus when it should be in the launcher' )
382-
383- XDo::Keyboard.alt_F1
384- verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher visible with window in the way and mouse moved out, should be hidden' ){
385- @app.Unity2dPanel()['x_absolute'].to_i
386- }
387- assert_equal( xid.id, XDo::XWindow.active_window, \
388- 'terminal does not have focus when it should' )
389- xid.close!
390- end
391-
392-
393- # Test case objectives:
394- # * Alt+F1 gives keyboard focus to the Launcher when dash was open, escape removes it
395- # Pre-conditions
396- # * Desktop with no running applications
397- # Test steps
398- # * Open application in position overlapping Launcher
399- # * Verify Launcher hiding
400- # * Verify application has keyboard focus
401- # * Press Super to invoke the Dash
402- # * Verify Launcher is shown
403- # * Press Alt+F1
404- # * Verify Launcher shows
405- # * Verify Dash icon is highlighted
406- # * Verify application does not have keyboard focus
407- # * Press Escape
408- # * Verify Launcher hides
409- # * Verify application has keyboard focus
410- # Post-conditions
411- # * None
412- # References
413- # * None
414- xtest "Press Alt+F1 to focus/unfocus Launcher when dash is open" do
415- xid = TmpWindow.open_window_at(10,100)
416- verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher visible with window in the way, should be hidden' ) {
417- @app.Unity2dPanel()['x_absolute'].to_i
418- }
419- assert_equal( xid.id, XDo::XWindow.active_window, \
420- 'terminal should have focus after starting it' )
421-
422- XDo::Keyboard.simulate('{SUPER}')
423- verify_equal( 0, TIMEOUT, 'Launcher hiding after Super pressed, should be visible' ) {
424- @app.Unity2dPanel()['x_absolute'].to_i
425- }
426-
427- XDo::Keyboard.alt_F1 #Must use uppercase F to indicate function keys
428- verify_equal( 'true', TIMEOUT, 'Dash icon not highlighted after Alt+F1 pressed' ) {
429- @app.LauncherList( :name => 'main' ) \
430- .QDeclarativeItem( :name => 'Dash home' ) \
431- .QDeclarativeImage( :name => 'selectionOutline' )['visible']
432- }
433- assert_not_equal( xid.id, XDo::XWindow.active_window, \
434- 'terminal has focus when it should be in the launcher' )
435-
436- XDo::Keyboard.escape
437- verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher visible with window in the way and mouse moved out, should be hidden' ){
438- @app.Unity2dPanel()['x_absolute'].to_i
439- }
440- assert_equal( xid.id, XDo::XWindow.active_window, \
441- 'terminal does not have focus when it should' )
442- xid.close!
443- end
444-
445-
446- # Test case objectives:
447- # * Alt+F1 takes & gives keyboard focus to the Launcher when dash was open
448- # Pre-conditions
449- # * Desktop with no running applications
450- # Test steps
451- # * Open application in position overlapping Launcher
452- # * Verify Launcher hiding
453- # * Verify application has keyboard focus
454- # * Press Super to invoke the Dash
455- # * Verify Launcher is shown
456- # * Press Alt+F1
457- # * Verify Launcher shows
458- # * Verify Dash icon is highlighted
459- # * Verify application does not have keyboard focus
460- # * Press Alt+F1
461- # * Verify Launcher hides
462- # * Verify application has keyboard focus
463- # Post-conditions
464- # * None
465- # References
466- # * None
467- xtest "Press Alt+F1 to focus Launcher when dash is open, escape to unfocus" do
468- xid = TmpWindow.open_window_at(10,100)
469- verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher visible with window in the way, should be hidden' ) {
470- @app.Unity2dPanel()['x_absolute'].to_i
471- }
472- assert_equal( xid.id, XDo::XWindow.active_window, \
473- 'terminal should have focus after starting it' )
474-
475- XDo::Keyboard.simulate('{SUPER}')
476- verify_equal( 0, TIMEOUT, 'Launcher hiding after Super pressed, should be visible' ) {
477- @app.Unity2dPanel()['x_absolute'].to_i
478- }
479-
480- XDo::Keyboard.alt_F1 #Must use uppercase F to indicate function keys
481- verify_equal( 'true', TIMEOUT, 'Dash icon not highlighted after Alt+F1 pressed' ) {
482- @app.LauncherList( :name => 'main' ) \
483- .QDeclarativeItem( :name => 'Dash home' ) \
484- .QDeclarativeImage( :name => 'selectionOutline' )['visible']
485- }
486- assert_not_equal( xid.id, XDo::XWindow.active_window, \
487- 'terminal has focus when it should be in the launcher' )
488-
489- XDo::Keyboard.alt_F1
490- verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher visible with window in the way and mouse moved out, should be hidden' ){
491- @app.Unity2dPanel()['x_absolute'].to_i
492- }
493- assert_equal( xid.id, XDo::XWindow.active_window, \
494- 'terminal does not have focus when it should' )
495- xid.close!
496- end
497-
498-
499- # Test case objectives:
500- # * Launcher displays when 'show desktop' engages
501- # Pre-conditions
502- # * Desktop with no running applications
503- # Test steps
504- # * Open application in position overlapping Launcher
505- # * Verify Launcher hiding
506- # * Engage "Show Desktop" mode
507- # * Verify Launcher showing
508- # * Disengage "Show Desktop" mode
509- # * Verify Launcher hides
510- # Post-conditions
511- # * None
512- # References
513- # * None
514+ test_alt_f1_focus_unfocus_launcher()
515+ end
516+
517+ xtest "Press Alt+F1, esc to focus/unfocus Launcher when dash is open" do
518+ test_alt_f1_esc_focus_unfocus_launcher_when_dash_open()
519+ end
520+
521+ xtest "Press Alt+F1 to focus Launcher when dash is open, Alt+F1 to unfocus" do
522+ test_alt_f1_toggle_focus_launcher_when_dash_open()
523+ end
524+
525 test "Launcher visible on show-desktop" do
526- xid = TmpWindow.open_window_at(10,100)
527- verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher visible with window in the way, should be hidden' ) {
528- @app.Unity2dPanel()['x_absolute'].to_i
529- }
530-
531- XDo::XWindow.toggle_minimize_all # This is effectively the show-desktop shortcut
532- verify_equal( 0, TIMEOUT, 'Launcher hiding after triggering show-desktop, should be visible' ) {
533- @app.Unity2dPanel()['x_absolute'].to_i
534- }
535-
536- XDo::XWindow.toggle_minimize_all
537- verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher visible with window in the way, should be hidden' ) {
538- @app.Unity2dPanel()['x_absolute'].to_i
539- }
540- xid.close!
541+ test_launcher_visible_show_desktop()
542 end
543
544- # Test case objectives:
545- # * Launcher is around for 1 second after removing a tile
546- # Pre-conditions
547- # * Desktop with at least one application not running
548- # Test steps
549- # * Open application in position overlapping Launcher
550- # * Verify Launcher hiding
551- # * Right click on a non running application tile
552- # * Wait enough time ( > 1 sec) so that the timer that would close the launcher
553- # if the menu was not open triggers
554- # * Click on the last menu item (Remove)
555- # * Verify Launcher stays away for a second
556- # Post-conditions
557- # * None
558- # References
559- # * None
560 test "Launcher hide delay on tile removal" do
561- xid = TmpWindow.open_window_at(10,100)
562- tiles = ""
563- verify( 0, 'Could not find any non running application tile to remove' ) {
564- tiles = @app.LauncherList( :name => 'main' ).children( { :running => 'false', :desktopFile => /^.*.desktop$/ } )
565- }
566- if !tiles.empty?
567- tile = tiles[0]
568- XDo::Mouse.move(0, 200, 0, true)
569- verify_equal( 0, TIMEOUT, 'Launcher hiding when mouse at left edge of screen' ) {
570- @app.Unity2dPanel()['x_absolute'].to_i
571- }
572- XDo::Mouse.move(tile['x_absolute'].to_i + 1, tile['y_absolute'].to_i + 1, 0, true)
573- XDo::Mouse.click(nil, nil, :right)
574- menu = @app.LauncherContextualMenu( :folded => false );
575- XDo::Mouse.move(menu['x_absolute'].to_i + 20, menu['y_absolute'].to_i + menu['height'].to_i - 10, 0, true)
576- sleep 1.5
577- XDo::Mouse.click()
578- sleep 0.9
579- verify_equal( 0, 0, 'Launcher hiding after icon removal, should be visible for 1 second' ) {
580- @app.Unity2dPanel()['x_absolute'].to_i
581- }
582- verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher visible with window in the way, should be hidden' ) {
583- @app.Unity2dPanel()['x_absolute'].to_i
584- }
585- xid.close!
586- end
587+ test_launcher_hide_delay_on_tile_removal()
588 end
589
590- # Test case objectives:
591- # * Launcher does not hide after toggling the dash
592- # Pre-conditions
593- # * Desktop with no running applications
594- # Test steps
595- # * Open application in position overlapping Launcher
596- # * Verify Launcher hiding
597- # * Move mouse to the left
598- # * Verify Launcher showing
599- # * Click twice in the bfb
600- # * Verify Launcher showing during 1.5 seconds
601- # Post-conditions
602- # * None
603- # References
604- # * None
605 test "Launcher visible after toggling dash" do
606- xid = TmpWindow.open_window_at(10,100)
607- verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher visible with window in the way, should be hidden' ) {
608- @app.Unity2dPanel()['x_absolute'].to_i
609- }
610-
611- bfb = @app.LauncherList( :name => 'main' ).LauncherList( :isBfb => true );
612- XDo::Mouse.move(0, 200, 0, true)
613- verify_equal( 0, TIMEOUT, 'Launcher hiding when mouse at left edge of screen' ) {
614- @app.Unity2dPanel()['x_absolute'].to_i
615- }
616- bfb.move_mouse()
617- bfb.tap()
618- bfb.tap()
619- verify_not(0, 'Launcher hiding after hovering mouse over bfb and clicking twice') {
620- verify_equal( -LAUNCHER_WIDTH, 2 ) {
621- @app.Unity2dPanel()['x_absolute'].to_i
622- }
623- }
624-
625- xid.close!
626+ test_launcher_visible_after_toggling_dash()
627 end
628
629- # Test case objectives:
630- # * Launcher does not hide on Esc after Alt+F1 with overlapping window
631- # Pre-conditions
632- # * Desktop with no running applications
633- # Test steps
634- # * Open application in position overlapping Launcher
635- # * Verify Launcher hiding
636- # * Press Alt+F1
637- # * Verify Launcher showing
638- # * Move mouse over the launcher
639- # * Press Esc
640- # * Verify Launcher does not hide
641- # Post-conditions
642- # * None
643- # References
644- # * None
645 test "Launcher does not hide on Esc after Alt+F1 with overlapping window" do
646- xid = TmpWindow.open_window_at(10,100)
647- verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher visible with window in the way, should be hidden' ) {
648- @app.Unity2dPanel()['x_absolute'].to_i
649- }
650- XDo::Keyboard.alt_F1 #Must use uppercase F to indicate function keys
651- bfb = @app.LauncherList( :name => 'main' ).LauncherList( :isBfb => true );
652- bfb.move_mouse()
653- XDo::Keyboard.escape
654- verify_not(0, 'Launcher hiding after hovering mouse over bfb and clicking twice') {
655- verify_equal( -LAUNCHER_WIDTH, 2 ) {
656- @app.Unity2dPanel()['x_absolute'].to_i
657- }
658- }
659- xid.close!
660+ test_launcher_does_not_hide_on_esc_after_alt_f1_with_overlapping_window()
661 end
662
663 end
664
665=== added file 'tests/launcher/autohide_show_tests_common.rb'
666--- tests/launcher/autohide_show_tests_common.rb 1970-01-01 00:00:00 +0000
667+++ tests/launcher/autohide_show_tests_common.rb 2012-02-06 10:04:19 +0000
668@@ -0,0 +1,498 @@
669+=begin
670+/*
671+ * This file is part of unity-2d
672+ *
673+ * Copyright 2011 Canonical Ltd.
674+ *
675+ * This program is free software; you can redistribute it and/or modify
676+ * it under the terms of the GNU General Public License as published by
677+ * the Free Software Foundation; version 3.
678+ *
679+ * This program is distributed in the hope that it will be useful,
680+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
681+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
682+ * GNU General Public License for more details.
683+ *
684+ * You should have received a copy of the GNU General Public License
685+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
686+ */
687+=end
688+
689+# Test case objectives:
690+# * Check the Launcher position on Empty desktop
691+# Pre-conditions
692+# * Desktop with no running applications
693+# Test steps
694+# * Verify Launcher is #{LAUNCHER_WIDTH} pixels wide
695+# * Verify Launcher showing
696+# Post-conditions
697+# * None
698+# References
699+# * None
700+def test_position_with_empty_desktop()
701+ # check width before proceeding
702+ verify_equal( LAUNCHER_WIDTH, TIMEOUT, "Launcher is not #{LAUNCHER_WIDTH} pixels wide on screen!" ) {
703+ @app.Unity2dPanel()['width'].to_i
704+ }
705+
706+ verify_launcher_visible(TIMEOUT, 'Launcher hiding on empty desktop, should be visible')
707+end
708+
709+
710+# Test case objectives:
711+# * Check the Launcher position on desktop with window not in way
712+# Pre-conditions
713+# * Desktop with no running applications
714+# Test steps
715+# * Open application in position not overlapping Launcher
716+# * Verify Launcher showing
717+# Post-conditions
718+# * None
719+# References
720+# * None
721+def test_position_width_window_not_in_the_way()
722+ # Open Terminal with position 100x100
723+ xid = TmpWindow.open_window_at(100,100)
724+ verify_launcher_visible(TIMEOUT, 'Launcher hiding when window not in the way, should be visible')
725+ xid.close!
726+end
727+
728+
729+# Test case objectives:
730+# * Check the Launcher position on desktop with window in the way
731+# Pre-conditions
732+# * Desktop with no running applications
733+# Test steps
734+# * Open application in position overlapping Launcher
735+# * Verify Launcher hides
736+# Post-conditions
737+# * None
738+# References
739+# * None
740+def test_position_with_window_in_the_way()
741+ # Open Terminal with position 40x100
742+ xid = open_overlapping_window()
743+ verify_launcher_hidden(TIMEOUT, 'Launcher visible when window in the way, should be hidden')
744+ xid.close!
745+end
746+
747+
748+# Test case objectives:
749+# * Check Launcher autohide working
750+# Pre-conditions
751+# * Desktop with no running applications
752+# Test steps
753+# * Open application in position not overlapping Launcher
754+# * Verify Launcher showing
755+# * Move application window to position overlapping Launcher
756+# * Verify Launcher hides
757+# * Move application window to position not overlapping Launcher
758+# * Verify Launcher shows again
759+# Post-conditions
760+# * None
761+# References
762+# * None
763+def test_move_window_positioning_to_check_launcher_action()
764+ # Open Terminal with position 100x100
765+ xid = TmpWindow.open_window_at(100,100)
766+ verify_launcher_visible(TIMEOUT, 'Launcher hiding when window not in the way, should be visible')
767+
768+ move_window_just_overlapping(xid)
769+ verify_launcher_hidden(TIMEOUT, 'Launcher visible when window in the way, should be hidden')
770+
771+ move_window_just_not_overlapping(xid)
772+ verify_launcher_visible(TIMEOUT, 'Launcher hiding when window not in the way, should be visible')
773+ xid.close!
774+end
775+
776+
777+# Test case objectives:
778+# * Check Launcher reveal using mouse works
779+# Pre-conditions
780+# * Desktop with no running applications
781+# Test steps
782+# * Open application in position overlapping Launcher
783+# * Verify Launcher hiding
784+# * Move mouse to left of screen to reveal Launcher
785+# * Verify Launcher shows but not immediately
786+# * Move mouse to the right, but still over the Launcher
787+# * Verify Launcher still showing
788+# * Move mouse further right to not overlap Launcher
789+# * Verify Launcher hides but not immediately
790+# Post-conditions
791+# * None
792+# References
793+# * None
794+def test_reveal_hidden_launcher_with_mouse()
795+ xid = open_overlapping_window()
796+ verify_launcher_hidden(TIMEOUT, 'Launcher visible with window in the way, should be hidden')
797+
798+ move_mouse_to_screen_edge()
799+ sleep 0.4
800+ verify_launcher_hidden(0, 'Launcher should not be visible immediately after mouse moves to the edge, has to wait 0.5 seconds to show')
801+ verify_launcher_visible(TIMEOUT, 'Launcher hiding when mouse at edge of screen')
802+
803+ move_mouse_to_launcher_inner_border()
804+ verify_launcher_visible(TIMEOUT, 'Launcher should still be visible as mouse over it')
805+
806+ move_mouse_to_just_outside_launcher()
807+ sleep 0.9
808+ verify_launcher_visible(0, 'Launcher should still be visible as it should take 1 second to hide after mouse is not over it')
809+ verify_launcher_hidden(TIMEOUT, 'Launcher visible with window in the way and mouse moved out, should be hidden' )
810+ xid.close!
811+end
812+
813+
814+# Test case objectives:
815+# * Check Launcher reveal when dash is invoked
816+# Pre-conditions
817+# * None
818+# Test steps
819+# * Open application in position overlapping Launcher
820+# * Verify Launcher hiding
821+# * Press Super key
822+# * Verify Launcher shows
823+# * Press Super key
824+# * Verify Launcher hides
825+# Post-conditions
826+# * None
827+# References
828+# * None
829+def test_press_super_to_toggle_launcher()
830+ xid = open_overlapping_window()
831+ verify_launcher_hidden(TIMEOUT, 'Launcher visible with window in the way, should be hidden')
832+
833+ XDo::Keyboard.simulate('{SUPER}')
834+ verify_launcher_visible(TIMEOUT, 'Launcher hiding when Super Key pressed, should be visible')
835+
836+ XDo::Keyboard.simulate('{SUPER}')
837+ verify_launcher_hidden(TIMEOUT, 'Launcher visible with window in the way and mouse moved out, should be hidden')
838+ xid.close!
839+end
840+
841+
842+# Test case objectives:
843+# * Check Launcher reveal with Super key works
844+# Pre-conditions
845+# * None
846+# Test steps
847+# * Open application in position overlapping Launcher
848+# * Verify Launcher hiding
849+# * Hold down Super key
850+# * Verify Launcher shows
851+# * Verify Tile shortcut numbers are showing
852+# * Release Super key
853+# * Verify Launcher hides
854+# Post-conditions
855+# * None
856+# References
857+# * None
858+def test_hold_super_launcher_shortcuts()
859+ xid = open_overlapping_window()
860+ verify_launcher_hidden(TIMEOUT, 'Launcher visible with window in the way, should be hidden')
861+
862+ sleep 1 #launcher seems not ready to accept Super key, need a pause
863+ XDo::Keyboard.key_down('SUPER')
864+ verify_launcher_visible(TIMEOUT, 'Launcher hiding when Super Key help, should be visible')
865+ verify_equal( 'true', TIMEOUT, 'Shortcut on Home Folder icon not displaying with Super key held' ) {
866+ @app.LauncherList( :name => 'main' ) \
867+ .QDeclarativeItem( :name => 'Home Folder' ) \
868+ .QDeclarativeRectangle() \
869+ .QDeclarativeText()['visible']
870+ }
871+
872+ XDo::Keyboard.key_up('SUPER')
873+ verify_launcher_hidden(TIMEOUT, 'Launcher visible with window in the way and mouse moved out, should be hidden')
874+ xid.close!
875+end
876+
877+
878+# Test case objectives:
879+# * Alt+F1 gives keyboard focus to Launcher, escape removes it
880+# Pre-conditions
881+# * Desktop with no running applications
882+# Test steps
883+# * Open application in position overlapping Launcher
884+# * Verify Launcher hiding
885+# * Press Alt+F1
886+# * Verify Launcher shows
887+# * Verify Dash icon is highlighted
888+# * Press Escape
889+# * Verify Launcher hides
890+# Post-conditions
891+# * None
892+# References
893+# * None
894+def test_alt_f1_focus_launcher()
895+ xid = open_overlapping_window()
896+ verify_launcher_hidden(TIMEOUT, 'Launcher visible with window in the way, should be hidden')
897+
898+ XDo::Keyboard.alt_F1 #Must use uppercase F to indicate function keys
899+ verify_launcher_visible(TIMEOUT, 'Launcher visible with window in the way, should be hidden')
900+ verify_equal( 'true', TIMEOUT, 'Dash icon not highlighted after Alt+F1 pressed' ){
901+ @app.LauncherList( :name => 'main' ).LauncherList( :isBfb => true ).QDeclarativeImage( :name => 'selectionOutline' )['visible']
902+ }
903+
904+ XDo::Keyboard.escape
905+ verify_launcher_hidden(TIMEOUT, 'Launcher visible with window in the way and mouse moved out, should be hidden')
906+ xid.close!
907+end
908+
909+
910+# Test case objectives:
911+# * Alt+F1 takes & gives keyboard focus to the Launcher
912+# Pre-conditions
913+# * Desktop with no running applications
914+# Test steps
915+# * Open application in position overlapping Launcher
916+# * Verify Launcher hiding
917+# * Verify application has keyboard focus
918+# * Press Alt+F1
919+# * Verify Launcher shows
920+# * Verify Dash icon is highlighted
921+# * Verify application does not have keyboard focus
922+# * Press Alt+F1
923+# * Verify Launcher hides
924+# * Verify application has keyboard focus
925+# Post-conditions
926+# * None
927+# References
928+# * None
929+def test_alt_f1_focus_unfocus_launcher()
930+ xid = open_overlapping_window()
931+ verify_launcher_hidden(TIMEOUT, 'Launcher visible with window in the way, should be hidden')
932+ assert_equal( xid.id, XDo::XWindow.active_window, \
933+ 'terminal should have focus after starting it' )
934+
935+ XDo::Keyboard.alt_F1 #Must use uppercase F to indicate function keys
936+ verify_launcher_visible(TIMEOUT, 'Launcher hiding after Alt+F1 pressed, should be visible')
937+ verify_equal( 'true', TIMEOUT, 'Dash icon not highlighted after Alt+F1 pressed' ) {
938+ @app.LauncherList( :name => 'main' ).LauncherList( :isBfb => true ).QDeclarativeImage( :name => 'selectionOutline' )['visible']
939+ }
940+ assert_not_equal( xid.id, XDo::XWindow.active_window, \
941+ 'terminal has focus when it should be in the launcher' )
942+
943+ XDo::Keyboard.alt_F1
944+ verify_launcher_hidden(TIMEOUT, 'Launcher visible with window in the way and mouse moved out, should be hidden')
945+ assert_equal( xid.id, XDo::XWindow.active_window, \
946+ 'terminal does not have focus when it should' )
947+ xid.close!
948+end
949+
950+
951+# Test case objectives:
952+# * Alt+F1 gives keyboard focus to the Launcher when dash was open, escape removes it
953+# Pre-conditions
954+# * Desktop with no running applications
955+# Test steps
956+# * Open application in position overlapping Launcher
957+# * Verify Launcher hiding
958+# * Verify application has keyboard focus
959+# * Press Super to invoke the Dash
960+# * Verify Launcher is shown
961+# * Press Alt+F1
962+# * Verify Launcher shows
963+# * Verify Dash icon is highlighted
964+# * Verify application does not have keyboard focus
965+# * Press Escape
966+# * Verify Launcher hides
967+# * Verify application has keyboard focus
968+# Post-conditions
969+# * None
970+# References
971+# * None
972+def test_alt_f1_esc_focus_unfocus_launcher_when_dash_open()
973+ xid = open_overlapping_window()
974+ verify_launcher_hidden(TIMEOUT, 'Launcher visible with window in the way, should be hidden')
975+ assert_equal( xid.id, XDo::XWindow.active_window, \
976+ 'terminal should have focus after starting it' )
977+
978+ XDo::Keyboard.simulate('{SUPER}')
979+ verify_launcher_visible(TIMEOUT, 'Launcher hiding after Super pressed, should be visible')
980+
981+ XDo::Keyboard.alt_F1 #Must use uppercase F to indicate function keys
982+ verify_equal( 'true', TIMEOUT, 'Dash icon not highlighted after Alt+F1 pressed' ) {
983+ @app.LauncherList( :name => 'main' ).LauncherList( :isBfb => true ).QDeclarativeImage( :name => 'selectionOutline' )['visible']
984+ }
985+ assert_not_equal( xid.id, XDo::XWindow.active_window, \
986+ 'terminal has focus when it should be in the launcher' )
987+
988+ XDo::Keyboard.escape
989+ verify_launcher_hidden(TIMEOUT, 'Launcher visible with window in the way and mouse moved out, should be hidden')
990+ assert_equal( xid.id, XDo::XWindow.active_window, \
991+ 'terminal does not have focus when it should' )
992+ xid.close!
993+end
994+
995+
996+# Test case objectives:
997+# * Alt+F1 takes & gives keyboard focus to the Launcher when dash was open
998+# Pre-conditions
999+# * Desktop with no running applications
1000+# Test steps
1001+# * Open application in position overlapping Launcher
1002+# * Verify Launcher hiding
1003+# * Verify application has keyboard focus
1004+# * Press Super to invoke the Dash
1005+# * Verify Launcher is shown
1006+# * Press Alt+F1
1007+# * Verify Launcher shows
1008+# * Verify Dash icon is highlighted
1009+# * Verify application does not have keyboard focus
1010+# * Press Alt+F1
1011+# * Verify Launcher hides
1012+# * Verify application has keyboard focus
1013+# Post-conditions
1014+# * None
1015+# References
1016+# * None
1017+def test_alt_f1_toggle_focus_launcher_when_dash_open()
1018+ xid = open_overlapping_window()
1019+ verify_launcher_hidden(TIMEOUT, 'Launcher visible with window in the way, should be hidden')
1020+ assert_equal( xid.id, XDo::XWindow.active_window, \
1021+ 'terminal should have focus after starting it' )
1022+
1023+ XDo::Keyboard.simulate('{SUPER}')
1024+ verify_launcher_visible(TIMEOUT, 'Launcher hiding after Super pressed, should be visible')
1025+
1026+ XDo::Keyboard.alt_F1 #Must use uppercase F to indicate function keys
1027+ verify_equal( 'true', TIMEOUT, 'Dash icon not highlighted after Alt+F1 pressed' ) {
1028+ @app.LauncherList( :name => 'main' ).LauncherList( :isBfb => true ).QDeclarativeImage( :name => 'selectionOutline' )['visible']
1029+ }
1030+ assert_not_equal( xid.id, XDo::XWindow.active_window, \
1031+ 'terminal has focus when it should be in the launcher' )
1032+
1033+ XDo::Keyboard.alt_F1
1034+ verify_launcher_hidden(TIMEOUT, 'Launcher visible with window in the way and mouse moved out, should be hidden')
1035+ assert_equal( xid.id, XDo::XWindow.active_window, \
1036+ 'terminal does not have focus when it should' )
1037+ xid.close!
1038+end
1039+
1040+
1041+# Test case objectives:
1042+# * Launcher displays when 'show desktop' engages
1043+# Pre-conditions
1044+# * Desktop with no running applications
1045+# Test steps
1046+# * Open application in position overlapping Launcher
1047+# * Verify Launcher hiding
1048+# * Engage "Show Desktop" mode
1049+# * Verify Launcher showing
1050+# * Disengage "Show Desktop" mode
1051+# * Verify Launcher hides
1052+# Post-conditions
1053+# * None
1054+# References
1055+# * None
1056+def test_launcher_visible_show_desktop()
1057+ xid = open_overlapping_window()
1058+ verify_launcher_hidden(TIMEOUT, 'Launcher visible with window in the way, should be hidden')
1059+
1060+ XDo::XWindow.toggle_minimize_all # This is effectively the show-desktop shortcut
1061+ verify_launcher_visible(TIMEOUT, 'Launcher hiding after triggering show-desktop, should be visible')
1062+
1063+ XDo::XWindow.toggle_minimize_all
1064+ verify_launcher_hidden(TIMEOUT, 'Launcher visible with window in the way, should be hidden')
1065+ xid.close!
1066+end
1067+
1068+# Test case objectives:
1069+# * Launcher is around for 1 second after removing a tile
1070+# Pre-conditions
1071+# * Desktop with at least one application not running
1072+# Test steps
1073+# * Open application in position overlapping Launcher
1074+# * Verify Launcher hiding
1075+# * Right click on a non running application tile
1076+# * Wait enough time ( > 1 sec) so that the timer that would close the launcher
1077+# if the menu was not open triggers
1078+# * Click on the last menu item (Remove)
1079+# * Verify Launcher stays away for a second
1080+# Post-conditions
1081+# * None
1082+# References
1083+# * None
1084+def test_launcher_hide_delay_on_tile_removal()
1085+ xid = open_overlapping_window()
1086+ tiles = ""
1087+ verify( 0, 'Could not find any non running application tile to remove' ) {
1088+ tiles = @app.LauncherList( :name => 'main' ).children( { :running => 'false', :desktopFile => /^.*.desktop$/ } )
1089+ }
1090+ if !tiles.empty?
1091+ tile = tiles[0]
1092+ move_mouse_to_screen_edge()
1093+ verify_launcher_visible(TIMEOUT, 'Launcher hiding when mouse at edge of screen, should be visible')
1094+ tile.move_mouse()
1095+ XDo::Mouse.click(nil, nil, :right)
1096+ menu = @app.LauncherContextualMenu( :folded => false );
1097+ XDo::Mouse.move(menu['x_absolute'].to_i + 20, menu['y_absolute'].to_i + menu['height'].to_i - 10, 0, true)
1098+ sleep 1.5
1099+ XDo::Mouse.click()
1100+ sleep 0.9
1101+ verify_launcher_visible(0, 'Launcher hiding after icon removal, should be visible for 1 second')
1102+ verify_launcher_hidden(TIMEOUT, 'Launcher visible with window in the way, should be hidden')
1103+ xid.close!
1104+ end
1105+end
1106+
1107+# Test case objectives:
1108+# * Launcher does not hide after toggling the dash
1109+# Pre-conditions
1110+# * Desktop with no running applications
1111+# Test steps
1112+# * Open application in position overlapping Launcher
1113+# * Verify Launcher hiding
1114+# * Move mouse to the left
1115+# * Verify Launcher showing
1116+# * Click twice in the bfb
1117+# * Verify Launcher showing during 1.5 seconds
1118+# Post-conditions
1119+# * None
1120+# References
1121+# * None
1122+def test_launcher_visible_after_toggling_dash()
1123+ xid = open_overlapping_window()
1124+ verify_launcher_hidden(TIMEOUT, 'Launcher visible with window in the way, should be hidden')
1125+
1126+ bfb = @app.LauncherList( :name => 'main' ).LauncherList( :isBfb => true );
1127+ move_mouse_to_screen_edge()
1128+ verify_launcher_visible(TIMEOUT, 'Launcher hiding when mouse at edge of screen, should be visible')
1129+ bfb.move_mouse()
1130+ bfb.tap()
1131+ bfb.tap()
1132+ verify_not(0, 'Launcher hiding after hovering mouse over bfb and clicking twice') {
1133+ verify_launcher_hidden(2)
1134+ }
1135+
1136+ xid.close!
1137+end
1138+
1139+# Test case objectives:
1140+# * Launcher does not hide on Esc after Alt+F1 with overlapping window
1141+# Pre-conditions
1142+# * Desktop with no running applications
1143+# Test steps
1144+# * Open application in position overlapping Launcher
1145+# * Verify Launcher hiding
1146+# * Press Alt+F1
1147+# * Verify Launcher showing
1148+# * Move mouse over the launcher
1149+# * Press Esc
1150+# * Verify Launcher does not hide
1151+# Post-conditions
1152+# * None
1153+# References
1154+# * None
1155+def test_launcher_does_not_hide_on_esc_after_alt_f1_with_overlapping_window()
1156+ xid = open_overlapping_window()
1157+ verify_launcher_hidden(TIMEOUT, 'Launcher visible with window in the way, should be hidden')
1158+ XDo::Keyboard.alt_F1 #Must use uppercase F to indicate function keys
1159+ bfb = @app.LauncherList( :name => 'main' ).LauncherList( :isBfb => true );
1160+ bfb.move_mouse()
1161+ XDo::Keyboard.escape
1162+ verify_not(0, 'Launcher hiding after on Esc after Alt+F1 with mouse over bfb') {
1163+ verify_launcher_hidden(2)
1164+ }
1165+ xid.close!
1166+end
1167
1168=== added file 'tests/launcher/autohide_show_tests_rtl.rb'
1169--- tests/launcher/autohide_show_tests_rtl.rb 1970-01-01 00:00:00 +0000
1170+++ tests/launcher/autohide_show_tests_rtl.rb 2012-02-06 10:04:19 +0000
1171@@ -0,0 +1,174 @@
1172+#!/usr/bin/env ruby1.8
1173+=begin
1174+/*
1175+ * This file is part of unity-2d
1176+ *
1177+ * Copyright 2011 Canonical Ltd.
1178+ *
1179+ * Authors:
1180+ * - Gerry Boland <gerry.boland@canonical.com>
1181+ *
1182+ * This program is free software; you can redistribute it and/or modify
1183+ * it under the terms of the GNU General Public License as published by
1184+ * the Free Software Foundation; version 3.
1185+ *
1186+ * This program is distributed in the hope that it will be useful,
1187+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1188+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1189+ * GNU General Public License for more details.
1190+ *
1191+ * You should have received a copy of the GNU General Public License
1192+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1193+ */
1194+=end
1195+
1196+require '../run-tests.rb' unless $INIT_COMPLETED
1197+require 'xdo/xwindow'
1198+require 'xdo/keyboard'
1199+require 'xdo/mouse'
1200+require 'tmpwindow'
1201+require $library_path + '/../../launcher/autohide_show_tests_common.rb'
1202+
1203+############################# Test Suite #############################
1204+context "Launcher Autohide and Show Tests on RTL" do
1205+ launcher_favorites = ""
1206+
1207+ def verify_launcher_visible(timeout, message = '')
1208+ verify_equal( XDo::XWindow.display_geometry[0] - LAUNCHER_WIDTH, timeout, message ) {
1209+ @app.Unity2dPanel()['x_absolute'].to_i
1210+ }
1211+ end
1212+
1213+ def verify_launcher_hidden(timeout, message = '')
1214+ verify_equal( XDo::XWindow.display_geometry[0], timeout, message ) {
1215+ @app.Unity2dPanel()['x_absolute'].to_i
1216+ }
1217+ end
1218+
1219+ def open_overlapping_window()
1220+ xid = TmpWindow.open_window_at(100, 100)
1221+ xid.move(XDo::XWindow.display_geometry[0] - xid.size[0] - 10 , 100)
1222+ return xid
1223+ end
1224+
1225+ def move_mouse_to_screen_edge()
1226+ XDo::Mouse.move(XDo::XWindow.display_geometry[0], 200, 0, true)
1227+ end
1228+
1229+ def move_mouse_to_launcher_inner_border()
1230+ XDo::Mouse.move(XDo::XWindow.display_geometry[0] - LAUNCHER_WIDTH, 200)
1231+ end
1232+
1233+ def move_mouse_to_just_outside_launcher()
1234+ XDo::Mouse.move(XDo::XWindow.display_geometry[0] - LAUNCHER_WIDTH - 1, 200)
1235+ end
1236+
1237+ def move_window_just_overlapping(xid)
1238+ xid.move(XDo::XWindow.display_geometry[0] - xid.size[0] - LAUNCHER_WIDTH - 1 , 100)
1239+ end
1240+
1241+ def move_window_just_not_overlapping(xid)
1242+ xid.move(XDo::XWindow.display_geometry[0] - xid.size[0]- LAUNCHER_WIDTH - 2, 100)
1243+ end
1244+
1245+ # Run once at the beginning of this test suite
1246+ startup do
1247+ $SUT.execute_shell_command 'killall unity-2d-launcher'
1248+ $SUT.execute_shell_command 'killall unity-2d-launcher'
1249+
1250+ # Minimize all windows
1251+ XDo::XWindow.toggle_minimize_all
1252+ end
1253+
1254+ # Run once at the end of this test suite
1255+ shutdown do
1256+ end
1257+
1258+ # Run before each test case begins
1259+ setup do
1260+ #Ensure mouse out of the way
1261+ XDo::Mouse.move(200,200,10,true)
1262+
1263+ launcher_favorites = $SUT.execute_shell_command 'gsettings get com.canonical.Unity.Launcher favorites'
1264+
1265+ # Execute the application
1266+ @app = $SUT.run( :name => UNITY_2D_LAUNCHER,
1267+ :arguments => "-testability,-reverse",
1268+ :sleeptime => 2 )
1269+ # Make certain application is ready for testing
1270+ verify{ @app.Unity2dPanel() }
1271+ end
1272+
1273+ # Run after each test case completes
1274+ teardown do
1275+ TmpWindow.close_all_windows
1276+ #@app.close
1277+ #Need to kill Launcher as it does not shutdown when politely asked
1278+ $SUT.execute_shell_command 'pkill -nf unity-2d-launcher'
1279+ $SUT.execute_shell_command "gsettings set com.canonical.Unity.Launcher favorites \"" + launcher_favorites + "\""
1280+ end
1281+
1282+ #####################################################################################
1283+ # Test cases
1284+
1285+ test "Position with Empty Desktop" do
1286+ test_position_with_empty_desktop()
1287+ end
1288+
1289+ test "Position with Window not in the way" do
1290+ test_position_width_window_not_in_the_way()
1291+ end
1292+
1293+ test "Position with Window in the way" do
1294+ test_position_with_window_in_the_way()
1295+ end
1296+
1297+ test "Move window positioning to check launcher action" do
1298+ test_move_window_positioning_to_check_launcher_action()
1299+ end
1300+
1301+ xtest "Reveal hidden Launcher with mouse" do
1302+ test_reveal_hidden_launcher_with_mouse()
1303+ end
1304+
1305+ test "Press Super key to toggle launcher" do
1306+ test_press_super_to_toggle_launcher()
1307+ end
1308+
1309+ test "Hold Super key down to reveal launcher and shortcut keys" do
1310+ test_hold_super_launcher_shortcuts()
1311+ end
1312+
1313+ test "Press Alt+F1 to focus Launcher" do
1314+ test_alt_f1_focus_launcher()
1315+ end
1316+
1317+ test "Press Alt+F1 to focus/unfocus Launcher" do
1318+ test_alt_f1_focus_unfocus_launcher()
1319+ end
1320+
1321+ xtest "Press Alt+F1, esc to focus/unfocus Launcher when dash is open" do
1322+ test_alt_f1_esc_focus_unfocus_launcher_when_dash_open()
1323+ end
1324+
1325+ xtest "Press Alt+F1 to focus Launcher when dash is open, Alt+F1 to unfocus" do
1326+ test_alt_f1_toggle_focus_launcher_when_dash_open()
1327+ end
1328+
1329+ test "Launcher visible on show-desktop" do
1330+ test_launcher_visible_show_desktop()
1331+ end
1332+
1333+ xtest "Launcher hide delay on tile removal" do
1334+ test_launcher_hide_delay_on_tile_removal()
1335+ end
1336+
1337+ xtest "Launcher visible after toggling dash" do
1338+ test_launcher_visible_after_toggling_dash()
1339+ end
1340+
1341+ test "Launcher does not hide on Esc after Alt+F1 with overlapping window" do
1342+ test_launcher_does_not_hide_on_esc_after_alt_f1_with_overlapping_window()
1343+ end
1344+
1345+end

Subscribers

People subscribed via source and target branches