Merge lp:~nskaggs/ubuntu-calendar-app/fix-aptest-monthview-swipes into lp:ubuntu-calendar-app

Proposed by Nicholas Skaggs
Status: Merged
Approved by: Nicholas Skaggs
Approved revision: 118
Merged at revision: 114
Proposed branch: lp:~nskaggs/ubuntu-calendar-app/fix-aptest-monthview-swipes
Merge into: lp:ubuntu-calendar-app
Diff against target: 72 lines (+34/-17)
1 file modified
tests/autopilot/calendar_app/tests/test_monthview.py (+34/-17)
To merge this branch: bzr merge lp:~nskaggs/ubuntu-calendar-app/fix-aptest-monthview-swipes
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Ubuntu Calendar Developers Pending
Review via email: mp+185147@code.launchpad.net

Commit message

Fix broken tests in lab by changing swipe and asserts for MonthView https://bugs.launchpad.net/ubuntu-calendar-app/+bug/1220908

Description of the change

Fix broken tests in lab by changing swipe and asserts for MonthView https://bugs.launchpad.net/ubuntu-calendar-app/+bug/1220908

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
115. By Nicholas Skaggs

fix pep8

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
116. By Nicholas Skaggs

fix pyflakes

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
117. By Nicholas Skaggs

fix pep8 issues :-(

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
118. By Nicholas Skaggs

fix year tests

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
Olivier Tilloy (osomon) wrote :

Looks like I’m chiming in late…

Can you please enlighten me on what this changeset actually changes, apart from making the code much more verbose and broken if abs(delta) > 24 ?

If the goal was only to change the start and stop points used for the swipe gesture, the diff could have been much smaller, no?

Revision history for this message
Olivier Tilloy (osomon) wrote :

Seeing that this change didn’t fix the failures it was meant to address, and that it introduces a regression (for abs(delta) > 24 as pointed out above), I submitted a MR to revert it: https://code.launchpad.net/~osomon/ubuntu-calendar-app/revert-useless-revision/+merge/185779.

Revision history for this message
Olivier Tilloy (osomon) wrote :

Also, next time please do not approve your own MR without requesting a review by another developer. This defeats the point of submitting code for review, and bypasses the quality policy.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/calendar_app/tests/test_monthview.py'
2--- tests/autopilot/calendar_app/tests/test_monthview.py 2013-08-31 03:15:01 +0000
3+++ tests/autopilot/calendar_app/tests/test_monthview.py 2013-09-11 20:57:34 +0000
4@@ -12,12 +12,9 @@
5 from autopilot.matchers import Eventually
6 from testtools.matchers import Equals
7
8-import math
9-
10 from calendar_app.tests import CalendarTestCase
11
12 from datetime import datetime
13-from dateutil.relativedelta import relativedelta
14
15
16 class TestMonthView(CalendarTestCase):
17@@ -28,21 +25,41 @@
18
19 def change_month(self, delta):
20 month_view = self.main_view.get_month_view()
21- y_line = month_view.globalRect[1] + month_view.globalRect[3] / 2
22- x_pad = 0.15
23- sign = int(math.copysign(1, delta))
24- start = (-sign * x_pad) % 1
25- stop = (sign * x_pad) % 1
26- x_start = month_view.globalRect[0] + month_view.globalRect[2] * start
27- x_stop = month_view.globalRect[0] + month_view.globalRect[2] * stop
28+ x, y, w, h = month_view.globalRect
29+ tx = x + (w / 3)
30+ ty = y + (h / 3)
31+
32+ #swipe to change page
33 for i in range(abs(delta)):
34- before = self.get_currentDayStart()
35- self.pointing_device.drag(x_start, y_line, x_stop, y_line)
36- after = before + relativedelta(months=sign)
37- self.assertThat(lambda: self.get_currentDayStart().month,
38- Eventually(Equals(after.month)))
39- self.assertThat(lambda: self.get_currentDayStart().year,
40- Eventually(Equals(after.year)))
41+ currentMonth = self.get_currentDayStart().month
42+ currentYear = self.get_currentDayStart().year
43+ if delta < 0:
44+ #swipe backward
45+ self.pointing_device.drag(tx, ty, tx + (w / 2), ty)
46+ diff = -1
47+ else:
48+ #swipe forward
49+ self.pointing_device.drag(tx + (w / 2), ty, tx, ty)
50+ diff = 1
51+
52+ #check for switched ui
53+ if currentMonth + diff <= 12 and currentMonth + diff > 0:
54+ self.assertThat(lambda: self.get_currentDayStart().month,
55+ Eventually(Equals(currentMonth + diff)))
56+ self.assertThat(lambda: self.get_currentDayStart().year,
57+ Eventually(Equals(currentYear)))
58+ else:
59+ self.assertThat(lambda: self.get_currentDayStart().year,
60+ Eventually(Equals(currentYear + diff)))
61+ #account for rolled over months
62+ if currentMonth + diff > 12:
63+ newMonth = currentMonth + diff - 12
64+ self.assertThat(lambda: self.get_currentDayStart().month,
65+ Eventually(Equals(newMonth)))
66+ else:
67+ newMonth = currentMonth + diff + 12
68+ self.assertThat(lambda: self.get_currentDayStart().month,
69+ Eventually(Equals(newMonth)))
70
71 def _test_go_to_today(self, delta):
72 start = self.get_currentDayStart()

Subscribers

People subscribed via source and target branches

to status/vote changes: