2014-10-14 00:24:47 +02:00
|
|
|
#include "../termo.h"
|
2012-04-24 18:27:48 +02:00
|
|
|
#include "taplib.h"
|
|
|
|
|
2021-10-30 02:53:18 +02:00
|
|
|
int
|
|
|
|
main (int argc, char *argv[])
|
2012-04-24 18:27:48 +02:00
|
|
|
{
|
2014-10-14 00:24:47 +02:00
|
|
|
termo_t *tk;
|
|
|
|
termo_key_t key;
|
2014-09-28 05:56:13 +02:00
|
|
|
int line, col;
|
2012-04-24 18:27:48 +02:00
|
|
|
|
2014-09-28 05:56:13 +02:00
|
|
|
plan_tests (8);
|
2012-04-24 18:27:48 +02:00
|
|
|
|
2014-10-14 00:24:47 +02:00
|
|
|
tk = termo_new_abstract ("vt100", NULL, 0);
|
2012-04-24 18:27:48 +02:00
|
|
|
|
2014-10-14 00:24:47 +02:00
|
|
|
termo_push_bytes (tk, "\e[?15;7R", 8);
|
2012-04-24 18:27:48 +02:00
|
|
|
|
2014-10-14 00:24:47 +02:00
|
|
|
is_int (termo_getkey (tk, &key), TERMO_RES_KEY,
|
2014-09-28 05:56:13 +02:00
|
|
|
"getkey yields RES_KEY for position report");
|
2012-04-24 18:27:48 +02:00
|
|
|
|
2014-10-14 00:24:47 +02:00
|
|
|
is_int (key.type, TERMO_TYPE_POSITION, "key.type for position report");
|
2012-04-24 18:27:48 +02:00
|
|
|
|
2014-10-14 00:24:47 +02:00
|
|
|
is_int (termo_interpret_position (tk, &key, &line, &col), TERMO_RES_KEY,
|
2014-09-28 05:56:13 +02:00
|
|
|
"interpret_position yields RES_KEY");
|
2012-04-24 18:27:48 +02:00
|
|
|
|
2015-05-27 21:36:50 +02:00
|
|
|
is_int (line, 14, "line for position report");
|
|
|
|
is_int (col, 6, "column for position report");
|
2012-04-24 18:27:48 +02:00
|
|
|
|
2014-10-14 21:19:11 +02:00
|
|
|
// A plain CSI R is likely to be <F3> though. This is tricky :/
|
2014-10-14 00:24:47 +02:00
|
|
|
termo_push_bytes (tk, "\e[R", 3);
|
2012-11-30 16:36:06 +01:00
|
|
|
|
2014-10-14 00:24:47 +02:00
|
|
|
is_int (termo_getkey (tk, &key), TERMO_RES_KEY,
|
2014-09-28 05:56:13 +02:00
|
|
|
"getkey yields RES_KEY for <F3>");
|
2012-11-30 16:36:06 +01:00
|
|
|
|
2014-10-14 00:24:47 +02:00
|
|
|
is_int (key.type, TERMO_TYPE_FUNCTION, "key.type for <F3>");
|
2014-09-28 05:56:13 +02:00
|
|
|
is_int (key.code.number, 3, "key.code.number for <F3>");
|
2012-11-30 16:36:06 +01:00
|
|
|
|
2014-10-14 00:24:47 +02:00
|
|
|
termo_destroy (tk);
|
2014-09-28 05:56:13 +02:00
|
|
|
return exit_status ();
|
2012-04-24 18:27:48 +02:00
|
|
|
}
|