]> git.sur5r.net Git - i3/i3/blob - testcases/t/210-mark-unmark.t
Added missing bar section for tray_output primary
[i3/i3] / testcases / t / 210-mark-unmark.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 #
4 # Please read the following documents before working on tests:
5 # • http://build.i3wm.org/docs/testsuite.html
6 #   (or docs/testsuite)
7 #
8 # • http://build.i3wm.org/docs/lib-i3test.html
9 #   (alternatively: perldoc ./testcases/lib/i3test.pm)
10 #
11 # • http://build.i3wm.org/docs/ipc.html
12 #   (or docs/ipc)
13 #
14 # • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
15 #   (unless you are already familiar with Perl)
16 #
17 # checks if mark and unmark work correctly
18 use i3test;
19
20 sub get_marks {
21     return i3(get_socket_path())->get_marks->recv;
22 }
23
24 ##############################################################
25 # 1: check that there are no marks set yet
26 ##############################################################
27
28 my $tmp = fresh_workspace;
29
30 cmd 'split h';
31
32 is_deeply(get_marks(), [], 'no marks set yet');
33
34
35 ##############################################################
36 # 2: mark a con, check that it's marked, unmark it, check that
37 ##############################################################
38
39 my $one = open_window;
40 cmd 'mark foo';
41
42 is_deeply(get_marks(), ["foo"], 'mark foo set');
43
44 cmd 'unmark foo';
45
46 is_deeply(get_marks(), [], 'mark foo removed');
47
48 ##############################################################
49 # 3: mark three cons, check that they are marked
50 #    unmark one con, check that it's unmarked
51 #    unmark all cons, check that they are unmarked
52 ##############################################################
53
54 my $left = open_window;
55 my $middle = open_window;
56 my $right = open_window;
57
58 cmd 'mark right';
59 cmd 'focus left';
60 cmd 'mark middle';
61 cmd 'focus left';
62 cmd 'mark left';
63
64 #
65 # get_marks replys an array of marks, whose order is undefined,
66 # so we use sort to be able to compare the output
67 #
68
69 is_deeply(sort(get_marks()), ["left","middle","right"], 'all three marks set');
70
71 cmd 'unmark right';
72
73 is_deeply(sort(get_marks()), ["left","middle"], 'mark right removed');
74
75 cmd 'unmark';
76
77 is_deeply(get_marks(), [], 'all marks removed');
78
79 done_testing;