2 # vim:ts=4:sw=4:expandtab
4 # Please read the following documents before working on tests:
5 # • https://build.i3wm.org/docs/testsuite.html
8 # • https://build.i3wm.org/docs/lib-i3test.html
9 # (alternatively: perldoc ./testcases/lib/i3test.pm)
11 # • https://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 # Tests whether 'workspace next' works correctly.
19 use List::Util qw(first);
20 use i3test i3_config => <<EOT;
22 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
24 fake-outputs 1024x768+0+0,1024x768+1024+0
31 # We need to sync after changing focus to a different output to wait for the
32 # EnterNotify to be processed, otherwise it will be processed at some point
33 # later in time and mess up our subsequent tests.
36 is(focused_ws, $expected, "workspace $expected focused");
43 # We need to sync after changing focus to a different output to wait for the
44 # EnterNotify to be processed, otherwise it will be processed at some point
45 # later in time and mess up our subsequent tests.
48 is(focused_ws, $expected, "workspace $expected focused");
52 $x->root->warp_pointer(0, 0);
55 ################################################################################
56 # Setup workspaces so that they stay open (with an empty container).
57 # open_window ensures, this
60 # output 1 (left) : 1, 2, 3, 6, 7, B, F, C
61 # output 2 (right): 4, 5, A, D, E
63 ################################################################################
65 cmd 'focus output left';
66 cmd 'workspace A'; open_window;
67 cmd 'workspace D'; open_window;
68 cmd 'workspace 4'; open_window;
69 cmd 'workspace 5'; open_window;
70 cmd 'workspace E'; open_window;
72 cmd 'focus output right';
73 cmd 'workspace 1'; open_window;
74 cmd 'workspace 2'; open_window;
75 cmd 'workspace B'; open_window;
76 cmd 'workspace 3'; open_window;
77 cmd 'workspace F'; open_window;
78 cmd 'workspace 6'; open_window;
79 cmd 'workspace C'; open_window;
80 cmd 'workspace 7'; open_window;
82 ################################################################################
83 # Use workspace next and verify the correct order.
84 # numbered -> numerical sort
85 # named -> sort by creation time
86 ################################################################################
88 is(focused_ws, '1', 'back on workspace 1');
106 is(focused_ws, '1', 'back on workspace 1');