From 4b4fe00cc2750713ef8d2bc0a9f396ab577c36fc Mon Sep 17 00:00:00 2001
From: Naohiro Aota <naota@gentoo.org>
Date: Thu, 4 Oct 2018 18:14:17 +0900
Subject: [PATCH] src/tests: Enable GSettings in runtest in ibus-1.5.18

This patch is based on:
https://github.com/ibus/ibus/commit/10cc30eac200d10b581d9d2122d5a732f4880943

Signed-off-by: Naohiro Aota <naota@gentoo.org>
---
 src/tests/runtest | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/src/tests/runtest b/src/tests/runtest
index 0e43fee..84d85ab 100755
--- a/src/tests/runtest
+++ b/src/tests/runtest
@@ -29,6 +29,7 @@ ibus-engine-switch
 ibus-compose
 test-stress
 "
+IBUS_SCHEMA_FILE='org.freedesktop.ibus.gschema.xml'
 
 # Portable replacement of basename.
 func_basename () {
@@ -80,6 +81,12 @@ trap 'func_cleanup $tstdir' 1 2 3 15
 tst=$1; shift
 tstdir=tmp-`func_basename $tst`
 
+# IBusEngine has GSettings
+if test ! -f "$top_builddir/data/dconf/$IBUS_SCHEMA_FILE" ; then
+    echo "NOT FOUND $top_builddir/data/dconf/$IBUS_SCHEMA_FILE"
+    exit -1
+fi
+
 test -d $tstdir || mkdir $tstdir
 
 ( cd $tstdir
@@ -101,6 +108,20 @@ test -d $tstdir || mkdir $tstdir
     IBUS_ADDRESS_FILE=$PWD/ibus-daemon.pid
     export IBUS_ADDRESS_FILE
 
+    cp "../$top_builddir/data/dconf/$IBUS_SCHEMA_FILE" $PWD
+    glib-compile-schemas $PWD
+    if test $? -ne 0 ; then
+        echo "FAILED glib-compile-schemas"
+        retval=1
+        return
+    fi
+    if test ! -f $PWD/gschemas.compiled ; then
+        echo "NOT FOUND $PWD/gschemas.compiled"
+        retval=1
+        return
+    fi
+    export GSETTINGS_SCHEMA_DIR=$PWD
+
     # Start ibus-daemon.
     ../$top_builddir/bus/ibus-daemon \
     --daemonize \
-- 
2.19.0

