die "could not fork()";
}
if ($pid == 0) {
+ # Start a process group so that in the parent, we can kill the entire
+ # process group and immediately kill i3bar and any other child
+ # processes.
+ setpgrp;
+
$ENV{LISTEN_PID} = $$;
$ENV{LISTEN_FDS} = 1;
delete $ENV{DESKTOP_STARTUP_ID};
exit_gracefully($i3_pid, "/tmp/nested-$ENV{DISPLAY}");
} else {
- kill(9, $i3_pid)
+ kill(-9, $i3_pid)
or $tester->BAIL_OUT("could not kill i3");
waitpid $i3_pid, 0;
my $pkg = caller;
$i3_autostart = delete($args{i3_autostart}) // 1;
+ my $i3_config = delete($args{i3_config}) // '-default';
- my $cv = launch_with_config('-default', dont_block => 1)
+ my $cv = launch_with_config($i3_config, dont_block => 1)
if $i3_autostart;
my $test_more_args = '';
# the time of launching the new one. Also make sure that focusing containers
# in other workspaces work even when there is a fullscreen container.
#
-use i3test i3_autostart => 0;
-
-# Screen setup looks like this:
-# +----+----+
-# | S1 | S2 |
-# +----+----+
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
fake-outputs 1024x768+0+0,1024x768+1024+0
EOT
-
-my $pid = launch_with_config($config);
-
-my $i3 = i3(get_socket_path());
+# Screen setup looks like this:
+# +----+----+
+# | S1 | S2 |
+# +----+----+
my $tmp = fresh_workspace;
# TODO: Tests for "move to output" and "move workspace to output".
-exit_gracefully($pid);
-
done_testing;
# Wrong behaviour manifested itself up to (including) commit
# f78caf8c5815ae7a66de9e4b734546fd740cc19d
#
-use i3test i3_autostart => 0;
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
assign [title="testcase"] targetws
EOT
-my $pid = launch_with_config($config);
-
my $i3 = i3(get_socket_path(0));
cmd 'workspace targetws';
open_window(name => "testcase");
is_num_children('targetws', 3, 'new window opened next to last one');
-exit_gracefully($pid);
-
done_testing;
# (unless you are already familiar with Perl)
#
# Verifies that the IPC 'mode' event is sent when modes are changed.
-use i3test i3_autostart => 0;
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
}
EOT
-my $pid = launch_with_config($config);
-
my $i3 = i3(get_socket_path(0));
$i3->connect->recv;
ok($cv->recv, 'Mode event received');
-exit_gracefully($pid);
-
done_testing;
#
use List::Util qw(first);
-use i3test i3_autostart => 0;
-use Time::HiRes qw(sleep);
-
-# Ensure the pointer is at (0, 0) so that we really start on the first
-# (the left) workspace.
-$x->root->warp_pointer(0, 0);
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
force_display_urgency_hint 500ms
EOT
-my $pid = launch_with_config($config);
+use Time::HiRes qw(sleep);
#####################################################################
# Initial setup: one window on ws1, empty ws2
sleep(0.6);
is(count_total_urgent(get_ws($tmp3)), 0, "no more urgent windows on workspace $tmp3");
-exit_gracefully($pid);
-
done_testing;
# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
# (unless you are already familiar with Perl)
#
-use i3test i3_autostart => 0;
+use i3test;
use IPC::Run qw(run);
use File::Temp;
# 1: test that shared memory logging does not work yet
################################################################################
-my $config = <<EOT;
-# i3 config file (v4)
-font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
-EOT
-
-# NB: launch_with_config sets --shmlog-size=0 because the logfile gets
-# redirected via stdout redirection anyways.
-my $pid = launch_with_config($config);
+# NB: launch_with_config (called in i3test) sets --shmlog-size=0 because the
+# logfile gets redirected via stdout redirection anyways.
my $stdout;
my $stderr;
like($stderr, qr#^i3-dump-log: ERROR: i3 is running, but SHM logging is not enabled\.#,
'shm logging not enabled');
-exit_gracefully($pid);
-
done_testing;
# criteria for windows on non-visible workspaces.
# Ticket: #1027
# Bug still in: 4.5.1-90-g6582da9
-use i3test i3_autostart => 0;
-
-my $config = <<'EOT';
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
for_window [class="^special$"] floating enable, floating disable
EOT
-my $pid = launch_with_config($config);
-
my $window = open_window(
name => 'Borderless window',
wm_class => 'special',
does_i3_live;
-exit_gracefully($pid);
-
done_testing;
#
# Ticket: #1086
# Bug still in: 4.6-62-g7098ef6
-use i3test i3_autostart => 0;
+use i3test i3_config => <<EOT;
+# i3 config file (v4)
+font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
+
+assign [class="special"] nonvisible
+EOT
sub open_special {
my %args = @_;
return $window;
}
-my $config = <<EOT;
-# i3 config file (v4)
-font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
-
-assign [class="special"] nonvisible
-EOT
-my $pid = launch_with_config($config);
-
my $tmp = fresh_workspace;
ok((scalar grep { $_ eq 'nonvisible' } @{get_workspace_names()}) == 0,
my @urgent = grep { $_->{urgent} } @{get_ws_content('nonvisible')};
isnt(@urgent, 0, 'urgent window(s) found on destination workspace');
-exit_gracefully($pid);
-
done_testing;
# client.
# Ticket: #1201
# Bug still in: 4.7.2-107-g9b03be6
-use i3test i3_autostart => 0;
-
-my $config = <<'EOT';
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
EOT
-my $pid = launch_with_config($config);
-
-my $i3 = i3(get_socket_path());
-$i3->connect()->recv;
-
my $window = open_window(
wm_class => 'special',
window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'),
does_i3_live;
-exit_gracefully($pid);
-
done_testing;
# and that they keep their geometry.
# Ticket: #1263
# Bug still in: 4.7.2-200-g570b572
-use i3test i3_autostart => 0;
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
for_window [instance=__i3-test-window] floating enable, border pixel 1
EOT
-my $pid = launch_with_config($config);
my $tmp = fresh_workspace;
my $window = open_window(wm_class => '__i3-test-window');
is($floating_win->{fullscreen_mode}, 1, 'floating window still in fullscreen mode');
is_deeply($floating_win->{geometry}, $old_geometry, 'floating window geometry still the same');
-exit_gracefully($pid);
-
done_testing;
# which can lead to complications
# Ticket: #1283
# Bug still in: 4.8-24-g60070de
-use i3test i3_autostart => 0;
-
-my $config = <<'EOT';
+use i3test i3_config => <<'EOT';
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
for_window [class="^special_scratchpad$"] move scratchpad
EOT
-my $pid = launch_with_config($config);
-
my $win = open_window;
my $scratch_window = open_window(
is($x->input_focus, $win->{id},
'an assignment that kills a window should not disturb focus');
-exit_gracefully($pid);
-
done_testing;
# assigned to an invisible workspace) will not crash i3.
# Ticket: #1338
# Bug still in: 4.8-91-g294d52e
-use i3test i3_autostart => 0;
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
for_window [title=".*"] layout tabbed, focus
EOT
-my $pid = launch_with_config($config);
-
# Switch away from workspace 1
my $tmp = fresh_workspace;
does_i3_live;
-exit_gracefully($pid);
-
done_testing;
# Decorations are disabled to avoid floating_enable's logic which shifts
# windows upwards dependent on their decoration height.
#
-use i3test i3_autostart => 0;
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
new_float none
EOT
-my $pid = launch_with_config($config);
-
#####################################################################
# Open a floating window, verifying that its initial position is
# centered, and also verify that both centering methods leave it in
is($new->{x}, $child->{x}, 'x coordinates match');
is($new->{y}, $child->{y}, 'y coordinates match');
-exit_gracefully($pid);
-
done_testing;
# Ensures that 'move workspace $new, floating enable' on a marked window
# leaves the window centered on the new workspace.
# Bug still in: 4.10.2-137-ga4f0ed6
-use i3test i3_autostart => 0;
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
new_float none
EOT
-my $pid = launch_with_config($config);
-
#####################################################################
# Open a tiled window, and then simultaneously move it to another
# workspace and float it, ensuring that it ends up centered.
is(int($pos->{y} + $pos->{height} / 2), int($x->root->rect->height / 2),
'y coordinates match');
-exit_gracefully($pid);
-
done_testing;
# to focus_on_window_activation=urgent), hence the application not clearing it.
# Ticket: #1825
# Bug still in: 4.10.3-253-g03799dd
-use i3test i3_autostart => 0;
+use i3test i3_config => <<EOT;
+# i3 config file (v4)
+font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
+
+focus_on_window_activation urgent
+EOT
sub send_net_active_window {
my ($id) = @_;
$x->send_event(0, $x->get_root_window(), X11::XCB::EVENT_MASK_SUBSTRUCTURE_REDIRECT, $msg);
}
-my $config = <<'EOT';
-# i3 config file (v4)
-font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
-
-focus_on_window_activation urgent
-EOT
-
-my $pid = launch_with_config($config);
-my $i3 = i3(get_socket_path(0));
my $ws = fresh_workspace;
my $first = open_window;
my $second = open_window;
sync_with_i3;
is($x->input_focus, $second->id, 'second window still focused');
-exit_gracefully($pid);
-
done_testing;
# Verifies that "move container to output" works correctly when
# used with command criteria.
# Bug still in: 4.10.4-349-gee5db87
-use i3test i3_autostart => 0;
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
fake-outputs 800x600+0+0,800x600+800+0,800x600+0+600,800x600+800+600
EOT
-my $pid = launch_with_config($config);
-
my $ws_top_left = fresh_workspace(output => 0);
my $ws_top_right = fresh_workspace(output => 1);
my $ws_bottom_left = fresh_workspace(output => 2);
is_num_children($ws_bottom_left, 0, 'no containers on the lower left workspace');
is_num_children($ws_bottom_right, 1, 'one container on the lower right workspace');
-exit_gracefully($pid);
-
done_testing;
# Ticket: #2062
# Bug still in: 4.11-103-gc8d51b4
# Bug introduced with commit 0e5180cae9e9295678e3f053042b559e82cb8c98
-use i3test i3_autostart => 0;
+use i3test
+ i3_config => <<EOT;
+# i3 config file (v4)
+font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
+
+bindsym Print nop Print
+bindsym Mod4+Return nop Mod4+Return
+EOT
use i3test::XTEST;
use ExtUtils::PkgConfig;
skip "setxkbmap not found", 1 if
system(q|setxkbmap -print >/dev/null|) != 0;
-my $config = <<EOT;
-# i3 config file (v4)
-font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
-
-bindsym Print nop Print
-bindsym Mod4+Return nop Mod4+Return
-EOT
-
-my $pid = launch_with_config($config);
-
start_binding_capture;
system(q|setxkbmap us,ru -option grp:alt_shift_toggle|);
# Disable the grp:alt_shift_toggle option, as we use Alt+Shift in other testcases.
system(q|setxkbmap us -option|);
-exit_gracefully($pid);
-
}
done_testing;
# Ticket: #2002
# Bug still in: 4.11-103-gc8d51b4
# Bug introduced with commit bf3cd41b5ddf1e757515ab5fbf811be56e5f69cc
-use i3test i3_autostart => 0;
-use i3test::XTEST;
-use ExtUtils::PkgConfig;
-
-SKIP: {
- skip "libxcb-xkb too old (need >= 1.11)", 1 unless
- ExtUtils::PkgConfig->atleast_version('xcb-xkb', '1.11');
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
bindsym Mod1+b nop Mod1+b
bindsym --release Mod1+Shift+b nop Mod1+Shift+b release
EOT
+use i3test::XTEST;
+use ExtUtils::PkgConfig;
-my $pid = launch_with_config($config);
+SKIP: {
+ skip "libxcb-xkb too old (need >= 1.11)", 1 unless
+ ExtUtils::PkgConfig->atleast_version('xcb-xkb', '1.11');
start_binding_capture;
sync_with_i3;
is(scalar @i3test::XTEST::binding_events, 4, 'Received exactly 4 binding events');
-exit_gracefully($pid);
-
}
done_testing;
# binding mode.
# Ticket: #2228
# Bug still in: 4.11-262-geb631ce
-use i3test i3_autostart => 0;
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
}
EOT
-my $pid = launch_with_config($config);
-
cmd 'mode othermode';
my $i3 = i3(get_socket_path(0));
ok($cv->recv, 'Mode event received');
-exit_gracefully($pid);
-
done_testing;
#
# Verifies that command or config criteria does not match dock clients
# Bug still in: 4.12-38-ge690e3d
-use i3test i3_autostart => 0;
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
for_window [class="dock"] move workspace current
EOT
-my $pid = launch_with_config($config);
-
my $ws = fresh_workspace();
is_num_children($ws, 0, 'no container on the current workspace');
-exit_gracefully($pid);
done_testing;
# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
# (unless you are already familiar with Perl)
#
-use i3test i3_autostart => 0;
-use X11::XCB qw(PROP_MODE_REPLACE);
-
-##############################################################
-# 13: check that the tiling / floating criteria work.
-##############################################################
-
-my $config = <<"EOT";
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
for_window [tiling] mark tiled
for_window [floating] mark floated
EOT
+use X11::XCB qw(PROP_MODE_REPLACE);
+
+##############################################################
+# 13: check that the tiling / floating criteria work.
+##############################################################
-my $pid = launch_with_config($config);
my $tmp = fresh_workspace;
open_window;
cmp_ok(@nodes, '==', 1, 'one floating container on this workspace');
is_deeply($nodes[0]->{nodes}[0]->{marks}, [ 'floated' ], "mark set for 'floating' criterion");
-exit_gracefully($pid);
-
##############################################################
done_testing;
# Regression: Checks if focus is stolen when a window is managed which is
# assigned to an invisible workspace
#
-use i3test i3_autostart => 0;
+use i3test i3_config => <<EOT;
+# i3 config file (v4)
+font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
+assign [class="special"] targetws
+EOT
sub open_special {
my %args = @_;
# start a window and see that it does not get assigned with an empty config
#####################################################################
-my $config = <<EOT;
-# i3 config file (v4)
-font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
-assign [class="special"] targetws
-EOT
-
-my $pid = launch_with_config($config);
-
my $tmp = fresh_workspace;
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
ok(@{get_ws_content('targetws')} == 1, 'special window on targetws');
ok(get_ws($tmp)->{focused}, 'current workspace still focused');
-exit_gracefully($pid);
-
$window->destroy;
done_testing;
# not applied when the default tiling border is set to a pixel value.
# Ticket: #1305
# Bug still in: 4.8-62-g7381b50
-use i3test i3_autostart => 0;
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
new_float normal
EOT
-my $pid = launch_with_config($config);
-
my $ws = fresh_workspace;
my $float_window = open_floating_window;
is($floating[0]->{nodes}[0]->{border}, 'normal', 'default floating border is `normal`');
-exit_gracefully($pid);
-
done_testing;
# in criteria selection
# Ticket: #1052
# Bug still in: 4.8-73-g6bf7f8e
-use i3test i3_autostart => 0;
-use X11::XCB qw(PROP_MODE_REPLACE);
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
for_window [class="Special"] mark special_class_mark
EOT
-
-my $pid = launch_with_config($config);
+use X11::XCB qw(PROP_MODE_REPLACE);
sub change_window_class {
my ($window, $class, $length) = @_;
is($con->{window_properties}->{class}, 'a',
'Non-null-terminated strings should be handled correctly');
-exit_gracefully($pid);
-
done_testing;
#
# Test that the binding event works properly
# Ticket: #1210
-use i3test i3_autostart => 0;
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
skip 'xdotool is required to test the binding event. `[apt-get install|pacman -S] xdotool`', 1 if $?;
- my $pid = launch_with_config($config);
-
- my $i3 = i3(get_socket_path());
- $i3->connect->recv;
-
qx(xdotool key r);
does_i3_live;
- exit_gracefully($pid);
-
}
done_testing;
# unfocused window within a tabbed container.
# Ticket: #1484
# Bug still in: 4.9.1-124-g856e1f9
-use i3test i3_autostart => 0;
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
workspace_layout tabbed
EOT
-my $pid = launch_with_config($config);
-
open_window;
open_window;
does_i3_live;
-exit_gracefully($pid);
-
done_testing;
# Verifies that mouse bindings work on the root window if
# --whole-window is set.
# Ticket: #2115
-use i3test i3_autostart => 0;
-use i3test::XTEST;
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
workspace_auto_back_and_forth no
bindsym --whole-window button4 workspace special
EOT
+use i3test::XTEST;
-my $pid = launch_with_config($config);
fresh_workspace;
xtest_button_press(4, 50, 50);
is(focused_ws(), 'special', 'the binding was triggered');
-exit_gracefully($pid);
-
done_testing;
#
# Tests the swap command.
# Ticket: #917
-use i3test i3_autostart => 0;
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
for_window[class="mark_B"] mark B
EOT
-my ($pid);
my ($ws, $ws1, $ws2, $ws3);
my ($nodes, $expected_focus, $A, $B, $F);
my ($result);
my @urgent;
-$pid = launch_with_config($config);
-
###############################################################################
# Invalid con_id should not crash i3
# See issue #2895.
###############################################################################
-exit_gracefully($pid);
-
done_testing;
# Tests that the provided X-Server to the t/5??-*.t tests is actually providing
# multiple monitors.
#
-use i3test i3_autostart => 0;
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
fake-outputs 1024x768+0+0,1024x768+1024+0
EOT
-my $pid = launch_with_config($config);
my $i3 = i3(get_socket_path());
is_deeply(\@outputs, [ '__i3', 'fake-0', 'fake-1' ],
'multi-monitor outputs ok');
-exit_gracefully($pid);
done_testing;
# ticket #596, bug present until up to commit
# 89dded044b4fffe78f9d70778748fabb7ac533e9.
#
-use i3test i3_autostart => 0;
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
fake-outputs 1024x768+0+0,1024x768+1024+0
EOT
-my $pid = launch_with_config($config);
-
-my $i3 = i3(get_socket_path());
################################################################################
# Open a workspace on the second output, put a window to scratchpad, display
verify_scratchpad_switch($first, $second);
-exit_gracefully($pid);
-
done_testing;
#
# Verifies the 'focus output' command works properly.
-use i3test i3_autostart => 0;
-use List::Util qw(first);
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
fake-outputs 1024x768+0+0,1024x768+1024+0
EOT
-my $pid = launch_with_config($config);
+use List::Util qw(first);
my $tmp = fresh_workspace;
my $i3 = i3(get_socket_path());
cmd 'focus output fake-0';
is(focused_output, 'fake-0', 'focus on first output');
-exit_gracefully($pid);
-
done_testing;
# Tests whether 'workspace next_on_output' and the like work correctly.
#
use List::Util qw(first);
-use i3test i3_autostart => 0;
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
fake-outputs 1024x768+0+0,1024x768+1024+0
EOT
-my $pid = launch_with_config($config);
################################################################################
# Setup workspaces so that they stay open (with an empty container).
cmd 'workspace prev_on_output';
is(focused_ws, '2', 'workspace 2 focused');
-exit_gracefully($pid);
-
done_testing;
# Tests whether the 'move workspace <ws> to [output] <output>' command works
#
use List::Util qw(first);
-use i3test i3_autostart => 0;
-
-# Ensure the pointer is at (0, 0) so that we really start on the first
-# (the left) workspace.
-$x->root->warp_pointer(0, 0);
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
fake-outputs 1024x768+0+0,1024x768+1024+0
EOT
-my $pid = launch_with_config($config);
+
+# TODO: get rid of smartmatch in this test
################################################################################
# Setup workspaces so that they stay open (with an empty container).
################################################################################
-exit_gracefully($pid);
done_testing;
# Verifies that scratchpad windows don’t move due to floating point caulcation
# errors when repeatedly hiding/showing, no matter what display resolution.
#
-use i3test i3_autostart => 0;
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
fake-outputs 683x768+0+0,1024x768+683+0
EOT
-my $pid = launch_with_config($config);
-
-my $i3 = i3(get_socket_path());
sync_with_i3;
$x->root->warp_pointer(0, 0);
my $third = fresh_workspace(output => 1);
verify_scratchpad_doesnt_move($third);
-exit_gracefully($pid);
-
done_testing;
# Bug still in: 4.3-78-g66b389c
#
use List::Util qw(first);
-use i3test i3_autostart => 0;
-
-# Ensure the pointer is at (0, 0) so that we really start on the first
-# (the left) workspace.
-$x->root->warp_pointer(0, 0);
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
fake-outputs 1024x768+0+0,1024x768+1024+0
EOT
-my $pid = launch_with_config($config);
################################################################################
# Setup workspaces so that they stay open (with an empty container).
does_i3_live;
-exit_gracefully($pid);
-
done_testing;
# Tests whether workspace_layout is properly set after startup.
#
use List::Util qw(first);
-use i3test i3_autostart => 0;
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
fake-outputs 1024x768+0+0
workspace_layout tabbed
EOT
-my $pid = launch_with_config($config);
################################################################################
# Test that workspace_layout is properly set
################################################################################
-
is(focused_ws, '1', 'starting on workspace 1');
my $ws = get_ws(1);
is($ws->{workspace_layout}, 'tabbed', 'workspace layout is "tabbed"');
-
-exit_gracefully($pid);
-
done_testing;
# Tests that switching workspaces via 'focus $dir' never leaves a floating
# window focused.
#
-use i3test i3_autostart => 0;
-
-# Ensure the pointer is at (0, 0) so that we really start on the first
-# (the left) workspace.
-$x->root->warp_pointer(0, 0);
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
fake-outputs 1024x768+0+0,1024x768+1024+0,1024x768+0+768,1024x768+1024+768
EOT
-my $pid = launch_with_config($config);
my $s0_ws = fresh_workspace;
my $first = open_window;
cmd 'focus up';
is($x->input_focus, $second->id, 'second window focused');
-exit_gracefully($pid);
-
done_testing;
# Tests that ConfigureRequests don’t make windows fall out of the scratchpad.
# Ticket: #898
# Bug still in: 4.4-15-g770ead6
-use i3test i3_autostart => 0;
-
-# Ensure the pointer is at (0, 0) so that we really start on the first
-# (the left) workspace.
-$x->root->warp_pointer(0, 0);
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
fake-outputs 1024x768+0+0,1024x768+1024+0
EOT
-my $pid = launch_with_config($config);
-
my $left_ws = fresh_workspace(output => 0);
my $right_ws = fresh_workspace(output => 1);
$ws = get_ws($right_ws);
is(scalar @{$ws->{floating_nodes}}, 0, 'scratchpad window still in scratchpad after ConfigureRequest');
-exit_gracefully($pid);
-
done_testing;
# E.g. when you have a container on the right output and you move it to the
# right, it should appear on the left output.
# Bug still in: 4.4-106-g3cd4b8c
-use i3test i3_autostart => 0;
-
-# Ensure the pointer is at (0, 0) so that we really start on the first
-# (the left) workspace.
-$x->root->warp_pointer(0, 0);
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
fake-outputs 1024x768+0+0,1024x768+1024+0
EOT
-my $pid = launch_with_config($config);
-
my $right = fresh_workspace(output => 1);
my $left = fresh_workspace(output => 0);
is_num_children($left, 1, 'one container on left workspace');
is_num_children($right, 0, 'no containers on right workspace');
-exit_gracefully($pid);
-
done_testing;
# (unless you are already familiar with Perl)
#
# Tests whether moving workspaces between outputs works correctly.
-use i3test i3_autostart => 0;
-use List::Util qw(first);
-
-# Ensure the pointer is at (0, 0) so that we really start on the first
-# (the left) workspace.
-$x->root->warp_pointer(0, 0);
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
fake-outputs 1024x768+0+0,1024x768+1024+0
EOT
-
-my $pid = launch_with_config($config);
+use List::Util qw(first);
sub workspaces_per_screen {
my $i3 = i3(get_socket_path());
($nodes, $focus) = get_ws_content('5');
is($nodes->[1]->{window}, $win1->id, 'window 1 on workspace 5 after moving');
-exit_gracefully($pid);
-
done_testing;
# Ticket: #990
# Bug still in: 4.5.1-23-g82b5978
-use i3test i3_autostart => 0;
-
-# Ensure the pointer is at (0, 0) so that we really start on the first
-# (the left) workspace.
-$x->root->warp_pointer(0, 0);
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
fake-outputs 1024x768+0+0,1024x768+1024+0
EOT
-my $pid = launch_with_config($config);
-
my $i3 = i3(get_socket_path());
$i3->connect()->recv;
is($event->{current}->{id}, $current_ws->{id}, 'Event gave correct current workspace');
is($event->{old}->{id}, $old_ws->{id}, 'Event gave correct old workspace');
-exit_gracefully($pid);
-
done_testing;
# Tests that new workspace names are taken from the config,
# then from the first free number starting with 1.
#
-use i3test i3_autostart => 0;
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
bindsym 1 workspace 1: eggs
EOT
-my $pid = launch_with_config($config);
my $i3 = i3(get_socket_path());
my $ws = $i3->get_workspaces->recv;
is($ws->[0]->{name}, '1: eggs', 'new workspace uses config name');
is($ws->[1]->{name}, '2', 'naming continues with next free number');
-exit_gracefully($pid);
-
done_testing;
#
# Tests if a simple 'move <direction>' command will move containers across outputs.
#
-use i3test i3_autostart => 0;
-
-# Ensure the pointer is at (0, 0) so that we really start on the first
-# (the left) workspace.
-$x->root->warp_pointer(0, 0);
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
workspace left-bottom output fake-3
EOT
-my $pid = launch_with_config($config);
+# Ensure the pointer is at (0, 0) so that we really start on the first
+# (the left) workspace.
+$x->root->warp_pointer(0, 0);
#####################################################################
# Try to move a single window across outputs in each direction
$compare_window = shift @{get_ws_content('left-top')};
is($social_window->name, $compare_window->{name}, 'moved correct window to left-bottom workspace');
-exit_gracefully($pid);
-
done_testing;
# ipc event required for i3bar to be properly updated and redrawn.
#
# Bug still in: 4.6-195-g34232b8
-use i3test i3_autostart => 0;
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
workspace ws-right output fake-1
EOT
-my $pid = launch_with_config($config);
-
my $i3 = i3(get_socket_path());
$i3->connect()->recv;
is($event->{current}->{name}, 'ws-right', 'focus event gave the right workspace');
is(@{$event->{current}->{nodes}}, 2, 'focus event gave the right number of windows on the workspace');
-exit_gracefully($pid);
-
done_testing;
# assign any workspace of that number to the specified output.
# Ticket: #1238
# Bug still in: 4.7.2-147-g3760a48
-use i3test i3_autostart => 0;
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
fake-outputs 1024x768+0+0,1024x768+1024+0
EOT
-my $pid = launch_with_config($config);
my $i3 = i3(get_socket_path());
$i3->connect->recv;
'Assignment rules should not be affected by the order assignments are declared')
or diag 'Since workspace "1:override" is assigned by name to fake-0, it should open on fake-0';
-exit_gracefully($pid);
-
done_testing;
# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
# (unless you are already familiar with Perl)
-use i3test i3_autostart => 0;
-
-# Ensure the pointer is at (0, 0) so that we really start on the first
-# (the left) workspace.
-$x->root->warp_pointer(0, 0);
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
fake-outputs 1024x768+0+0,1024x768+1024+0
mouse_warping none
EOT
-my $pid = launch_with_config($config);
-my $i3 = i3(get_socket_path());
+# Ensure the pointer is at (0, 0) so that we really start on the first
+# (the left) workspace.
+$x->root->warp_pointer(0, 0);
######################################################
# Open one workspace with one window on both outputs #
# Ensure focus is still on workspace 2
is(focused_ws, '2', 'warped mouse cursor to (0, 0), focus still in workspace 2');
-# Exit gracefully
-exit_gracefully($pid);
done_testing;
# Ensure that `focus [direction]` will focus an existing floating con when no
# tiling con exists on the output in [direction] when focusing across outputs
# Bug still in: 4.7.2-204-g893dbae
-use i3test i3_autostart => 0;
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
fake-outputs 1024x768+0+0,1024x768+1024+0
EOT
-my $pid = launch_with_config($config);
-
cmd 'workspace ws_left';
my $win = open_window();
is($x->input_focus, $win->id,
'Focusing across outputs with `focus [direction]` should focus an existing floating con when no tiling con exists on the output in [direction].');
-exit_gracefully($pid);
-
done_testing;
# properly on the root window. We interpret this as a list of x/y coordinate
# pairs for the upper left corner of the respective outputs of the workspaces
# Ticket: #1241
-use i3test i3_autostart => 0;
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
fake-outputs 1024x768+0+0,1024x768+1024+0
EOT
-my $pid = launch_with_config($config);
-
sub get_desktop_viewport {
# Make sure that i3 pushed its changes to X11 before querying.
sync_with_i3;
is_deeply(\@desktop_viewport, \@expected_viewport,
'it should be updated when a workspace is emptied');
-exit_gracefully($pid);
-
done_testing;
# are renamed to an assigned name.
# Ticket: #1473
-use i3test i3_autostart => 0;
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
fake-outputs 1024x768+0+0,1024x768+1024+0
workspace baz output fake-1
EOT
-my $pid = launch_with_config($config);
my $i3 = i3(get_socket_path());
$i3->connect->recv;
is(get_output_for_workspace('baz'), 'fake-1',
'Renaming the workspace to a number and name should move it to the assigned output');
-
-exit_gracefully($pid);
done_testing;
# the appropriate output.
# Ticket: #1211
# Bug still in: 4.9.1-108-g037cb31
-use i3test i3_autostart => 0;
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
workspace right output fake-1
EOT
-my $pid = launch_with_config($config);
-
#####################################################################
# Verify that 'move position center' on a floating window does not
# move it to another output.
is(scalar @{get_ws('left')->{floating_nodes}}, 0, 'no floating nodes on left ws');
is(scalar @{get_ws('right')->{floating_nodes}}, 1, 'one floating node on right ws');
-exit_gracefully($pid);
-
done_testing;
# Ticket: #1603
# Bug still in: 4.10.1-40-g0ad097e
use List::Util qw(first);
-use i3test i3_autostart => 0;
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
workspace_layout stacked
EOT
-my $pid = launch_with_config($config);
-
#####################################################################
# Create two windows in the upper left workspace and move them
# clockwise around the workspaces until the end up where they began.
is_num_children('left-bottom', 0, 'no children on left-bottom');
is_num_children('left-top', 2, 'two children on left-top');
-exit_gracefully($pid);
-
done_testing;
#
# Ensures that mouse bindings on the i3bar work correctly.
# Ticket: #1695
-use i3test i3_autostart => 0;
-use i3test::XTEST;
-
-my ($cv, $timer);
-sub reset_test {
- $cv = AE::cv;
- $timer = AE::timer(1, 0, sub { $cv->send(0); });
-}
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
focus_follows_mouse no
bindsym button5 focus left
}
EOT
+use i3test::XTEST;
+
+my ($cv, $timer);
+sub reset_test {
+ $cv = AE::cv;
+ $timer = AE::timer(1, 0, sub { $cv->send(0); });
+}
-my $pid = launch_with_config($config);
my $i3 = i3(get_socket_path());
$i3->connect()->recv;
my $ws = fresh_workspace;
},
})->recv;
-my $con = $cv->recv;
-ok($con, 'i3bar appeared');
+my $con;
+
+sub i3bar_present {
+ my ($nodes) = @_;
+
+ for my $node (@{$nodes}) {
+ my $props = $node->{window_properties};
+ if (defined($props) && $props->{class} eq 'i3bar') {
+ return 1;
+ }
+ }
+
+ return 0 if !@{$nodes};
+
+ my @children = (map { @{$_->{nodes}} } @{$nodes},
+ map { @{$_->{'floating_nodes'}} } @{$nodes});
+
+ return i3bar_present(\@children);
+}
+
+if (i3bar_present($i3->get_tree->recv->{nodes})) {
+ ok(1, 'i3bar present');
+} else {
+ $con = $cv->recv;
+ ok($con, 'i3bar appeared');
+}
my $left = open_window;
my $right = open_window;
is($con->{window}, $left->{id}, 'button 5 moves focus left');
reset_test;
-exit_gracefully($pid);
-
done_testing;
#
# Test reconfiguration of dock clients.
# Ticket: #1883
-use i3test i3_autostart => 0;
+use i3test i3_config => <<EOT;
+# i3 config file (v4)
+font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
+
+fake-outputs 1024x768+0+0,1024x768+1024+0
+EOT
-my ($config, $pid, $window, $rect);
+my ($window, $rect);
my (@docks);
###############################################################################
# moved to the correct position.
###############################################################################
-$config = <<EOT;
-# i3 config file (v4)
-font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
-
-fake-outputs 1024x768+0+0,1024x768+1024+0
-EOT
-$pid = launch_with_config($config);
-
$window = open_window({
window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK')
});
is($docks[0]->{rect}->{x}, 1024, 'dock client has moved to the other screen');
-exit_gracefully($pid);
-
###############################################################################
done_testing;
# Tests whether 'workspace next' works correctly.
#
use List::Util qw(first);
-use i3test i3_autostart => 0;
+use i3test i3_config => <<EOT;
+# i3 config file (v4)
+font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
+
+fake-outputs 1024x768+0+0,1024x768+1024+0
+EOT
sub assert_next {
my ($expected) = @_;
is(focused_ws, $expected, "workspace $expected focused");
}
-my $config = <<EOT;
-# i3 config file (v4)
-font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
-
-fake-outputs 1024x768+0+0,1024x768+1024+0
-EOT
-my $pid = launch_with_config($config);
-
sync_with_i3;
$x->root->warp_pointer(0, 0);
sync_with_i3;
assert_prev('1');
-exit_gracefully($pid);
-
done_testing;
#
# Tests for _NET_WM_DESKTOP.
# Ticket: #2153
-use i3test i3_autostart => 0;
+use i3test i3_config => <<EOT;
+# i3 config file (v4)
+font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
+
+bar {
+ status_command i3status
+}
+EOT
use X11::XCB qw(:all);
###############################################################################
return $window;
}
-###############################################################################
-
-my $config = <<EOT;
-# i3 config file (v4)
-font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
-
-bar {
- status_command i3status
-}
-EOT
-
-my $pid = launch_with_config($config);
-
###############################################################################
# Upon managing a window which does not set _NET_WM_DESKTOP, the property is
# set on the window.
###############################################################################
-exit_gracefully($pid);
-
done_testing;
#
# Ticket: #2229
# Bug still in: 4.11-262-geb631ce
-use i3test i3_autostart => 0;
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
workspace_auto_back_and_forth no
EOT
-my $pid = launch_with_config($config);
my $i3 = i3(get_socket_path());
# Set it up such that workspace 3 is on the left output and
# ensure that workspace 3 has now vanished
my $get_ws = $i3->get_workspaces->recv;
my @ws_names = map { $_->{name} } @$get_ws;
+# TODO get rid of smartmatch
ok(!('3' ~~ @ws_names), 'workspace 3 has been closed');
-exit_gracefully($pid);
-
done_testing;
#
# Tests that fullscreen windows appear on the output indicated by
# their geometry
-use i3test i3_autostart => 0;
-use List::Util qw(first);
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
fake-outputs 1024x768+0+0,1024x768+1024+0
EOT
-
-my $pid = launch_with_config($config);
+use List::Util qw(first);
# Helper functions
sub fullscreen($) {
is($node1->{fullscreen_mode}, 1, "first window is fullscreen");
is($node2->{fullscreen_mode}, 1, "second window is fullscreen");
-exit_gracefully($pid);
-
done_testing;
# over an unfocused workspace.
# Ticket: #2681
# Bug still in: 4.13-210-g80c23afa
-use i3test i3_autostart => 0;
-
-# Ensure the pointer is at (0, 0) so that we really start on the first
-# (the left) workspace.
-$x->root->warp_pointer(0, 0);
-
-my $config = <<EOT;
+use i3test i3_config => <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
focus_follows_mouse no
EOT
-my $pid = launch_with_config($config);
-
cmd 'focus output fake-0';
my $s0_ws = fresh_workspace;
cmp_ok($reply->{root_x}, '<', 1024, 'pointer still on fake-0');
cmp_ok($reply->{root_y}, '<', 768, 'pointer still on fake-0');
-exit_gracefully($pid);
-
done_testing;
# Tests whether 'workspace next' works correctly.
#
use List::Util qw(first);
-use i3test i3_autostart => 0;
+use i3test i3_config => <<EOT;
+# i3 config file (v4)
+font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
+
+fake-outputs 1024x768+0+0,1024x768+1024+0
+EOT
sub assert_next {
my ($expected) = @_;
is(focused_ws, $expected, "workspace $expected focused");
}
-my $config = <<EOT;
-# i3 config file (v4)
-font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
-
-fake-outputs 1024x768+0+0,1024x768+1024+0
-EOT
-my $pid = launch_with_config($config);
-
sync_with_i3;
$x->root->warp_pointer(0, 0);
sync_with_i3;
assert_prev('1');
-exit_gracefully($pid);
-
done_testing;
#
# Tests for _NET_WM_DESKTOP.
# Ticket: #2153
-use i3test i3_autostart => 0;
+use i3test i3_config => <<EOT;
+# i3 config file (v4)
+font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
+
+workspace "0" output "fake-0"
+workspace "1" output "fake-0"
+workspace "2" output "fake-0"
+workspace "10" output "fake-1"
+workspace "11" output "fake-1"
+workspace "12" output "fake-1"
+
+fake-outputs 1024x768+0+0,1024x768+1024+0
+EOT
use X11::XCB qw(:all);
sub get_net_wm_desktop {
return unpack("L", $reply->{value});
}
-my $config = <<EOT;
-# i3 config file (v4)
-font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
-
-workspace "0" output "fake-0"
-workspace "1" output "fake-0"
-workspace "2" output "fake-0"
-workspace "10" output "fake-1"
-workspace "11" output "fake-1"
-workspace "12" output "fake-1"
-
-fake-outputs 1024x768+0+0,1024x768+1024+0
-EOT
-
###############################################################################
# _NET_WM_DESKTOP is updated when the window is moved to another workspace
# on another output.
###############################################################################
-my $pid = launch_with_config($config);
-
cmd 'workspace 0';
open_window;
cmd 'workspace 10';
is(get_net_wm_desktop($con), 1, '_NET_WM_DESKTOP is updated when moving the window');
-exit_gracefully($pid);
-
done_testing;