2 # vim:ts=4:sw=4:expandtab
6 my $x = X11::XCB::Connection->new;
8 my $tmp = fresh_workspace;
10 #####################################################################
11 # Create two windows and make sure focus switching works
12 #####################################################################
14 # Change mode of the container to "default" for following tests
18 my $top = open_window($x);
19 my $mid = open_window($x);
20 my $bottom = open_window($x);
23 # Returns the input focus after sending the given command to i3 via IPC
24 # end sleeping for half a second to make sure i3 reacted
31 return $x->input_focus;
34 $focus = $x->input_focus;
35 is($focus, $bottom->id, "Latest window focused");
37 $focus = focus_after('focus up');
38 is($focus, $mid->id, "Middle window focused");
40 $focus = focus_after('focus up');
41 is($focus, $top->id, "Top window focused");
43 #####################################################################
45 #####################################################################
47 $focus = focus_after('focus up');
48 is($focus, $bottom->id, "Bottom window focused (wrapping to the top works)");
50 $focus = focus_after('focus down');
51 is($focus, $top->id, "Top window focused (wrapping to the bottom works)");
53 ###############################################
54 # Test focus with empty containers and colspan
55 ###############################################
57 #my $otmp = get_unused_workspace();
58 #$i3->command("workspace $otmp")->recv;
60 #$top = i3test::open_standard_window($x);
61 #$bottom = i3test::open_standard_window($x);
64 #$focus = focus_after("mj");
65 #$focus = focus_after("mh");
66 #$focus = focus_after("k");
67 #is($focus, $bottom->id, "Selecting top window without snapping doesn't work");
69 #$focus = focus_after("sl");
70 #is($focus, $bottom->id, "Bottom window focused");
72 #$focus = focus_after("k");
73 #is($focus, $top->id, "Top window focused");
75 ## Same thing, but left/right instead of top/bottom
77 #my $o2tmp = get_unused_workspace();
78 #$i3->command("workspace $o2tmp")->recv;
80 #my $left = i3test::open_standard_window($x);
81 #my $right = i3test::open_standard_window($x);
84 #$focus = focus_after("ml");
85 #$focus = focus_after("h");
86 #$focus = focus_after("mk");
87 #$focus = focus_after("l");
88 #is($focus, $left->id, "Selecting right window without snapping doesn't work");
90 #$focus = focus_after("sj");
91 #is($focus, $left->id, "left window focused");
93 #$focus = focus_after("l");
94 #is($focus, $right->id, "right window focused");