|
|
866890 |
diff -Nru ibus-table-1.9.18/engine/table.py ibus-table-1.9.18.new/engine/table.py
|
|
|
866890 |
--- ibus-table-1.9.18/engine/table.py 2020-07-23 17:21:31.934904346 +0200
|
|
|
866890 |
+++ ibus-table-1.9.18.new/engine/table.py 2020-07-23 17:28:19.342746241 +0200
|
|
|
866890 |
@@ -1752,6 +1752,9 @@
|
|
|
866890 |
self._input_mode)
|
|
|
866890 |
self._update_ui()
|
|
|
866890 |
|
|
|
866890 |
+ def get_pinyin_mode(self):
|
|
|
866890 |
+ return self._editor._py_mode
|
|
|
866890 |
+
|
|
|
866890 |
def set_onechar_mode(self, mode=False, update_dconf=True):
|
|
|
866890 |
if mode == self._editor._onechar:
|
|
|
866890 |
return
|
|
|
866890 |
diff -Nru ibus-table-1.9.18/tests/test_0_gtk.py ibus-table-1.9.18.new/tests/test_0_gtk.py
|
|
|
866890 |
--- ibus-table-1.9.18/tests/test_0_gtk.py 2020-07-23 17:21:31.940904285 +0200
|
|
|
866890 |
+++ ibus-table-1.9.18.new/tests/test_0_gtk.py 2020-07-23 17:37:23.234210681 +0200
|
|
|
866890 |
@@ -205,14 +205,14 @@
|
|
|
866890 |
object_path = '%s/%d' % (self.ENGINE_PATH, self.__id)
|
|
|
866890 |
db_dir = '/usr/share/ibus-table/tables'
|
|
|
866890 |
db_file = os.path.join(db_dir, engine_name + '.db')
|
|
|
866890 |
- database = tabsqlitedb.TabSqliteDb(filename=db_file, user_db=':memory:')
|
|
|
866890 |
- self.__engine = table.TabEngine(
|
|
|
866890 |
+ database = tabsqlitedb.tabsqlitedb(filename=db_file, user_db=':memory:')
|
|
|
866890 |
+ self.__engine = table.tabengine(
|
|
|
866890 |
self.__bus,
|
|
|
866890 |
object_path,
|
|
|
866890 |
database)
|
|
|
866890 |
self.__engine.connect('focus-in', self.__engine_focus_in)
|
|
|
866890 |
self.__engine.connect('focus-out', self.__engine_focus_out)
|
|
|
866890 |
- # FIXME: Need to connect 'reset' after TabEngine.clear_all_input_and_preedit()
|
|
|
866890 |
+ # FIXME: Need to connect 'reset' after tabengine.clear_all_input_and_preedit()
|
|
|
866890 |
# is called.
|
|
|
866890 |
self.__engine.connect_after('reset', self.__engine_reset)
|
|
|
866890 |
self.__bus.get_connection().signal_subscribe(
|
|
|
866890 |
diff -Nru ibus-table-1.9.18/tests/test_it.py ibus-table-1.9.18.new/tests/test_it.py
|
|
|
866890 |
--- ibus-table-1.9.18/tests/test_it.py 2020-07-23 17:21:31.940904285 +0200
|
|
|
866890 |
+++ ibus-table-1.9.18.new/tests/test_it.py 2020-07-23 17:29:52.032800325 +0200
|
|
|
866890 |
@@ -78,7 +78,6 @@
|
|
|
866890 |
ORIG_SINGLE_WILDCARD_CHAR = None
|
|
|
866890 |
ORIG_MULTI_WILDCARD_CHAR = None
|
|
|
866890 |
ORIG_PINYIN_MODE = None
|
|
|
866890 |
-ORIG_SUGGESTION_MODE = None
|
|
|
866890 |
|
|
|
866890 |
def backup_original_settings():
|
|
|
866890 |
global ENGINE
|
|
|
866890 |
@@ -97,7 +96,6 @@
|
|
|
866890 |
global ORIG_SINGLE_WILDCARD_CHAR
|
|
|
866890 |
global ORIG_MULTI_WILDCARD_CHAR
|
|
|
866890 |
global ORIG_PINYIN_MODE
|
|
|
866890 |
- global ORIG_SUGGESTION_MODE
|
|
|
866890 |
ORIG_INPUT_MODE = ENGINE.get_input_mode()
|
|
|
866890 |
ORIG_CHINESE_MODE = ENGINE.get_chinese_mode()
|
|
|
866890 |
ORIG_LETTER_WIDTH = ENGINE.get_letter_width()
|
|
|
866890 |
@@ -113,7 +111,6 @@
|
|
|
866890 |
ORIG_SINGLE_WILDCARD_CHAR = ENGINE.get_single_wildcard_char()
|
|
|
866890 |
ORIG_MULTI_WILDCARD_CHAR = ENGINE.get_multi_wildcard_char()
|
|
|
866890 |
ORIG_PINYIN_MODE = ENGINE.get_pinyin_mode()
|
|
|
866890 |
- ORIG_SUGGESTION_MODE = ENGINE.get_suggestion_mode()
|
|
|
866890 |
|
|
|
866890 |
def restore_original_settings():
|
|
|
866890 |
global ENGINE
|
|
|
866890 |
@@ -132,7 +129,6 @@
|
|
|
866890 |
global ORIG_SINGLE_WILDCARD_CHAR
|
|
|
866890 |
global ORIG_MULTI_WILDCARD_CHAR
|
|
|
866890 |
global ORIG_PINYIN_MODE
|
|
|
866890 |
- global ORIG_SUGGESTION_MODE
|
|
|
866890 |
ENGINE.set_input_mode(ORIG_INPUT_MODE)
|
|
|
866890 |
ENGINE.set_chinese_mode(ORIG_CHINESE_MODE)
|
|
|
866890 |
ENGINE.set_letter_width(ORIG_LETTER_WIDTH[0], input_mode=0)
|
|
|
866890 |
@@ -150,7 +146,6 @@
|
|
|
866890 |
ENGINE.set_single_wildcard_char(ORIG_SINGLE_WILDCARD_CHAR)
|
|
|
866890 |
ENGINE.set_multi_wildcard_char(ORIG_MULTI_WILDCARD_CHAR)
|
|
|
866890 |
ENGINE.set_pinyin_mode(ORIG_PINYIN_MODE)
|
|
|
866890 |
- ENGINE.set_suggestion_mode(ORIG_SUGGESTION_MODE)
|
|
|
866890 |
|
|
|
866890 |
def set_default_settings():
|
|
|
866890 |
global ENGINE
|
|
|
866890 |
@@ -256,7 +251,6 @@
|
|
|
866890 |
ENGINE.set_multi_wildcard_char(multi_wildcard_char)
|
|
|
866890 |
|
|
|
866890 |
ENGINE.set_pinyin_mode(False)
|
|
|
866890 |
- ENGINE.set_suggestion_mode(False)
|
|
|
866890 |
|
|
|
866890 |
def set_up(engine_name):
|
|
|
866890 |
'''
|
|
|
866890 |
@@ -290,7 +284,7 @@
|
|
|
866890 |
assert IBus.PropList is not IBUS_PROP_LIST
|
|
|
866890 |
assert IBus.PropList is MockPropList
|
|
|
866890 |
# Reload the table module so that the patches
|
|
|
866890 |
- # are applied to TabEngine:
|
|
|
866890 |
+ # are applied to tabengine:
|
|
|
866890 |
sys.path.insert(0, '../engine')
|
|
|
866890 |
importlib.reload(table)
|
|
|
866890 |
sys.path.pop(0)
|
|
|
866890 |
@@ -302,9 +296,9 @@
|
|
|
866890 |
ENGINE = None
|
|
|
866890 |
tear_down()
|
|
|
866890 |
return False
|
|
|
866890 |
- TABSQLITEDB = tabsqlitedb.TabSqliteDb(
|
|
|
866890 |
+ TABSQLITEDB = tabsqlitedb.tabsqlitedb(
|
|
|
866890 |
filename=db_file, user_db=':memory:')
|
|
|
866890 |
- ENGINE = table.TabEngine(
|
|
|
866890 |
+ ENGINE = table.tabengine(
|
|
|
866890 |
bus,
|
|
|
866890 |
'/com/redhat/IBus/engines/table/%s/engine/0' %engine_name,
|
|
|
866890 |
TABSQLITEDB,
|
|
|
866890 |
@@ -380,59 +374,6 @@
|
|
|
866890 |
self.assertEqual(ENGINE.mock_preedit_text, '')
|
|
|
866890 |
self.assertEqual(ENGINE.mock_committed_text, '工爱工')
|
|
|
866890 |
|
|
|
866890 |
- def test_suggestion_mode(self):
|
|
|
866890 |
- if not ENGINE._ime_sg:
|
|
|
866890 |
- self.skipTest("This engine does not have a suggestion mode.")
|
|
|
866890 |
- # Suggestion mode is False by default:
|
|
|
866890 |
- self.assertEqual(ENGINE.get_suggestion_mode(), False)
|
|
|
866890 |
- self.assertEqual(ENGINE.get_pinyin_mode(), False)
|
|
|
866890 |
- ENGINE.do_process_key_event(IBus.KEY_a, 0, 0)
|
|
|
866890 |
- self.assertEqual(ENGINE.mock_preedit_text, '工')
|
|
|
866890 |
- ENGINE.do_process_key_event(IBus.KEY_space, 0, 0)
|
|
|
866890 |
- self.assertEqual(ENGINE.mock_preedit_text, '')
|
|
|
866890 |
- self.assertEqual(ENGINE.mock_committed_text, '工')
|
|
|
866890 |
- self.assertEqual(ENGINE._editor._lookup_table.mock_candidates, [])
|
|
|
866890 |
- ENGINE.set_suggestion_mode(True)
|
|
|
866890 |
- ENGINE.do_process_key_event(IBus.KEY_a, 0, 0)
|
|
|
866890 |
- self.assertEqual(ENGINE.mock_preedit_text, '工')
|
|
|
866890 |
- ENGINE.do_process_key_event(IBus.KEY_space, 0, 0)
|
|
|
866890 |
- self.assertEqual(ENGINE.mock_preedit_text, '')
|
|
|
866890 |
- self.assertEqual(ENGINE.mock_committed_text, '工工')
|
|
|
866890 |
- self.assertEqual(ENGINE._editor._lookup_table.mock_candidates,
|
|
|
866890 |
- ['工作人员 673 0',
|
|
|
866890 |
- '工作会议 310 0',
|
|
|
866890 |
- '工作报告 267 0',
|
|
|
866890 |
- '工人阶级 146 0',
|
|
|
866890 |
- '工作重点 78 0',
|
|
|
866890 |
- '工作小组 73 0',
|
|
|
866890 |
- '工业企业 71 0',
|
|
|
866890 |
- '工业大学 69 0',
|
|
|
866890 |
- '工作单位 61 0',
|
|
|
866890 |
- '工业生产 58 0'])
|
|
|
866890 |
- ENGINE.do_process_key_event(IBus.KEY_space, 0, 0)
|
|
|
866890 |
- self.assertEqual(ENGINE.mock_preedit_text, '')
|
|
|
866890 |
- self.assertEqual(ENGINE.mock_committed_text, '工工作人员')
|
|
|
866890 |
- ENGINE.set_pinyin_mode(True)
|
|
|
866890 |
- ENGINE.do_process_key_event(IBus.KEY_a, 0, 0)
|
|
|
866890 |
- self.assertEqual(ENGINE.mock_preedit_text, '爱')
|
|
|
866890 |
- ENGINE.do_process_key_event(IBus.KEY_space, 0, 0)
|
|
|
866890 |
- self.assertEqual(ENGINE.mock_preedit_text, '')
|
|
|
866890 |
- self.assertEqual(ENGINE.mock_committed_text, '工工作人员爱')
|
|
|
866890 |
- self.assertEqual(ENGINE._editor._lookup_table.mock_candidates,
|
|
|
866890 |
- ['爱因斯坦 1109 0',
|
|
|
866890 |
- '爱情故事 519 0',
|
|
|
866890 |
- '爱国主义 191 0',
|
|
|
866890 |
- '爱尔兰语 91 0',
|
|
|
866890 |
- '爱好和平 62 0',
|
|
|
866890 |
- '爱情小说 58 0',
|
|
|
866890 |
- '爱不释手 39 0',
|
|
|
866890 |
- '爱国热情 35 0',
|
|
|
866890 |
- '爱莫能助 34 0',
|
|
|
866890 |
- '爱理不理 32 0'])
|
|
|
866890 |
- ENGINE.do_process_key_event(IBus.KEY_space, 0, 0)
|
|
|
866890 |
- self.assertEqual(ENGINE.mock_preedit_text, '')
|
|
|
866890 |
- self.assertEqual(ENGINE.mock_committed_text, '工工作人员爱因斯坦')
|
|
|
866890 |
-
|
|
|
866890 |
def test_commit_to_preedit_switching_to_pinyin_defining_a_phrase(self):
|
|
|
866890 |
ENGINE.do_process_key_event(IBus.KEY_a, 0, 0)
|
|
|
866890 |
# commit to preëdit needs a press and release of either
|