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

Static Public Attributes

 scenarios
 

Protected Member Functions

 _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)
 

Additional Inherited Members

- Public Member Functions inherited from lomiri.shell.tests.LomiriTestCase
 setUpClass (cls)
 
 setUp (self)
 
 launch_lomiri (self, mode="full-greeter", *args)
 
 patch_lightdm_mock (self)
 
 wait_for_lomiri (self)
 
 get_dash (self)
 
 main_window (self)
 
- Public Attributes inherited from lomiri.shell.tests.LomiriTestCase
 lomiri_geometry_args
 
 grid_size
 
- Protected Attributes inherited from lomiri.shell.tests.LomiriTestCase
 _proxy
 
 _qml_mock_enabled
 
 _data_dirs_mock_enabled
 
 _environment
 
 _clear_proxy
 

Detailed Description

Base class for all notification tests that provides helper methods.

Definition at line 41 of file test_notifications.py.

Member Function Documentation

◆ _assert_notification()

lomiri.shell.tests.test_notifications.NotificationsBase._assert_notification (   self,
  notification,
  summary = None,
  body = None,
  icon = True,
  secondary_icon = False,
  opacity = None 
)
protected
Assert that the expected qualities of a notification are as
expected.

Definition at line 72 of file test_notifications.py.

80 ):
81 """Assert that the expected qualities of a notification are as
82 expected.
83
84 """
85
86 if summary is not None:
87 self.assertThat(notification.summary, Eventually(Equals(summary)))
88
89 if body is not None:
90 self.assertThat(notification.body, Eventually(Equals(body)))
91
92 if icon:
93 self.assertThat(notification.iconSource, Eventually(NotEquals("")))
94 else:
95 self.assertThat(notification.iconSource, Eventually(Equals("")))
96
97 if secondary_icon:
98 self.assertThat(
99 notification.secondaryIconSource,
100 Eventually(NotEquals(""))
101 )
102 else:
103 self.assertThat(
104 notification.secondaryIconSource,
105 Eventually(Equals(""))
106 )
107
108 if opacity is not None:
109 self.assertThat(notification.opacity, Eventually(Equals(opacity)))
110
111

◆ _get_icon_path()

lomiri.shell.tests.test_notifications.NotificationsBase._get_icon_path (   self,
  icon_name 
)
protected
Given an icons file name returns the full path (either system or
source tree.

Consider the graphics directory as root so for example (running tests
from installed lomiri-autopilot package):
>>> self.get_icon_path('clock.png')
/usr/share/lomiri/graphics/clock.png

>>> self.get_icon_path('applicationIcons/facebook.png')
/usr/share/lomiri/graphics/applicationIcons/facebook.png

Definition at line 47 of file test_notifications.py.

47 def _get_icon_path(self, icon_name):
48 """Given an icons file name returns the full path (either system or
49 source tree.
50
51 Consider the graphics directory as root so for example (running tests
52 from installed lomiri-autopilot package):
53 >>> self.get_icon_path('clock.png')
54 /usr/share/lomiri/graphics/clock.png
55
56 >>> self.get_icon_path('applicationIcons/facebook.png')
57 /usr/share/lomiri/graphics/applicationIcons/facebook.png
58
59 """
60 if os.path.abspath(__file__).startswith('/usr/'):
61 return '/usr/share/lomiri/graphics/' + icon_name
62 else:
63 return os.path.dirname(__file__) + (
64 "/../../../../../tests/graphics/" + icon_name)
65

◆ _get_notifications_list()

lomiri.shell.tests.test_notifications.NotificationsBase._get_notifications_list (   self)
protected

Definition at line 66 of file test_notifications.py.

66 def _get_notifications_list(self):
67 return self.main_window.select_single(
68 "Notifications",
69 objectName='notificationList'
70 )
71

Member Data Documentation

◆ scenarios

lomiri.shell.tests.test_notifications.NotificationsBase.scenarios
static
Initial value:
= lomiri_scenarios.get_device_simulation_scenarios(
lomiri_scenarios.NEXUS4_DEVICE)

Definition at line 44 of file test_notifications.py.


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