tests: make t/166-assign.t more robust

…by using the new syntax which will not trigger i3-nagbar. Checking for
i3-nagbar is inherently prone to race conditions since i3-nagbar does
not communicate in any way that it’s there.
This commit is contained in:
Michael Stapelberg 2012-06-29 21:28:10 +02:00
parent 19946ee14d
commit daee3218c9
1 changed files with 3 additions and 11 deletions

View File

@ -206,24 +206,16 @@ sub i3nagbar_running {
$config = <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
assign "special" ~
for_window [title="special"] floating enable
EOT
$pid = launch_with_config($config);
# Ensure that i3-nagbar is running. It should be started pretty quickly, so we
# busy-loop with a short delay.
while (!i3nagbar_running($pid)) {
sleep 0.05;
}
$tmp = fresh_workspace;
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
my @docked = get_dock_clients;
# We expect i3-nagbar as the first dock client due to using the old assign
# syntax
is(@docked, 1, 'one dock client yet');
is(@docked, 0, 'one dock client yet');
$window = open_special(
window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'),
@ -233,7 +225,7 @@ $content = get_ws($tmp);
ok(@{$content->{nodes}} == 0, 'no tiling cons');
ok(@{$content->{floating_nodes}} == 0, 'one floating con');
@docked = get_dock_clients;
is(@docked, 2, 'two dock clients now');
is(@docked, 1, 'one dock client now');
$window->destroy;