← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~carla-sella/ubuntu-calendar-app/current-day-month-year-selected into lp:ubuntu-calendar-app

 

Carla Sella has proposed merging lp:~carla-sella/ubuntu-calendar-app/current-day-month-year-selected into lp:ubuntu-calendar-app.

Commit message:
Autopilot test for Calendar App.

Requested reviews:
  Nicholas Skaggs (nskaggs)
Related bugs:
  Bug #1426068 in Ubuntu Calendar App: "Autopilot test: monthview test suite need updated"
  https://bugs.launchpad.net/ubuntu-calendar-app/+bug/1426068

For more details, see:
https://code.launchpad.net/~carla-sella/ubuntu-calendar-app/current-day-month-year-selected/+merge/251387

Updating monthview test suite.
-- 
Your team Ubuntu Calendar Developers is subscribed to branch lp:ubuntu-calendar-app.
=== modified file 'MonthView.qml'
--- MonthView.qml	2015-02-18 19:27:20 +0000
+++ MonthView.qml	2015-03-01 14:08:04 +0000
@@ -50,6 +50,7 @@
         ]
 
         contents: Label {
+            objectName:"monthYearLabel"
             fontSize: "x-large"
             // TRANSLATORS: this is a time formatting string,
             // see http://qt-project.org/doc/qt-5/qml-qtqml-date.html#details for valid expressions.

=== modified file 'tests/autopilot/calendar_app/__init__.py'
--- tests/autopilot/calendar_app/__init__.py	2015-02-26 18:26:10 +0000
+++ tests/autopilot/calendar_app/__init__.py	2015-03-01 14:08:04 +0000
@@ -386,6 +386,9 @@
         month = self.get_current_month()
         return month.currentMonth.datetime.strftime("%B")
 
+    def get_current_selected_day(self):
+        return self.select_many('MonthComponentDateDelegate', isToday=True)
+
 
 class DayView(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
 

=== modified file 'tests/autopilot/calendar_app/tests/test_monthview.py'
--- tests/autopilot/calendar_app/tests/test_monthview.py	2014-09-04 16:04:37 +0000
+++ tests/autopilot/calendar_app/tests/test_monthview.py	2015-03-01 14:08:04 +0000
@@ -25,7 +25,7 @@
 
 from calendar_app.tests import CalendarAppTestCase
 
-from datetime import datetime
+import datetime
 from dateutil.relativedelta import relativedelta
 
 
@@ -96,3 +96,17 @@
 
     def test_monthview_go_to_today_prev_year(self):
         self._go_to_today(-12)
+
+    def test_current_day_month_and_year_is_selected(self):
+        """By default, the day view shows the current month and year."""
+        now = datetime.datetime.now()
+        expected_month_name_year = now.strftime("%B %Y")
+
+        self.assertThat(self.app.main_view.get_month_year(self.month_view),
+                        Equals(expected_month_name_year))
+
+        expected_day = str(int(now.strftime("%d")))
+        selected_day = self.month_view.get_current_selected_day()[0]
+
+        self.assertThat(selected_day.select_single('Label').text,
+                        Equals(expected_day))


Follow ups