Blame SOURCES/use-config-not-gsettings-for-gui-test.patch

56711a
diff -ru ibus-table-1.9.18.orig/tests/test_0_gtk.py ibus-table-1.9.18/tests/test_0_gtk.py
56711a
--- ibus-table-1.9.18.orig/tests/test_0_gtk.py	2020-07-27 09:41:25.799087549 +0200
56711a
+++ ibus-table-1.9.18/tests/test_0_gtk.py	2020-07-28 12:23:43.127130148 +0200
56711a
@@ -68,6 +68,7 @@
56711a
 
56711a
 DONE_EXIT = True
56711a
 ENGINE_NAME = 'wubi-jidian86'
56711a
+CONFIG_SECTION = 'engine/table/%s' % ENGINE_NAME
56711a
 
56711a
 from gtkcases import TestCases
56711a
 
56711a
@@ -96,16 +97,18 @@
56711a
 class SimpleGtkTestCase(unittest.TestCase):
56711a
     global DONE_EXIT
56711a
     global ENGINE_NAME
56711a
+    global CONFIG_SECTION
56711a
     ENGINE_PATH = '/com/redhat/IBus/engines/table/Test/Engine'
56711a
 
56711a
     @classmethod
56711a
     def setUpClass(cls):
56711a
         cls._flag = False
56711a
         IBus.init()
56711a
-        cls._gsettings = Gio.Settings(
56711a
-            schema='org.freedesktop.ibus.engine.table',
56711a
-            path='/org/freedesktop/ibus/engine/table/%s/' % ENGINE_NAME)
56711a
-        cls._orig_chinesemode = cls._gsettings.get_int('chinesemode')
56711a
+        cls.__bus = IBus.Bus()
56711a
+        cls._config = cls.__bus.get_config()
56711a
+        cls._orig_chinesemode = table.variant_to_value(
56711a
+            cls._config.get_value(
56711a
+                CONFIG_SECTION, 'chinesemode'))
56711a
         signums = [getattr(signal, s, None) for s in
56711a
                    'SIGINT SIGTERM SIGHUP'.split()]
56711a
         for signum in filter(None, signums):
56711a
@@ -116,7 +119,11 @@
56711a
                                  (signum, original_handler))
56711a
     @classmethod
56711a
     def tearDownClass(cls):
56711a
-        cls._gsettings.set_int('chinesemode', cls._orig_chinesemode)
56711a
+        if cls._orig_chinesemode:
56711a
+            cls._config.set_value(
56711a
+                CONFIG_SECTION,
56711a
+                'chinesemode',
56711a
+                GLib.Variant.new_int32(cls._orig_chinesemode))
56711a
 
56711a
     @classmethod
56711a
     def signal_handler(cls, user_data):
56711a
@@ -136,10 +142,12 @@
56711a
         self.__inserted_text = ''
56711a
         self.__commit_done = False
56711a
         self.__reset_coming = False
56711a
-        self._gsettings.set_int('chinesemode', 4)
56711a
+        self._config.set_value(
56711a
+            CONFIG_SECTION,
56711a
+            'chinesemode',
56711a
+            GLib.Variant.new_int32(4))
56711a
 
56711a
     def register_ibus_engine(self):
56711a
-        self.__bus = IBus.Bus()
56711a
         if not self.__bus.is_connected():
56711a
             self.fail('ibus-daemon is not running')
56711a
             return False