aboutsummaryrefslogtreecommitdiff
path: root/t/30mouse.c
diff options
context:
space:
mode:
authorPaul LeoNerd Evans <leonerd@leonerd.org.uk>2012-04-05 18:54:30 +0100
committerPaul LeoNerd Evans <leonerd@leonerd.org.uk>2012-04-05 18:54:30 +0100
commit789a5a3c9d6be17df59491ae20e05d9620365fc7 (patch)
tree5334a34c5d2d35748f9a1b2374d2457fefbaa06a /t/30mouse.c
parent5f942e9e3ef9a70beb31e8539dd60a5a3cc0c7a2 (diff)
downloadtermo-789a5a3c9d6be17df59491ae20e05d9620365fc7.tar.gz
termo-789a5a3c9d6be17df59491ae20e05d9620365fc7.tar.xz
termo-789a5a3c9d6be17df59491ae20e05d9620365fc7.zip
Extract modifiers for mouse events at peekkey time
Diffstat (limited to 't/30mouse.c')
-rw-r--r--t/30mouse.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/t/30mouse.c b/t/30mouse.c
index d543d22..f806dfb 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(20);
+ plan_tests(31);
/* vt100 doesn't have a mouse, we need xterm */
tk = termkey_new_abstract("xterm", 0);
@@ -27,6 +27,7 @@ int main(int argc, char *argv[])
is_int(button, 1, "mouse button for press");
is_int(line, 1, "mouse line for press");
is_int(col, 1, "mouse column for press");
+ is_int(key.modifiers, 0, "modifiers for press");
len = termkey_strfkey(tk, buffer, sizeof buffer, &key, 0);
is_int(len, 13, "string length for press");
@@ -45,6 +46,7 @@ int main(int argc, char *argv[])
is_int(button, 1, "mouse button for drag");
is_int(line, 1, "mouse line for drag");
is_int(col, 2, "mouse column for drag");
+ is_int(key.modifiers, 0, "modifiers for press");
termkey_push_bytes(tk, "\e[M##!", 6);
@@ -54,6 +56,22 @@ int main(int argc, char *argv[])
is_int(ev, TERMKEY_MOUSE_RELEASE, "mouse event for release");
is_int(line, 1, "mouse line for release");
is_int(col, 3, "mouse column for release");
+ is_int(key.modifiers, 0, "modifiers for press");
+
+ termkey_push_bytes(tk, "\e[M0++", 6);
+
+ termkey_getkey(tk, &key);
+ 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 Ctrl-press");
+ is_int(button, 1, "mouse button for Ctrl-press");
+ is_int(line, 11, "mouse line for Ctrl-press");
+ is_int(col, 11, "mouse column for Ctrl-press");
+ is_int(key.modifiers, TERMKEY_KEYMOD_CTRL, "modifiers for Ctrl-press");
+
+ len = termkey_strfkey(tk, buffer, sizeof buffer, &key, 0);
+ is_int(len, 15, "string length for Ctrl-press");
+ is_str(buffer, "C-MousePress(1)", "string buffer for Ctrl-press");
termkey_destroy(tk);