← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~carla-sella/ubuntu-calendar-app/fix-dayview-default-view into lp:ubuntu-calendar-app

 

Carla Sella has proposed merging lp:~carla-sella/ubuntu-calendar-app/fix-dayview-default-view into lp:ubuntu-calendar-app with lp:~pkunal-parmar/ubuntu-calendar-app/WeekNumber as a prerequisite.

Commit message:
Fixing weed number issue in DayView test default view.

Requested reviews:
  Nicholas Skaggs (nskaggs)

For more details, see:
https://code.launchpad.net/~carla-sella/ubuntu-calendar-app/fix-dayview-default-view/+merge/257814

Fixes Week number issue in  DayView test default view.
-- 
Your team Ubuntu Calendar Developers is subscribed to branch lp:ubuntu-calendar-app.
=== modified file 'tests/autopilot/calendar_app/__init__.py'
--- tests/autopilot/calendar_app/__init__.py	2015-04-17 19:49:43 +0000
+++ tests/autopilot/calendar_app/__init__.py	2015-05-07 18:07:15 +0000
@@ -647,8 +647,7 @@
 
     @autopilot.logging.log_action(logger.info)
     def get_timeline_header(self, day):
-        """Return the dayheader for a given day. If no day is given,
-        return the current day.
+        """Return the dayheader for a given day.
 
         :param day:  day in date(year, month, day) format
         :return: The day header object

=== modified file 'tests/autopilot/calendar_app/tests/test_dayview.py'
--- tests/autopilot/calendar_app/tests/test_dayview.py	2015-05-07 18:07:15 +0000
+++ tests/autopilot/calendar_app/tests/test_dayview.py	2015-05-07 18:07:15 +0000
@@ -75,8 +75,16 @@
         self.assertEquals(
             self.day_view.get_datelabel(today).text, str(now.day))
 
-        week = int(now.strftime("%U"))+1
+        # Qt locale will return 0 for Sunday as first day of week
+        # and will return 1 for monday.
+        first_day_of_week = self.day_view.get_timeline_header(today).\
+            firstDayOfWeek
+        if first_day_of_week == 1:
+            week = int(now.strftime("%W"))+1
+        elif first_day_of_week == 0:
+            week = int(now.strftime("%U"))+1
 
+        logger.warn(first_day_of_week)
         logger.warn(now)
         logger.warn(str(week))
         logger.warn(self.day_view.get_weeknumer(today).text)


Follow ups