Merge lp:~3v1n0/unity/wily-ap-fixes into lp:unity

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: no longer in the source branch.
Merged at revision: 3994
Proposed branch: lp:~3v1n0/unity/wily-ap-fixes
Merge into: lp:unity
Diff against target: 1183 lines (+200/-398)
17 files modified
tests/autopilot/unity/emulators/__init__.py (+24/-0)
tests/autopilot/unity/emulators/dash.py (+26/-67)
tests/autopilot/unity/emulators/hud.py (+2/-2)
tests/autopilot/unity/emulators/icons.py (+2/-9)
tests/autopilot/unity/emulators/launcher.py (+3/-7)
tests/autopilot/unity/emulators/panel.py (+35/-45)
tests/autopilot/unity/emulators/quicklist.py (+6/-9)
tests/autopilot/unity/emulators/screen.py (+5/-4)
tests/autopilot/unity/emulators/window_manager.py (+3/-2)
tests/autopilot/unity/tests/launcher/test_icon_behavior.py (+1/-1)
tests/autopilot/unity/tests/launcher/test_visual.py (+1/-3)
tests/autopilot/unity/tests/test_dash.py (+59/-200)
tests/autopilot/unity/tests/test_panel.py (+12/-16)
tests/autopilot/unity/tests/test_quicklist.py (+3/-3)
tests/autopilot/unity/tests/test_spread.py (+5/-16)
tests/autopilot/unity/tests/test_switcher.py (+5/-6)
unity-shared/WindowButtons.cpp (+8/-8)
To merge this branch: bzr merge lp:~3v1n0/unity/wily-ap-fixes
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Andrea Azzarone (community) Approve
Review via email: mp+268468@code.launchpad.net

Commit message

Autopilot: modernize some tests, use stronger methods to ensure false positive

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Andrea Azzarone (azzar1) wrote :

