Lomiri
Loading...
Searching...
No Matches
lomiri.shell.tests.test_notifications.EphemeralNotificationsTests Class Reference
Inheritance diagram for lomiri.shell.tests.test_notifications.EphemeralNotificationsTests:
Collaboration diagram for lomiri.shell.tests.test_notifications.EphemeralNotificationsTests:

Public Member Functions

 setUp (self)
 
 test_icon_summary_body (self)
 
 test_icon_summary (self)
 
 test_urgency_order (self)
 
 test_summary_and_body (self)
 
 test_summary_only (self)
 
 test_update_notification_same_layout (self)
 
 test_update_notification_layout_change (self)
 
 test_notification_helper (self)
 
- Public Member Functions inherited from lomiri.shell.tests.LomiriTestCase
 setUpClass (cls)
 
 launch_lomiri (self, mode="full-greeter", *args)
 
 patch_lightdm_mock (self)
 
 wait_for_lomiri (self)
 
 get_dash (self)
 
 main_window (self)
 

Additional Inherited Members

- Public Attributes inherited from lomiri.shell.tests.LomiriTestCase
 lomiri_geometry_args
 
 grid_size
 
- Static Public Attributes inherited from lomiri.shell.tests.test_notifications.NotificationsBase
 scenarios
 
- Protected Member Functions inherited from lomiri.shell.tests.test_notifications.NotificationsBase
 _get_icon_path (self, icon_name)
 
 _get_notifications_list (self)
 
 _assert_notification (self, notification, summary=None, body=None, icon=True, secondary_icon=False, opacity=None)
 
- Protected Member Functions inherited from lomiri.shell.tests.LomiriTestCase
 _setup_display_details (self)
 
 _determine_geometry (self)
 
 _setup_grid_size (self, scale_divisor)
 
 _geo_larger_than_display (self, width, height)
 
 _get_scaled_down_geo (self, width, height)
 
 _launch_lomiri_with_upstart (self, binary_path, args)
 
 _patch_data_dirs (self)
 
 _get_lightdm_mock_path (self)
 
 _set_proxy (self, proxy)
 
 _clear_proxy (self)
 
- Protected Attributes inherited from lomiri.shell.tests.LomiriTestCase
 _proxy
 
 _qml_mock_enabled
 
 _data_dirs_mock_enabled
 
 _environment
 
 _clear_proxy
 

Detailed Description

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

Definition at line 412 of file test_notifications.py.

Member Function Documentation

◆ setUp()

lomiri.shell.tests.test_notifications.EphemeralNotificationsTests.setUp (   self)

Reimplemented from lomiri.shell.tests.LomiriTestCase.

Definition at line 415 of file test_notifications.py.

415 def setUp(self):
416 super().setUp()
417 # Because we are using the Notify library we need to init and un-init
418 # otherwise we get crashes.
419 Notify.init("Autopilot Ephemeral Notification Tests")
420 self.addCleanup(Notify.uninit)
421

◆ test_icon_summary()

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

Definition at line 458 of file test_notifications.py.

458 def test_icon_summary(self):
459 """Notification must display the expected summary and secondary
460 icon."""
461 self.launch_lomiri()
462 unlock_lomiri()
463
464 notify_list = self._get_notifications_list()
465
466 summary = "Upload of image completed"
467 icon_path = self._get_icon_path('applicationIcons/facebook.png')
468 hints = []
469
470 notification = shell.create_ephemeral_notification(
471 summary,
472 None,
473 icon_path,
474 hints,
475 "NORMAL",
476 )
477
478 notification.show()
479
480 notification = lambda: notify_list.wait_select_single(
481 'Notification', objectName='notification0')
482 self._assert_notification(
483 notification(),
484 summary,
485 None,
486 True,
487 False,
488 1.0
489 )
490

◆ test_icon_summary_body()

lomiri.shell.tests.test_notifications.EphemeralNotificationsTests.test_icon_summary_body (   self)
Notification must display the expected summary and body text.

Definition at line 422 of file test_notifications.py.

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

◆ test_notification_helper()

lomiri.shell.tests.test_notifications.EphemeralNotificationsTests.test_notification_helper (   self)
 use the create notification script to get a notification dialog.
Check that the arguments passed to the script match the fields. 

Definition at line 708 of file test_notifications.py.

708 def test_notification_helper(self):
709 """ use the create notification script to get a notification dialog.
710 Check that the arguments passed to the script match the fields. """
711
712 self.launch_lomiri()
713 unlock_lomiri()
714
715 summary = 'Helper summary'
716 body = 'Helper body'
717
718 notification = shell.create_ephemeral_notification(summary, body)
719 notification.show()
720
721 notification_data = self.main_window.wait_for_notification()
722
723 self.assertThat(notification_data['summary'],
724 Eventually(Equals(summary)))
725 self.assertThat(notification_data['body'], Eventually(Equals(body)))

◆ test_summary_and_body()

lomiri.shell.tests.test_notifications.EphemeralNotificationsTests.test_summary_and_body (   self)
Notification must display the expected summary- and body-text.

Definition at line 579 of file test_notifications.py.

579 def test_summary_and_body(self):
580 """Notification must display the expected summary- and body-text."""
581 self.launch_lomiri()
582 unlock_lomiri()
583
584 notify_list = self._get_notifications_list()
585
586 summary = 'Summary-Body'
587 body = 'This is a superfluous notification'
588
589 notification = shell.create_ephemeral_notification(summary, body)
590 notification.show()
591
592 notification = notify_list.wait_select_single(
593 'Notification', objectName='notification0')
594
595 self._assert_notification(
596 notification,
597 summary,
598 body,
599 False,
600 False,
601 1.0
602 )
603

◆ test_summary_only()

lomiri.shell.tests.test_notifications.EphemeralNotificationsTests.test_summary_only (   self)
Notification must display only the expected summary-text.

Definition at line 604 of file test_notifications.py.

604 def test_summary_only(self):
605 """Notification must display only the expected summary-text."""
606 self.launch_lomiri()
607 unlock_lomiri()
608
609 notify_list = self._get_notifications_list()
610
611 summary = 'Summary-Only'
612
613 notification = shell.create_ephemeral_notification(summary)
614 notification.show()
615
616 notification = notify_list.wait_select_single(
617 'Notification', objectName='notification0')
618
619 self._assert_notification(notification, summary, '', False, False, 1.0)
620

◆ test_update_notification_layout_change()

lomiri.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 660 of file test_notifications.py.

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

◆ test_update_notification_same_layout()

lomiri.shell.tests.test_notifications.EphemeralNotificationsTests.test_update_notification_same_layout (   self)
Notification must allow updating its contents while being
displayed.

Definition at line 621 of file test_notifications.py.

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

◆ test_urgency_order()

lomiri.shell.tests.test_notifications.EphemeralNotificationsTests.test_urgency_order (   self)
Notifications must be displayed in order according to their
urgency.

Definition at line 491 of file test_notifications.py.

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

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