2012-04-24 18:27:48 +02:00
|
|
|
#include "../termkey.h"
|
|
|
|
#include "taplib.h"
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
TermKey *tk;
|
|
|
|
TermKeyKey key;
|
|
|
|
int line, col;
|
|
|
|
|
2012-11-30 16:36:06 +01:00
|
|
|
plan_tests(8);
|
2012-04-24 18:27:48 +02:00
|
|
|
|
|
|
|
tk = termkey_new_abstract("vt100", 0);
|
|
|
|
|
2012-11-30 17:12:26 +01:00
|
|
|
termkey_push_bytes(tk, "\e[?15;7R", 8);
|
2012-04-24 18:27:48 +02:00
|
|
|
|
|
|
|
is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY for position report");
|
|
|
|
|
|
|
|
is_int(key.type, TERMKEY_TYPE_POSITION, "key.type for position report");
|
|
|
|
|
|
|
|
is_int(termkey_interpret_position(tk, &key, &line, &col), TERMKEY_RES_KEY, "interpret_position yields RES_KEY");
|
|
|
|
|
2012-04-25 19:34:47 +02:00
|
|
|
is_int(line, 15, "line for position report");
|
|
|
|
is_int(col, 7, "column for position report");
|
2012-04-24 18:27:48 +02:00
|
|
|
|
2012-11-30 16:36:06 +01:00
|
|
|
/* A plain CSI R is likely to be <F3> though.
|
|
|
|
* This is tricky :/
|
|
|
|
*/
|
|
|
|
termkey_push_bytes(tk, "\e[R", 3);
|
|
|
|
|
|
|
|
is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY for <F3>");
|
|
|
|
|
|
|
|
is_int(key.type, TERMKEY_TYPE_FUNCTION, "key.type for <F3>");
|
|
|
|
is_int(key.code.number, 3, "key.code.number for <F3>");
|
|
|
|
|
2012-04-24 18:27:48 +02:00
|
|
|
termkey_destroy(tk);
|
|
|
|
|
|
|
|
return exit_status();
|
|
|
|
}
|