Merge lp:~brandontschaefer/unity/ap-ibus-test-fixes into lp:unity

Proposed by Brandon Schaefer on 2012-05-14
Status: Merged
Approved by: Brandon Schaefer on 2012-05-14
Approved revision: 2354
Merged at revision: 2355
Proposed branch: lp:~brandontschaefer/unity/ap-ibus-test-fixes
Merge into: lp:unity
Diff against target: 107 lines (+30/-5)
2 files modified
tests/autopilot/autopilot/emulators/ibus.py (+5/-0)
tests/autopilot/autopilot/tests/test_ibus.py (+25/-5)
To merge this branch: bzr merge lp:~brandontschaefer/unity/ap-ibus-test-fixes
Reviewer Review Type Date Requested Status
Thomi Richards (community) 2012-05-14 Approve on 2012-05-14
Review via email: mp+105595@code.launchpad.net

Commit Message

Fixes ibus pinyin and hangul ap test

Description of the Change

== Problem ==
All the ibus test fail

== Fix ==
They were failing because of an option in ibus that doesn't allow using of different ibus-engines from your local. This is now toggled on. The Anthy test seem to still have a problem, but this fixes Pinyin and Hangul.

To post a comment you must log in.
Thomi Richards (thomir) wrote :

+1

review: Approve
Unity Merger (unity-merger) wrote :

No commit message specified.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/autopilot/emulators/ibus.py'
2--- tests/autopilot/autopilot/emulators/ibus.py 2012-04-02 20:18:58 +0000
3+++ tests/autopilot/autopilot/emulators/ibus.py 2012-05-14 01:42:19 +0000
4@@ -69,6 +69,11 @@
5
6 bus = get_ibus_bus()
7 config = bus.get_config()
8+
9+ config.set_value("general",
10+ "preload_engine_mode",
11+ ibus.common.PRELOAD_ENGINE_MODE_USER)
12+
13 old_engines = get_active_input_engines()
14 config.set_list("general", "preload_engines", engine_list, "s")
15 # need to restart the ibus bus before it'll pick up the new engine.
16
17=== modified file 'tests/autopilot/autopilot/tests/test_ibus.py'
18--- tests/autopilot/autopilot/tests/test_ibus.py 2012-04-25 04:34:55 +0000
19+++ tests/autopilot/autopilot/tests/test_ibus.py 2012-05-14 01:42:19 +0000
20@@ -11,6 +11,7 @@
21 from testtools.matchers import Equals, NotEquals
22
23 from autopilot.emulators.ibus import (
24+ get_active_input_engines,
25 set_active_engines,
26 get_available_input_engines,
27 )
28@@ -30,20 +31,19 @@
29 @classmethod
30 def setUpClass(cls):
31 cls._old_engines = None
32- cls.activate_input_engine_or_skip(cls.engine_name)
33
34 @classmethod
35 def tearDownClass(cls):
36 if cls._old_engines is not None:
37 set_active_engines(cls._old_engines)
38
39- @classmethod
40- def activate_input_engine_or_skip(cls, engine_name):
41+ def activate_input_engine_or_skip(self, engine_name):
42 available_engines = get_available_input_engines()
43 if engine_name in available_engines:
44- cls._old_engines = set_active_engines([engine_name])
45+ if get_active_input_engines() != [engine_name]:
46+ IBusTests._old_engines = set_active_engines([engine_name])
47 else:
48- raise AutopilotTestCase.skipException("This test requires the '%s' engine to be installed." % (engine_name))
49+ self.skip("This test requires the '%s' engine to be installed." % (engine_name))
50
51 def activate_ibus(self, widget):
52 """Activate IBus, and wait till it's actived on 'widget'"""
53@@ -93,6 +93,10 @@
54 ('disk_management', {'input': 'cipan guanli ', 'result': u'\u78c1\u76d8\u7ba1\u7406'}),
55 ]
56
57+ def setUp(self):
58+ super(IBusTestsPinyin, self).setUp()
59+ self.activate_input_engine_or_skip(self.engine_name)
60+
61 def test_simple_input_dash(self):
62 self.do_dash_test_with_engine()
63
64@@ -111,6 +115,10 @@
65 ('document', {'input': 'anstj ', 'result': u'\ubb38\uc11c '}),
66 ]
67
68+ def setUp(self):
69+ super(IBusTestsHangul, self).setUp()
70+ self.activate_input_engine_or_skip(self.engine_name)
71+
72 def test_simple_input_dash(self):
73 self.do_dash_test_with_engine()
74
75@@ -135,6 +143,10 @@
76 ]
77 )
78
79+ def setUp(self):
80+ super(IBusTestsAnthy, self).setUp()
81+ self.activate_input_engine_or_skip(self.engine_name)
82+
83 def test_simple_input_dash(self):
84 self.do_dash_test_with_engine()
85
86@@ -147,6 +159,10 @@
87
88 engine_name = "pinyin"
89
90+ def setUp(self):
91+ super(IBusTestsPinyinIgnore, self).setUp()
92+ self.activate_input_engine_or_skip(self.engine_name)
93+
94 def test_ignore_key_events_on_dash(self):
95 self.dash.ensure_visible()
96 self.addCleanup(self.dash.ensure_hidden)
97@@ -177,6 +193,10 @@
98
99 engine_name = "anthy"
100
101+ def setUp(self):
102+ super(IBusTestsAnthyIgnore, self).setUp()
103+ self.activate_input_engine_or_skip(self.engine_name)
104+
105 def test_ignore_key_events_on_dash(self):
106 self.dash.ensure_visible()
107 self.addCleanup(self.dash.ensure_hidden)