import ibus-table-1.9.18-6.el8
This commit is contained in:
parent
7702ba0b61
commit
66be8bdc00
1816
SOURCES/add-a-gui-test.patch
Normal file
1816
SOURCES/add-a-gui-test.patch
Normal file
File diff suppressed because it is too large
Load Diff
6974
SOURCES/add-a-test-suite.patch
Normal file
6974
SOURCES/add-a-test-suite.patch
Normal file
File diff suppressed because it is too large
Load Diff
166
SOURCES/fix-test-cases-for-old-ibus-table.patch
Normal file
166
SOURCES/fix-test-cases-for-old-ibus-table.patch
Normal file
@ -0,0 +1,166 @@
|
|||||||
|
diff -Nru ibus-table-1.9.18/engine/table.py ibus-table-1.9.18.new/engine/table.py
|
||||||
|
--- ibus-table-1.9.18/engine/table.py 2020-07-23 17:21:31.934904346 +0200
|
||||||
|
+++ ibus-table-1.9.18.new/engine/table.py 2020-07-23 17:28:19.342746241 +0200
|
||||||
|
@@ -1752,6 +1752,9 @@
|
||||||
|
self._input_mode)
|
||||||
|
self._update_ui()
|
||||||
|
|
||||||
|
+ def get_pinyin_mode(self):
|
||||||
|
+ return self._editor._py_mode
|
||||||
|
+
|
||||||
|
def set_onechar_mode(self, mode=False, update_dconf=True):
|
||||||
|
if mode == self._editor._onechar:
|
||||||
|
return
|
||||||
|
diff -Nru ibus-table-1.9.18/tests/test_0_gtk.py ibus-table-1.9.18.new/tests/test_0_gtk.py
|
||||||
|
--- ibus-table-1.9.18/tests/test_0_gtk.py 2020-07-23 17:21:31.940904285 +0200
|
||||||
|
+++ ibus-table-1.9.18.new/tests/test_0_gtk.py 2020-07-23 17:37:23.234210681 +0200
|
||||||
|
@@ -205,14 +205,14 @@
|
||||||
|
object_path = '%s/%d' % (self.ENGINE_PATH, self.__id)
|
||||||
|
db_dir = '/usr/share/ibus-table/tables'
|
||||||
|
db_file = os.path.join(db_dir, engine_name + '.db')
|
||||||
|
- database = tabsqlitedb.TabSqliteDb(filename=db_file, user_db=':memory:')
|
||||||
|
- self.__engine = table.TabEngine(
|
||||||
|
+ database = tabsqlitedb.tabsqlitedb(filename=db_file, user_db=':memory:')
|
||||||
|
+ self.__engine = table.tabengine(
|
||||||
|
self.__bus,
|
||||||
|
object_path,
|
||||||
|
database)
|
||||||
|
self.__engine.connect('focus-in', self.__engine_focus_in)
|
||||||
|
self.__engine.connect('focus-out', self.__engine_focus_out)
|
||||||
|
- # FIXME: Need to connect 'reset' after TabEngine.clear_all_input_and_preedit()
|
||||||
|
+ # FIXME: Need to connect 'reset' after tabengine.clear_all_input_and_preedit()
|
||||||
|
# is called.
|
||||||
|
self.__engine.connect_after('reset', self.__engine_reset)
|
||||||
|
self.__bus.get_connection().signal_subscribe(
|
||||||
|
diff -Nru ibus-table-1.9.18/tests/test_it.py ibus-table-1.9.18.new/tests/test_it.py
|
||||||
|
--- ibus-table-1.9.18/tests/test_it.py 2020-07-23 17:21:31.940904285 +0200
|
||||||
|
+++ ibus-table-1.9.18.new/tests/test_it.py 2020-07-23 17:29:52.032800325 +0200
|
||||||
|
@@ -78,7 +78,6 @@
|
||||||
|
ORIG_SINGLE_WILDCARD_CHAR = None
|
||||||
|
ORIG_MULTI_WILDCARD_CHAR = None
|
||||||
|
ORIG_PINYIN_MODE = None
|
||||||
|
-ORIG_SUGGESTION_MODE = None
|
||||||
|
|
||||||
|
def backup_original_settings():
|
||||||
|
global ENGINE
|
||||||
|
@@ -97,7 +96,6 @@
|
||||||
|
global ORIG_SINGLE_WILDCARD_CHAR
|
||||||
|
global ORIG_MULTI_WILDCARD_CHAR
|
||||||
|
global ORIG_PINYIN_MODE
|
||||||
|
- global ORIG_SUGGESTION_MODE
|
||||||
|
ORIG_INPUT_MODE = ENGINE.get_input_mode()
|
||||||
|
ORIG_CHINESE_MODE = ENGINE.get_chinese_mode()
|
||||||
|
ORIG_LETTER_WIDTH = ENGINE.get_letter_width()
|
||||||
|
@@ -113,7 +111,6 @@
|
||||||
|
ORIG_SINGLE_WILDCARD_CHAR = ENGINE.get_single_wildcard_char()
|
||||||
|
ORIG_MULTI_WILDCARD_CHAR = ENGINE.get_multi_wildcard_char()
|
||||||
|
ORIG_PINYIN_MODE = ENGINE.get_pinyin_mode()
|
||||||
|
- ORIG_SUGGESTION_MODE = ENGINE.get_suggestion_mode()
|
||||||
|
|
||||||
|
def restore_original_settings():
|
||||||
|
global ENGINE
|
||||||
|
@@ -132,7 +129,6 @@
|
||||||
|
global ORIG_SINGLE_WILDCARD_CHAR
|
||||||
|
global ORIG_MULTI_WILDCARD_CHAR
|
||||||
|
global ORIG_PINYIN_MODE
|
||||||
|
- global ORIG_SUGGESTION_MODE
|
||||||
|
ENGINE.set_input_mode(ORIG_INPUT_MODE)
|
||||||
|
ENGINE.set_chinese_mode(ORIG_CHINESE_MODE)
|
||||||
|
ENGINE.set_letter_width(ORIG_LETTER_WIDTH[0], input_mode=0)
|
||||||
|
@@ -150,7 +146,6 @@
|
||||||
|
ENGINE.set_single_wildcard_char(ORIG_SINGLE_WILDCARD_CHAR)
|
||||||
|
ENGINE.set_multi_wildcard_char(ORIG_MULTI_WILDCARD_CHAR)
|
||||||
|
ENGINE.set_pinyin_mode(ORIG_PINYIN_MODE)
|
||||||
|
- ENGINE.set_suggestion_mode(ORIG_SUGGESTION_MODE)
|
||||||
|
|
||||||
|
def set_default_settings():
|
||||||
|
global ENGINE
|
||||||
|
@@ -256,7 +251,6 @@
|
||||||
|
ENGINE.set_multi_wildcard_char(multi_wildcard_char)
|
||||||
|
|
||||||
|
ENGINE.set_pinyin_mode(False)
|
||||||
|
- ENGINE.set_suggestion_mode(False)
|
||||||
|
|
||||||
|
def set_up(engine_name):
|
||||||
|
'''
|
||||||
|
@@ -290,7 +284,7 @@
|
||||||
|
assert IBus.PropList is not IBUS_PROP_LIST
|
||||||
|
assert IBus.PropList is MockPropList
|
||||||
|
# Reload the table module so that the patches
|
||||||
|
- # are applied to TabEngine:
|
||||||
|
+ # are applied to tabengine:
|
||||||
|
sys.path.insert(0, '../engine')
|
||||||
|
importlib.reload(table)
|
||||||
|
sys.path.pop(0)
|
||||||
|
@@ -302,9 +296,9 @@
|
||||||
|
ENGINE = None
|
||||||
|
tear_down()
|
||||||
|
return False
|
||||||
|
- TABSQLITEDB = tabsqlitedb.TabSqliteDb(
|
||||||
|
+ TABSQLITEDB = tabsqlitedb.tabsqlitedb(
|
||||||
|
filename=db_file, user_db=':memory:')
|
||||||
|
- ENGINE = table.TabEngine(
|
||||||
|
+ ENGINE = table.tabengine(
|
||||||
|
bus,
|
||||||
|
'/com/redhat/IBus/engines/table/%s/engine/0' %engine_name,
|
||||||
|
TABSQLITEDB,
|
||||||
|
@@ -380,59 +374,6 @@
|
||||||
|
self.assertEqual(ENGINE.mock_preedit_text, '')
|
||||||
|
self.assertEqual(ENGINE.mock_committed_text, '工爱工')
|
||||||
|
|
||||||
|
- def test_suggestion_mode(self):
|
||||||
|
- if not ENGINE._ime_sg:
|
||||||
|
- self.skipTest("This engine does not have a suggestion mode.")
|
||||||
|
- # Suggestion mode is False by default:
|
||||||
|
- self.assertEqual(ENGINE.get_suggestion_mode(), False)
|
||||||
|
- self.assertEqual(ENGINE.get_pinyin_mode(), False)
|
||||||
|
- ENGINE.do_process_key_event(IBus.KEY_a, 0, 0)
|
||||||
|
- self.assertEqual(ENGINE.mock_preedit_text, '工')
|
||||||
|
- ENGINE.do_process_key_event(IBus.KEY_space, 0, 0)
|
||||||
|
- self.assertEqual(ENGINE.mock_preedit_text, '')
|
||||||
|
- self.assertEqual(ENGINE.mock_committed_text, '工')
|
||||||
|
- self.assertEqual(ENGINE._editor._lookup_table.mock_candidates, [])
|
||||||
|
- ENGINE.set_suggestion_mode(True)
|
||||||
|
- ENGINE.do_process_key_event(IBus.KEY_a, 0, 0)
|
||||||
|
- self.assertEqual(ENGINE.mock_preedit_text, '工')
|
||||||
|
- ENGINE.do_process_key_event(IBus.KEY_space, 0, 0)
|
||||||
|
- self.assertEqual(ENGINE.mock_preedit_text, '')
|
||||||
|
- self.assertEqual(ENGINE.mock_committed_text, '工工')
|
||||||
|
- self.assertEqual(ENGINE._editor._lookup_table.mock_candidates,
|
||||||
|
- ['工作人员 673 0',
|
||||||
|
- '工作会议 310 0',
|
||||||
|
- '工作报告 267 0',
|
||||||
|
- '工人阶级 146 0',
|
||||||
|
- '工作重点 78 0',
|
||||||
|
- '工作小组 73 0',
|
||||||
|
- '工业企业 71 0',
|
||||||
|
- '工业大学 69 0',
|
||||||
|
- '工作单位 61 0',
|
||||||
|
- '工业生产 58 0'])
|
||||||
|
- ENGINE.do_process_key_event(IBus.KEY_space, 0, 0)
|
||||||
|
- self.assertEqual(ENGINE.mock_preedit_text, '')
|
||||||
|
- self.assertEqual(ENGINE.mock_committed_text, '工工作人员')
|
||||||
|
- ENGINE.set_pinyin_mode(True)
|
||||||
|
- ENGINE.do_process_key_event(IBus.KEY_a, 0, 0)
|
||||||
|
- self.assertEqual(ENGINE.mock_preedit_text, '爱')
|
||||||
|
- ENGINE.do_process_key_event(IBus.KEY_space, 0, 0)
|
||||||
|
- self.assertEqual(ENGINE.mock_preedit_text, '')
|
||||||
|
- self.assertEqual(ENGINE.mock_committed_text, '工工作人员爱')
|
||||||
|
- self.assertEqual(ENGINE._editor._lookup_table.mock_candidates,
|
||||||
|
- ['爱因斯坦 1109 0',
|
||||||
|
- '爱情故事 519 0',
|
||||||
|
- '爱国主义 191 0',
|
||||||
|
- '爱尔兰语 91 0',
|
||||||
|
- '爱好和平 62 0',
|
||||||
|
- '爱情小说 58 0',
|
||||||
|
- '爱不释手 39 0',
|
||||||
|
- '爱国热情 35 0',
|
||||||
|
- '爱莫能助 34 0',
|
||||||
|
- '爱理不理 32 0'])
|
||||||
|
- ENGINE.do_process_key_event(IBus.KEY_space, 0, 0)
|
||||||
|
- self.assertEqual(ENGINE.mock_preedit_text, '')
|
||||||
|
- self.assertEqual(ENGINE.mock_committed_text, '工工作人员爱因斯坦')
|
||||||
|
-
|
||||||
|
def test_commit_to_preedit_switching_to_pinyin_defining_a_phrase(self):
|
||||||
|
ENGINE.do_process_key_event(IBus.KEY_a, 0, 0)
|
||||||
|
# commit to preëdit needs a press and release of either
|
62
SOURCES/use-config-not-gsettings-for-gui-test.patch
Normal file
62
SOURCES/use-config-not-gsettings-for-gui-test.patch
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
diff -ru ibus-table-1.9.18.orig/tests/test_0_gtk.py ibus-table-1.9.18/tests/test_0_gtk.py
|
||||||
|
--- ibus-table-1.9.18.orig/tests/test_0_gtk.py 2020-07-27 09:41:25.799087549 +0200
|
||||||
|
+++ ibus-table-1.9.18/tests/test_0_gtk.py 2020-07-28 12:23:43.127130148 +0200
|
||||||
|
@@ -68,6 +68,7 @@
|
||||||
|
|
||||||
|
DONE_EXIT = True
|
||||||
|
ENGINE_NAME = 'wubi-jidian86'
|
||||||
|
+CONFIG_SECTION = 'engine/table/%s' % ENGINE_NAME
|
||||||
|
|
||||||
|
from gtkcases import TestCases
|
||||||
|
|
||||||
|
@@ -96,16 +97,18 @@
|
||||||
|
class SimpleGtkTestCase(unittest.TestCase):
|
||||||
|
global DONE_EXIT
|
||||||
|
global ENGINE_NAME
|
||||||
|
+ global CONFIG_SECTION
|
||||||
|
ENGINE_PATH = '/com/redhat/IBus/engines/table/Test/Engine'
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def setUpClass(cls):
|
||||||
|
cls._flag = False
|
||||||
|
IBus.init()
|
||||||
|
- cls._gsettings = Gio.Settings(
|
||||||
|
- schema='org.freedesktop.ibus.engine.table',
|
||||||
|
- path='/org/freedesktop/ibus/engine/table/%s/' % ENGINE_NAME)
|
||||||
|
- cls._orig_chinesemode = cls._gsettings.get_int('chinesemode')
|
||||||
|
+ cls.__bus = IBus.Bus()
|
||||||
|
+ cls._config = cls.__bus.get_config()
|
||||||
|
+ cls._orig_chinesemode = table.variant_to_value(
|
||||||
|
+ cls._config.get_value(
|
||||||
|
+ CONFIG_SECTION, 'chinesemode'))
|
||||||
|
signums = [getattr(signal, s, None) for s in
|
||||||
|
'SIGINT SIGTERM SIGHUP'.split()]
|
||||||
|
for signum in filter(None, signums):
|
||||||
|
@@ -116,7 +119,11 @@
|
||||||
|
(signum, original_handler))
|
||||||
|
@classmethod
|
||||||
|
def tearDownClass(cls):
|
||||||
|
- cls._gsettings.set_int('chinesemode', cls._orig_chinesemode)
|
||||||
|
+ if cls._orig_chinesemode:
|
||||||
|
+ cls._config.set_value(
|
||||||
|
+ CONFIG_SECTION,
|
||||||
|
+ 'chinesemode',
|
||||||
|
+ GLib.Variant.new_int32(cls._orig_chinesemode))
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def signal_handler(cls, user_data):
|
||||||
|
@@ -136,10 +142,12 @@
|
||||||
|
self.__inserted_text = ''
|
||||||
|
self.__commit_done = False
|
||||||
|
self.__reset_coming = False
|
||||||
|
- self._gsettings.set_int('chinesemode', 4)
|
||||||
|
+ self._config.set_value(
|
||||||
|
+ CONFIG_SECTION,
|
||||||
|
+ 'chinesemode',
|
||||||
|
+ GLib.Variant.new_int32(4))
|
||||||
|
|
||||||
|
def register_ibus_engine(self):
|
||||||
|
- self.__bus = IBus.Bus()
|
||||||
|
if not self.__bus.is_connected():
|
||||||
|
self.fail('ibus-daemon is not running')
|
||||||
|
return False
|
@ -1,17 +1,34 @@
|
|||||||
Name: ibus-table
|
Name: ibus-table
|
||||||
Version: 1.9.18
|
Version: 1.9.18
|
||||||
Release: 3%{?dist}
|
Release: 6%{?dist}
|
||||||
Summary: The Table engine for IBus platform
|
Summary: The Table engine for IBus platform
|
||||||
License: LGPLv2+
|
License: LGPLv2+
|
||||||
Group: System Environment/Libraries
|
Group: System Environment/Libraries
|
||||||
URL: http://code.google.com/p/ibus/
|
URL: http://code.google.com/p/ibus/
|
||||||
Source0: http://mfabian.fedorapeople.org/ibus-table/%{name}-%{version}.tar.gz
|
Source0: http://mfabian.fedorapeople.org/ibus-table/%{name}-%{version}.tar.gz
|
||||||
|
Patch0: add-a-test-suite.patch
|
||||||
|
Patch1: add-a-gui-test.patch
|
||||||
|
Patch2: use-config-not-gsettings-for-gui-test.patch
|
||||||
|
Patch3: fix-test-cases-for-old-ibus-table.patch
|
||||||
Requires: ibus > 1.3.0
|
Requires: ibus > 1.3.0
|
||||||
Requires: python(abi) >= 3.3
|
Requires: python(abi) >= 3.3
|
||||||
Requires: %{__python3}
|
Requires: %{__python3}
|
||||||
BuildRequires: ibus-devel > 1.3.0
|
BuildRequires: ibus-devel > 1.3.0
|
||||||
BuildRequires: python3-devel
|
BuildRequires: python3-devel
|
||||||
|
# for the unit tests
|
||||||
|
BuildRequires: automake
|
||||||
|
BuildRequires: autoconf
|
||||||
|
BuildRequires: gettext-devel
|
||||||
BuildRequires: libappstream-glib
|
BuildRequires: libappstream-glib
|
||||||
|
BuildRequires: desktop-file-utils
|
||||||
|
BuildRequires: python3-mock
|
||||||
|
BuildRequires: python3-gobject
|
||||||
|
BuildRequires: python3-gobject-base
|
||||||
|
BuildRequires: dbus-x11
|
||||||
|
BuildRequires: xorg-x11-server-Xvfb
|
||||||
|
BuildRequires: ibus-table-chinese-wubi-jidian
|
||||||
|
BuildRequires: ibus-table-chinese-cangjie
|
||||||
|
BuildRequires: ibus-table-chinese-stroke5
|
||||||
|
|
||||||
Obsoletes: ibus-table-additional < 1.2.0.20100111-5
|
Obsoletes: ibus-table-additional < 1.2.0.20100111-5
|
||||||
|
|
||||||
@ -29,12 +46,25 @@ Requires: %{name} = %{version}-%{release}, pkgconfig
|
|||||||
%description -n %{name}-devel
|
%description -n %{name}-devel
|
||||||
Development files for %{name}.
|
Development files for %{name}.
|
||||||
|
|
||||||
|
%package tests
|
||||||
|
Summary: Tests for the %{name} package
|
||||||
|
Requires: %{name} = %{version}-%{release}
|
||||||
|
|
||||||
|
%description tests
|
||||||
|
The %{name}-tests package contains tests that can be used to verify
|
||||||
|
the functionality of the installed %{name} package.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
|
%patch0 -p1 -b .add-a-test-suite
|
||||||
|
%patch1 -p1 -b .add-a-gui-test
|
||||||
|
%patch2 -p1 -b .use-config-not-gsettings-for-gui-test
|
||||||
|
%patch3 -p1 -b .fix-test-cases-for-old-ibus-table
|
||||||
|
|
||||||
%build
|
%build
|
||||||
export PYTHON=%{__python3}
|
export PYTHON=%{__python3}
|
||||||
%configure --disable-static --disable-additional
|
./autogen.sh --prefix=/usr
|
||||||
|
%configure --enable-installed-tests
|
||||||
%__make %{?_smp_mflags}
|
%__make %{?_smp_mflags}
|
||||||
|
|
||||||
%install
|
%install
|
||||||
@ -46,6 +76,38 @@ export PYTHON=%{__python3}
|
|||||||
|
|
||||||
%check
|
%check
|
||||||
appstream-util validate-relax --nonet %{buildroot}/%{_datadir}/metainfo/*.appdata.xml
|
appstream-util validate-relax --nonet %{buildroot}/%{_datadir}/metainfo/*.appdata.xml
|
||||||
|
pushd engine
|
||||||
|
# run doctests
|
||||||
|
python3 table.py
|
||||||
|
python3 it_util.py
|
||||||
|
popd
|
||||||
|
export DISPLAY=:1
|
||||||
|
Xvfb $DISPLAY -screen 0 1024x768x16 &
|
||||||
|
ibus-daemon -drx # not needed on Fedora 32
|
||||||
|
# A window manager and and ibus-daemon are needed to run the GUI
|
||||||
|
# test tests/test_gtk.py, for example i3 can be used.
|
||||||
|
#
|
||||||
|
# To debug what is going on if there is a problem with the GUI test
|
||||||
|
# add BuildRequires: x11vnc and start a vnc server:
|
||||||
|
#
|
||||||
|
# x11vnc -display $DISPLAY -unixsock /tmp/mysock -bg -nopw -listen localhost -xkb
|
||||||
|
#
|
||||||
|
# Then one can view what is going on outside of the chroot with vncviewer:
|
||||||
|
#
|
||||||
|
# vncviewer /var/lib/mock/fedora-32-x86_64/root/tmp/mysock
|
||||||
|
#
|
||||||
|
# The GUI test will be skipped if XDG_SESSION_TYPE is not x11 or wayland.
|
||||||
|
#
|
||||||
|
#ibus-daemon -drx
|
||||||
|
#touch /tmp/i3config
|
||||||
|
#i3 -c /tmp/i3config &
|
||||||
|
#export XDG_SESSION_TYPE=x11
|
||||||
|
|
||||||
|
make check && rc=0 || rc=1
|
||||||
|
cat tests/*.log
|
||||||
|
if [ $rc != 0 ] ; then
|
||||||
|
exit $rc
|
||||||
|
fi
|
||||||
|
|
||||||
%clean
|
%clean
|
||||||
%__rm -rf $RPM_BUILD_ROOT
|
%__rm -rf $RPM_BUILD_ROOT
|
||||||
@ -67,7 +129,25 @@ appstream-util validate-relax --nonet %{buildroot}/%{_datadir}/metainfo/*.appdat
|
|||||||
%defattr(-, root, root, -)
|
%defattr(-, root, root, -)
|
||||||
%{_datadir}/pkgconfig/%{name}.pc
|
%{_datadir}/pkgconfig/%{name}.pc
|
||||||
|
|
||||||
|
%files tests
|
||||||
|
%dir %{_libexecdir}/installed-tests
|
||||||
|
%{_libexecdir}/installed-tests/%{name}
|
||||||
|
%dir %{_datadir}/installed-tests
|
||||||
|
%{_datadir}/installed-tests/%{name}
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Feb 16 2021 Mike FABIAN <mfabian@redhat.com> - 1.9.18-6
|
||||||
|
- Fix a covscan error
|
||||||
|
- Related: rhbz#1929102
|
||||||
|
|
||||||
|
* Tue Feb 16 2021 Mike FABIAN <mfabian@redhat.com> - 1.9.18-5
|
||||||
|
- Bump release number to add the new subpackage ibus-table-tests
|
||||||
|
- Resolves: rhbz#1929102
|
||||||
|
|
||||||
|
* Sat Jul 25 2020 Mike FABIAN <mfabian@redhat.com> - 1.9.18-4
|
||||||
|
- Add gating tests to ibus-table
|
||||||
|
- Resolves: rhbz#1682163
|
||||||
|
|
||||||
* Thu Sep 20 2018 Tomas Orsava <torsava@redhat.com> - 1.9.18-3
|
* Thu Sep 20 2018 Tomas Orsava <torsava@redhat.com> - 1.9.18-3
|
||||||
- Require the Python interpreter directly instead of using the package name
|
- Require the Python interpreter directly instead of using the package name
|
||||||
- Related: rhbz#1619153
|
- Related: rhbz#1619153
|
||||||
|
Loading…
Reference in New Issue
Block a user