Canonicalise (a local copy of) the key structures given to termkey_keycmp() before comparing them
This commit is contained in:
14
t/13cmpkey.c
14
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();
|
||||
|
||||
Reference in New Issue
Block a user