From: Michael Stapelberg Date: Sun, 8 Jan 2012 11:59:24 +0000 (+0000) Subject: add testcase for 'focus output' X-Git-Tag: 4.2~151^2~2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=07d07719f047de0aed545036bba1dba4b1076481;p=i3%2Fi3 add testcase for 'focus output' --- diff --git a/testcases/t/502-focus-output.t b/testcases/t/502-focus-output.t new file mode 100644 index 00000000..139b670a --- /dev/null +++ b/testcases/t/502-focus-output.t @@ -0,0 +1,50 @@ +#!perl +# vim:ts=4:sw=4:expandtab +# +# Verifies the 'focus output' command works properly. + +use i3test; +use List::Util qw(first); + +my $tmp = fresh_workspace; +my $i3 = i3(get_socket_path()); + +################################################################################ +# use 'focus output' and verify that focus gets changed appropriately +################################################################################ + +sub focused_output { + my $tree = $i3->get_tree->recv; + my $focused = $tree->{focus}->[0]; + my $output = first { $_->{id} == $focused } @{$tree->{nodes}}; + return $output->{name}; +} + +is(focused_output, 'xinerama-0', 'focus on first output'); + +cmd 'focus output right'; +is(focused_output, 'xinerama-1', 'focus on second output'); + +# focus should wrap when we focus to the right again. +cmd 'focus output right'; +is(focused_output, 'xinerama-0', 'focus on first output again'); + +cmd 'focus output left'; +is(focused_output, 'xinerama-1', 'focus back on second output'); + +cmd 'focus output left'; +is(focused_output, 'xinerama-0', 'focus on first output again'); + +cmd 'focus output up'; +is(focused_output, 'xinerama-0', 'focus still on first output'); + +cmd 'focus output down'; +is(focused_output, 'xinerama-0', 'focus still on first output'); + +cmd 'focus output xinerama-1'; +is(focused_output, 'xinerama-1', 'focus on second output'); + +cmd 'focus output xinerama-0'; +is(focused_output, 'xinerama-0', 'focus on first output'); + +done_testing;