aboutsummaryrefslogtreecommitdiff
path: root/t/30mouse.c
diff options
context:
space:
mode:
Diffstat (limited to 't/30mouse.c')
-rw-r--r--t/30mouse.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/t/30mouse.c b/t/30mouse.c
index 14956b8..a466bb4 100644
--- a/t/30mouse.c
+++ b/t/30mouse.c
@@ -10,7 +10,7 @@ int main(int argc, char *argv[])
char buffer[32];
size_t len;
- plan_tests(46);
+ plan_tests(58);
/* vt100 doesn't have a mouse, we need xterm */
tk = termkey_new_abstract("xterm", 0);
@@ -101,6 +101,31 @@ int main(int argc, char *argv[])
is_int(col, 20, "mouse column for release rxvt protocol");
is_int(key.modifiers, 0, "modifiers for release rxvt protocol");
+ // SGR protocol
+ termkey_push_bytes(tk, "\e[<0;30;30M", 11);
+
+ is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY for mouse press SGR encoding");
+
+ is_int(key.type, TERMKEY_TYPE_MOUSE, "key.type for mouse press SGR encoding");
+
+ is_int(termkey_interpret_mouse(tk, &key, &ev, &button, &line, &col), TERMKEY_RES_KEY, "interpret_mouse yields RES_KEY");
+
+ is_int(ev, TERMKEY_MOUSE_PRESS, "mouse event for press SGR");
+ is_int(button, 1, "mouse button for press SGR");
+ is_int(line, 30, "mouse line for press SGR");
+ is_int(col, 30, "mouse column for press SGR");
+ is_int(key.modifiers, 0, "modifiers for press SGR");
+
+ termkey_push_bytes(tk, "\e[<0;30;30m", 11);
+
+ is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY for mouse release SGR encoding");
+
+ is_int(key.type, TERMKEY_TYPE_MOUSE, "key.type for mouse release SGR encoding");
+
+ is_int(termkey_interpret_mouse(tk, &key, &ev, &button, &line, &col), TERMKEY_RES_KEY, "interpret_mouse yields RES_KEY");
+
+ is_int(ev, TERMKEY_MOUSE_RELEASE, "mouse event for release SGR");
+
termkey_destroy(tk);
return exit_status();