2011-03-31 14:51:21 +02:00
|
|
|
#include "../termkey.h"
|
2011-03-31 14:43:16 +02:00
|
|
|
#include "taplib.h"
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
TermKey *tk;
|
|
|
|
TermKeySym sym;
|
2013-07-15 02:03:35 +02:00
|
|
|
const char *end;
|
2011-03-31 14:43:16 +02:00
|
|
|
|
2011-04-01 14:26:54 +02:00
|
|
|
plan_tests(10);
|
2011-03-31 14:43:16 +02:00
|
|
|
|
2012-01-26 13:55:34 +01:00
|
|
|
tk = termkey_new_abstract("vt100", 0);
|
2011-03-31 14:43:16 +02:00
|
|
|
|
|
|
|
sym = termkey_keyname2sym(tk, "Space");
|
|
|
|
is_int(sym, TERMKEY_SYM_SPACE, "keyname2sym Space");
|
|
|
|
|
|
|
|
sym = termkey_keyname2sym(tk, "SomeUnknownKey");
|
|
|
|
is_int(sym, TERMKEY_SYM_UNKNOWN, "keyname2sym SomeUnknownKey");
|
|
|
|
|
2011-04-01 14:26:54 +02:00
|
|
|
end = termkey_lookup_keyname(tk, "Up", &sym);
|
|
|
|
ok(!!end, "termkey_get_keyname Up returns non-NULL");
|
|
|
|
is_str(end, "", "termkey_get_keyname Up return points at endofstring");
|
|
|
|
is_int(sym, TERMKEY_SYM_UP, "termkey_get_keyname Up yields Up symbol");
|
|
|
|
|
|
|
|
end = termkey_lookup_keyname(tk, "DownMore", &sym);
|
|
|
|
ok(!!end, "termkey_get_keyname DownMore returns non-NULL");
|
|
|
|
is_str(end, "More", "termkey_get_keyname DownMore return points at More");
|
|
|
|
is_int(sym, TERMKEY_SYM_DOWN, "termkey_get_keyname DownMore yields Down symbol");
|
|
|
|
|
|
|
|
end = termkey_lookup_keyname(tk, "SomeUnknownKey", &sym);
|
|
|
|
ok(!end, "termkey_get_keyname SomeUnknownKey returns NULL");
|
|
|
|
|
2011-03-31 14:43:16 +02:00
|
|
|
is_str(termkey_get_keyname(tk, TERMKEY_SYM_SPACE), "Space", "get_keyname SPACE");
|
|
|
|
|
|
|
|
termkey_destroy(tk);
|
|
|
|
|
|
|
|
return exit_status();
|
|
|
|
}
|