Unity 8
 All Classes Functions
unity8.shell.tests.test_notifications.EphemeralNotificationsTests Class Reference
Inheritance diagram for unity8.shell.tests.test_notifications.EphemeralNotificationsTests:
Collaboration diagram for unity8.shell.tests.test_notifications.EphemeralNotificationsTests:

Public Member Functions

def setUp
 
def test_icon_summary_body
 
def test_icon_summary
 
def test_urgency_order
 
def test_summary_and_body
 
def test_summary_only
 
def test_update_notification_same_layout
 
def test_update_notification_layout_change
 
- Public Member Functions inherited from unity8.shell.tests.UnityTestCase
def setUpClass
 
def setUp
 
def launch_unity
 
def patch_lightdm_mock
 
def wait_for_unity
 
def get_dash
 
def main_window
 

Additional Inherited Members

- Public Attributes inherited from unity8.shell.tests.UnityTestCase
 touch
 
 unity_geometry_args
 
 grid_size
 
- Static Public Attributes inherited from unity8.shell.tests.test_notifications.NotificationsBase
tuple scenarios = _get_device_emulation_scenarios('Nexus4')
 

Detailed Description

Collection of tests for Emphemeral notifications (non-interactive.)

Definition at line 409 of file test_notifications.py.

Member Function Documentation

def unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_icon_summary (   self)
Notification must display the expected summary and secondary
icon.

Definition at line 455 of file test_notifications.py.

456  def test_icon_summary(self):
457  """Notification must display the expected summary and secondary
458  icon."""
459  unity_proxy = self.launch_unity()
460  unlock_unity(unity_proxy)
461 
462  notify_list = self._get_notifications_list()
463 
464  summary = "Upload of image completed"
465  icon_path = self._get_icon_path('applicationIcons/facebook.png')
466  hints=[]
467 
468  notification = shell.create_ephemeral_notification(
469  summary,
470  None,
471  icon_path,
472  hints,
473  "NORMAL",
474  )
475 
476  notification.show()
477 
478  notification = lambda: notify_list.wait_select_single(
479  'Notification', objectName='notification1')
481  notification(),
482  summary,
483  None,
484  True,
485  False,
486  1.0
487  )
def unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_icon_summary_body (   self)
Notification must display the expected summary and body text.

Definition at line 419 of file test_notifications.py.

420  def test_icon_summary_body(self):
421  """Notification must display the expected summary and body text."""
422  unity_proxy = self.launch_unity()
423  unlock_unity(unity_proxy)
424 
425  notify_list = self._get_notifications_list()
426 
427  summary = "Icon-Summary-Body"
428  body = "Hey pal, what's up with the party next weekend? Will you " \
429  "join me and Anna?"
430  icon_path = self._get_icon_path('avatars/anna_olsson.png')
431  hints = [
432  ("x-canonical-secondary-icon", "message")
433  ]
434 
435  notification = shell.create_ephemeral_notification(
436  summary,
437  body,
438  icon_path,
439  hints,
440  "NORMAL",
441  )
442 
443  notification.show()
444 
445  notification = lambda: notify_list.wait_select_single(
446  'Notification', objectName='notification1')
448  notification(),
449  summary,
450  body,
451  True,
452  True,
453  1.0,
454  )
def unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_summary_and_body (   self)
Notification must display the expected summary- and body-text.

Definition at line 576 of file test_notifications.py.

577  def test_summary_and_body(self):
578  """Notification must display the expected summary- and body-text."""
579  unity_proxy = self.launch_unity()
580  unlock_unity(unity_proxy)
581 
582  notify_list = self._get_notifications_list()
583 
584  summary = 'Summary-Body'
585  body = 'This is a superfluous notification'
586 
587  notification = shell.create_ephemeral_notification(summary, body)
588  notification.show()
589 
590  notification = notify_list.wait_select_single(
591  'Notification', objectName='notification1')
592 
594  notification,
595  summary,
596  body,
597  False,
598  False,
599  1.0
600  )
def unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_summary_only (   self)
Notification must display only the expected summary-text.

Definition at line 601 of file test_notifications.py.

602  def test_summary_only(self):
603  """Notification must display only the expected summary-text."""
604  unity_proxy = self.launch_unity()
605  unlock_unity(unity_proxy)
606 
607  notify_list = self._get_notifications_list()
608 
609  summary = 'Summary-Only'
610 
611  notification = shell.create_ephemeral_notification(summary)
612  notification.show()
613 
614  notification = notify_list.wait_select_single(
615  'Notification', objectName='notification1')
616 
617  self._assert_notification(notification, summary, '', False, False, 1.0)
def unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_update_notification_layout_change (   self)
Notification must allow updating its contents and layout while
being displayed.

Definition at line 657 of file test_notifications.py.

