Back to index

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

List of all members.

Public Member Functions

def setUp
def test_simple_input_dash
def test_simple_input_hud
def tearDown
def setUpClass
def tearDownClass
def activate_input_engine_or_skip
def activate_ibus
def deactivate_ibus
def do_dash_test_with_engine
def do_hud_test_with_engine
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

string engine_name = "hangul"
list scenarios

Detailed Description

Tests for the Hangul(Korean) input engine.

Definition at line 110 of file test_ibus.py.


Member Function Documentation

def unity.tests.test_ibus.IBusTests.activate_ibus (   self,
  widget 
) [inherited]
Activate IBus, and wait till it's actived on 'widget'

Definition at line 51 of file test_ibus.py.

00051 
00052     def activate_ibus(self, widget):
00053         """Activate IBus, and wait till it's actived on 'widget'"""
00054         self.assertThat(widget.im_active, Equals(False))
00055         self.keyboard.press_and_release('Ctrl+Space', 0.05)
00056         self.assertThat(widget.im_active, Eventually(Equals(True)))

Here is the caller graph for this function:

def unity.tests.test_ibus.IBusTests.activate_input_engine_or_skip (   self,
  engine_name 
) [inherited]

Definition at line 43 of file test_ibus.py.

00043 
00044     def activate_input_engine_or_skip(self, engine_name):
00045         available_engines = get_available_input_engines()
00046         if engine_name in available_engines:
00047             if get_active_input_engines() != [engine_name]:
00048                 IBusTests._old_engines = set_active_engines([engine_name])
00049         else:
00050             self.skip("This test requires the '%s' engine to be installed." % (engine_name))

Here is the caller graph for this function:

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

def unity.tests.test_ibus.IBusTests.deactivate_ibus (   self,
  widget 
) [inherited]
Deactivate ibus, and wait till it's inactive on 'widget'

Definition at line 57 of file test_ibus.py.

00057 
00058     def deactivate_ibus(self, widget):
00059         """Deactivate ibus, and wait till it's inactive on 'widget'"""
00060         self.assertThat(widget.im_active, Equals(True))
00061         self.keyboard.press_and_release('Ctrl+Space', 0.05)
00062         self.assertThat(widget.im_active, Eventually(Equals(False)))

Here is the caller graph for this function:

Definition at line 63 of file test_ibus.py.

00063 
00064     def do_dash_test_with_engine(self):
00065         self.dash.ensure_visible()
00066         self.addCleanup(self.dash.ensure_hidden)
00067         self.activate_ibus(self.dash.searchbar)
00068         self.keyboard.type(self.input)
00069         commit_key = getattr(self, 'commit_key', None)
00070         if commit_key:
00071             self.keyboard.press_and_release(commit_key)
00072         self.deactivate_ibus(self.dash.searchbar)
00073         self.assertThat(self.dash.search_string, Eventually(Equals(self.result)))

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 74 of file test_ibus.py.

00074 
00075     def do_hud_test_with_engine(self):
00076         self.hud.ensure_visible()
00077         self.addCleanup(self.hud.ensure_hidden)
00078         self.activate_ibus(self.hud.searchbar)
00079         self.keyboard.type(self.input)
00080         commit_key = getattr(self, 'commit_key', None)
00081         if commit_key:
00082             self.keyboard.press_and_release(commit_key)
00083         self.deactivate_ibus(self.hud.searchbar)
00084         self.assertThat(self.hud.search_string, Eventually(Equals(self.result)))
00085 

Here is the call graph for this function:

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_ibus.IBusTests.

Definition at line 121 of file test_ibus.py.

00121 
00122     def setUp(self):
00123         super(IBusTestsHangul, self).setUp()
00124         self.activate_input_engine_or_skip(self.engine_name)

Here is the call graph for this function:

def unity.tests.test_ibus.IBusTests.setUpClass (   cls) [inherited]

Definition at line 35 of file test_ibus.py.

00035 
00036     def setUpClass(cls):
00037         cls._old_engines = None

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_ibus.IBusTests.tearDown (   self) [inherited]

Definition at line 31 of file test_ibus.py.

00031 
00032     def tearDown(self):
00033         super(IBusTests, self).tearDown()

Definition at line 39 of file test_ibus.py.

00039 
00040     def tearDownClass(cls):
00041         if cls._old_engines is not None:
00042             set_active_engines(cls._old_engines)

Definition at line 125 of file test_ibus.py.

Here is the call graph for this function:

Definition at line 128 of file test_ibus.py.

00128 
00129     def test_simple_input_hud(self):
00130         self.do_hud_test_with_engine()
00131 

Here is the call graph for this function:

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 113 of file test_ibus.py.

Initial value:
[
        ('transmission', {'input': 'xmfostmaltus ', 'result': u'\ud2b8\ub79c\uc2a4\ubbf8\uc158 '}),
        ('social', {'input': 'httuf ', 'result': u'\uc18c\uc15c '}),
        ('document', {'input': 'anstj ', 'result': u'\ubb38\uc11c '}),
        ]

Definition at line 115 of file test_ibus.py.


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