]> git.sur5r.net Git - i3/i3/blobdiff - testcases/t/164-kill-win-vs-client.t
Revise workspace next/prev
[i3/i3] / testcases / t / 164-kill-win-vs-client.t
index 20dd50ca349aa40596ef7e72098900cc702dcb6c..be30ca8fb1f764c4124f5e6329e041d44c06de7c 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 if WM_STATE is WM_STATE_NORMAL when mapped and WM_STATE_WITHDRAWN when
 # unmapped.
 #
@@ -14,8 +27,6 @@ sub two_windows {
     my $first = open_window;
     my $second = open_window;
 
-    sync_with_i3 $x;
-
     is($x->input_focus, $second->id, 'second window focused');
     ok(@{get_ws_content($tmp)} == 2, 'two containers opened');
 
@@ -30,8 +41,7 @@ sub two_windows {
 my $tmp = two_windows;
 
 cmd 'kill';
-
-sleep 0.25;
+sync_with_i3;
 
 ok(@{get_ws_content($tmp)} == 1, 'one container left after killing');
 
@@ -43,8 +53,7 @@ ok(@{get_ws_content($tmp)} == 1, 'one container left after killing');
 $tmp = two_windows;
 
 cmd 'kill window';
-
-sleep 0.25;
+sync_with_i3;
 
 ok(@{get_ws_content($tmp)} == 1, 'one container left after killing');
 
@@ -56,8 +65,9 @@ ok(@{get_ws_content($tmp)} == 1, 'one container left after killing');
 $tmp = two_windows;
 
 cmd 'kill client';
-
-sleep 0.25;
+# We need to re-establish the X11 connection which we just killed :).
+$x = i3test::X11->new;
+sync_with_i3(no_cache => 1);
 
 ok(@{get_ws_content($tmp)} == 0, 'no containers left after killing');