Merge lp:~elopio/gallery-app/workaround1302706-fix1302706-click_toolbar_button_failure into lp:gallery-app

Proposed by Leo Arias
Status: Merged
Approved by: Bill Filler
Approved revision: 943
Merged at revision: 948
Proposed branch: lp:~elopio/gallery-app/workaround1302706-fix1302706-click_toolbar_button_failure
Merge into: lp:gallery-app
Diff against target: 49 lines (+33/-1)
1 file modified
tests/autopilot/gallery_app/emulators/toolbar.py (+33/-1)
To merge this branch: bzr merge lp:~elopio/gallery-app/workaround1302706-fix1302706-click_toolbar_button_failure
Reviewer Review Type Date Requested Status
Bill Filler (community) Approve
PS Jenkins bot continuous-integration Needs Fixing
Review via email: mp+214310@code.launchpad.net

Commit message

    On the autopilot helpers to click a toolbar button, check that the toolbar is opened first.

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
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Bill Filler (bfiller) wrote :

approved

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/gallery_app/emulators/toolbar.py'
2--- tests/autopilot/gallery_app/emulators/toolbar.py 2013-11-03 22:47:55 +0000
3+++ tests/autopilot/gallery_app/emulators/toolbar.py 2014-04-04 16:55:41 +0000
4@@ -1,5 +1,5 @@
5 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
6-# Copyright 2013 Canonical
7+# Copyright 2013, 2014 Canonical
8 #
9 # This program is free software: you can redistribute it and/or modify it
10 # under the terms of the GNU General Public License version 3, as published
11@@ -15,6 +15,38 @@
12 class Toolbar(toolkit_emulators.Toolbar):
13 """An emulator class that makes it easy to interact with the tool bar"""
14
15+ def click_button(self, object_name):
16+ """Click a button of the toolbar.
17+
18+ The toolbar should be opened before clicking the button, or an
19+ exception will be raised. If the toolbar is closed for some reason
20+ (e.g., timer finishes) after moving the mouse cursor and before
21+ clicking the button, it is re-opened automatically by this function.
22+
23+ Overriden from the toolkit because of bug http://pad.lv/1302706
24+ TODO remove this method once that bug is fixed on the toolkit.
25+ --elopio - 2014-04-04
26+
27+ :parameter object_name: The QML objectName property of the button.
28+ :raise ToolkitEmulatorException: If there is no button with that object
29+ name.
30+
31+ """
32+ # ensure the toolbar is open
33+ if not self.opened:
34+ raise toolkit_emulators.ToolkitEmulatorException(
35+ 'Toolbar must be opened before calling click_button().')
36+ try:
37+ button = self._get_button(object_name)
38+ except StateNotFoundError:
39+ raise toolkit_emulators.ToolkitEmulatorException(
40+ 'Button with objectName "{0}" not found.'.format(object_name))
41+ self.pointing_device.move_to_object(button)
42+ # ensure the toolbar is still open (may have closed due to timeout)
43+ self.open()
44+ # click the button
45+ self.pointing_device.click_object(button)
46+
47 def click_custom_button(self, object_name):
48 try:
49 button = self.select_single('Button', objectName=object_name)

Subscribers

People subscribed via source and target branches

to all changes: