]> 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 7f8f392d4ab74254830686bec9d943d7639006a5..6afdd806fc52bbcd82b48430d33b35b50ab55f28 100644 (file)
@@ -1,6 +1,19 @@
 #!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;
@@ -132,7 +145,7 @@ sub get_output_content {
     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}};
+    return first { $_->{type} eq 'con' } @{$output->{nodes}};
 }
 
 $tmp = fresh_workspace;
@@ -145,4 +158,24 @@ is(get_output_content()->{layout}, 'splith', 'content container layout ok');
 cmd 'layout stacked';
 is(get_output_content()->{layout}, 'splith', 'content container layout still ok');
 
+######################################################################
+# Splitting a workspace that has more than one child
+######################################################################
+
+$tmp = fresh_workspace;
+
+cmd 'open';
+cmd 'open';
+cmd 'focus parent';
+cmd 'split v';
+cmd 'open';
+
+my $content = get_ws_content($tmp);
+my $fst = $content->[0];
+my $snd = $content->[1];
+
+is(@{$content}, 2, 'two containers on workspace');
+is(@{$fst->{nodes}}, 2, 'first child has two children');
+is(@{$snd->{nodes}}, 0, 'second child has no children');
+
 done_testing;