2016-10-18 08:32:41 +02:00
|
|
|
#!perl
|
|
|
|
# vim:ts=4:sw=4:expandtab
|
|
|
|
#
|
|
|
|
# Please read the following documents before working on tests:
|
2017-09-24 10:19:50 +02:00
|
|
|
# • https://build.i3wm.org/docs/testsuite.html
|
2016-10-18 08:32:41 +02:00
|
|
|
# (or docs/testsuite)
|
|
|
|
#
|
2017-09-24 10:19:50 +02:00
|
|
|
# • https://build.i3wm.org/docs/lib-i3test.html
|
2016-10-18 08:32:41 +02:00
|
|
|
# (alternatively: perldoc ./testcases/lib/i3test.pm)
|
|
|
|
#
|
2017-09-24 10:19:50 +02:00
|
|
|
# • https://build.i3wm.org/docs/ipc.html
|
2016-10-18 08:32:41 +02:00
|
|
|
# (or docs/ipc)
|
|
|
|
#
|
|
|
|
# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
|
|
|
|
# (unless you are already familiar with Perl)
|
|
|
|
#
|
|
|
|
# Tests for the window::mark IPC event.
|
|
|
|
# Ticket: #2501
|
|
|
|
use i3test;
|
|
|
|
|
2017-09-24 15:40:30 +02:00
|
|
|
sub mark_subtest {
|
|
|
|
my ($cmd) = @_;
|
2016-10-18 08:32:41 +02:00
|
|
|
|
2017-09-24 15:40:30 +02:00
|
|
|
my @events = events_for(
|
|
|
|
sub { cmd $cmd },
|
|
|
|
'window');
|
2016-10-18 08:32:41 +02:00
|
|
|
|
2017-09-24 15:40:30 +02:00
|
|
|
my @mark = grep { $_->{change} eq 'mark' } @events;
|
|
|
|
is(scalar @mark, 1, 'Received 1 window::mark event');
|
|
|
|
}
|
2016-10-18 08:32:41 +02:00
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# Marking a container triggers a 'mark' event.
|
|
|
|
###############################################################################
|
|
|
|
fresh_workspace;
|
|
|
|
open_window;
|
|
|
|
|
2017-09-24 15:40:30 +02:00
|
|
|
subtest 'mark', \&mark_subtest, 'mark x';
|
2016-10-18 08:32:41 +02:00
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# Unmarking a container triggers a 'mark' event.
|
|
|
|
###############################################################################
|
|
|
|
fresh_workspace;
|
|
|
|
open_window;
|
|
|
|
cmd 'mark x';
|
|
|
|
|
2017-09-24 15:40:30 +02:00
|
|
|
subtest 'unmark', \&mark_subtest, 'unmark x';
|
2016-10-18 08:32:41 +02:00
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
done_testing;
|