Back to index

unity  6.0.0
Public Member Functions | Static Public Attributes
unity.tests.test_hud.HudLockedLauncherInteractionsTests Class Reference
Inheritance diagram for unity.tests.test_hud.HudLockedLauncherInteractionsTests:
Inheritance graph
[legend]
Collaboration diagram for unity.tests.test_hud.HudLockedLauncherInteractionsTests:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def setUp
def test_hud_launcher_icon_hides_bfb
def test_hud_desaturates_launcher_icons
def test_hud_launcher_icon_click_hides_hud
def tearDown
def get_num_active_launcher_icons
def check_test_behavior
def dash
def hud
def launcher
def panels
def switcher
def window_manager
def workspace
def set_unity_log_level
def assertNumberWinsIsEventually

Static Public Attributes

tuple scenarios = _make_monitor_scenarios()

Detailed Description

Definition at line 315 of file test_hud.py.


Member Function Documentation

def unity.tests.UnityTestCase.assertNumberWinsIsEventually (   self,
  app,
  num 
) [inherited]
Asserts that 'app' eventually has 'num' wins. Waits up to 10 seconds.

Definition at line 196 of file __init__.py.

00196 
00197     def assertNumberWinsIsEventually(self, app, num):
00198         """Asserts that 'app' eventually has 'num' wins. Waits up to 10 seconds."""
00199 
00200         self.assertThat(lambda: len(app.get_windows()), Eventually(Equals(num)))

Here is the caller graph for this function:

Fail the test if it did something naughty.

This includes leaving the dash or the hud open, changing the current
workspace, or leaving the system in show_desktop mode.

Definition at line 56 of file __init__.py.

00056 
00057     def check_test_behavior(self):
00058         """Fail the test if it did something naughty.
00059 
00060         This includes leaving the dash or the hud open, changing the current
00061         workspace, or leaving the system in show_desktop mode.
00062 
00063         """
00064         well_behaved = True
00065         reasons = []
00066         log.info("Checking system state for badly behaving test...")
00067 
00068         # Have we switched workspace?
00069         if self.workspace.current_workspace != self._initial_workspace_num:
00070             well_behaved = False
00071             reasons.append("The test changed the active workspace from %d to %d." \
00072                 % (self._initial_workspace_num, self.workspace.current_workspace))
00073             log.warning("Test changed the active workspace, changing it back...")
00074             self.workspace.switch_to(self._initial_workspace_num)
00075         # Have we left the dash open?
00076         if self.dash.visible:
00077             well_behaved = False
00078             reasons.append("The test left the dash open.")
00079             log.warning("Test left the dash open, closing it...")
00080             self.dash.ensure_hidden()
00081         # ... or the hud?
00082         if self.hud.visible:
00083             well_behaved = False
00084             reasons.append("The test left the hud open.")
00085             log.warning("Test left the hud open, closing it...")
00086             self.hud.ensure_hidden()
00087         # Are we in show desktop mode?
00088         if self.window_manager.showdesktop_active:
00089             well_behaved = False
00090             reasons.append("The test left the system in show_desktop mode.")
00091             log.warning("Test left the system in show desktop mode, exiting it...")
00092             self.window_manager.leave_show_desktop()
00093         for launcher in self.launcher.get_launchers():
00094             if launcher.in_keynav_mode:
00095                 well_behaved = False
00096                 reasons.append("The test left the launcher keynav mode enabled.")
00097                 log.warning("Test left the launcher in keynav mode, exiting it...")
00098                 launcher.key_nav_cancel()
00099             if launcher.in_switcher_mode:
00100                 well_behaved = False
00101                 reasons.append("The test left the launcher in switcher mode.")
00102                 log.warning("Test left the launcher in switcher mode, exiting it...")
00103                 launcher.switcher_cancel()
00104 
00105         if not well_behaved:
00106             self.fail("/n".join(reasons))
00107         else:
00108             log.info("Test was well behaved.")

def unity.tests.UnityTestCase.dash (   self) [inherited]

Definition at line 110 of file __init__.py.

00110 
00111     def dash(self):
00112         if not getattr(self, '__dash', None):
00113             self.__dash = Dash()
00114         return self.__dash

Definition at line 51 of file test_hud.py.

00051 
00052     def get_num_active_launcher_icons(self):
00053         num_active = 0
00054         for icon in self.launcher.model.get_launcher_icons():
00055             if icon.active and icon.visible:
00056                 num_active += 1
00057         return num_active
00058 

Here is the caller graph for this function:

def unity.tests.UnityTestCase.hud (   self) [inherited]

Definition at line 116 of file __init__.py.

00116 
00117     def hud(self):
00118         if not getattr(self, '__hud', None):
00119             self.__hud = Hud();
00120         return self.__hud

def unity.tests.UnityTestCase.launcher (   self) [inherited]

Definition at line 122 of file __init__.py.

00122 
00123     def launcher(self):
00124         if not getattr(self, '__launcher', None):
00125             self.__launcher = self._get_launcher_controller()
00126         return self.__launcher

def unity.tests.UnityTestCase.panels (   self) [inherited]

Definition at line 128 of file __init__.py.

