aboutsummaryrefslogtreecommitdiff
path: root/testcases/t/265-ipc-mark.t
blob: 1930559f1b60e0233f467d0f4cc5f306cbf0e05a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!perl
# vim:ts=4:sw=4:expandtab
#
# Please read the following documents before working on tests:
# • https://build.i3wm.org/docs/testsuite.html
#   (or docs/testsuite)
#
# • https://build.i3wm.org/docs/lib-i3test.html
#   (alternatively: perldoc ./testcases/lib/i3test.pm)
#
# • https://build.i3wm.org/docs/ipc.html
#   (or docs/ipc)
#
# • https://i3wm.org/downloads/modern_perl_a4.pdf
#   (unless you are already familiar with Perl)
#
# Tests for the window::mark IPC event.
# Ticket: #2501
use i3test;

sub mark_subtest {
    my ($cmd) = @_;

    my @events = events_for(
	sub { cmd $cmd },
	'window');

    my @mark = grep { $_->{change} eq 'mark' } @events;
    is(scalar @mark, 1, 'Received 1 window::mark event');
}

###############################################################################
# Marking a container triggers a 'mark' event.
###############################################################################
fresh_workspace;
open_window;

subtest 'mark', \&mark_subtest, 'mark x';

###############################################################################
# Unmarking a container triggers a 'mark' event.
###############################################################################
fresh_workspace;
open_window;
cmd 'mark x';

subtest 'unmark', \&mark_subtest, 'unmark x';

###############################################################################

done_testing;