summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRan Benita <ran234@gmail.com>2012-11-05 21:34:59 +0200
committerRan Benita <ran234@gmail.com>2012-11-05 21:34:59 +0200
commit7891c9170bda67bc710ba9cad1b48263d14d7ec2 (patch)
tree4bb87c525ce3b104330ba159c9759f6cc1431948 /test
parentfb201645b2bae1f4a1f7a6dfa37e14a0de04556e (diff)
keysym-utf: also translate special keysyms like Tab and Return
The keysym2ucs.c file apparently leaves out some keysyms, which libX11 deals with separately (like in _XkbHandleSpecialSym()). The problematic keysyms are the keypad ones (for which we already added some support) and keysyms which use 0xff** instead of 0x00** < 0x20. This code should fix them properly, as much as I could gather from libX11 and http://www.cl.cam.ac.uk/~mgk25/ucs/keysym2ucs.c and other sources (which are not aware of locale). https://bugs.freedesktop.org/show_bug.cgi?id=56780 Reported-by: Gatis Paeglis <gatis.paeglis@digia.com> Signed-off-by: Ran Benita <ran234@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/keysym.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/test/keysym.c b/test/keysym.c
index 595f829..fe6138d 100644
--- a/test/keysym.c
+++ b/test/keysym.c
@@ -73,8 +73,10 @@ test_utf8(xkb_keysym_t keysym, const char *expected)
if (ret <= 0)
return ret;
- fprintf(stderr, "Expected keysym %#x -> %s\n", keysym, expected);
- fprintf(stderr, "Received keysym %#x -> %s\n\n", keysym, s);
+ fprintf(stderr, "Expected keysym %#x -> %s (%u bytes)\n", keysym, expected,
+ (unsigned) strlen(expected));
+ fprintf(stderr, "Received keysym %#x -> %s (%u bytes)\n\n", keysym, s,
+ (unsigned) strlen(s));
return streq(s, expected);
}
@@ -133,6 +135,17 @@ main(void)
assert(test_utf8(XKB_KEY_space, " "));
assert(test_utf8(XKB_KEY_KP_Space, " "));
+ assert(test_utf8(XKB_KEY_BackSpace, "\b"));
+ assert(test_utf8(XKB_KEY_Escape, "\e"));
+ assert(test_utf8(XKB_KEY_KP_Separator, ","));
+ assert(test_utf8(XKB_KEY_KP_Decimal, "."));
+ assert(test_utf8(XKB_KEY_Tab, "\t"));
+ assert(test_utf8(XKB_KEY_KP_Tab, "\t"));
+ assert(test_utf8(XKB_KEY_hyphen, "­"));
+ assert(test_utf8(XKB_KEY_Linefeed, "\n"));
+ assert(test_utf8(XKB_KEY_Return, "\r"));
+ assert(test_utf8(XKB_KEY_KP_Enter, "\r"));
+ assert(test_utf8(XKB_KEY_KP_Equal, "="));
assert(test_utf8(XKB_KEY_9, "9"));
assert(test_utf8(XKB_KEY_KP_9, "9"));
assert(test_utf8(XKB_KEY_KP_Multiply, "*"));