Files
debian
docs
i3-config-wizard
i3-input
i3-msg
i3-nagbar
include
man
render-tree
src
testcases
t
lib
00-load.t
01-tile.t
02-fullscreen.t
03-unmanaged.t
04-floating.t
05-ipc.t
06-focus.t
07-move.t
08-focus-stack.t
09-stacking.t
10-dock.t
11-goto.t
12-floating-resize.t
13-urgent.t
14-client-leader.t
15-ipc-workspaces.t
16-nestedcons.t
17-workspace.t
18-openkill.t
19-match.t
20-multiple-cmds.t
21-next-prev.t
22-split.t
24-move.t
26-regress-close.t
27-regress-floating-parent.t
28-open-order.t
29-focus-after-close.t
30-close-empty-split.t
31-stacking-order.t
32-move-workspace.t
33-size-hints.t
34-invalid-command.t
35-floating-focus.t
36-floating-ws-empty.t
37-floating-unmap.t
38-floating-attach.t
39-ws-numbers.t
40-focus-lost.t
41-resize.t
42-regress-move-floating.t
43-regress-floating-restart.t
44-regress-floating-resize.t
45-flattening.t
46-floating-reinsert.t
47-regress-floatingmove.t
48-regress-floatingmovews.t
50-regress-dock-restart.t
51-regress-float-size.t
52-regress-level-up.t
53-floating-originalsize.t
54-regress-multiple-dock.t
55-floating-split-size.t
56-fullscreen-focus.t
57-regress-fullscreen-level-up.t
58-wm_take_focus.t
59-socketpaths.t
61-regress-borders-restart.t
62-regress-dock-urgent.t
63-wm-state.t
64-kill-win-vs-client.t
65-for_window.t
66-assign.t
67-workspace_layout.t
68-regress-fullscreen-restart.t
69-border-toggle.t
70-force_focus_wrapping.t
71-config-migrate.t
Makefile
complete-run.pl
i3-test.config
tests
website
yajl-fallback
.gitignore
CMDMODE
DEPENDS
GOALS
LICENSE
Makefile
PACKAGE-MAINTAINER
README.tree
RELEASE-NOTES-3.a-bf1
RELEASE-NOTES-3.b
RELEASE-NOTES-3.c
RELEASE-NOTES-3.d
RELEASE-NOTES-tree-pr1
RELEASE-NOTES-tree-pr2
RELEASE-NOTES-tree-pr3
RELEASE-NOTES-tree-pr4
TODO
common.mk
dump-asy.pl
gtk-tree-watch.pl
i3-migrate-config-to-v4.pl
i3-wsbar
i3.config
i3.config.keycodes
i3.desktop
i3.welcome
logo.svg
pseudo-doc.doxygen
i3/testcases/t/06-focus.t
Michael Stapelberg d68e4710fe CONFIG BREAK: kick the 'next'/'prev' commands, introduce 'focus left' etc.
Instead of the cryptic next/prev commands, we now provide an argument to the
focus command. Userguide and default config is updated.
2011-06-08 20:49:49 +02:00

108 lines
2.8 KiB
Perl

#!perl
# vim:ts=4:sw=4:expandtab
use i3test;
use X11::XCB qw(:all);
BEGIN {
use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection');
}
my $x = X11::XCB::Connection->new;
my $i3 = i3("/tmp/nestedcons");
my $tmp = fresh_workspace;
#####################################################################
# Create two windows and make sure focus switching works
#####################################################################
# Change mode of the container to "default" for following tests
cmd 'layout default';
cmd 'split v';
my $top = open_standard_window($x);
my $mid = open_standard_window($x);
my $bottom = open_standard_window($x);
sleep 0.25;
diag("top id = " . $top->id);
diag("mid id = " . $mid->id);
diag("bottom id = " . $bottom->id);
#
# Returns the input focus after sending the given command to i3 via IPC
# end sleeping for half a second to make sure i3 reacted
#
sub focus_after {
my $msg = shift;
$i3->command($msg)->recv;
return $x->input_focus;
}
$focus = $x->input_focus;
is($focus, $bottom->id, "Latest window focused");
$focus = focus_after('focus up');
is($focus, $mid->id, "Middle window focused");
$focus = focus_after('focus up');
is($focus, $top->id, "Top window focused");
#####################################################################
# Test focus wrapping
#####################################################################
$focus = focus_after('focus up');
is($focus, $bottom->id, "Bottom window focused (wrapping to the top works)");
$focus = focus_after('focus down');
is($focus, $top->id, "Top window focused (wrapping to the bottom works)");
###############################################
# Test focus with empty containers and colspan
###############################################
#my $otmp = get_unused_workspace();
#$i3->command("workspace $otmp")->recv;
#
#$top = i3test::open_standard_window($x);
#$bottom = i3test::open_standard_window($x);
#sleep 0.25;
#
#$focus = focus_after("mj");
#$focus = focus_after("mh");
#$focus = focus_after("k");
#is($focus, $bottom->id, "Selecting top window without snapping doesn't work");
#
#$focus = focus_after("sl");
#is($focus, $bottom->id, "Bottom window focused");
#
#$focus = focus_after("k");
#is($focus, $top->id, "Top window focused");
#
## Same thing, but left/right instead of top/bottom
#
#my $o2tmp = get_unused_workspace();
#$i3->command("workspace $o2tmp")->recv;
#
#my $left = i3test::open_standard_window($x);
#my $right = i3test::open_standard_window($x);
#sleep 0.25;
#
#$focus = focus_after("ml");
#$focus = focus_after("h");
#$focus = focus_after("mk");
#$focus = focus_after("l");
#is($focus, $left->id, "Selecting right window without snapping doesn't work");
#
#$focus = focus_after("sj");
#is($focus, $left->id, "left window focused");
#
#$focus = focus_after("l");
#is($focus, $right->id, "right window focused");
done_testing;