659  """Notification must allow updating its contents and layout while
660  being displayed."""
661  unity_proxy = self.launch_unity()
662  unlock_unity(unity_proxy)
663 
664  notify_list = self._get_notifications_list()
665 
666  summary = 'Initial layout'
667  body = 'This bubble uses the icon-title-body layout with a ' \
668  'secondary icon.'
669  icon_path = self._get_icon_path('avatars/anna_olsson.png')
670  hint_icon = 'dialer'
671 
672  notification = shell.create_ephemeral_notification(
673  summary,
674  body,
675  icon_path
676  )
677  notification.set_hint_string(
678  'x-canonical-secondary-icon',
679  hint_icon
680  )
681  notification.show()
682 
683  get_notification = lambda: notify_list.wait_select_single(
684  'Notification', objectName='notification1')
685 
687  get_notification(),
688  summary,
689  body,
690  True,
691  True,
692  1.0
693  )
694 
695  notification.clear_hints()
696  summary = 'Updated layout'
697  body = 'After the update we now have a bubble using the title-body ' \
698  'layout.'
699  notification.update(summary, body, None)
700  notification.show()
701 
702  self.assertThat(get_notification, Eventually(NotEquals(None)))
704  get_notification(), summary, body, False, False, 1.0)
def unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_update_notification_same_layout (   self)
Notification must allow updating its contents while being
displayed.

Definition at line 618 of file test_notifications.py.

620  """Notification must allow updating its contents while being
621  displayed."""
622  unity_proxy = self.launch_unity()
623  unlock_unity(unity_proxy)
624 
625  notify_list = self._get_notifications_list()
626 
627  summary = 'Initial notification'
628  body = 'This is the original content of this notification-bubble.'
629  icon_path = self._get_icon_path('avatars/funky.png')
630 
631  notification = shell.create_ephemeral_notification(
632  summary,
633  body,
634  icon_path
635  )
636  notification.show()
637 
638  get_notification = lambda: notify_list.wait_select_single(
639  'Notification', summary=summary)
641  get_notification(),
642  summary,
643  body,
644  True,
645  False,
646  1.0
647  )
648 
649  summary = 'Updated notification'
650  body = 'Here the same bubble with new title- and body-text, even ' \
651  'the icon can be changed on the update.'
652  icon_path = self._get_icon_path('avatars/amanda.png')
653  notification.update(summary, body, icon_path)
654  notification.show()
656  get_notification(), summary, body, True, False, 1.0)
def unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_urgency_order (   self)
Notifications must be displayed in order according to their
urgency.

Definition at line 488 of file test_notifications.py.

489  def test_urgency_order(self):
490  """Notifications must be displayed in order according to their
491  urgency."""
492  unity_proxy = self.launch_unity()
493  unlock_unity(unity_proxy)
494 
495  notify_list = self._get_notifications_list()
496 
497  summary_low = 'Low Urgency'
498  body_low = "No, I'd rather see paint dry, pal *yawn*"
499  icon_path_low = self._get_icon_path('avatars/amanda.png')
500 
501  summary_normal = 'Normal Urgency'
502  body_normal = "Hey pal, what's up with the party next weekend? Will " \
503  "you join me and Anna?"
504  icon_path_normal = self._get_icon_path('avatars/funky.png')
505 
506  summary_critical = 'Critical Urgency'
507  body_critical = 'Dude, this is so urgent you have no idea :)'
508  icon_path_critical = self._get_icon_path('avatars/anna_olsson.png')
509 
510  notification_normal = shell.create_ephemeral_notification(
511  summary_normal,
512  body_normal,
513  icon_path_normal,
514  urgency="NORMAL"
515  )
516  notification_normal.show()
517 
518  notification_low = shell.create_ephemeral_notification(
519  summary_low,
520  body_low,
521  icon_path_low,
522  urgency="LOW"
523  )
524  notification_low.show()
525 
526  notification_critical = shell.create_ephemeral_notification(
527  summary_critical,
528  body_critical,
529  icon_path_critical,
530  urgency="CRITICAL"
531  )
532  notification_critical.show()
533 
534  get_notification = lambda: notify_list.wait_select_single(
535  'Notification',
536  summary=summary_critical
537  )
538 
539  notification = get_notification()
541  notification,
542  summary_critical,
543  body_critical,
544  True,
545  False,
546  1.0
547  )
548 
549  get_normal_notification = lambda: notify_list.wait_select_single(
550  'Notification',
551  summary=summary_normal
552  )
553  notification = get_normal_notification()
555  notification,
556  summary_normal,
557  body_normal,
558  True,
559  False,
560  1.0
561  )
562 
563  get_low_notification = lambda: notify_list.wait_select_single(
564  'Notification',
565  summary=summary_low
566  )
567  notification = get_low_notification()
569  notification,
570  summary_low,
571  body_low,
572  True,
573  False,
574  1.0
575  )

The documentation for this class was generated from the following file: