use i3test;
use File::Temp;
-my $x = X11::XCB::Connection->new;
-
my $tmp = fresh_workspace;
cmd 'split h';
# Create two windows and make sure focus switching works
#####################################################################
-my $top = open_window($x);
-my $mid = open_window($x);
-my $bottom = open_window($x);
+my $top = open_window;
+my $mid = open_window;
+my $bottom = open_window;
#
# Returns the input focus after sending the given command to i3 via IPC
my $msg = shift;
cmd $msg;
- sync_with_i3($x);
return $x->input_focus;
}
-$focus = $x->input_focus;
+my $focus = $x->input_focus;
is($focus, $bottom->id, "Latest window focused");
$focus = focus_after('focus left');
$focus = focus_after(qq|[con_mark="$random_mark" con_mark="$random_mark"] focus|);
is($focus, $mid->id, "goto worked");
+ #####################################################################
+ # Set the same mark multiple times and see if focus works correctly
+ #####################################################################
+
+ $focus = focus_after('focus left');
+ is($focus, $top->id, "Top window focused");
+
+ cmd "mark $random_mark";
+
+ $focus = focus_after(qq|[con_mark="$random_mark"] focus|);
+ is($focus, $top->id, "focus unchanged after goto");
+
+ $focus = focus_after('focus right');
+ is($focus, $mid->id, "mid window focused");
+
+ $focus = focus_after(qq|[con_mark="$random_mark"] focus|);
+ is($focus, $top->id, "goto worked");
+
#####################################################################
# Check whether the focus command will switch to a different
# workspace if necessary
my $tmp = fresh_workspace;
my $marks = get_marks();
-cmp_deeply($marks, [], 'no marks set so far');
+is_deeply($marks, [], 'no marks set so far');
##############################################################
# 2: check that setting a mark is reflected in the get_marks reply
cmd 'open';
cmd 'mark foo';
-cmp_deeply(get_marks(), [ 'foo' ], 'mark foo set');
+is_deeply(get_marks(), [ 'foo' ], 'mark foo set');
##############################################################
# 3: check that the mark is gone after killing the container
cmd 'kill';
-cmp_deeply(get_marks(), [ ], 'mark gone');
+is_deeply(get_marks(), [ ], 'mark gone');
- ##############################################################
- # 4: check that duplicate marks are included twice in the get_marks reply
- ##############################################################
-
- cmd 'open';
- cmd 'mark bar';
-
- cmd 'open';
- cmd 'mark bar';
-
- is_deeply(get_marks(), [ 'bar', 'bar' ], 'duplicate mark found twice');
-
done_testing;