← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~nskaggs/ubuntu-calendar-app/fix-illogical-tests into lp:ubuntu-calendar-app

 

Nicholas Skaggs has proposed merging lp:~nskaggs/ubuntu-calendar-app/fix-illogical-tests into lp:ubuntu-calendar-app.

Commit message:
Fix common test failures in trunk by removing illogical bits and locale specifics that don't test well.

Requested reviews:
  Ubuntu Calendar Developers (ubuntu-calendar-dev)

For more details, see:
https://code.launchpad.net/~nskaggs/ubuntu-calendar-app/fix-illogical-tests/+merge/259841

Fix common test failures in trunk by removing illogical bits and locale specifics that don't test well.
-- 
Your team Ubuntu Calendar Developers is requested to review the proposed merge of lp:~nskaggs/ubuntu-calendar-app/fix-illogical-tests into lp:ubuntu-calendar-app.
=== modified file 'tests/autopilot/calendar_app/tests/test_dayview.py'
--- tests/autopilot/calendar_app/tests/test_dayview.py	2015-05-07 18:06:41 +0000
+++ tests/autopilot/calendar_app/tests/test_dayview.py	2015-05-21 19:34:18 +0000
@@ -75,23 +75,6 @@
         self.assertEquals(
             self.day_view.get_datelabel(today).text, str(now.day))
 
-        # 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)
-        # Checking week number is  correct
-        self.assertEquals(
-            self.day_view.get_weeknumer(today).text, 'W' + str(week))
-
         # Check  day is scrolled to the current time
         self.assertEquals(self.day_view.get_scrollHour(), now.hour)
 

=== modified file 'tests/autopilot/calendar_app/tests/test_weekview.py'
--- tests/autopilot/calendar_app/tests/test_weekview.py	2015-05-09 02:20:09 +0000
+++ tests/autopilot/calendar_app/tests/test_weekview.py	2015-05-21 19:34:18 +0000
@@ -156,21 +156,13 @@
 
     def test_selecting_a_day_switches_to_day_view(self):
         """It must be possible to show a single day by clicking on it."""
-        days = self.week_view.get_days_of_week()
         today = datetime.datetime.now()
-
-        # selecting today
-        index = 0
-        for i in range(len(days)):
-            if days[i] == today.day:
-                index = i
-
-        day_to_select = self.app.main_view.get_label_with_text(days[index])
-        expected_day = days[index]
-        dayStart = self.week_view.firstDay
-        expected_month = dayStart.month
-        expected_year = dayStart.year
-
+        day_to_select = self.week_view.get_current_headerdatecomponent(today)
+
+        expected_day = day_to_select.date.day
+        expected_month = day_to_select.date.month
+        expected_year = day_to_select.date.year
+        
         self.app.pointing_device.click_object(day_to_select)
 
         # Check that the view changed from 'Week' to 'Day'
@@ -178,12 +170,8 @@
         self.assertThat(day_view.visible, Eventually(Equals(True)))
 
         # Check that the 'Day' view is on the correct/selected day.
-        selected_date = \
-            self.app.main_view.get_day_view().get_selected_day().startDay
-
-        logger.debug(expected_day)
-        logger.debug(selected_date)
-
-        self.assertThat(expected_day, Equals(selected_date.day))
-        self.assertThat(expected_month, Equals(selected_date.month))
-        self.assertThat(expected_year, Equals(selected_date.year))
+        day = self.app.main_view.get_day_view().get_selected_day().startDay
+        
+        self.assertThat(expected_day, Equals(day.day))
+        self.assertThat(expected_month, Equals(day.month))
+        self.assertThat(expected_year, Equals(day.year))


Follow ups