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