]> git.sur5r.net Git - i3/i3/blobdiff - testcases/t/122-split.t
Merge branch 'master' into next
[i3/i3] / testcases / t / 122-split.t
index d491c37a47451057132eca9acf6ab47e773fd5d4..01765e1e92a8dbeb9f09081c8812b0c705d041e4 100644 (file)
@@ -1,9 +1,23 @@
 #!perl
 # vim:ts=4:sw=4:expandtab
 #
+# Please read the following documents before working on tests:
+# • http://build.i3wm.org/docs/testsuite.html
+#   (or docs/testsuite)
+#
+# • http://build.i3wm.org/docs/lib-i3test.html
+#   (alternatively: perldoc ./testcases/lib/i3test.pm)
+#
+# • http://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 splitting
 #
 use i3test;
+use List::Util qw(first);
 
 my $tmp;
 my $ws;
@@ -119,4 +133,29 @@ cmd 'open';
 is(scalar @content, 1, 'Still one container on this ws');
 is(scalar @{$content[0]->{nodes}}, 1, 'Stacked con still has one child node');
 
+################################################################################
+# When focusing the workspace, changing the layout should have an effect on the
+# workspace, not on the parent (CT_CONTENT) container.
+################################################################################
+
+sub get_output_content {
+    my $tree = i3(get_socket_path())->get_tree->recv;
+
+    my @outputs = grep { $_->{name} !~ /^__/ } @{$tree->{nodes}};
+    is(scalar @outputs, 1, 'exactly one output (testcase not multi-monitor capable)');
+    my $output = $outputs[0];
+    # get the first (and only) CT_CON
+    return first { $_->{type} == 2 } @{$output->{nodes}};
+}
+
+$tmp = fresh_workspace;
+
+cmd 'open';
+cmd 'split v';
+cmd 'open';
+cmd 'focus parent';
+is(get_output_content()->{layout}, 'splith', 'content container layout ok');
+cmd 'layout stacked';
+is(get_output_content()->{layout}, 'splith', 'content container layout still ok');
+
 done_testing;