From 8f32ac525f34aa32cd6dab4d13d0cfe84bf30879 Mon Sep 17 00:00:00 2001 From: Paul LeoNerd Evans Date: Tue, 6 Sep 2011 22:49:05 +0100 Subject: Canonicalise (a local copy of) the key structures given to termkey_keycmp() before comparing them --- t/13cmpkey.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 't') diff --git a/t/13cmpkey.c b/t/13cmpkey.c index 90ff9e1..62902cc 100644 --- a/t/13cmpkey.c +++ b/t/13cmpkey.c @@ -6,7 +6,7 @@ int main(int argc, char *argv[]) TermKey *tk; TermKeyKey key1, key2; - plan_tests(10); + plan_tests(12); tk = termkey_new(0, TERMKEY_FLAG_NOTERMIOS); @@ -44,6 +44,18 @@ int main(int argc, char *argv[]) ok(termkey_keycmp(tk, &key1, &key2) < 0, "cmpkey orders KEYSYM after UNICODE"); ok(termkey_keycmp(tk, &key2, &key1) > 0, "cmpkey orders UNICODE before KEYSYM"); + key1.type = TERMKEY_TYPE_KEYSYM; + key1.code.sym = TERMKEY_SYM_SPACE; + key1.modifiers = 0; + key2.type = TERMKEY_TYPE_UNICODE; + key2.code.codepoint = ' '; + key2.modifiers = 0; + + is_int(termkey_keycmp(tk, &key1, &key2), 0, "cmpkey considers KEYSYM/SPACE and UNICODE/SP identical"); + + termkey_set_canonflags(tk, termkey_get_canonflags(tk) | TERMKEY_CANON_SPACESYMBOL); + is_int(termkey_keycmp(tk, &key1, &key2), 0, "cmpkey considers KEYSYM/SPACE and UNICODE/SP identical under SPACESYMBOL"); + termkey_destroy(tk); return exit_status(); -- cgit v1.2.3