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
=== modified file 'tests/autopilot/calendar_app/tests/test_monthview.py'
--- tests/autopilot/calendar_app/tests/test_monthview.py 2013-08-31 03:15:01 +0000
+++ tests/autopilot/calendar_app/tests/test_monthview.py 2013-09-11 20:57:34 +0000
@@ -12,12 +12,9 @@
12from autopilot.matchers import Eventually12from autopilot.matchers import Eventually
13from testtools.matchers import Equals13from testtools.matchers import Equals
1414
15import math
16
17from calendar_app.tests import CalendarTestCase15from calendar_app.tests import CalendarTestCase
1816
19from datetime import datetime17from datetime import datetime
20from dateutil.relativedelta import relativedelta
2118
2219
23class TestMonthView(CalendarTestCase):20class TestMonthView(CalendarTestCase):
@@ -28,21 +25,41 @@
2825
29 def change_month(self, delta):26 def change_month(self, delta):
30 month_view = self.main_view.get_month_view()27 month_view = self.main_view.get_month_view()
31 y_line = month_view.globalRect[1] + month_view.globalRect[3] / 228 x, y, w, h = month_view.globalRect
32 x_pad = 0.1529 tx = x + (w / 3)
33 sign = int(math.copysign(1, delta))30 ty = y + (h / 3)
34 start = (-sign * x_pad) % 131
35 stop = (sign * x_pad) % 132 #swipe to change page
36 x_start = month_view.globalRect[0] + month_view.globalRect[2] * start
37 x_stop = month_view.globalRect[0] + month_view.globalRect[2] * stop
38 for i in range(abs(delta)):33 for i in range(abs(delta)):
39 before = self.get_currentDayStart()34 currentMonth = self.get_currentDayStart().month
40 self.pointing_device.drag(x_start, y_line, x_stop, y_line)35 currentYear = self.get_currentDayStart().year
41 after = before + relativedelta(months=sign)36 if delta < 0:
42 self.assertThat(lambda: self.get_currentDayStart().month,37 #swipe backward
43 Eventually(Equals(after.month)))38 self.pointing_device.drag(tx, ty, tx + (w / 2), ty)
44 self.assertThat(lambda: self.get_currentDayStart().year,39 diff = -1
45 Eventually(Equals(after.year)))40 else:
41 #swipe forward
42 self.pointing_device.drag(tx + (w / 2), ty, tx, ty)
43 diff = 1
44
45 #check for switched ui
46 if currentMonth + diff <= 12 and currentMonth + diff > 0:
47 self.assertThat(lambda: self.get_currentDayStart().month,
48 Eventually(Equals(currentMonth + diff)))
49 self.assertThat(lambda: self.get_currentDayStart().year,
50 Eventually(Equals(currentYear)))
51 else:
52 self.assertThat(lambda: self.get_currentDayStart().year,
53 Eventually(Equals(currentYear + diff)))
54 #account for rolled over months
55 if currentMonth + diff > 12:
56 newMonth = currentMonth + diff - 12
57 self.assertThat(lambda: self.get_currentDayStart().month,
58 Eventually(Equals(newMonth)))
59 else:
60 newMonth = currentMonth + diff + 12
61 self.assertThat(lambda: self.get_currentDayStart().month,
62 Eventually(Equals(newMonth)))
4663
47 def _test_go_to_today(self, delta):64 def _test_go_to_today(self, delta):
48 start = self.get_currentDayStart()65 start = self.get_currentDayStart()

Subscribers

People subscribed via source and target branches

to status/vote changes: