]> git.sur5r.net Git - i3/i3/blob - testcases/t/265-ipc-mark.t
Merge pull request #2980 from orestisf1993/issue-1160-pr
[i3/i3] / testcases / t / 265-ipc-mark.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 #
4 # Please read the following documents before working on tests:
5 # • https://build.i3wm.org/docs/testsuite.html
6 #   (or docs/testsuite)
7 #
8 # • https://build.i3wm.org/docs/lib-i3test.html
9 #   (alternatively: perldoc ./testcases/lib/i3test.pm)
10 #
11 # • https://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 # Tests for the window::mark IPC event.
18 # Ticket: #2501
19 use i3test;
20
21 sub mark_subtest {
22     my ($cmd) = @_;
23
24     my @events = events_for(
25         sub { cmd $cmd },
26         'window');
27
28     my @mark = grep { $_->{change} eq 'mark' } @events;
29     is(scalar @mark, 1, 'Received 1 window::mark event');
30 }
31
32 ###############################################################################
33 # Marking a container triggers a 'mark' event.
34 ###############################################################################
35 fresh_workspace;
36 open_window;
37
38 subtest 'mark', \&mark_subtest, 'mark x';
39
40 ###############################################################################
41 # Unmarking a container triggers a 'mark' event.
42 ###############################################################################
43 fresh_workspace;
44 open_window;
45 cmd 'mark x';
46
47 subtest 'unmark', \&mark_subtest, 'unmark x';
48
49 ###############################################################################
50
51 done_testing;