aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-08-08 23:51:29 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2015-08-09 14:52:02 +0200
commitf05e40a30a008e0197fe0c8b192f399c448a95c6 (patch)
treefb3d2bb73687c6b56222196fca1fddec59d08e49 /tests
parent0b5d8ecd0d4119f7fa3e1ef8bc060c6c7124de14 (diff)
downloadtermo-f05e40a30a008e0197fe0c8b192f399c448a95c6.tar.gz
termo-f05e40a30a008e0197fe0c8b192f399c448a95c6.tar.xz
termo-f05e40a30a008e0197fe0c8b192f399c448a95c6.zip
Don't interpret an n*<Esc> as (n-1)*<Alt>-<Esc>
Diffstat (limited to 'tests')
-rw-r--r--tests/02getkey.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/tests/02getkey.c b/tests/02getkey.c
index 94f71c7..b36eb9e 100644
--- a/tests/02getkey.c
+++ b/tests/02getkey.c
@@ -7,7 +7,7 @@ main (int argc, char *argv[])
termo_t *tk;
termo_key_t key;
- plan_tests (31);
+ plan_tests (38);
tk = termo_new_abstract ("vt100", NULL, 0);
@@ -86,6 +86,27 @@ main (int argc, char *argv[])
is_int (key.modifiers, TERMO_KEYMOD_CTRL,
"key.modifiers after Ctrl-Escape");
+ // Escape key in various amounts
+
+ termo_push_bytes (tk, "\x1b\x1b", 2);
+ is_int (termo_getkey (tk, &key), TERMO_RES_AGAIN,
+ "two Escapes don't yield anything");
+ is_int (termo_get_buffer_remaining (tk), 254,
+ "buffer free 254 after two Escapes");
+
+ termo_push_bytes (tk, "\x1b", 1);
+ is_int (termo_getkey (tk, &key), TERMO_RES_KEY,
+ "three Escapes yield Alt-Escape");
+ is_int (termo_get_buffer_remaining (tk), 255,
+ "buffer free 255 after three Escapes");
+
+ is_int (key.type, TERMO_TYPE_KEYSYM,
+ "key.type after three Escapes");
+ is_int (key.code.sym, TERMO_SYM_ESCAPE,
+ "key.code.sym after three Escapes");
+ is_int (key.modifiers, TERMO_KEYMOD_ALT,
+ "key.modifiers after three Escapes");
+
termo_destroy (tk);
return exit_status ();