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

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