Commit 3040854f authored by ChangZhuo Chen's avatar ChangZhuo Chen

Imported Upstream version 2.2

parent 7b2d4274
......@@ -3,6 +3,7 @@
# IBus Cangjie was written by these people:
Anthony Wong <anthony.wong@ubuntu.com>
antonyho <ntonyworkshop@gmail.com>
Benau <benau2006@yahoo.com.hk>
Koala Yeung <koalay@gmail.com>
Mathieu Bridon <bochecha@fedoraproject.org>
......@@ -59,7 +59,7 @@ mostlyclean-am: clean-gsettings-schemas
gsettings__enum_file = $(addsuffix .enums.xml,$(gsettings_ENUM_NAMESPACE))
%.gschema.valid: %.gschema.xml $(gsettings__enum_file)
$(AM_V_GEN) if test -f "$<"; then d=; else d="$(srcdir)/"; fi; $(GLIB_COMPILE_SCHEMAS) --strict --dry-run $(addprefix --schema-file=,$(gsettings__enum_file)) --schema-file=$${d}$< && touch [$]@
$(AM_V_GEN) $(GLIB_COMPILE_SCHEMAS) --strict --dry-run $(addprefix --schema-file=,$(gsettings__enum_file)) --schema-file=$< && mkdir -p [$](@D) && touch [$]@
all-am: $(gsettings_SCHEMAS:.xml=.valid)
uninstall-am: uninstall-gsettings-schemas
......
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for ibus-cangjie 2.1.
# Generated by GNU Autoconf 2.69 for ibus-cangjie 2.2.
#
# Report bugs to <https://github.com/Cangjians/ibus-cangjie/issues>.
#
......@@ -579,8 +579,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='ibus-cangjie'
PACKAGE_TARNAME='ibus-cangjie'
PACKAGE_VERSION='2.1'
PACKAGE_STRING='ibus-cangjie 2.1'
PACKAGE_VERSION='2.2'
PACKAGE_STRING='ibus-cangjie 2.2'
PACKAGE_BUGREPORT='https://github.com/Cangjians/ibus-cangjie/issues'
PACKAGE_URL='https://github.com/Cangjians/ibus-cangjie'
......@@ -1313,7 +1313,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures ibus-cangjie 2.1 to adapt to many kinds of systems.
\`configure' configures ibus-cangjie 2.2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
......@@ -1383,7 +1383,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of ibus-cangjie 2.1:";;
short | recursive ) echo "Configuration of ibus-cangjie 2.2:";;
esac
cat <<\_ACEOF
......@@ -1495,7 +1495,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
ibus-cangjie configure 2.1
ibus-cangjie configure 2.2
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
......@@ -1705,7 +1705,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by ibus-cangjie $as_me 2.1, which was
It was created by ibus-cangjie $as_me 2.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
......@@ -2579,7 +2579,7 @@ fi
# Define the identity of the package.
PACKAGE='ibus-cangjie'
VERSION='2.1'
VERSION='2.2'
cat >>confdefs.h <<_ACEOF
......@@ -7030,7 +7030,7 @@ mostlyclean-am: clean-gsettings-schemas
gsettings__enum_file = $(addsuffix .enums.xml,$(gsettings_ENUM_NAMESPACE))
%.gschema.valid: %.gschema.xml $(gsettings__enum_file)
$(AM_V_GEN) if test -f "$<"; then d=; else d="$(srcdir)/"; fi; $(GLIB_COMPILE_SCHEMAS) --strict --dry-run $(addprefix --schema-file=,$(gsettings__enum_file)) --schema-file=$${d}$< && touch $@
$(AM_V_GEN) $(GLIB_COMPILE_SCHEMAS) --strict --dry-run $(addprefix --schema-file=,$(gsettings__enum_file)) --schema-file=$< && mkdir -p $(@D) && touch $@
all-am: $(gsettings_SCHEMAS:.xml=.valid)
uninstall-am: uninstall-gsettings-schemas
......@@ -7608,7 +7608,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by ibus-cangjie $as_me 2.1, which was
This file was extended by ibus-cangjie $as_me 2.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
......@@ -7675,7 +7675,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
ibus-cangjie config.status 2.1
ibus-cangjie config.status 2.2
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
......
AC_PREREQ(2.63)
AC_INIT([ibus-cangjie], [2.1], [https://github.com/Cangjians/ibus-cangjie/issues], [ibus-cangjie], [https://github.com/Cangjians/ibus-cangjie])
AC_INIT([ibus-cangjie], [2.2], [https://github.com/Cangjians/ibus-cangjie/issues], [ibus-cangjie], [https://github.com/Cangjians/ibus-cangjie])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
......
......@@ -36,7 +36,8 @@ _ = lambda x: gettext.dgettext("ibus-cangjie", x)
def is_inputnumber(keyval):
"""Is the `keyval` param a numeric input, e.g to select a candidate."""
return keyval in range(getattr(IBus, "0"), getattr(IBus, "9")+1)
return ((keyval in range(getattr(IBus, "0"), getattr(IBus, "9")+1)) or
(keyval in range(IBus.KP_0, IBus.KP_9+1)))
class Engine(IBus.Engine):
......
......@@ -114,6 +114,7 @@ sys.modules["ibus_cangjie.canberra"].Canberra = MockCanberra
# -- Set some environment variables for the tests ----------------------------
# The unit tests will need this to find the settings schemas
os.environ["GSETTINGS_BACKEND"] = "memory"
os.environ["GSETTINGS_SCHEMA_DIR"] = "@BUILDDIR@/data"
subprocess.check_call(["glib-compile-schemas", os.environ["GSETTINGS_SCHEMA_DIR"]])
......
......@@ -182,3 +182,27 @@ class QuickTestCase(unittest.TestCase):
self.assertEqual(len(self.engine._mock_auxiliary_text), 1)
self.assertEqual(len(self.engine._mock_committed_text), 1)
self.assertTrue(self.engine.lookuptable.get_number_of_candidates() > 1)
def test_commit_with_numpad(self):
self.engine.do_process_key_event(IBus.h, 0, 0)
self.engine.do_process_key_event(IBus.i, 0, 0)
self.engine.do_process_key_event(getattr(IBus, "7"), 0, 0)
self.assertEqual(len(self.engine._mock_auxiliary_text), 0)
self.assertEqual(len(self.engine._mock_committed_text), 1)
self.assertEqual(self.engine.lookuptable.get_number_of_candidates(), 0)
# Reset the committed text, but keep the value first
expected = self.engine._mock_committed_text[:]
self.engine._mock_committed_text = ''
self.engine.do_process_key_event(IBus.h, 0, 0)
self.engine.do_process_key_event(IBus.i, 0, 0)
self.engine.do_process_key_event(IBus.KP_7, 0, 0)
self.assertEqual(len(self.engine._mock_auxiliary_text), 0)
self.assertEqual(len(self.engine._mock_committed_text), 1)
self.assertEqual(self.engine.lookuptable.get_number_of_candidates(), 0)
# Now check that the same character was committed
self.assertEqual(expected, self.engine._mock_committed_text)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment