on xenial help sign in
Merge Mircos changes
commit8e38d4d9dd6b1400a6b04de731a0f014b197ba7a authorChristopher Lee <chris.lee@canonical.com> dateThu 1 Aug 2013, 11:42 (13 years ago) parent361be38c6a2cd0
2 files changed+40−12
tests/autopilot/unity8/shell/emulators/create_interactive_notification.py+19 tests/autopilot/unity8/shell/tests/test_notifications.py+21−12
tests/autopilot/unity8/shell/emulators/create_interactive_notification.py+19
@@ -1,5 +1,24 @@
11#!/usr/bin/env python
22
3+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
4+#
5+# Unity Autopilot Test Suite
6+# Copyright (C) 2012-2013 Canonical
7+#
8+# This program is free software: you can redistribute it and/or modify
9+# it under the terms of the GNU General Public License as published by
10+# the Free Software Foundation, either version 3 of the License, or
11+# (at your option) any later version.
12+#
13+# This program is distributed in the hope that it will be useful,
14+# but WITHOUT ANY WARRANTY; without even the implied warranty of
15+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+# GNU General Public License for more details.
17+#
18+# You should have received a copy of the GNU General Public License
19+# along with this program. If not, see <http://www.gnu.org/licenses/>.
20+#
21+
322import argparse
423from gi.repository import GLib, Notify
524import signal
tests/autopilot/unity8/shell/tests/test_notifications.py+21−12
@@ -111,6 +111,7 @@ class InteractiveNotificationBase(NotificationsBase):
111111 self._notify_proc = None
112112
113113 def test_interactive(self):
114+ """Interactive notification must react upon click on itself."""
114115 self.launch_unity()
115116 greeter = self.main_window.get_greeter()
116117 greeter.unlock()
@@ -255,7 +256,6 @@ class InteractiveNotificationBase(NotificationsBase):
255256 stdout=subprocess.PIPE,
256257 stderr=subprocess.PIPE,
257258 close_fds=True,
258− preexec_fn=os.setsid
259259 )
260260
261261 self.addCleanup(self._tidy_up_script_process)
@@ -359,6 +359,7 @@ class EphemeralNotificationsTests(NotificationsBase):
359359 self._assert_notification(notification, summary, body, True, True, 1.0)
360360
361361 def test_icon_summary(self):
362+ """Notification must display the expected summary and secondary icon."""
362363 self.launch_unity()
363364 greeter = self.main_window.get_greeter()
364365 greeter.unlock()
@@ -396,6 +397,7 @@ class EphemeralNotificationsTests(NotificationsBase):
396397 )
397398
398399 def test_urgency_order(self):
400+ """Notifications must be displayed in order according to their urgency."""
399401 self.launch_unity()
400402 greeter = self.main_window.get_greeter()
401403 greeter.unlock()
@@ -486,6 +488,7 @@ class EphemeralNotificationsTests(NotificationsBase):
486488 )
487489
488490 def test_summary_and_body(self):
491+ """Notification must display the expected summary- and body-text."""
489492 self.launch_unity()
490493 greeter = self.main_window.get_greeter()
491494 greeter.unlock()
@@ -511,6 +514,7 @@ class EphemeralNotificationsTests(NotificationsBase):
511514 )
512515
513516 def test_summary_only(self):
517+ """Notification must display only the expected summary-text."""
514518 self.launch_unity()
515519 greeter = self.main_window.get_greeter()
516520 greeter.unlock()
@@ -528,19 +532,15 @@ class EphemeralNotificationsTests(NotificationsBase):
528532
529533 self._assert_notification(notification, summary, '', False, False, 1.0)
530534
531− def test_update_notification(self):
532− # Mirco, this should probably be split up into 2 tests, one for each
533− # layout type.
534− # Also, the sleeps should be changed to something similar to what is in
535− # the test "test_urgency_order" i.e. using the eventually matcher to
536− # ensure that the required notification etc. is displayed.
535+ def test_update_notification_same_layout(self):
536+ """Notification must allow updating its contents while being displayed."""
537537 self.launch_unity()
538538 greeter = self.main_window.get_greeter()
539539 greeter.unlock()
540540
541541 notify_list = self._get_notifications_list()
542542
543− summary = 'Inital notification (1. notification)'
543+ summary = 'Initial notification'
544544 body = 'This is the original content of this notification-bubble.'
545545 icon_path = self._get_icon_path('avatars/funky@12.png')
546546
@@ -563,7 +563,7 @@ class EphemeralNotificationsTests(NotificationsBase):
563563 )
564564
565565 time.sleep(3)
566− summary = 'Updated notification (1. notification)'
566+ summary = 'Updated notification'
567567 body = 'Here the same bubble with new title- and body-text, even ' \
568568 'the icon can be changed on the update.'
569569 icon_path = self._get_icon_path('avatars/amanda@12.png')
@@ -572,8 +572,15 @@ class EphemeralNotificationsTests(NotificationsBase):
572572 self.assertThat(get_notification, Eventually(NotEquals(None)))
573573 self._assert_notification(get_notification(), summary, body)
574574
575− time.sleep(6)
576− summary = 'Initial layout (2. notification)'
575+ def test_update_notification_layout_change(self):
576+ """Notification must allow updating its contents and layout while being displayed."""
577+ self.launch_unity()
578+ greeter = self.main_window.get_greeter()
579+ greeter.unlock()
580+
581+ notify_list = self._get_notifications_list()
582+
583+ summary = 'Initial layout'
577584 body = 'This bubble uses the icon-title-body layout with a ' \
578585 'secondary icon.'
579586 icon_path = self._get_icon_path('avatars/anna_olsson@12.png')
@@ -590,6 +597,7 @@ class EphemeralNotificationsTests(NotificationsBase):
590597 )
591598 notification.show()
592599
600+ get_notification = lambda: notify_list.select_single('Notification')
593601 self.assertThat(get_notification, Eventually(NotEquals(None)))
594602 self._assert_notification(
595603 get_notification(),
@@ -602,7 +610,7 @@ class EphemeralNotificationsTests(NotificationsBase):
602610
603611 time.sleep(3)
604612 notification.clear_hints()
605− summary = 'Updated layout (2. notification)'
613+ summary = 'Updated layout'
606614 body = 'After the update we now have a bubble using the title-body ' \
607615 'layout.'
608616 notification.update(summary, body, None)
@@ -612,6 +620,7 @@ class EphemeralNotificationsTests(NotificationsBase):
612620 self._assert_notification(get_notification(), summary, body, False)
613621
614622 def test_append_hint(self):
623+ """Notification has to accumulate body-text using append-hint."""
615624 self.launch_unity()
616625 greeter = self.main_window.get_greeter()
617626 greeter.unlock()