2011-08-27 20:29:34 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
#include "../termkey.h"
|
|
|
|
#include "taplib.h"
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
TermKey *tk;
|
|
|
|
TermKeyKey key;
|
|
|
|
|
|
|
|
plan_tests(8);
|
|
|
|
|
2012-01-26 13:55:34 +01:00
|
|
|
tk = termkey_new_abstract("vt100", 0);
|
2011-08-27 20:29:34 +02:00
|
|
|
|
2012-01-18 14:39:50 +01:00
|
|
|
termkey_push_bytes(tk, " ", 1);
|
2011-08-27 20:29:34 +02:00
|
|
|
|
2012-01-18 14:39:50 +01:00
|
|
|
is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY after space");
|
2011-08-27 20:29:34 +02:00
|
|
|
|
2014-03-05 02:11:45 +01:00
|
|
|
is_int(key.type, TERMKEY_TYPE_UNICODE, "key.type after space");
|
|
|
|
is_int(key.code.codepoint, ' ', "key.code.codepoint after space");
|
|
|
|
is_int(key.modifiers, 0, "key.modifiers after space");
|
2011-08-27 20:29:34 +02:00
|
|
|
|
|
|
|
termkey_set_flags(tk, TERMKEY_FLAG_SPACESYMBOL);
|
|
|
|
|
2012-01-18 14:39:50 +01:00
|
|
|
termkey_push_bytes(tk, " ", 1);
|
2011-08-27 20:29:34 +02:00
|
|
|
|
2012-01-18 14:39:50 +01:00
|
|
|
is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY after space");
|
2011-08-27 20:29:34 +02:00
|
|
|
|
2014-03-05 02:11:45 +01:00
|
|
|
is_int(key.type, TERMKEY_TYPE_KEYSYM, "key.type after space with FLAG_SPACESYMBOL");
|
|
|
|
is_int(key.code.sym, TERMKEY_SYM_SPACE, "key.code.sym after space with FLAG_SPACESYMBOL");
|
|
|
|
is_int(key.modifiers, 0, "key.modifiers after space with FLAG_SPACESYMBOL");
|
2011-08-27 20:29:34 +02:00
|
|
|
|
|
|
|
termkey_destroy(tk);
|
|
|
|
|
|
|
|
return exit_status();
|
|
|
|
}
|