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

## 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
list | lomiri_geometry_args = []
int | grid_size = 8
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 = None
bool | _qml_mock_enabled = True
bool | _data_dirs_mock_enabled = True
dict | _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.

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

## 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.

def test_icon_summary(self):
"""Notification must display the expected summary and secondary
icon."""
self.launch_lomiri()
unlock_lomiri()
notify_list = self._get_notifications_list()
summary = "Upload of image completed"
icon_path = self._get_icon_path('applicationIcons/facebook.png')
hints = []
notification = shell.create_ephemeral_notification(
summary,
None,
icon_path,
hints,
"NORMAL",
)
notification.show()
notification = lambda: notify_list.wait_select_single(
'Notification', objectName='notification0')
self._assert_notification(
notification(),
summary,
None,
True,
False,
1.0
)

## 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.

def test_icon_summary_body(self):
"""Notification must display the expected summary and body text."""
self.launch_lomiri()
unlock_lomiri()
notify_list = self._get_notifications_list()
summary = "Icon-Summary-Body"
body = "Hey pal, what's up with the party next weekend? Will you " \
"join me and Anna?"
icon_path = self._get_icon_path('avatars/anna_olsson.png')
hints = [
("x-lomiri-secondary-icon", "message")
]
notification = shell.create_ephemeral_notification(
summary,
body,
icon_path,
hints,
"NORMAL",
)
notification.show()
notification = lambda: notify_list.wait_select_single(
'Notification', objectName='notification0')
self._assert_notification(
notification(),
summary,
body,
True,
True,
1.0,
)

## 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.

def 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. """
self.launch_lomiri()
unlock_lomiri()
summary = 'Helper summary'
body = 'Helper body'
notification = shell.create_ephemeral_notification(summary, body)
notification.show()
notification_data = self.main_window.wait_for_notification()
self.assertThat(notification_data['summary'],
Eventually(Equals(summary)))
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.

def test_summary_and_body(self):
"""Notification must display the expected summary- and body-text."""
self.launch_lomiri()
unlock_lomiri()
notify_list = self._get_notifications_list()
summary = 'Summary-Body'
body = 'This is a superfluous notification'
notification = shell.create_ephemeral_notification(summary, body)
notification.show()
notification = notify_list.wait_select_single(
'Notification', objectName='notification0')
self._assert_notification(
notification,
summary,
body,
False,
False,
1.0
)

## 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.

def test_summary_only(self):
"""Notification must display only the expected summary-text."""
self.launch_lomiri()
unlock_lomiri()
notify_list = self._get_notifications_list()
summary = 'Summary-Only'
notification = shell.create_ephemeral_notification(summary)
notification.show()
notification = notify_list.wait_select_single(
'Notification', objectName='notification0')
self._assert_notification(notification, summary, '', False, False, 1.0)

## 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.

def test_update_notification_layout_change(self):
"""Notification must allow updating its contents and layout while
being displayed."""
self.launch_lomiri()
unlock_lomiri()
notify_list = self._get_notifications_list()
summary = 'Initial layout'
body = 'This bubble uses the icon-title-body layout with a ' \
'secondary icon.'
icon_path = self._get_icon_path('avatars/anna_olsson.png')
hint_icon = 'dialer'
notification = shell.create_ephemeral_notification(
summary,
body,
icon_path
)
notification.set_hint_string(
'x-lomiri-secondary-icon',
hint_icon
)
notification.show()
get_notification = lambda: notify_list.wait_select_single(
'Notification', objectName='notification0')
self._assert_notification(
get_notification(),
summary,
body,
True,
True,
1.0
)
notification.clear_hints()
summary = 'Updated layout'
body = 'After the update we now have a bubble using the title-body ' \
'layout.'
notification.update(summary, body, None)
notification.show()
self.assertThat(get_notification, Eventually(NotEquals(None)))
self._assert_notification(
get_notification(), summary, body, False, False, 1.0)

## 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.

def test_update_notification_same_layout(self):
"""Notification must allow updating its contents while being
displayed."""
self.launch_lomiri()
unlock_lomiri()
notify_list = self._get_notifications_list()
summary = 'Initial notification'
body = 'This is the original content of this notification-bubble.'
icon_path = self._get_icon_path('avatars/funky.png')
notification = shell.create_ephemeral_notification(
summary,
body,
icon_path
)
notification.show()
get_notification = lambda: notify_list.wait_select_single(
'Notification', summary=summary)
self._assert_notification(
get_notification(),
summary,
body,
True,
False,
1.0
)
summary = 'Updated notification'
body = 'Here the same bubble with new title- and body-text, even ' \
'the icon can be changed on the update.'
icon_path = self._get_icon_path('avatars/amanda.png')
notification.update(summary, body, icon_path)
notification.show()
self._assert_notification(
get_notification(), summary, body, True, False, 1.0)

## 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.

def test_urgency_order(self):
"""Notifications must be displayed in order according to their
urgency."""
self.launch_lomiri()
unlock_lomiri()
notify_list = self._get_notifications_list()
summary_low = 'Low Urgency'
body_low = "No, I'd rather see paint dry, pal *yawn*"
icon_path_low = self._get_icon_path('avatars/amanda.png')
summary_normal = 'Normal Urgency'
body_normal = "Hey pal, what's up with the party next weekend? Will " \
"you join me and Anna?"
icon_path_normal = self._get_icon_path('avatars/funky.png')
summary_critical = 'Critical Urgency'
body_critical = 'Dude, this is so urgent you have no idea :)'
icon_path_critical = self._get_icon_path('avatars/anna_olsson.png')
notification_normal = shell.create_ephemeral_notification(
summary_normal,
body_normal,
icon_path_normal,
urgency="NORMAL"
)
notification_normal.show()
notification_low = shell.create_ephemeral_notification(
summary_low,
body_low,
icon_path_low,
urgency="LOW"
)
notification_low.show()
notification_critical = shell.create_ephemeral_notification(
summary_critical,
body_critical,
icon_path_critical,
urgency="CRITICAL"
)
notification_critical.show()
get_notification = lambda: notify_list.wait_select_single(
'Notification',
summary=summary_critical
)
notification = get_notification()
self._assert_notification(
notification,
summary_critical,
body_critical,
True,
False,
1.0
)
get_normal_notification = lambda: notify_list.wait_select_single(
'Notification',
summary=summary_normal
)
notification = get_normal_notification()
self._assert_notification(
notification,
summary_normal,
body_normal,
True,
False,
1.0
)
get_low_notification = lambda: notify_list.wait_select_single(
'Notification',
summary=summary_low
)
notification = get_low_notification()
self._assert_notification(
notification,
summary_low,
body_low,
True,
False,
1.0
)

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

- tests/autopilot/lomiri/shell/tests/test_notifications.py