Blame SOURCES/fix-test-cases-for-old-ibus-table.patch

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