LGTM.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/unity/emulators/__init__.py'
2--- tests/autopilot/unity/emulators/__init__.py 2013-10-03 02:47:42 +0000
3+++ tests/autopilot/unity/emulators/__init__.py 2015-08-19 13:54:35 +0000
4@@ -28,6 +28,30 @@
5
6 _Backend = DBusAddress.SessionBus(DBUS_SERVICE, DBUS_OBJECT)
7
8+ def _repr_string(self, obj_details=""):
9+ geostr = ""
10+ if hasattr(self, 'globalRect'):
11+ geostr = " geo=[{r.x}x{r.y} {r.width}x{r.height}]".format(r=self.globalRect)
12+
13+ obj_details.strip()
14+ obj_details = " "+obj_details if len(obj_details) else ""
15+
16+ return "<{cls} {addr} id={id}{geo}{details}>".format(cls=self.__class__.__name__,
17+ addr=hex(id(self)),
18+ id=self.id,
19+ geo=geostr,
20+ details=obj_details)
21+
22+ def __repr__(self):
23+ with self.no_automatic_refreshing():
24+ return self._repr_string()
25+
26+ def __eq__(self, other):
27+ return isinstance(other, self.__class__) and self.id == other.id
28+
29+ def __ne__(self, other):
30+ return not self.__eq__(other)
31+
32
33 def ensure_unity_is_running(timeout=300):
34 """Poll the unity debug interface, and return when it's ready for use.
35
36=== modified file 'tests/autopilot/unity/emulators/dash.py'
37--- tests/autopilot/unity/emulators/dash.py 2015-04-10 16:22:23 +0000
38+++ tests/autopilot/unity/emulators/dash.py 2015-08-19 13:54:35 +0000
39@@ -158,7 +158,7 @@
40
41 @property
42 def geometry(self):
43- return (self.view.x, self.view.y, self.view.width, self.view.height)
44+ return self.view.globalRect
45
46
47 class DashView(UnityIntrospectionObject):
48@@ -225,10 +225,12 @@
49 class ScopeView(UnityIntrospectionObject):
50 """A Scope View."""
51
52- def get_groups(self):
53+ def get_categories(self, only_visible=False):
54 """Get a list of all groups within this scopeview. May return an empty list."""
55- groups = self.get_children_by_type(PlacesGroup)
56- return groups
57+ if only_visible:
58+ return self.get_children_by_type(PlacesGroup, is_visible=True)
59+
60+ return self.get_children_by_type(PlacesGroup)
61
62 def get_focused_category(self):
63 """Return a PlacesGroup instance for the category whose header has keyboard focus.
64@@ -236,30 +238,22 @@
65 Returns None if no category headers have keyboard focus.
66
67 """
68- categories = self.get_children_by_type(PlacesGroup)
69- matches = [m for m in categories if m.header_has_keyfocus]
70- if matches:
71- return matches[0]
72- return None
73+ matches = self.get_children_by_type(PlacesGroup, header_has_keyfocus=True)
74+ return matches[0] if matches else None
75
76 def get_category_by_name(self, category_name):
77 """Return a PlacesGroup instance with the given name, or None."""
78- categories = self.get_children_by_type(PlacesGroup)
79- matches = [m for m in categories if m.name == category_name]
80- if matches:
81- return matches[0]
82- return None
83+ matches = self.get_children_by_type(PlacesGroup, name=category_name)
84+ return matches[0] if matches else None
85
86 def get_num_visible_categories(self):
87 """Get the number of visible categories in this scope."""
88- return len([c for c in self.get_children_by_type(PlacesGroup) if c.is_visible])
89+ return len(self.get_categories(only_visible=True))
90
91 def get_filterbar(self):
92 """Get the filter bar for the current scope, or None if it doesn't have one."""
93 bars = self.get_children_by_type(FilterBar)
94- if bars:
95- return bars[0]
96- return None
97+ return bars[0] if bars else None
98
99
100 class PlacesGroup(UnityIntrospectionObject):
101@@ -279,26 +273,16 @@
102 """A single result in the dash."""
103
104 def activate(self, double_click=True):
105- tx = self.x + (self.width / 2)
106- ty = self.y + (self.height / 2)
107 m = Mouse.create()
108- m.move(tx, ty)
109- m.click(1)
110+ m.click_object(self, button=1)
111 if double_click:
112- m.click(1)
113+ m.click_object(self, button=1)
114
115 def preview(self, button=1):
116- tx = self.x + (self.width / 2)
117- ty = self.y + (self.height / 2)
118- m = Mouse.create()
119- m.move(tx, ty)
120- m.click(button)
121+ Mouse.create().click_object(self, button)
122
123 def preview_key(self):
124- tx = self.x + (self.width / 2)
125- ty = self.y + (self.height / 2)
126- m = Mouse.create()
127- m.move(tx, ty)
128+ Mouse.create().move_to_object(self)
129
130 k = Keyboard.create()
131 k.press_and_release('Menu')
132@@ -313,11 +297,8 @@
133
134 def get_focused_filter(self):
135 """Returns the id of the focused filter widget."""
136- filters = self.get_children_by_type(FilterExpanderLabel)
137- for filter_label in filters:
138- if filter_label.expander_has_focus:
139- return filter_label
140- return None
141+ filters = self.get_children_by_type(FilterExpanderLabel, expander_has_focus=True)
142+ return filters[0] if filters else None
143
144 @property
145 def expanded(self):
146@@ -366,21 +347,13 @@
147 def ensure_expanded(self):
148 """Expand the filter expander label, if it's not already"""
149 if not self.expanded:
150- tx = self.x + self.width / 2
151- ty = self.y + self.height / 2
152- m = Mouse.create()
153- m.move(tx, ty)
154- m.click()
155+ Mouse.create().click_object(self)
156 self.expanded.wait_for(True)
157
158 def ensure_collapsed(self):
159 """Collapse the filter expander label, if it's not already"""
160 if self.expanded:
161- tx = self.x + self.width / 2
162- ty = self.y + self.height / 2
163- m = Mouse.create()
164- m.move(tx, ty)
165- m.click()
166+ Mouse.create().click_object(self)
167 self.expanded.wait_for(False)
168
169
170@@ -402,21 +375,14 @@
171
172 def get_action_by_id(self, action_id):
173 """Returns the action given it's action hint."""
174- actions = self.get_children_by_type(ActionButton)
175- for action in actions:
176- if action.action == action_id:
177- return action
178- return None
179+ actions = self.get_children_by_type(ActionButton, action=action_id)
180+ return actions[0] if actions else None
181
182 def execute_action_by_id(self, action_id):
183 """Executes an action given by the id."""
184 action = self.get_action_by_id(action_id)
185 if action:
186- tx = action.x + (action.width / 2)
187- ty = action.y + (action.height / 2)
188- m = Mouse.create()
189- m.move(tx, ty)
190- m.click()
191+ Mouse.create().click_object(action)
192
193 @property
194 def cover_art(self):
195@@ -495,12 +461,8 @@
196
197 def navigate_left(self, count=1):
198 """Navigate preview left"""
199- navigator = self.get_left_navigator()
200-
201- tx = navigator.button_x + (navigator.button_width / 2)
202- ty = navigator.button_y + (navigator.button_height / 2)
203 m = Mouse.create()
204- m.move(tx, ty)
205+ m.move_to_object(self.get_left_navigator().button_geo)
206
207 old_preview_initiate_count = self.preview_initiate_count
208
209@@ -512,12 +474,8 @@
210
211 def navigate_right(self, count=1):
212 """Navigate preview right"""
213- navigator = self.get_right_navigator()
214-
215- tx = navigator.button_x + (navigator.button_width / 2)
216- ty = navigator.button_y + (navigator.button_height / 2)
217 m = Mouse.create()
218- m.move(tx, ty)
219+ m.move_to_object(self.get_right_navigator().button_geo)
220
221 old_preview_initiate_count = self.preview_initiate_count
222
223@@ -607,3 +565,4 @@
224
225 class StaticCairoText(UnityIntrospectionObject):
226 """Text boxes in the preview"""
227+
228
229=== modified file 'tests/autopilot/unity/emulators/hud.py'
230--- tests/autopilot/unity/emulators/hud.py 2013-10-03 01:33:53 +0000
231+++ tests/autopilot/unity/emulators/hud.py 2015-08-19 13:54:35 +0000
232@@ -105,7 +105,7 @@
233
234 @property
235 def geometry(self):
236- return (self.x, self.y, self.width, self.height)
237+ return self.globalRect
238
239 @property
240 def selected_button(self):
241@@ -156,7 +156,7 @@
242
243 @property
244 def geometry(self):
245- return (self.x, self.y, self.width, self.height)
246+ return self.globalRect
247
248
249 class HudButton(UnityIntrospectionObject):
250
251=== modified file 'tests/autopilot/unity/emulators/icons.py'
252--- tests/autopilot/unity/emulators/icons.py 2013-11-14 01:56:41 +0000
253+++ tests/autopilot/unity/emulators/icons.py 2015-08-19 13:54:35 +0000
254@@ -58,10 +58,6 @@
255
256 return self.xids.contains(xid)
257
258- def __repr__(self):
259- with self.no_automatic_refreshing():
260- return "<%s id=%d>" % (self.__class__.__name__, self.id)
261-
262
263 class BFBLauncherIcon(SimpleLauncherIcon):
264 """Represents the BFB button in the launcher."""
265@@ -80,10 +76,7 @@
266
267 def __repr__(self):
268 with self.no_automatic_refreshing():
269- return "<%s %s id=%d>" % (
270- self.__class__.__name__,
271- self.desktop_id,
272- self.id)
273+ return self._repr_string("{0.desktop_id}".format(self))
274
275 class TrashLauncherIcon(SimpleLauncherIcon):
276 """Represents the trash launcher icon."""
277@@ -110,7 +103,7 @@
278
279 @property
280 def geometry(self):
281- return (self.x, self.y, self.width, self.height)
282+ return self.globalRect
283
284
285 class LauncherEntry(UnityIntrospectionObject):
286
287=== modified file 'tests/autopilot/unity/emulators/launcher.py'
288--- tests/autopilot/unity/emulators/launcher.py 2014-01-23 15:51:46 +0000
289+++ tests/autopilot/unity/emulators/launcher.py 2015-08-19 13:54:35 +0000
290@@ -118,12 +118,8 @@
291 def move_mouse_over_launcher(self):
292 """Move the mouse over this launcher."""
293 move_mouse_to_screen(self.monitor)
294- (x, y, w, h) = self.geometry
295- target_x = x + w / 2
296- target_y = y + h / 2
297-
298 logger.debug("Moving mouse to center of launcher.")
299- self._mouse.move(target_x, target_y)
300+ self._mouse.move_to_object(self)
301
302 def move_mouse_to_icon(self, icon, autoscroll_offset=0):
303 """Move the mouse to a specific icon."""
304@@ -438,8 +434,8 @@
305
306 @property
307 def geometry(self):
308- """Returns a tuple of (x,y,w,h) for the current launcher."""
309- return (self.x, self.y, self.width, self.height)
310+ """Returns a Rectangle (x,y,w,h) for the current launcher."""
311+ return self.globalRect
312
313
314 class LauncherModel(UnityIntrospectionObject):
315
316=== modified file 'tests/autopilot/unity/emulators/panel.py'
317--- tests/autopilot/unity/emulators/panel.py 2015-02-18 00:49:47 +0000
318+++ tests/autopilot/unity/emulators/panel.py 2015-08-19 13:54:35 +0000
319@@ -14,6 +14,7 @@
320
321 from autopilot.input import Mouse
322 from autopilot.keybindings import KeybindingsHelper
323+from autopilot.introspection.types import Rectangle
324
325 from unity.emulators import UnityIntrospectionObject
326 logger = logging.getLogger(__name__)
327@@ -107,30 +108,18 @@
328
329 def move_mouse_over_grab_area(self):
330 """Move the mouse over the grab area for this panel."""
331- (x, y, w, h) = self.grab_area.geometry
332- target_x = x + w / 2
333- target_y = y + h / 2
334-
335 logger.debug("Moving mouse to center of grab area.")
336- self._mouse.move(target_x, target_y)
337+ self._mouse.move_to_object(self.grab_area)
338
339 def move_mouse_over_window_buttons(self):
340 """Move the mouse over the center of the window buttons area for this panel."""
341- (x, y, w, h) = self.window_buttons.geometry
342- target_x = x + w / 2
343- target_y = y + h / 2
344-
345 logger.debug("Moving mouse to center of the window buttons.")
346- self._mouse.move(target_x, target_y)
347+ self._mouse.move_to_object(self.window_buttons)
348
349 def move_mouse_over_indicators(self):
350 """Move the mouse over the center of the indicators area for this panel."""
351- (x, y, w, h) = self.indicators.geometry
352- target_x = x + w / 2
353- target_y = y + h / 2
354-
355 logger.debug("Moving mouse to center of the indicators area.")
356- self._mouse.move(target_x, target_y)
357+ self._mouse.move_to_object(self.indicators)
358
359 def get_indicator_entries(self, visible_only=True, include_hidden_menus=False):
360 """Returns a list of entries for this panel including both menus and indicators"""
361@@ -192,8 +181,8 @@
362
363 @property
364 def geometry(self):
365- """Returns a tuple of (x,y,w,h) for the current panel."""
366- return (self.x, self.y, self.width, self.height)
367+ """Returns a Rectangle (x,y,w,h) for the current panel."""
368+ return self.globalRect
369
370
371 class MenuView(UnityIntrospectionObject):
372@@ -215,8 +204,8 @@
373
374 @property
375 def geometry(self):
376- """Returns a tuple of (x,y,w,h) for the current menu view."""
377- return (self.x, self.y, self.width, self.height)
378+ """Returns a Rectangle (x,y,w,h) for the current menu view."""
379+ return self.globalRect
380
381
382 class WindowButtons(UnityIntrospectionObject):
383@@ -256,8 +245,8 @@
384
385 @property
386 def geometry(self):
387- """Returns a tuple of (x,y,w,h) for the current panel."""
388- return (self.x, self.y, self.width, self.height)
389+ """Returns a Rectangle (x,y,w,h) for the current panel."""
390+ return self.globalRect
391
392
393 class WindowButton(UnityIntrospectionObject):
394@@ -268,20 +257,25 @@
395 self._mouse = Mouse.create()
396
397 def mouse_move_to(self):
398- target_x = self.x + self.width / 2
399- target_y = self.y + self.height / 2
400- self._mouse.move(target_x, target_y, rate=20, time_between_events=0.005)
401+ self._mouse.move_to_object(self)
402
403 def mouse_click(self):
404- self.mouse_move_to()
405- sleep(.2)
406- self._mouse.click(press_duration=.1)
407+ # Ignore buttons that are placed at 0x0, as they're invisible yet
408+ if not self.x and not self.y and not self.visible:
409+ return
410+
411+ self._mouse.click_object(self)
412 sleep(.01)
413
414 @property
415 def geometry(self):
416- """Returns a tuple of (x,y,w,h) for the window button."""
417- return (self.x, self.y, self.width, self.height)
418+ """Returns a Rectangle (x,y,w,h) for the window button."""
419+ return self.globalRect
420+
421+ def __repr__(self):
422+ with self.no_automatic_refreshing():
423+ details = "type={0.type} state={0.visual_state} sensitive={0.sensitive}".format(self)
424+ return self._repr_string(details)
425
426
427 class GrabArea(UnityIntrospectionObject):
428@@ -289,8 +283,8 @@
429
430 @property
431 def geometry(self):
432- """Returns a tuple of (x,y,w,h) for the grab area."""
433- return (self.x, self.y, self.width, self.height)
434+ """Returns a Rectangle (x,y,w,h) for the grab area."""
435+ return self.globalRect
436
437
438 class Indicators(UnityIntrospectionObject):
439@@ -314,8 +308,8 @@
440
441 @property
442 def geometry(self):
443- """Returns a tuple of (x,y,w,h) for the indicators area."""
444- return (self.x, self.y, self.width, self.height)
445+ """Returns a Rectangle (x,y,w,h) for the indicators area."""
446+ return self.globalRect
447
448
449 class IndicatorEntry(UnityIntrospectionObject):
450@@ -326,30 +320,26 @@
451 self._mouse = Mouse.create()
452
453 def mouse_move_to(self):
454- target_x = self.x + self.width / 2
455- target_y = self.y + self.height / 2
456- self._mouse.move(target_x, target_y, rate=20, time_between_events=0.005)
457+ self._mouse.move_to_object(self)
458
459 def mouse_click(self, button=1):
460- self.mouse_move_to()
461- sleep(.2)
462- assert(self.visible)
463- self._mouse.click(press_duration=.1)
464+ self._mouse.click_object(self, button=button)
465 sleep(.01)
466
467 @property
468 def geometry(self):
469- """Returns a tuple of (x,y,w,h) for the indicator entry."""
470- return (self.x, self.y, self.width, self.height)
471+ """Returns a Rectangle (x,y,w,h) for the indicator entry."""
472+ return self.globalRect
473
474 @property
475 def menu_geometry(self):
476- """Returns a tuple of (x,y,w,h) for the opened menu geometry."""
477- return (self.menu_x, self.menu_y, self.menu_width, self.menu_height)
478+ """Returns a Rectangle (x,y,w,h) for the opened menu geometry."""
479+ return Rectangle(self.menu_x, self.menu_y, self.menu_width, self.menu_height)
480
481 def __repr__(self):
482 with self.no_automatic_refreshing():
483- return "<IndicatorEntry 0x%x (%s)>" % (id(self), self.label)
484+ details = "label={0.label}".format(self)
485+ return self._repr_string(details)
486
487
488 class Tray(UnityIntrospectionObject):
489
490=== modified file 'tests/autopilot/unity/emulators/quicklist.py'
491--- tests/autopilot/unity/emulators/quicklist.py 2013-05-10 05:16:07 +0000
492+++ tests/autopilot/unity/emulators/quicklist.py 2015-08-19 13:54:35 +0000
493@@ -66,8 +66,8 @@
494
495 @property
496 def geometry(self):
497- """Returns a tuple of (x,y,w,h) for the quicklist."""
498- return (self.x, self.y, self.width, self.height)
499+ """Returns a Rectangle (x,y,w,h) for the quicklist."""
500+ return self.globalRect
501
502
503 class QuicklistMenuItem(UnityIntrospectionObject):
504@@ -79,20 +79,17 @@
505
506 @property
507 def geometry(self):
508- """Returns a tuple of (x,y,w,h) for the quicklist item."""
509- return (self.x, self.y, self.width, self.height)
510+ """Returns a Rectangle (x,y,w,h) for the quicklist item."""
511+ return self.globalRect
512
513 def mouse_move_to(self):
514 assert(self.visible)
515 logger.debug("Moving mouse over quicklist item %r", self)
516- target_x = self.x + self.width / 2
517- target_y = self.y + self.height / 2
518- self._mouse.move(target_x, target_y, rate=20, time_between_events=0.005)
519+ self._mouse.move_to_object(self)
520
521 def mouse_click(self, button=1):
522 logger.debug("Clicking on quicklist item %r", self)
523- self.mouse_move_to()
524- self._mouse.click()
525+ self._mouse.click_object(self)
526
527
528 class QuicklistMenuItemLabel(QuicklistMenuItem):
529
530=== modified file 'tests/autopilot/unity/emulators/screen.py'
531--- tests/autopilot/unity/emulators/screen.py 2014-02-20 21:37:37 +0000
532+++ tests/autopilot/unity/emulators/screen.py 2015-08-19 13:54:35 +0000
533@@ -13,6 +13,7 @@
534 from unity.emulators import UnityIntrospectionObject
535 from testtools.matchers import GreaterThan
536
537+from autopilot.introspection.types import Rectangle
538 from unity.emulators.dash import SearchBar
539
540 logger = logging.getLogger(__name__)
541@@ -54,15 +55,15 @@
542
543 @property
544 def geometry(self):
545- """Returns a tuple of (x,y,w,h) for the current window."""
546- return (self.x, self.y, self.width, self.height)
547+ """Returns a Rectangle (x,y,w,h) for the current window."""
548+ return self.globalRect
549
550 @property
551 def scale_close_geometry(self):
552- """Returns a tuple of (x,y,w,h) for the scale close button."""
553+ """Returns a Rectangle (x,y,w,h) for the scale close button."""
554 self.scaled_close_width.wait_for(GreaterThan(0))
555 self.scaled_close_height.wait_for(GreaterThan(0))
556- return (self.scaled_close_x, self.scaled_close_y, self.scaled_close_width, self.scaled_close_height)
557+ return Rectangle(self.scaled_close_x, self.scaled_close_y, self.scaled_close_width, self.scaled_close_height)
558
559
560 class SpreadFilter(UnityIntrospectionObject):
561
562=== modified file 'tests/autopilot/unity/emulators/window_manager.py'
563--- tests/autopilot/unity/emulators/window_manager.py 2013-10-02 23:33:55 +0000
564+++ tests/autopilot/unity/emulators/window_manager.py 2015-08-19 13:54:35 +0000
565@@ -10,6 +10,7 @@
566 from __future__ import absolute_import
567
568 import logging
569+from autopilot.introspection.types import Rectangle
570 from autopilot.keybindings import KeybindingsHelper
571
572 from unity.emulators import UnityIntrospectionObject
573@@ -22,8 +23,8 @@
574
575 @property
576 def screen_geometry(self):
577- """Returns a tuple of (x,y,w,h) for the screen."""
578- return (self.x, self.y, self.width, self.height)
579+ """Returns a Rectangle (x,y,w,h) for the screen."""
580+ return self.globalRect
581
582 def initiate_spread(self):
583 self.keybinding("spread/start")
584
585=== modified file 'tests/autopilot/unity/tests/launcher/test_icon_behavior.py'
586--- tests/autopilot/unity/tests/launcher/test_icon_behavior.py 2015-03-25 14:59:04 +0000
587+++ tests/autopilot/unity/tests/launcher/test_icon_behavior.py 2015-08-19 13:54:35 +0000
588@@ -384,7 +384,7 @@
589 self.drag_type)
590 moved_icon = self.unity.launcher.model.\
591 get_launcher_icons_for_monitor(self.launcher_monitor)[1]
592- self.assertThat(moved_icon.id, Equals(calc_icon.id))
593+ self.assertThat(moved_icon, Equals(calc_icon))
594
595 def test_can_drag_icon_below_window_switcher(self):
596 """Application icons must be dragable to below the workspace switcher icon."""
597
598=== modified file 'tests/autopilot/unity/tests/launcher/test_visual.py'
599--- tests/autopilot/unity/tests/launcher/test_visual.py 2013-12-11 19:12:58 +0000
600+++ tests/autopilot/unity/tests/launcher/test_visual.py 2015-08-19 13:54:35 +0000
601@@ -71,14 +71,12 @@
602
603 def test_mouse_over_with_dash_open_desaturates_icons(self):
604 """Moving mouse over launcher with dash open must saturate icons."""
605- launcher_instance = self.get_launcher()
606 self.unity.dash.ensure_visible()
607 current_monitor = self.unity.dash.monitor
608
609 self.addCleanup(self.unity.dash.ensure_hidden)
610 sleep(.5)
611- x,y,w,h = launcher_instance.geometry
612- self.mouse.move(x + w/2, y + h/2)
613+ self.mouse.move_to_object(self.get_launcher())
614 sleep(.5)
615 for icon in self.unity.launcher.model.get_launcher_icons():
616 self.assertFalse(icon.monitors_desaturated[current_monitor])
617
618=== modified file 'tests/autopilot/unity/tests/test_dash.py'
619--- tests/autopilot/unity/tests/test_dash.py 2015-02-19 19:23:39 +0000
620+++ tests/autopilot/unity/tests/test_dash.py 2015-08-19 13:54:35 +0000
621@@ -400,10 +400,11 @@
622
623 # Test that tab cycles through the categories.
624 # + 1 is the filter bar
625- for i in range(scope.get_num_visible_categories()):
626+ for category in scope.get_categories(only_visible=True):
627 self.keyboard.press_and_release('Tab')
628- category = scope.get_focused_category()
629- self.assertIsNot(category, None)
630+ selected = scope.get_focused_category()
631+ expected = category if category.expand_label_is_visible else None
632+ self.assertEqual(selected, expected)
633
634 def test_tab_with_filter_bar(self):
635 """ This test makes sure that Tab works well with the filter bara."""
636@@ -544,10 +545,7 @@
637
638 self.unity.dash.ensure_visible()
639
640- self.mouse.move(self.unity.dash.searchbar.x + self.unity.dash.searchbar.width / 2,
641- self.unity.dash.searchbar.y + self.unity.dash.searchbar.height / 2)
642-
643- self.mouse.click(button=2)
644+ self.mouse.click_object(self.unity.dash.searchbar, button=2)
645
646 self.assertThat(self.unity.dash.search_string, Eventually(Equals('ThirdButtonPaste')))
647
648@@ -691,7 +689,7 @@
649
650 self.unity.dash.ensure_visible()
651
652- self.assertThat(self.unity.dash.geometry[0], Eventually(Equals(launcher.geometry[0] + launcher.geometry[2] - 1)))
653+ self.assertThat(self.unity.dash.view.x, Eventually(Equals(launcher.geometry.x + launcher.geometry.width - 1)))
654
655
656 def test_see_more_result_alignment(self):
657@@ -701,11 +699,9 @@
658 self.unity.dash.reveal_application_scope()
659
660 scope = self.unity.dash.get_current_scope()
661- self.assertThat(lambda: len(scope.get_groups()), Eventually(GreaterThan(0), timeout=20))
662-
663- groups = scope.get_groups()
664-
665- for group in groups:
666+ self.assertThat(lambda: len(scope.get_categories()), Eventually(GreaterThan(0), timeout=20))
667+
668+ for group in scope.get_categories():
669 if (group.is_visible and group.expand_label_is_visible):
670 expand_label_y = group.expand_label_y + group.expand_label_baseline
671 name_label_y = group.name_label_y + group.name_label_baseline
672@@ -725,10 +721,7 @@
673 the rectangle outside of the icon.
674 """
675 app_icon = self.scopebar.get_icon_by_name(u'applications.scope')
676-
677- self.mouse.move(app_icon.x + (app_icon.width / 2),
678- app_icon.y + (app_icon.height / 2))
679- self.mouse.click()
680+ self.mouse.click_object(app_icon)
681
682 self.assertThat(self.scopebar.active_scope, Eventually(Equals('applications.scope')))
683
684@@ -1119,10 +1112,7 @@
685 cover_art = self.get_current_preview().cover_art[0]
686
687 # click the cover-art (this will set focus)
688- tx = cover_art.x + (cover_art.width / 2)
689- ty = cover_art.y + (cover_art.height / 2)
690- self.mouse.move(tx, ty)
691- self.mouse.click()
692+ self.mouse.click_object(cover_art)
693
694 self.keyboard.press_and_release("Escape")
695
696@@ -1138,13 +1128,21 @@
697 class PreviewClickCancelTests(DashTestCase):
698 """Tests that the preview closes when left, middle, and right clicking in the preview"""
699
700+ scenarios = [('Left button', {'clicked_button': 1}),
701+ ('Middle button', {'clicked_button': 2}),
702+ ('Right button', {'clicked_button': 3})]
703+
704 def setUp(self):
705 super(PreviewClickCancelTests, self).setUp()
706 gettext.install("unity-scope-applications")
707- scope = self.unity.dash.reveal_application_scope()
708+ scope = self.unity.dash.reveal_application_scope(clear_search=False)
709 self.addCleanup(self.unity.dash.ensure_hidden)
710 # Only testing an application preview for this test.
711- self.keyboard.type("Software Updater")
712+
713+ search_string = "Software Updater"
714+ if self.unity.dash.search_string != search_string:
715+ self.unity.dash.clear_search()
716+ self.keyboard.type(search_string)
717
718 # wait for "Installed" category
719 category = self.wait_for_category(scope, _("Installed"))
720@@ -1159,183 +1157,43 @@
721
722 self.preview_container = self.unity.dash.view.get_preview_container()
723
724- def test_left_click_on_preview_icon_cancel_preview(self):
725- """Left click on preview icon must close preview."""
726- icon = self.get_current_preview().icon[0]
727- self.assertThat(icon, NotEquals(None))
728-
729- tx = icon.x + icon.width
730- ty = icon.y + (icon.height / 2)
731- self.mouse.move(tx, ty)
732- self.mouse.click(button=1)
733-
734- self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False)))
735-
736- def test_middle_click_on_preview_icon_cancel_preview(self):
737- """Middle click on preview icon must close preview."""
738- icon = self.get_current_preview().icon[0]
739- self.assertThat(icon, NotEquals(None))
740-
741- tx = icon.x + icon.width
742- ty = icon.y + (icon.height / 2)
743- self.mouse.move(tx, ty)
744- self.mouse.click(button=2)
745-
746- self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False)))
747-
748- def test_right_click_on_preview_icon_cancel_preview(self):
749- """Right click on preview icon must close preview."""
750- icon = self.get_current_preview().icon[0]
751- self.assertThat(icon, NotEquals(None))
752-
753- tx = icon.x + icon.width
754- ty = icon.y + (icon.height / 2)
755- self.mouse.move(tx, ty)
756- self.mouse.click(button=3)
757-
758- self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False)))
759-
760- def test_left_click_on_preview_image_cancel_preview(self):
761- """Left click on preview image must cancel the preview."""
762- cover_art = self.get_current_preview().cover_art[0]
763- self.assertThat(cover_art, NotEquals(None))
764-
765- tx = cover_art.x + (cover_art.width / 2)
766- ty = cover_art.y + (cover_art.height / 2)
767- self.mouse.move(tx, ty)
768- self.mouse.click(button=1)
769-
770- self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False)))
771-
772- def test_middle_click_on_preview_image_cancel_preview(self):
773- """Middle click on preview image must cancel the preview."""
774- cover_art = self.get_current_preview().cover_art[0]
775- self.assertThat(cover_art, NotEquals(None))
776-
777- tx = cover_art.x + (cover_art.width / 2)
778- ty = cover_art.y + (cover_art.height / 2)
779- self.mouse.move(tx, ty)
780- self.mouse.click(button=2)
781-
782- self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False)))
783-
784- def test_right_click_on_preview_image_cancel_preview(self):
785- """Right click on preview image must cancel the preview."""
786- cover_art = self.get_current_preview().cover_art[0]
787- self.assertThat(cover_art, NotEquals(None))
788-
789- tx = cover_art.x + (cover_art.width / 2)
790- ty = cover_art.y + (cover_art.height / 2)
791- self.mouse.move(tx, ty)
792- self.mouse.click(button=3)
793-
794- self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False)))
795-
796- def test_left_click_on_preview_text_cancel_preview(self):
797- """Left click on some preview text must cancel the preview."""
798- text = self.get_current_preview().text_boxes[0]
799- self.assertThat(text, NotEquals(None))
800-
801- tx = text.x + (text.width / 2)
802- ty = text.y + (text.height / 2)
803- self.mouse.move(tx, ty)
804- self.mouse.click(button=1)
805-
806- self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False)))
807-
808- def test_middle_click_on_preview_text_cancel_preview(self):
809- """Middle click on some preview text must cancel the preview."""
810- text = self.get_current_preview().text_boxes[0]
811- self.assertThat(text, NotEquals(None))
812-
813- tx = text.x + (text.width / 2)
814- ty = text.y + (text.height / 2)
815- self.mouse.move(tx, ty)
816- self.mouse.click(button=2)
817-
818- self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False)))
819-
820- def test_right_click_on_preview_text_cancel_preview(self):
821- """Right click on some preview text must cancel the preview."""
822- text = self.get_current_preview().text_boxes[0]
823- self.assertThat(text, NotEquals(None))
824-
825- tx = text.x + (text.width / 2)
826- ty = text.y + (text.height / 2)
827- self.mouse.move(tx, ty)
828- self.mouse.click(button=3)
829-
830- self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False)))
831-
832- def test_left_click_on_preview_ratings_widget_cancel_preview(self):
833- """Left click on the ratings widget must cancel the preview."""
834- ratings_widget = self.get_current_preview().ratings_widget[0]
835- self.assertThat(ratings_widget, NotEquals(None))
836-
837- tx = ratings_widget.x + (ratings_widget.width / 2)
838- ty = ratings_widget.y + (ratings_widget.height / 2)
839- self.mouse.move(tx, ty)
840- self.mouse.click(button=1)
841-
842- self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False)))
843-
844- def test_middle_click_on_preview_ratings_widget_cancel_preview(self):
845- """Middle click on the ratings widget must cancel the preview."""
846- ratings_widget = self.get_current_preview().ratings_widget[0]
847- self.assertThat(ratings_widget, NotEquals(None))
848-
849- tx = ratings_widget.x + (ratings_widget.width / 2)
850- ty = ratings_widget.y + (ratings_widget.height / 2)
851- self.mouse.move(tx, ty)
852- self.mouse.click(button=2)
853-
854- self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False)))
855-
856- def test_right_click_on_preview_ratings_widget_cancel_preview(self):
857- """Right click on the ratings widget must cancel the preview."""
858- ratings_widget = self.get_current_preview().ratings_widget[0]
859- self.assertThat(ratings_widget, NotEquals(None))
860-
861- tx = ratings_widget.x + (ratings_widget.width / 2)
862- ty = ratings_widget.y + (ratings_widget.height / 2)
863- self.mouse.move(tx, ty)
864- self.mouse.click(button=3)
865-
866- self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False)))
867-
868- def test_left_click_on_preview_info_hint_cancel_preview(self):
869- """Left click on the info hint must cancel the preview."""
870- info_hint = self.get_current_preview().info_hint_widget[0]
871- self.assertThat(info_hint, NotEquals(None))
872-
873- tx = info_hint.x + (info_hint.width / 2)
874- ty = info_hint.y + (info_hint.height / 8)
875- self.mouse.move(tx, ty)
876- self.mouse.click(button=1)
877-
878- self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False)))
879-
880- def test_middle_click_on_preview_info_hint_cancel_preview(self):
881- """Middle click on the info hint must cancel the preview."""
882- info_hint = self.get_current_preview().info_hint_widget[0]
883- self.assertThat(info_hint, NotEquals(None))
884-
885- tx = info_hint.x + (info_hint.width / 2)
886- ty = info_hint.y + (info_hint.height / 8)
887- self.mouse.move(tx, ty)
888- self.mouse.click(button=2)
889-
890- self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False)))
891-
892- def test_right_click_on_preview_info_hint_cancel_preview(self):
893- """Right click on the info hint must cancel the preview."""
894- info_hint = self.get_current_preview().info_hint_widget[0]
895- self.assertThat(info_hint, NotEquals(None))
896-
897- tx = info_hint.x + (info_hint.width / 2)
898- ty = info_hint.y + (info_hint.height / 8)
899- self.mouse.move(tx, ty)
900- self.mouse.click(button=3)
901+ def test_click_on_preview_icon_cancel_preview(self):
902+ """Clicking with any button on preview icon must close preview."""
903+ icon = self.get_current_preview().icon[0]
904+ self.assertThat(icon, NotEquals(None))
905+
906+ self.mouse.click_object(icon, button=self.clicked_button)
907+ self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False)))
908+
909+ def test_click_on_preview_image_cancel_preview(self):
910+ """Clicking with any button on preview image must cancel the preview."""
911+ cover_art = self.get_current_preview().cover_art[0]
912+ self.assertThat(cover_art, NotEquals(None))
913+
914+ self.mouse.click_object(cover_art, button=self.clicked_button)
915+ self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False)))
916+
917+ def test_click_on_preview_text_cancel_preview(self):
918+ """Clicking with any button on some preview text must cancel the preview."""
919+ text = self.get_current_preview().text_boxes[0]
920+ self.assertThat(text, NotEquals(None))
921+ self.mouse.click_object(text, button=self.clicked_button)
922+
923+ self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False)))
924+
925+ def test_click_on_preview_ratings_widget_cancel_preview(self):
926+ """Clicking with any button on the ratings widget must cancel the preview."""
927+ ratings_widget = self.get_current_preview().ratings_widget[0]
928+ self.assertThat(ratings_widget, NotEquals(None))
929+ self.mouse.click_object(ratings_widget, button=self.clicked_button)
930+
931+ self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False)))
932+
933+ def test_click_on_preview_info_hint_cancel_preview(self):
934+ """Clicking with any button on the info hint must cancel the preview."""
935+ info_hint = self.get_current_preview().info_hint_widget[0]
936+ self.assertThat(info_hint, NotEquals(None))
937+ self.mouse.click_object(info_hint, button=self.clicked_button)
938
939 self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False)))
940
941@@ -1401,3 +1259,4 @@
942 self.addCleanup(self.unity.dash.ensure_hidden)
943
944 self.assertThat(self.unity.dash.visible, Eventually(Equals(True)))
945+
946
947=== modified file 'tests/autopilot/unity/tests/test_panel.py'
948--- tests/autopilot/unity/tests/test_panel.py 2015-02-19 14:41:09 +0000
949+++ tests/autopilot/unity/tests/test_panel.py 2015-08-19 13:54:35 +0000
950@@ -78,8 +78,7 @@
951 self.keybinding("window/restore")
952 self.addCleanup(self.keybinding, "window/maximize")
953
954- sleep(.25)
955- self.assertProperty(win, is_maximized=maximized)
956+ self.assertThat(lambda: win.is_maximized, Eventually(Equals(maximized)))
957
958 def open_new_application_window(self, app_name, maximized=False, move_to_monitor=True):
959 """Opens a new instance of the requested application, ensuring that only
960@@ -93,8 +92,8 @@
961 app = app_win.application
962
963 app_win.set_focus()
964- self.assertTrue(app.is_active)
965- self.assertTrue(app_win.is_focused)
966+ self.assertThat(lambda: app.is_active, Eventually(Equals(True)))
967+ self.assertThat(lambda: app_win.is_focused, Eventually(Equals(True)))
968 self.assertThat(app.desktop_file, Equals(app_win.application.desktop_file))
969
970 if move_to_monitor:
971@@ -431,7 +430,6 @@
972 self.addCleanup(self.unity.hud.ensure_hidden)
973
974 self.panel.window_buttons.maximize.mouse_click()
975-
976 self.assertThat(self.unity.hud.visible, Eventually(Equals(True)))
977
978 def test_hud_maximize_button_does_not_change_dash_form_factor(self):
979@@ -986,7 +984,7 @@
980
981 def open_app_and_get_menu_entry(self):
982 """Open the test app and wait for the menu entry to appear."""
983- self.open_new_application_window("Remmina" if self.lim else "Calculator",
984+ self.open_new_application_window("Text Editor" if self.lim else "Calculator",
985 maximized=self.lim)
986
987 refresh_fn = lambda: len(self.panel.menus.get_entries())
988@@ -1043,7 +1041,8 @@
989 self.assertThat(menu_entry.active, Eventually(Equals(True)))
990
991 self.open_new_application_window("Text Editor")
992- self.assertThat(self.unity.panels.get_active_indicator, Eventually(Equals(None)))
993+ get_active_indicator_fn = lambda: self.unity.panels.get_active_indicator()
994+ self.assertThat(get_active_indicator_fn, Eventually(Equals(None)))
995
996 def test_indicator_opens_when_dash_is_open(self):
997 """When the dash is open and a click is on an indicator the dash
998@@ -1068,8 +1067,9 @@
999 This method will wait until the active indicator has been set.
1000
1001 """
1002- self.assertThat(self.panel.get_active_indicator, Eventually(NotEquals(None)))
1003- return self.panel.get_active_indicator()
1004+ get_active_indicator_fn = lambda: self.panel.get_active_indicator()
1005+ self.assertThat(get_active_indicator_fn, Eventually(NotEquals(None)))
1006+ return get_active_indicator_fn()
1007
1008 def test_panel_first_menu_show_works(self):
1009 """Pressing the open-menus keybinding must open the first indicator."""
1010@@ -1185,9 +1185,7 @@
1011 self.assertProperty(text_win, is_focused=False)
1012 self.assertProperty(calc_win, is_focused=True)
1013
1014- self.move_mouse_over_grab_area()
1015- self.mouse.click()
1016-
1017+ self.mouse.click_object(self.panel.grab_area, button=1)
1018 self.assertProperty(text_win, is_focused=True)
1019
1020 def test_lower_the_maximized_window_works(self):
1021@@ -1198,8 +1196,7 @@
1022 self.assertProperty(text_win, is_focused=True)
1023 self.assertProperty(calc_win, is_focused=False)
1024
1025- self.move_mouse_over_grab_area()
1026- self.mouse.click(2)
1027+ self.mouse.click_object(self.panel.grab_area, button=2)
1028
1029 self.assertProperty(calc_win, is_focused=True)
1030
1031@@ -1209,8 +1206,7 @@
1032 self.addCleanup(self.unity.hud.ensure_hidden)
1033
1034 self.keyboard.type("Hello")
1035- self.move_mouse_over_grab_area()
1036- self.mouse.click()
1037+ self.mouse.click_object(self.panel.grab_area)
1038 self.keyboard.type("World")
1039
1040 self.assertThat(self.unity.hud.search_string, Eventually(Equals("HelloWorld")))
1041
1042=== modified file 'tests/autopilot/unity/tests/test_quicklist.py'
1043--- tests/autopilot/unity/tests/test_quicklist.py 2015-03-25 14:59:04 +0000
1044+++ tests/autopilot/unity/tests/test_quicklist.py 2015-08-19 13:54:35 +0000
1045@@ -269,7 +269,7 @@
1046 def assertCorrectItemSelected(self, item):
1047 """Ensure the item considers itself selected and that quicklist agrees."""
1048 self.assertThat(item.selected, Eventually(Equals(True)))
1049- self.assertThat(self.quicklist.selected_item.id, Equals(item.id))
1050+ self.assertThat(self.quicklist.selected_item, Equals(item))
1051
1052 def test_keynav_selects_first_item_when_unselected(self):
1053 """Home key MUST select the first selectable item in a quicklist."""
1054@@ -402,11 +402,11 @@
1055
1056 # Moving the mouse horizontally doesn't change the selection
1057 self.mouse.move(mouse_item.x + mouse_item.width - 10, mouse_item.y + mouse_item.height / 2)
1058- self.assertThat(self.quicklist.selected_item.id, Equals(key_item.id))
1059+ self.assertThat(self.quicklist.selected_item, Equals(key_item))
1060
1061 # Moving the mouse outside doesn't change the selection
1062 self.mouse.move(mouse_item.x + mouse_item.width + 50, mouse_item.y + mouse_item.height / 2)
1063- self.assertThat(self.quicklist.selected_item.id, Equals(key_item.id))
1064+ self.assertThat(self.quicklist.selected_item, Equals(key_item))
1065
1066 # Moving the mouse to another entry, changes the selection
1067 mouse_item = self.quicklist.selectable_items[-2]
1068
1069=== modified file 'tests/autopilot/unity/tests/test_spread.py'
1070--- tests/autopilot/unity/tests/test_spread.py 2015-03-24 22:35:27 +0000
1071+++ tests/autopilot/unity/tests/test_spread.py 2015-08-19 13:54:35 +0000
1072@@ -114,11 +114,7 @@
1073 target_xid = not_focused.x_id
1074 [target_win] = [w for w in self.unity.screen.scaled_windows if w.xid == target_xid]
1075
1076- (x, y, w, h) = target_win.geometry
1077- self.mouse.move(x + w / 2, y + h / 2)
1078- sleep(.5)
1079- self.mouse.click()
1080-
1081+ self.mouse.click_object(target_win, button=1)
1082 self.assertThat(lambda: not_focused.is_focused, Eventually(Equals(True)))
1083
1084 def test_scaled_window_closes_on_middle_click(self):
1085@@ -129,10 +125,8 @@
1086 target_xid = win.x_id
1087 [target_win] = [w for w in self.unity.screen.scaled_windows if w.xid == target_xid]
1088
1089- (x, y, w, h) = target_win.geometry
1090- self.mouse.move(x + w / 2, y + h / 2)
1091- sleep(.5)
1092- self.mouse.click(button=2)
1093+ sleep(1)
1094+ self.mouse.click_object(target_win, button=2)
1095
1096 self.assertWindowIsScaledEquals(target_xid, False)
1097 self.assertWindowIsClosed(target_xid)
1098@@ -146,13 +140,8 @@
1099 [target_win] = [w for w in self.unity.screen.scaled_windows if w.xid == target_xid]
1100
1101 # Make sure mouse is over the test window
1102- (x1, y1, w1, h1) = target_win.geometry
1103- self.mouse.move(x1 + w1 / 2, y1 + h1 / 2)
1104-
1105- (x, y, w, h) = target_win.scale_close_geometry
1106- self.mouse.move(x + w / 2, y + h / 2)
1107- sleep(.5)
1108- self.mouse.click()
1109+ self.mouse.move_to_object(target_win)
1110+ self.mouse.click_object(target_win.scale_close_geometry)
1111
1112 self.assertWindowIsScaledEquals(target_xid, False)
1113 self.assertWindowIsClosed(target_xid)
1114
1115=== modified file 'tests/autopilot/unity/tests/test_switcher.py'
1116--- tests/autopilot/unity/tests/test_switcher.py 2014-01-29 20:33:47 +0000
1117+++ tests/autopilot/unity/tests/test_switcher.py 2015-08-19 13:54:35 +0000
1118@@ -629,6 +629,7 @@
1119 def setUp(self):
1120 super(SwitcherDetailsMouseTests, self).setUp()
1121 self.set_timeout_setting(False)
1122+ self.mouse.move(0, 0, animate=False)
1123
1124 def test_mouse_highlights_switcher_icons(self):
1125 """ Tests that the mouse can hightlight all the switcher icons. """
1126@@ -653,7 +654,7 @@
1127 index = 0;
1128 for cords in icon_cords:
1129 self.mouse.move(cords[0], cords[1])
1130- self.assertThat(index, Equals(self.unity.switcher.selection_index))
1131+ self.assertThat(self.unity.switcher.selection_index, Eventually(Equals(index)))
1132 index += 1
1133
1134 def test_mouse_clicks_activate_icon(self):
1135@@ -691,7 +692,7 @@
1136
1137 mouse_index = self.unity.switcher.selection_index - 1
1138
1139- self.unity.switcher.view.move_over_icon(mouse_index);
1140+ self.unity.switcher.view.move_over_icon(mouse_index)
1141 # Assert we are over the icon we want to hover over.
1142 self.assertThat(self.unity.switcher.view.last_icon_selected, Eventually(Equals(mouse_index)))
1143
1144@@ -724,11 +725,9 @@
1145 self.unity.switcher.initiate(SwitcherMode.DETAIL)
1146 self.addCleanup(self.unity.switcher.terminate)
1147
1148- index = 0;
1149- for icon in self.unity.switcher.view.detail_icons:
1150+ for index in range(len(self.unity.switcher.view.detail_icons)):
1151 self.unity.switcher.view.move_over_detail_icon(index)
1152- self.assertThat(index, Equals(self.unity.switcher.detail_selection_index))
1153- index += 1
1154+ self.assertThat(self.unity.switcher.detail_selection_index, Eventually(Equals(index)))
1155
1156 def test_mouse_click_will_activate_detail_icon(self):
1157 """
1158
1159=== modified file 'unity-shared/WindowButtons.cpp'
1160--- unity-shared/WindowButtons.cpp 2015-06-03 12:10:00 +0000
1161+++ unity-shared/WindowButtons.cpp 2015-08-19 13:54:35 +0000
1162@@ -234,14 +234,14 @@
1163 }
1164
1165 introspection.add(GetAbsoluteGeometry())
1166- .add("type", type_name)
1167- .add("visible", IsVisible() && Parent()->opacity() != 0.0f)
1168- .add("sensitive", Parent()->GetInputEventSensitivity())
1169- .add("enabled", enabled())
1170- .add("visual_state", state_name)
1171- .add("opacity", Parent()->opacity())
1172- .add("focused", Parent()->focused())
1173- .add("overlay_mode", overlay_mode());
1174+ .add("type", type_name)
1175+ .add("visible", IsVisible() && Parent()->opacity() != 0.0f)
1176+ .add("sensitive", Parent()->GetInputEventSensitivity())
1177+ .add("enabled", enabled())
1178+ .add("visual_state", state_name)
1179+ .add("opacity", Parent()->opacity())
1180+ .add("focused", Parent()->focused())
1181+ .add("overlay_mode", overlay_mode());
1182 }
1183 } // Internal Namespace
1184