13
13
get_available_input_engines,
15
15
from autopilot.emulators.unity.dash import Dash
16
from autopilot.emulators.unity.hud import HudController
16
17
from autopilot.emulators.X11 import Keyboard
17
18
from autopilot.tests import AutopilotTestCase
32
34
set_active_engines(self._old_engines)
33
35
super(IBusTests, self).tearDown()
37
def get_hud_controller(self):
38
controllers = HudController.get_all_instances()
39
self.assertEqual(1, len(controllers))
35
42
def activate_input_engine_or_skip(self, engine_name):
36
43
available_engines = get_available_input_engines()
37
44
if engine_name in available_engines:
118
125
self.dash.ensure_hidden()
120
127
self.assertEqual(self.result, dash_search_string)
130
class IBusTestsPinyinIgnore(IBusTests):
131
"""Tests for ignoring key events while the Pinyin input engine is active."""
133
def test_ignore_key_events_on_dash(self):
134
self.activate_input_engine_or_skip("pinyin")
135
self.dash.ensure_visible()
139
self.kb.type("cipan")
140
self.kb.press_and_release("Tab")
142
dash_search_string = self.dash.get_searchbar().search_string
143
self.deactivate_ibus()
144
self.dash.ensure_hidden()
146
self.assertNotEqual(" ", dash_search_string)
148
def test_ignore_key_events_on_hud(self):
149
self.activate_input_engine_or_skip("pinyin")
150
self.hud.toggle_reveal()
156
old_selected = self.hud.selected_button
158
self.keyboard.press_and_release("Down")
159
new_selected = self.hud.selected_button
160
self.deactivate_ibus()
161
self.hud.toggle_reveal()
163
self.assertEqual(old_selected, new_selected)
166
class IBusTestsAnthyIgnore(IBusTests):
167
"""Tests for ignoring key events while the Anthy input engine is active."""
169
def test_ignore_key_events_on_dash(self):
170
self.activate_input_engine_or_skip("anthy")
171
self.dash.ensure_visible()
175
self.kb.type("shisutemu ")
176
self.kb.press_and_release("Tab")
177
self.kb.press_and_release("Ctrl+j")
178
dash_search_string = self.dash.get_searchbar().search_string
179
self.deactivate_ibus()
180
self.dash.ensure_hidden()
182
self.assertNotEqual("", dash_search_string)
184
def test_ignore_key_events_on_hud(self):
185
self.activate_input_engine_or_skip("anthy")
186
self.hud.toggle_reveal()
191
self.kb.type("hiduke")
192
old_selected = self.hud.selected_button
193
self.kb.press_and_release("Down")
194
new_selected = self.hud.selected_button
195
self.deactivate_ibus()
196
self.hud.toggle_reveal()
198
self.assertEqual(old_selected, new_selected)