termo/tests/04flags.c

44 lines
1014 B
C
Raw Normal View History

#include <stdio.h>
2014-10-14 00:24:47 +02:00
#include "../termo.h"
#include "taplib.h"
int
main (int argc, char *argv[])
{
(void) argc;
(void) argv;
2014-10-14 00:24:47 +02:00
termo_t *tk;
termo_key_t key;
plan_tests (8);
2014-10-14 00:24:47 +02:00
tk = termo_new_abstract ("vt100", NULL, 0);
2014-10-14 00:24:47 +02:00
termo_push_bytes (tk, " ", 1);
2014-10-14 00:24:47 +02:00
is_int (termo_getkey (tk, &key), TERMO_RES_KEY,
"getkey yields RES_KEY after space");
2014-10-14 00:24:47 +02:00
is_int (key.type, TERMO_TYPE_KEY, "key.type after space");
is_int (key.code.codepoint, ' ', "key.code.codepoint after space");
is_int (key.modifiers, 0, "key.modifiers after space");
2014-10-14 00:24:47 +02:00
termo_set_flags (tk, TERMO_FLAG_SPACESYMBOL);
2014-10-14 00:24:47 +02:00
termo_push_bytes (tk, " ", 1);
2014-10-14 00:24:47 +02:00
is_int (termo_getkey (tk, &key), TERMO_RES_KEY,
"getkey yields RES_KEY after space");
2014-10-14 00:24:47 +02:00
is_int (key.type, TERMO_TYPE_KEYSYM,
"key.type after space with FLAG_SPACESYMBOL");
2014-10-14 00:24:47 +02:00
is_int (key.code.sym, TERMO_SYM_SPACE,
"key.code.sym after space with FLAG_SPACESYMBOL");
is_int (key.modifiers, 0,
"key.modifiers after space with FLAG_SPACESYMBOL");
2014-10-14 00:24:47 +02:00
termo_destroy (tk);
return exit_status ();
}