From 82ec0169cb2eaea8ffc89e033bdd59b3c526a2d7 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Mon, 17 Oct 2011 23:34:29 +0100 Subject: [PATCH] tests: add t/176-workspace-baf for the workspace back_and_forth feature --- testcases/t/176-workspace-baf.t | 69 +++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 testcases/t/176-workspace-baf.t diff --git a/testcases/t/176-workspace-baf.t b/testcases/t/176-workspace-baf.t new file mode 100644 index 00000000..48ea948d --- /dev/null +++ b/testcases/t/176-workspace-baf.t @@ -0,0 +1,69 @@ +#!perl +# vim:ts=4:sw=4:expandtab +# !NO_I3_INSTANCE! will prevent complete-run.pl from starting i3 +# +# Checks if the 'workspace back_and_forth' command and the +# 'workspace_auto_back_and_forth' config directive work correctly. +# + +use i3test; +use X11::XCB::Connection; + +my $x = X11::XCB::Connection->new; + +my $config = <{focused}, 'first workspace focused'); + +my $second_ws = fresh_workspace; +ok(get_ws($second_ws)->{focused}, 'second workspace focused'); + +my $third_ws = fresh_workspace; +ok(get_ws($third_ws)->{focused}, 'third workspace focused'); + +cmd 'workspace back_and_forth'; +ok(get_ws($second_ws)->{focused}, 'second workspace focused'); + +##################################################################### +# test that without workspace_auto_back_and_forth switching to the same +# workspace that is currently focused is a no-op +##################################################################### + +cmd qq|workspace "$second_ws"|; +ok(get_ws($second_ws)->{focused}, 'second workspace still focused'); + +exit_gracefully($pid); + +##################################################################### +# the same test, but with workspace_auto_back_and_forth +##################################################################### + +$config = <{focused}, 'first workspace focused'); + +$second_ws = fresh_workspace; +ok(get_ws($second_ws)->{focused}, 'second workspace focused'); + +$third_ws = fresh_workspace; +ok(get_ws($third_ws)->{focused}, 'third workspace focused'); + +cmd qq|workspace "$third_ws"|; +ok(get_ws($second_ws)->{focused}, 'second workspace focused'); + +exit_gracefully($pid); + +done_testing; -- 2.39.5