Merge pull request #1752 from Airblader/feature-test-cleanups-1

Silence "masks earlier declaration in same scope" warnings
next
Michael Stapelberg 2015-06-13 14:39:19 +02:00
commit 4d25d6a5a6
9 changed files with 80 additions and 71 deletions

View File

@ -53,10 +53,10 @@ font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
force_display_urgency_hint 0ms
EOT
my $type;
my ($type, $tmp, $w1, $w2);
for ($type = 1; $type <= 2; $type++) {
my $pid = launch_with_config($config);
my $tmp = fresh_workspace;
$tmp = fresh_workspace;
#####################################################################
# Create two windows and put them in stacking mode
@ -269,8 +269,8 @@ for ($type = 1; $type <= 2; $type++) {
my $ws1 = fresh_workspace;
my $ws2 = fresh_workspace;
cmd "workspace $ws1";
my $w1 = open_window;
my $w2 = open_window;
$w1 = open_window;
$w2 = open_window;
cmd "workspace $ws2";
sync_with_i3;
set_urgency($w1, 1, $type);
@ -284,10 +284,10 @@ for ($type = 1; $type <= 2; $type++) {
##############################################################################
# Check if urgent flag can be unset if we move the window out of the container
##############################################################################
my $tmp = fresh_workspace;
$tmp = fresh_workspace;
cmd 'layout tabbed';
my $w1 = open_window;
my $w2 = open_window;
$w1 = open_window;
$w2 = open_window;
sync_with_i3;
cmd '[id="' . $w2->id . '"] focus';
sync_with_i3;
@ -316,8 +316,8 @@ for ($type = 1; $type <= 2; $type++) {
my $tmp_target = fresh_workspace;
cmd 'workspace ' . $tmp_source;
sync_with_i3;
my $w1 = open_window;
my $w2 = open_window;
$w1 = open_window;
$w2 = open_window;
sync_with_i3;
cmd '[id="' . $w1->id . '"] focus';
sync_with_i3;

View File

@ -17,6 +17,7 @@
# Tests resizing tiling containers
use i3test;
my ($left, $right);
my $tmp = fresh_workspace;
cmd 'split v';
@ -84,8 +85,8 @@ cmp_float($nodes->[1]->{percent}, 0.75, 'bottom window got 75%');
$tmp = fresh_workspace;
my $left = open_window;
my $right = open_window;
$left = open_window;
$right = open_window;
cmd 'split v';
@ -261,8 +262,8 @@ cmp_ok($content[0]->{rect}->{width}, '==', $oldrect->{width}, 'width the same as
$tmp = fresh_workspace;
my $left = open_floating_window;
my $right = open_floating_window;
$left = open_floating_window;
$right = open_floating_window;
sub get_floating_rect {
my ($window_id) = @_;

View File

@ -377,7 +377,7 @@ sub verify_scratchpad_move_with_visible_scratch_con {
# this should bring up window 1
cmd 'scratchpad show';
my $ws = get_ws($first);
$ws = get_ws($first);
is(scalar @{$ws->{floating_nodes}}, 1, 'one floating node on ws1');
is($x->input_focus, $window1->id, "showed the correct scratchpad window1");

View File

@ -18,6 +18,8 @@
use i3test;
use List::Util qw(first);
my ($con, $first, $second);
sub get_marks {
return i3(get_socket_path())->get_marks->recv;
}
@ -89,8 +91,8 @@ is_deeply(get_marks(), [], 'all marks removed');
# check that only the latter is marked
##############################################################
my $first = open_window;
my $second = open_window;
$first = open_window;
$second = open_window;
cmd 'mark important';
cmd 'focus left';
@ -103,7 +105,7 @@ ok(!get_mark_for_window_on_workspace($tmp, $second), 'second container lost the
# 5: mark a con, toggle the mark, check that the mark is gone
##############################################################
my $con = open_window;
$con = open_window;
cmd 'mark important';
cmd 'mark --toggle important';
ok(!get_mark_for_window_on_workspace($tmp, $con), 'container no longer has the mark');
@ -112,7 +114,7 @@ ok(!get_mark_for_window_on_workspace($tmp, $con), 'container no longer has the m
# 6: toggle a mark on an unmarked con, check it is marked
##############################################################
my $con = open_window;
$con = open_window;
cmd 'mark --toggle important';
is(get_mark_for_window_on_workspace($tmp, $con), 'important', 'container now has the mark');
@ -121,7 +123,7 @@ is(get_mark_for_window_on_workspace($tmp, $con), 'important', 'container now has
# with the new mark
##############################################################
my $con = open_window;
$con = open_window;
cmd 'mark boring';
cmd 'mark --toggle important';
is(get_mark_for_window_on_workspace($tmp, $con), 'important', 'container has the most recent mark');
@ -131,8 +133,8 @@ is(get_mark_for_window_on_workspace($tmp, $con), 'important', 'container has the
# check only the latter has the mark
##############################################################
my $first = open_window;
my $second = open_window;
$first = open_window;
$second = open_window;
cmd 'mark important';
cmd 'focus left';
@ -146,8 +148,8 @@ ok(!get_mark_for_window_on_workspace($tmp, $second), 'second containr no longer
# it fails
##############################################################
my $first = open_window(wm_class => 'iamnotunique');
my $second = open_window(wm_class => 'iamnotunique');
$first = open_window(wm_class => 'iamnotunique');
$second = open_window(wm_class => 'iamnotunique');
my $result = cmd "[instance=iamnotunique] mark important";

View File

@ -50,7 +50,7 @@ is($e->{container}->{floating}, 'user_on', 'the container should be floating');
$cv = AnyEvent->condvar;
cmd '[id="' . $win->{id} . '"] floating disable';
my $e = $cv->recv;
$e = $cv->recv;
isnt($e, 0, 'disabling floating on a container should send an ipc window event');
is($e->{container}->{window}, $win->{id}, 'the event should contain information about the window');

View File

@ -59,7 +59,7 @@ is($event->{container}->{urgent}, 1, 'the container should be urgent');
$cv = AnyEvent->condvar;
$win->delete_hint('urgency');
my $event = $cv->recv;
$event = $cv->recv;
isnt($event, 0, 'an urgent con should emit the window::urgent event');
is($event->{container}->{window}, $win->{id}, 'the event should contain information about the window');

View File

@ -20,6 +20,8 @@
use i3test i3_autostart => 0;
use File::Temp qw(tempfile);
my ($cfg, $ret, $out);
sub check_config {
my ($config) = @_;
my ($fh, $tmpfile) = tempfile(UNLINK => 1);
@ -35,12 +37,12 @@ sub check_config {
# 1: test with a bogus configuration file
################################################################################
my $cfg = <<EOT;
$cfg = <<EOT;
# i3 config file (v4)
i_am_an_unknown_config option
EOT
my ($ret, $out) = check_config($cfg);
($ret, $out) = check_config($cfg);
is($ret, 1, "exit code == 1");
like($out, qr/ERROR: *CONFIG: *[Ee]xpected.*tokens/, 'bogus config file');
@ -48,12 +50,12 @@ like($out, qr/ERROR: *CONFIG: *[Ee]xpected.*tokens/, 'bogus config file');
# 2: test with a valid configuration file
################################################################################
my $cfg = <<EOT;
$cfg = <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
EOT
my ($ret, $out) = check_config($cfg);
($ret, $out) = check_config($cfg);
is($ret, 0, "exit code == 0");
is($out, "", 'valid config file');

View File

@ -19,6 +19,8 @@
use i3test i3_autostart => 0;
use List::Util qw(first);
my ($config, $pid, $first, $second, $ws1, $ws2);
sub send_net_active_window {
my ($id) = @_;
@ -46,18 +48,18 @@ sub get_urgency_for_window_on_workspace {
# check that the urgent flag is set and focus is not lost.
#####################################################################
my $config = <<EOT;
$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);
$pid = launch_with_config($config);
my $ws = fresh_workspace;
my $first = open_window;
my $second = open_window;
$first = open_window;
$second = open_window;
send_net_active_window($first->id);
sync_with_i3;
@ -72,19 +74,19 @@ exit_gracefully($pid);
# visible, check that the urgent flag is set and focus is not lost.
#####################################################################
my $config = <<EOT;
$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);
$pid = launch_with_config($config);
my $ws1 = fresh_workspace;
my $first = open_window;
my $ws2 = fresh_workspace;
my $second = open_window;
$ws1 = fresh_workspace;
$first = open_window;
$ws2 = fresh_workspace;
$second = open_window;
send_net_active_window($first->id);
sync_with_i3;
@ -100,18 +102,18 @@ exit_gracefully($pid);
# check that the focus is switched.
#####################################################################
my $config = <<EOT;
$config = <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
focus_on_window_activation focus
EOT
my $pid = launch_with_config($config);
$pid = launch_with_config($config);
my $ws = fresh_workspace;
my $first = open_window;
my $second = open_window;
$first = open_window;
$second = open_window;
send_net_active_window($first->id);
sync_with_i3;
@ -126,19 +128,19 @@ exit_gracefully($pid);
# visible, check that the focus switched.
#####################################################################
my $config = <<EOT;
$config = <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
focus_on_window_activation focus
EOT
my $pid = launch_with_config($config);
$pid = launch_with_config($config);
my $ws1 = fresh_workspace;
my $first = open_window;
my $ws2 = fresh_workspace;
my $second = open_window;
$ws1 = fresh_workspace;
$first = open_window;
$ws2 = fresh_workspace;
$second = open_window;
send_net_active_window($first->id);
sync_with_i3;
@ -154,18 +156,18 @@ exit_gracefully($pid);
# check that nothing happens.
#####################################################################
my $config = <<EOT;
$config = <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
focus_on_window_activation none
EOT
my $pid = launch_with_config($config);
$pid = launch_with_config($config);
my $ws = fresh_workspace;
my $first = open_window;
my $second = open_window;
$first = open_window;
$second = open_window;
send_net_active_window($first->id);
sync_with_i3;
@ -180,19 +182,19 @@ exit_gracefully($pid);
# visible, check that nothing happens.
#####################################################################
my $config = <<EOT;
$config = <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
focus_on_window_activation none
EOT
my $pid = launch_with_config($config);
$pid = launch_with_config($config);
my $ws1 = fresh_workspace;
my $first = open_window;
my $ws2 = fresh_workspace;
my $second = open_window;
$ws1 = fresh_workspace;
$first = open_window;
$ws2 = fresh_workspace;
$second = open_window;
send_net_active_window($first->id);
sync_with_i3;

View File

@ -18,21 +18,23 @@
# Ticket: #1416
use i3test i3_autostart => 0;
my ($config, $pid, $ws, $first, $second, $focused);
#####################################################################
# 1: open a window and check that it takes focus
#####################################################################
my $config = <<EOT;
$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);
$pid = launch_with_config($config);
my $ws = fresh_workspace;
my $first = open_window;
my $focused = get_focused($ws);
my $second = open_window;
$ws = fresh_workspace;
$first = open_window;
$focused = get_focused($ws);
$second = open_window;
isnt(get_focused($ws), $focused, 'focus has changed');
@ -43,19 +45,19 @@ exit_gracefully($pid);
# it doesn't take focus
#####################################################################
my $config = <<EOT;
$config = <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
no_focus [instance=notme]
EOT
my $pid = launch_with_config($config);
$pid = launch_with_config($config);
my $ws = fresh_workspace;
my $first = open_window;
my $focused = get_focused($ws);
my $second = open_window(wm_class => 'notme');
$ws = fresh_workspace;
$first = open_window;
$focused = get_focused($ws);
$second = open_window(wm_class => 'notme');
is(get_focused($ws), $focused, 'focus has not changed');