2 # vim:ts=4:sw=4:expandtab
4 # Please read the following documents before working on tests:
5 # • http://build.i3wm.org/docs/testsuite.html
8 # • http://build.i3wm.org/docs/lib-i3test.html
9 # (alternatively: perldoc ./testcases/lib/i3test.pm)
11 # • http://build.i3wm.org/docs/ipc.html
14 # • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
15 # (unless you are already familiar with Perl)
17 # Beware that this test uses workspace 9 to perform some tests (it expects
18 # the workspace to be empty).
19 # TODO: skip it by default?
21 use i3test tests => 8;
22 use X11::XCB qw(:all);
23 use Time::HiRes qw(sleep);
26 use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection');
30 skip "Testcase not yet modified for new move concept", 7;
32 my $x = X11::XCB::Connection->new;
36 # Switch to the nineth workspace
37 $i3->command('9')->recv;
39 #####################################################################
40 # Create two windows and make sure focus switching works
41 #####################################################################
43 my $top = i3test::open_standard_window($x);
45 my $mid = i3test::open_standard_window($x);
47 my $bottom = i3test::open_standard_window($x);
50 diag("top id = " . $top->id);
51 diag("mid id = " . $mid->id);
52 diag("bottom id = " . $bottom->id);
55 # Returns the input focus after sending the given command to i3 via IPC
56 # end sleeping for half a second to make sure i3 reacted
61 $i3->command($msg)->recv;
62 return $x->input_focus;
65 my $focus = $x->input_focus;
66 is($focus, $bottom->id, "Latest window focused");
68 $focus = focus_after("ml");
69 is($focus, $bottom->id, "Right window still focused");
71 $focus = focus_after("h");
72 is($focus, $mid->id, "Middle window focused");
74 #####################################################################
75 # Now move to the top window, move right, then move left again
76 # (e.g., does i3 remember the focus in the last container?)
77 #####################################################################
79 $focus = focus_after("k");
80 is($focus, $top->id, "Top window focused");
82 $focus = focus_after("l");
83 is($focus, $bottom->id, "Right window focused");
85 $focus = focus_after("h");
86 is($focus, $top->id, "Top window focused");
88 #####################################################################
89 # Move window cross-workspace
90 #####################################################################
92 for my $cmd (qw(m12 t m13 12 13)) {
93 $i3->command($cmd)->recv;
95 ok(1, "Still living");