00128 
00129     def panels(self):
00130         if not getattr(self, '__panels', None):
00131             self.__panels = self._get_panel_controller()
00132         return self.__panels

def unity.tests.UnityTestCase.set_unity_log_level (   self,
  component,
  level 
) [inherited]
Set the unity log level for 'component' to 'level'.

Valid levels are: TRACE, DEBUG, INFO, WARNING and ERROR.

Components are dotted unity component names. The empty string specifies
the root logging component.

Definition at line 183 of file __init__.py.

00183 
00184     def set_unity_log_level(self, component, level):
00185         """Set the unity log level for 'component' to 'level'.
00186 
00187         Valid levels are: TRACE, DEBUG, INFO, WARNING and ERROR.
00188 
00189         Components are dotted unity component names. The empty string specifies
00190         the root logging component.
00191         """
00192         valid_levels = ('TRACE', 'DEBUG', 'INFO', 'WARN', 'WARNING', 'ERROR')
00193         if level not in valid_levels:
00194             raise ValueError("Log level '%s' must be one of: %r" % (level, valid_levels))
00195         set_log_severity(component, level)

Here is the call graph for this function:

Here is the caller graph for this function:

Reimplemented from unity.tests.test_hud.HudTestsBase.

Definition at line 319 of file test_hud.py.

00319 
00320     def setUp(self):
00321         super(HudLockedLauncherInteractionsTests, self).setUp()
00322         # Locked Launchers on all monitors
00323         self.set_unity_option('num_launchers', 0)
00324         self.set_unity_option('launcher_hide_mode', 0)
00325 
00326         self.screen_geo.move_mouse_to_monitor(self.hud_monitor)
00327         sleep(0.5)

def unity.tests.UnityTestCase.switcher (   self) [inherited]

Definition at line 134 of file __init__.py.

00134 
00135     def switcher(self):
00136         if not getattr(self, '__switcher', None):
00137             self.__switcher = Switcher()
00138         return self.__switcher

def unity.tests.test_hud.HudTestsBase.tearDown (   self) [inherited]

Definition at line 47 of file test_hud.py.

00047 
00048     def tearDown(self):
00049         self.hud.ensure_hidden()
00050         super(HudTestsBase, self).tearDown()

Launcher icons must desaturate when the HUD is opened.

Definition at line 345 of file test_hud.py.

00345 
00346     def test_hud_desaturates_launcher_icons(self):
00347         """Launcher icons must desaturate when the HUD is opened."""
00348 
00349         self.hud.ensure_visible()
00350 
00351         for icon in self.launcher.model.get_launcher_icons_for_monitor(self.hud_monitor):
00352             if isinstance(icon, HudLauncherIcon):
00353                 self.assertFalse(icon.desaturated)
00354             else:
00355                 self.assertTrue(icon.desaturated)

Clicking the Hud Icon should hide the HUD

Definition at line 356 of file test_hud.py.

00356 
00357     def test_hud_launcher_icon_click_hides_hud(self):
00358         """Clicking the Hud Icon should hide the HUD"""
00359 
00360         hud_icon = self.hud.get_launcher_icon()
00361         self.hud.ensure_visible()
00362 
00363         launcher = self.launcher.get_launcher_for_monitor(self.hud_monitor)
00364         launcher.click_launcher_icon(hud_icon)
00365 
00366         self.assertThat(self.hud.visible, Eventually(Equals(False)))
00367         self.assertThat(hud_icon.visible, Eventually(Equals(False)))
00368 

BFB icon must be hidden when the HUD launcher icon is shown.

Definition at line 328 of file test_hud.py.

00328 
00329     def test_hud_launcher_icon_hides_bfb(self):
00330         """BFB icon must be hidden when the HUD launcher icon is shown."""
00331 
00332         hud_icon = self.hud.get_launcher_icon()
00333         bfb_icon = self.launcher.model.get_bfb_icon()
00334 
00335         self.assertThat(bfb_icon.visible, Eventually(Equals(True)))
00336         self.assertTrue(bfb_icon.is_on_monitor(self.hud_monitor))
00337         self.assertThat(hud_icon.visible, Eventually(Equals(False)))
00338 
00339         self.hud.ensure_visible()
00340 
00341         self.assertThat(hud_icon.visible, Eventually(Equals(True)))
00342         self.assertTrue(hud_icon.is_on_monitor(self.hud_monitor))
00343         # For some reason the BFB icon is always visible :-/
00344         #bfb_icon.visible, Eventually(Equals(False)

def unity.tests.UnityTestCase.window_manager (   self) [inherited]

Definition at line 140 of file __init__.py.

00140 
00141     def window_manager(self):
00142         if not getattr(self, '__window_manager', None):
00143             self.__window_manager = self._get_window_manager()
00144         return self.__window_manager

def unity.tests.UnityTestCase.workspace (   self) [inherited]

Definition at line 146 of file __init__.py.

00146 
00147     def workspace(self):
00148         if not getattr(self, '__workspace', None):
00149             self.__workspace = WorkspaceManager()
00150         return self.__workspace


Member Data Documentation

Definition at line 317 of file test_hud.py.


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