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