2014-10-14 00:24:47 +02:00
|
|
|
#include "../termo.h"
|
2011-08-27 20:59:02 +02:00
|
|
|
#include "taplib.h"
|
|
|
|
|
2014-09-28 05:56:13 +02:00
|
|
|
int
|
|
|
|
main (int argc, char *argv[])
|
2011-08-27 20:59:02 +02:00
|
|
|
{
|
2023-08-01 03:05:55 +02:00
|
|
|
(void) argc;
|
|
|
|
(void) argv;
|
|
|
|
|
2014-10-14 00:24:47 +02:00
|
|
|
termo_t *tk;
|
|
|
|
termo_key_t key;
|
2014-09-28 05:56:13 +02:00
|
|
|
const char *endp;
|
2011-08-27 20:59:02 +02:00
|
|
|
|
2014-09-28 05:56:13 +02:00
|
|
|
#define CLEAR_KEY do { key.type = -1; key.code.codepoint = -1; \
|
|
|
|
key.modifiers = -1; key.multibyte[0] = 0; } while (0)
|
2011-08-27 20:59:02 +02:00
|
|
|
|
2014-09-28 05:56:13 +02:00
|
|
|
plan_tests (26);
|
2011-08-27 20:59:02 +02:00
|
|
|
|
2014-10-14 00:24:47 +02:00
|
|
|
tk = termo_new_abstract ("vt100", NULL, 0);
|
2011-08-27 20:59:02 +02:00
|
|
|
|
2014-09-28 05:56:13 +02:00
|
|
|
CLEAR_KEY;
|
2016-10-04 13:22:52 +02:00
|
|
|
endp = termo_strpkey_utf8 (tk, " ", &key, 0);
|
2014-10-14 00:24:47 +02:00
|
|
|
is_int (key.type, TERMO_TYPE_KEY, "key.type for SP/unicode");
|
2014-09-28 05:56:13 +02:00
|
|
|
is_int (key.code.codepoint, ' ', "key.code.codepoint for SP/unicode");
|
|
|
|
is_int (key.modifiers, 0, "key.modifiers for SP/unicode");
|
|
|
|
is_str (key.multibyte, " ", "key.multibyte for SP/unicode");
|
|
|
|
is_str (endp, "", "consumed entire input for SP/unicode");
|
2011-08-27 20:59:02 +02:00
|
|
|
|
2014-09-28 05:56:13 +02:00
|
|
|
CLEAR_KEY;
|
2016-10-04 13:22:52 +02:00
|
|
|
endp = termo_strpkey_utf8 (tk, "Space", &key, 0);
|
2014-10-14 00:24:47 +02:00
|
|
|
is_int (key.type, TERMO_TYPE_KEY, "key.type for Space/unicode");
|
2014-09-28 05:56:13 +02:00
|
|
|
is_int (key.code.codepoint, ' ', "key.code.codepoint for Space/unicode");
|
|
|
|
is_int (key.modifiers, 0, "key.modifiers for Space/unicode");
|
|
|
|
is_str (key.multibyte, " ", "key.multibyte for Space/unicode");
|
|
|
|
is_str (endp, "", "consumed entire input for Space/unicode");
|
2011-08-27 20:59:02 +02:00
|
|
|
|
2014-10-14 00:24:47 +02:00
|
|
|
termo_set_canonflags (tk,
|
|
|
|
termo_get_canonflags (tk) | TERMO_CANON_SPACESYMBOL);
|
2011-08-27 20:59:02 +02:00
|
|
|
|
2014-09-28 05:56:13 +02:00
|
|
|
CLEAR_KEY;
|
2016-10-04 13:22:52 +02:00
|
|
|
endp = termo_strpkey_utf8 (tk, " ", &key, 0);
|
2014-10-14 00:24:47 +02:00
|
|
|
is_int (key.type, TERMO_TYPE_KEYSYM, "key.type for SP/symbol");
|
|
|
|
is_int (key.code.sym, TERMO_SYM_SPACE,
|
2014-09-28 05:56:13 +02:00
|
|
|
"key.code.codepoint for SP/symbol");
|
|
|
|
is_int (key.modifiers, 0, "key.modifiers for SP/symbol");
|
|
|
|
is_str (endp, "", "consumed entire input for SP/symbol");
|
2011-08-27 20:59:02 +02:00
|
|
|
|
2014-09-28 05:56:13 +02:00
|
|
|
CLEAR_KEY;
|
2016-10-04 13:22:52 +02:00
|
|
|
endp = termo_strpkey_utf8 (tk, "Space", &key, 0);
|
2014-10-14 00:24:47 +02:00
|
|
|
is_int (key.type, TERMO_TYPE_KEYSYM, "key.type for Space/symbol");
|
|
|
|
is_int (key.code.sym, TERMO_SYM_SPACE,
|
2014-09-28 05:56:13 +02:00
|
|
|
"key.code.codepoint for Space/symbol");
|
|
|
|
is_int (key.modifiers, 0, "key.modifiers for Space/symbol");
|
|
|
|
is_str (endp, "", "consumed entire input for Space/symbol");
|
2011-08-27 20:59:02 +02:00
|
|
|
|
2014-09-28 05:56:13 +02:00
|
|
|
CLEAR_KEY;
|
2016-10-04 13:22:52 +02:00
|
|
|
endp = termo_strpkey_utf8 (tk, "DEL", &key, 0);
|
2014-10-14 00:24:47 +02:00
|
|
|
is_int (key.type, TERMO_TYPE_KEYSYM, "key.type for Del/unconverted");
|
|
|
|
is_int (key.code.sym, TERMO_SYM_DEL,
|
2014-09-28 05:56:13 +02:00
|
|
|
"key.code.codepoint for Del/unconverted");
|
|
|
|
is_int (key.modifiers, 0, "key.modifiers for Del/unconverted");
|
|
|
|
is_str (endp, "", "consumed entire input for Del/unconverted");
|
2011-08-28 18:57:57 +02:00
|
|
|
|
2014-10-14 00:24:47 +02:00
|
|
|
termo_set_canonflags (tk,
|
|
|
|
termo_get_canonflags (tk) | TERMO_CANON_DELBS);
|
2011-08-28 18:57:57 +02:00
|
|
|
|
2014-09-28 05:56:13 +02:00
|
|
|
CLEAR_KEY;
|
2016-10-04 13:22:52 +02:00
|
|
|
endp = termo_strpkey_utf8 (tk, "DEL", &key, 0);
|
2014-10-14 00:24:47 +02:00
|
|
|
is_int (key.type, TERMO_TYPE_KEYSYM, "key.type for Del/as-backspace");
|
|
|
|
is_int (key.code.sym, TERMO_SYM_BACKSPACE,
|
2014-09-28 05:56:13 +02:00
|
|
|
"key.code.codepoint for Del/as-backspace");
|
|
|
|
is_int (key.modifiers, 0, "key.modifiers for Del/as-backspace");
|
|
|
|
is_str (endp, "", "consumed entire input for Del/as-backspace");
|
2011-08-28 18:57:57 +02:00
|
|
|
|
2014-10-14 00:24:47 +02:00
|
|
|
termo_destroy (tk);
|
2014-09-28 05:56:13 +02:00
|
|
|
return exit_status ();
|
2011-08-27 20:59:02 +02:00
|
|
|
}
|