aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2020-09-14 15:38:49 +0200
committerPřemysl Eric Janouch <p@janouch.name>2020-09-14 17:55:41 +0200
commit0bfb13655c02c75b0e1cc864a81996e58cd5c7b4 (patch)
treebce0c60337beda47d632511f0f4e0afd9bb7eb17 /tests
parent78c0cd443d7e302fac6448db9d776c02a185d084 (diff)
downloadtermo-0bfb13655c02c75b0e1cc864a81996e58cd5c7b4.tar.gz
termo-0bfb13655c02c75b0e1cc864a81996e58cd5c7b4.tar.xz
termo-0bfb13655c02c75b0e1cc864a81996e58cd5c7b4.zip
Implement de/focus event parsing
So far there is no way to set it up, I'm not sure how to go about it.
Diffstat (limited to 'tests')
-rw-r--r--tests/33focus.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/33focus.c b/tests/33focus.c
new file mode 100644
index 0000000..76f1d42
--- /dev/null
+++ b/tests/33focus.c
@@ -0,0 +1,28 @@
+#include "../termo.h"
+#include "taplib.h"
+
+int
+main (int argc, char *argv[])
+{
+ termo_t *tk;
+ termo_key_t key;
+
+ plan_tests (6);
+
+ tk = termo_new_abstract ("vt100", NULL, 0);
+
+ termo_push_bytes (tk, "\e[I", 3);
+ is_int (termo_getkey (tk, &key), TERMO_RES_KEY,
+ "getkey yields RES_KEY for focus in");
+ is_int (key.type, TERMO_TYPE_FOCUS, "key.type for focus in");
+ is_int (key.code.focused, 1, "focused indicator for focus in");
+
+ termo_push_bytes (tk, "\e[O", 3);
+ is_int (termo_getkey (tk, &key), TERMO_RES_KEY,
+ "getkey yields RES_KEY for focus out");
+ is_int (key.type, TERMO_TYPE_FOCUS, "key.type for focus out");
+ is_int (key.code.focused, 0, "focused indicator for focus out");
+
+ termo_destroy (tk);
+ return exit_status ();
+}