diff options
author | Paul LeoNerd Evans <leonerd@leonerd.org.uk> | 2011-09-06 22:49:05 +0100 |
---|---|---|
committer | Paul LeoNerd Evans <leonerd@leonerd.org.uk> | 2011-09-06 22:49:05 +0100 |
commit | 8f32ac525f34aa32cd6dab4d13d0cfe84bf30879 (patch) | |
tree | 5406e7ba3016691d03afa9bf6730b86478918a03 /t/13cmpkey.c | |
parent | 3008ed29d195ecff454a160c153bcbb9d651cc68 (diff) | |
download | termo-8f32ac525f34aa32cd6dab4d13d0cfe84bf30879.tar.gz termo-8f32ac525f34aa32cd6dab4d13d0cfe84bf30879.tar.xz termo-8f32ac525f34aa32cd6dab4d13d0cfe84bf30879.zip |
Canonicalise (a local copy of) the key structures given to termkey_keycmp() before comparing them
Diffstat (limited to 't/13cmpkey.c')
-rw-r--r-- | t/13cmpkey.c | 14 |
1 files changed, 13 insertions, 1 deletions
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(); |