From 41400d8a16f2ff890e72d1bbe9acf74e4c578a4b Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Tue, 21 Feb 2012 14:28:37 +0100 Subject: [PATCH] t/164-kill-win-vs-client: get rid of sleep()s --- testcases/lib/i3test.pm | 4 +++- testcases/t/164-kill-win-vs-client.t | 11 +++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/testcases/lib/i3test.pm b/testcases/lib/i3test.pm index 979c60ac..58d9b9fa 100644 --- a/testcases/lib/i3test.pm +++ b/testcases/lib/i3test.pm @@ -409,10 +409,12 @@ sub focused_ws { # See also docs/testsuite for a long explanation # sub sync_with_i3 { + my %args = @_ == 1 ? %{$_[0]} : @_; + # Since we need a (mapped) window for receiving a ClientMessage, we create # one on the first call of sync_with_i3. It will be re-used in all # subsequent calls. - if (!defined($_sync_window)) { + if (!defined($_sync_window) || exists($args{no_cache})) { $_sync_window = open_window( rect => [ -15, -15, 10, 10 ], override_redirect => 1, diff --git a/testcases/t/164-kill-win-vs-client.t b/testcases/t/164-kill-win-vs-client.t index 165a32ce..bce6b23b 100644 --- a/testcases/t/164-kill-win-vs-client.t +++ b/testcases/t/164-kill-win-vs-client.t @@ -28,8 +28,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'); @@ -41,8 +40,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'); @@ -54,8 +52,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'); -- 2.39.5