From 2b5b6330dc40fe8398a2c0e3d90a3531b225bc4c Mon Sep 17 00:00:00 2001 From: Orestis Floros Date: Fri, 29 Sep 2017 01:35:11 +0300 Subject: [PATCH] Add testcases for focus_follows_mouse --- testcases/t/293-focus-follows-mouse.t | 60 +++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 testcases/t/293-focus-follows-mouse.t diff --git a/testcases/t/293-focus-follows-mouse.t b/testcases/t/293-focus-follows-mouse.t new file mode 100644 index 00000000..9fb1004e --- /dev/null +++ b/testcases/t/293-focus-follows-mouse.t @@ -0,0 +1,60 @@ +#!perl +# vim:ts=4:sw=4:expandtab +# +# Please read the following documents before working on tests: +# • https://build.i3wm.org/docs/testsuite.html +# (or docs/testsuite) +# +# • https://build.i3wm.org/docs/lib-i3test.html +# (alternatively: perldoc ./testcases/lib/i3test.pm) +# +# • https://build.i3wm.org/docs/ipc.html +# (or docs/ipc) +# +# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf +# (unless you are already familiar with Perl) +# +# Tests the focus_follows_mouse setting. +use i3test i3_config => <root->warp_pointer($x_px, $y_px); + sync_with_i3; +} + +################################################################### +# Test a simple case with 2 windows. +################################################################### + +synced_warp_pointer(600, 600); +$first = open_window; +$second = open_window; +is($x->input_focus, $second->id, 'second window focused'); + +synced_warp_pointer(0, 0); +is($x->input_focus, $first->id, 'first window focused'); + +################################################################### +# Test that focus isn't changed with tabbed windows. +################################################################### + +fresh_workspace; +synced_warp_pointer(600, 600); +$first = open_window; +cmd 'layout tabbed'; +$second = open_window; +is($x->input_focus, $second->id, 'second (tabbed) window focused'); + +synced_warp_pointer(0, 0); +is($x->input_focus, $second->id, 'second window still focused'); + +done_testing; -- 2.39.5