diff --git a/.gitignore b/.gitignore index 0d5ea62..5baa128 100644 --- a/.gitignore +++ b/.gitignore @@ -56,3 +56,9 @@ ibus-table-1.3.0.20100621.tar.gz /ibus-table-1.9.22.tar.gz /ibus-table-1.9.23.tar.gz /ibus-table-1.9.24.tar.gz +/ibus-table-1.9.25.tar.gz +/ibus-table-1.10.0.tar.gz +/ibus-table-1.10.1.tar.gz +/ibus-table-1.11.0.tar.gz +/ibus-table-1.12.0.tar.gz +/ibus-table-1.12.1.tar.gz diff --git a/fix-test.patch b/fix-test.patch new file mode 100644 index 0000000..d7fd254 --- /dev/null +++ b/fix-test.patch @@ -0,0 +1,16 @@ +diff -ru ibus-table-1.11.0.orig/tests/test_it.py ibus-table-1.11.0/tests/test_it.py +--- ibus-table-1.11.0.orig/tests/test_it.py 2020-08-16 03:01:17.000000000 +0200 ++++ ibus-table-1.11.0/tests/test_it.py 2020-08-16 04:01:02.995248967 +0200 +@@ -460,10 +460,10 @@ + self.assertEqual(ENGINE.get_input_mode(), 1) + + def test_switch_to_next_chinese_mode_with_keybinding(self): +- self.assertEqual(ENGINE.get_chinese_mode(), 2) ++ self.assertEqual(ENGINE.get_chinese_mode(), 4) + # Now change with the keybinding: + ENGINE._do_process_key_event(IBus.KEY_semicolon, 0, IBus.ModifierType.CONTROL_MASK) +- self.assertEqual(ENGINE.get_chinese_mode(), 3) ++ self.assertEqual(ENGINE.get_chinese_mode(), 0) + + def test_toggle_onechar_mode_with_keybinding(self): + self.assertEqual(ENGINE.get_onechar_mode(), False) diff --git a/ibus-table.spec b/ibus-table.spec index f825987..696a6aa 100644 --- a/ibus-table.spec +++ b/ibus-table.spec @@ -3,21 +3,28 @@ %global _python_bytecompile_extra 1 Name: ibus-table -Version: 1.9.24 +Version: 1.12.1 Release: 1%{?dist} Summary: The Table engine for IBus platform License: LGPLv2+ URL: http://code.google.com/p/ibus/ Source0: http://mfabian.fedorapeople.org/ibus-table/%{name}-%{version}.tar.gz +Patch0: fix-test.patch Requires: ibus > 1.3.0 Requires: python(abi) >= 3.3 %{?__python3:Requires: %{__python3}} BuildRequires: gcc BuildRequires: ibus-devel > 1.3.0 BuildRequires: python3-devel -BuildRequires: libappstream-glib # for the unit tests +BuildRequires: appstream +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 @@ -25,6 +32,8 @@ BuildRequires: ibus-table-code BuildRequires: ibus-table-latin BuildRequires: ibus-table-translit BuildRequires: ibus-table-tv +# A window manger is needed for the GUI test +BuildRequires: i3 Obsoletes: ibus-table-additional < 1.2.0.20100111-5 @@ -40,12 +49,21 @@ Requires: %{name} = %{version}-%{release}, pkgconfig %description -n %{name}-devel 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 %setup -q +%patch0 -p1 -b .fix-test %build export PYTHON=%{__python3} -%configure --disable-static --disable-additional +%configure --disable-static --disable-additional --enable-installed-tests %__make %{?_smp_mflags} %install @@ -56,6 +74,7 @@ export PYTHON=%{__python3} %find_lang %{name} %check +appstreamcli validate --pedantic --no-net %{buildroot}/%{_datadir}/metainfo/*.appdata.xml appstream-util validate-relax --nonet %{buildroot}/%{_datadir}/metainfo/*.appdata.xml desktop-file-validate \ $RPM_BUILD_ROOT%{_datadir}/applications/ibus-setup-table.desktop @@ -71,14 +90,35 @@ glib-compile-schemas /tmp/glib-2.0/schemas #&>/dev/null || : export XDG_DATA_DIRS=/tmp eval $(dbus-launch --sh-syntax) dconf dump / -dconf write /org/freedesktop/ibus/engine/table/wubi-jidian/chinesemode 1 -dconf write /org/freedesktop/ibus/engine/table/wubi-jidian/spacekeybehavior false +dconf write /org/freedesktop/ibus/engine/table/wubi-jidian86/chinesemode 2 +dconf write /org/freedesktop/ibus/engine/table/wubi-jidian86/spacekeybehavior false dconf dump / -ibus-daemon -drx -make -C tests run_tests -pushd tests - ./run_tests -popd +export DISPLAY=:1 +Xvfb $DISPLAY -screen 0 1024x768x16 & +# 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 %post [ -x %{_bindir}/ibus ] && \ @@ -104,7 +144,68 @@ popd %files devel %{_datadir}/pkgconfig/%{name}.pc +%files tests +%dir %{_libexecdir}/installed-tests +%{_libexecdir}/installed-tests/%{name} +%dir %{_datadir}/installed-tests +%{_datadir}/installed-tests/%{name} + %changelog +* Fri Sep 04 2020 Mike FABIAN - 1.12.1-1 +- Update to 1.12.1 +- Enable compose support. +- Add buttons to move key bindings for a command up or down. +- Make translations of 'Edit key bindings for command “%s”' work +- Added it_util.py to POTFILES, it had translatable strings for + the “About” dialog and the key settings dialog. +- Update translations from Weblate (updated ca, de, fr, tr, uk) + +* Wed Aug 26 2020 Mike FABIAN - 1.12.0-1 +- Update to 1.12.0 +- New setup tool, now keybindings can be configured with a GUI. +- Resolves: https://github.com/kaio/ibus-table/issues/57 +- Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1133127 +- Put exact (except tone) pinyin matches next after exact + matches in the candidate list. +- Resolves: https://github.com/kaio/ibus-table/issues/63 +- Allow lookup table orientation “System Default” in the setup +- Remove “spacekeybehavior” option, it became useless as all + keybindings are configurable now. +- Added a “debuglevel” option. +- Update translations from Weblate (updated ca, cs, de, es, fa, + fr, ja, pt_BR, pt_PT, uk, zh_TW, zh_HK, zh_CN) + +* Sun Aug 16 2020 Mike FABIAN - 1.11.0-1 +- Update to 1.11.0 +- Make key bindings configurable. + Only via the command line for the moment, not yet easy to do + for normal users. I have to rewrite the setup tool eventually + to make that possible. +- Resolves: https://github.com/ibus/ibus/issues/2241 + +* Wed Jul 15 2020 Mike FABIAN - 1.10.1-1 +- Update to 1.10.1 +- Add GUI test +- Make output of ibus-table-createdb deterministic +- Update translations from Weblate (updated fr, tr, zh_CN) + +* Wed Jul 01 2020 Mike FABIAN - 1.10.0-1 +- Update to 1.10.0 +- Add suggestion mode feature +- Resolves: https://github.com/mike-fabian/ibus-table/pull/9 +- Resolves: rhbz#835376 +- Add test cases for suggestion mode feature +- Fix problems with the behaviour of the property menus +- Use python logging module with log file rotation instead + of writing to stdout/stderr +- Update translations from Weblate (updated de, es, fr, pt_BR, pt_PT, tr, uk) + +* Wed Feb 12 2020 Mike FABIAN - 1.9.25-1 +- update to 1.9.25 +- Fix crash when changing some options using the menu or the floating panel +- Resolves: rhbz#1803028 +- Translation updates (pt_PT) + * Wed Jan 22 2020 Mike FABIAN - 1.9.24-1 - update to 1.9.24 - Fixed two typos in message ids (Thanks to Rafael Fontenelle) diff --git a/sources b/sources index 21b7d74..93aae8e 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (ibus-table-1.9.24.tar.gz) = a767e020d527dded57e099a6417eb87362e30d9905231e3c95b77522c99cb75dba4338027e7ea64362836b418335a58267a2932ae908b2b4b04a1f5aa5a32f8f +SHA512 (ibus-table-1.12.1.tar.gz) = 9cbd7c24067d182d3917eb66d8b18ea30e893b2d9a19dfb48ce4c91a41868707bf9682011f374dc2397f59f101855bddde0fbbe374856063e1f4226de7a9a01b diff --git a/tests/make_check.sh b/tests/make_check.sh deleted file mode 100644 index 94a7883..0000000 --- a/tests/make_check.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -set -x - -check_return_value () { - if [ $1 != 0 ] ; then - exit $1 - fi -} - -cd $1 -./configure --prefix=/usr -check_return_value $? -make check && rc=0 || rc=1; cat tests/test-suite.log -exit $rc diff --git a/tests/roles/ibus-desktop-testing-role/defaults/main.yml b/tests/roles/ibus-desktop-testing-role/defaults/main.yml new file mode 100644 index 0000000..9ea48ca --- /dev/null +++ b/tests/roles/ibus-desktop-testing-role/defaults/main.yml @@ -0,0 +1,25 @@ +role_pkgs_req: + - rsync + - xorg-x11-server-Xvfb + - appstream + - libappstream-glib + - desktop-file-utils + - python3-mock + - python3-gobject + - python3-gobject-base + - glib2 + - gtk3 + - dconf + - dbus-x11 + - ibus + - ibus-devel + - gcc + - python3-devel + - python3-pyxdg + - xorg-x11-server-Xvfb + - ibus-table-chinese-wubi-jidian + - ibus-table-chinese-cangjie + - ibus-table-chinese-stroke5 + - ibus-table-code + - ibus-table-latin + - ibus-table-translit diff --git a/tests/roles/ibus-desktop-testing-role/meta/main.yml b/tests/roles/ibus-desktop-testing-role/meta/main.yml new file mode 100644 index 0000000..6626402 --- /dev/null +++ b/tests/roles/ibus-desktop-testing-role/meta/main.yml @@ -0,0 +1,4 @@ +--- + +dependencies: + - role: str-common-init diff --git a/tests/roles/ibus-desktop-testing-role/tasks/main.yml b/tests/roles/ibus-desktop-testing-role/tasks/main.yml new file mode 100644 index 0000000..a958379 --- /dev/null +++ b/tests/roles/ibus-desktop-testing-role/tasks/main.yml @@ -0,0 +1,101 @@ +--- +- name: Check if GNOME installed-tests testing harness is installed + register: gnome_desktop_testing_runner + find: + paths: "{{ ansible_env.PATH.split(':') }}" + pattern: gnome-desktop-testing-runner + +- name: Build and install GNOME installed-tests testing harness + when: gnome_desktop_testing_runner.matched == 0 + block: + - name: Installing build dependencies for IBus and GNOME installed-tests testing harness + package: + name: + - git + - make + - gcc + - diffutils + - autoconf + - automake + - libtool + - glib2-devel + - systemd-devel + - gnome-session + - gnome-shell + - dbus-x11 + - xorg-x11-server-Xvfb + - ibus + - ibus-desktop-testing + - ibus-table-tests + + - name: Fetching GNOME installed-tests testing harness source from remote repository + git: + repo: 'https://gitlab.gnome.org/GNOME/gnome-desktop-testing.git' + dest: gnome-desktop-testing + force: yes + + - name: Configure GNOME installed-tests testing harness build + command: ./autogen.sh --prefix=/usr --sysconfdir=/etc --localstatedir=/var + args: + chdir: gnome-desktop-testing + + - name: Build GNOME installed-tests testing harness + command: make + args: + chdir: gnome-desktop-testing + + - name: Install GNOME installed-tests testing harness + command: make install + args: + chdir: gnome-desktop-testing + +- name: Start IBus installed-tests testing harness + environment: + ANSIBLE: 1 + TMPDIR: '{{ remote_artifacts }}' + G_MESSAGES_DEBUG: 'all' + block: + - name: Execute IBus table tests + shell: | + set -e + status="FAIL: frame" + ibus-desktop-testing-runner \ + --no-graphics \ + --runner=gnome \ + --timeout=1200 \ + --tests='{{ installed_test_name }}' \ + --output='{{ remote_artifacts }}/{{ installed_test_name }}.log' \ + --result='{{ remote_artifacts }}/test.log' \ + null + if [ $? -eq 0 ]; then + status="PASS: frame" + fi + echo "${status} $TEST" >> {{ remote_artifacts }}/test.log + + - name: Check the results + shell: | + log="{{ remote_artifacts }}/test.log" + if [ ! -f $log ] ; then + echo ERROR + exit 1 + else + FAIL=`grep "^FAIL: " $log | grep -v 'FAIL: 0$'` + if [ x"$FAIL" != x ] ; then + echo ERROR + exit 1 + else + echo PASS + fi + fi + register: test_fails + #failed_when: False + + - name: Set role result + set_fact: + role_result: "{{ test_fails.stdout }}" + role_result_failed: "{{ (test_fails.stdout|d|length > 0) or (test_fails.stderr|d|length > 0) }}" + role_result_msg: "{{ test_fails.stdout|d('tests failed.') }}" + + - include_role: + name: str-common-final + diff --git a/tests/run_python_doctests.sh b/tests/run_python_doctests.sh deleted file mode 100755 index fc9b739..0000000 --- a/tests/run_python_doctests.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -set -x - -check_return_value () { - if [ $1 != 0 ] ; then - exit $1 - fi -} - -pushd /usr/share/ibus-table/engine -for i in $@; do - python3 ${i} -v - check_return_value $? -done -popd diff --git a/tests/tests.yml b/tests/tests.yml index 5c56598..08966a8 100644 --- a/tests/tests.yml +++ b/tests/tests.yml @@ -1,40 +1,8 @@ - hosts: localhost - vars: - - artifacts: "{{ lookup('env', 'TEST_ARTIFACTS')|default('./artifacts', true) }}" - tags: - - classic - remote_user: root roles: - - role: standard-test-source # to get the source tar ball to do “make check” - - role: standard-test-basic - required_packages: - - make - - libappstream-glib - - desktop-file-utils - - python3-gobject - - python3-gobject-base - - glib2 - - gtk3 - - dconf - - dbus-x11 - - ibus - - ibus-devel - - gcc - - python3-devel - - python3-pyxdg - - ibus-table-chinese-wubi-jidian - - ibus-table-chinese-cangjie - - ibus-table-chinese-stroke5 - - ibus-table-code - - ibus-table-latin - - ibus-table-translit - tests: - - make-check: - dir: ./ - run: bash ./make_check.sh ./source - - doctests-table.py: - dir: ./ - run: bash ./run_python_doctests.sh table.py - - doctests-it_util.py: - dir: ./ - run: bash ./run_python_doctests.sh it_util.py + - role: ibus-desktop-testing-role + installed_test_name: ibus-table + tags: + - classic + - gating +