Merge lp:~elopio/ubuntu-calculator-app/swipe_to_delete into lp:~ubuntu-calculator-dev/ubuntu-calculator-app/old_trunk

Proposed by Leo Arias
Status: Merged
Approved by: Mihir Soni
Approved revision: 285
Merged at revision: 282
Proposed branch: lp:~elopio/ubuntu-calculator-app/swipe_to_delete
Merge into: lp:~ubuntu-calculator-dev/ubuntu-calculator-app/old_trunk
Diff against target: 97 lines (+30/-22)
2 files modified
tests/autopilot/ubuntu_calculator_app/emulators.py (+28/-20)
tests/autopilot/ubuntu_calculator_app/tests/test_simple_page.py (+2/-2)
To merge this branch: bzr merge lp:~elopio/ubuntu-calculator-app/swipe_to_delete
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Mihir Soni Approve
Christopher Lee (community) code review Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Chris Gagnon (community) Approve
Review via email: mp+223001@code.launchpad.net

Commit message

Updated the swipe to delete test to do the swipe to the right.

To post a comment you must log in.
Revision history for this message
Leo Arias (elopio) wrote :

The new version of ubuntu ui toolkit that's ready in a silo to land removed the swipe to delete from left to right. We need to update the test.

284. By Leo Arias

Reverted the pot change.

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Chris Gagnon (chris.gagnon) wrote :

lgtm

review: Approve
285. By Leo Arias

Added a link to the bug.

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Christopher Lee (veebers) wrote :

LGTM, thanks for adding the bug link.

review: Approve (code review)
Revision history for this message
Mihir Soni (mihirsoni) wrote :

Looks good to me.
Thanks.

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/ubuntu_calculator_app/emulators.py'
2--- tests/autopilot/ubuntu_calculator_app/emulators.py 2014-05-30 17:39:37 +0000
3+++ tests/autopilot/ubuntu_calculator_app/emulators.py 2014-06-12 22:26:00 +0000
4@@ -16,11 +16,17 @@
5
6 """Calculator app autopilot emulators."""
7
8+import logging
9+
10+import autopilot.logging
11 from autopilot.introspection import dbus
12
13 from ubuntuuitoolkit import emulators as toolkit_emulators
14
15
16+logger = logging.getLogger(__name__)
17+
18+
19 class MainView(toolkit_emulators.MainView):
20 """Calculator MainView Autopilot emulator."""
21
22@@ -120,10 +126,10 @@
23 """
24 self.swipe_previous_calculation_into_view(screen_index)
25 screen = self.get_screen_by_index(screen_index)
26- screen.swipe_to_left()
27+ screen.swipe_to_delete()
28 self._wait_for_screen_to_finish_animation()
29 if confirm:
30- screen.confirm_delete()
31+ screen.confirm_removal()
32 else:
33 raise NotImplementedError('Not yet implemented.')
34
35@@ -182,7 +188,7 @@
36 self.pointing_device.click_object(sign_button)
37
38
39-class Screen(toolkit_emulators.UbuntuUIToolkitEmulatorBase):
40+class Screen(toolkit_emulators.Standard):
41 """Screen Autopilot emulator."""
42
43 def __init__(self, *args):
44@@ -255,20 +261,22 @@
45 def _get_number_of_labels(self):
46 return len(self.select_many('CalcLabel'))
47
48- def swipe_to_left(self):
49- """Swipe the screen to the left.
50-
51- If it's an old calculation, a delete dialog will appear.
52-
53- """
54- x, y, w, h = self.globalRect
55- tx = x + (w - w / 8)
56- ty = y + (h / 2)
57- self.pointing_device.drag(tx, ty, (w / 10), ty)
58-
59- def confirm_delete(self):
60- """Confirm the deletion of the calculation."""
61- delete_item = self.select_single(
62- 'QQuickItem', objectName='confirmRemovalDialog')
63- """Click the icon"""
64- self.pointing_device.click_object(delete_item)
65+ @autopilot.logging.log_action(logger.info)
66+ def swipe_to_delete(self):
67+ """Swipe the screen to delete the calculation."""
68+ # We override it because the left side of the screen is used to
69+ # add labels, so the swipe has to start where the operation starts.
70+ # This is hard for a user to do, and weird for automation, which means
71+ # it's an usability issue. See http://pad.lv/1329536
72+ self._drag_pointing_device_to_delete()
73+ self.waitingConfirmationForRemoval.wait_for(True)
74+
75+ def _drag_pointing_device_to_delete(self):
76+ x, y, width, height = self.globalRect
77+ left_x = x + (width * 0.33)
78+ right_x = x + (width * 0.9)
79+ start_y = stop_y = y + (height // 2)
80+
81+ start_x = left_x
82+ stop_x = right_x
83+ self.pointing_device.drag(start_x, start_y, stop_x, stop_y)
84
85=== modified file 'tests/autopilot/ubuntu_calculator_app/tests/test_simple_page.py'
86--- tests/autopilot/ubuntu_calculator_app/tests/test_simple_page.py 2014-05-06 16:26:36 +0000
87+++ tests/autopilot/ubuntu_calculator_app/tests/test_simple_page.py 2014-06-12 22:26:00 +0000
88@@ -234,8 +234,8 @@
89 self.assertEquals(
90 self.main_view.get_screen_by_index(0).get_result(), "17")
91
92- def test_swipe_delete_calculation_right_left(self):
93- """Delete a calculation swiping it from right to left"""
94+ def test_swipe_to_delete_calculation(self):
95+ """Delete a calculation swiping on it to the side."""
96 self.main_view.calculate_operation("9+5")
97 self.main_view.clear_with_swipe()
98

Subscribers

People subscribed via source and target branches