2013-01-11 19:58:32 +01: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
|
2013-01-11 19:58:32 +01:00
|
|
|
# (or docs/testsuite)
|
|
|
|
#
|
2017-09-24 10:19:50 +02:00
|
|
|
# • https://build.i3wm.org/docs/lib-i3test.html
|
2013-01-11 19:58:32 +01:00
|
|
|
# (alternatively: perldoc ./testcases/lib/i3test.pm)
|
|
|
|
#
|
2017-09-24 10:19:50 +02:00
|
|
|
# • https://build.i3wm.org/docs/ipc.html
|
2013-01-11 19:58:32 +01:00
|
|
|
# (or docs/ipc)
|
|
|
|
#
|
|
|
|
# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
|
|
|
|
# (unless you are already familiar with Perl)
|
|
|
|
|
|
|
|
use i3test;
|
|
|
|
|
|
|
|
my $new = AnyEvent->condvar;
|
2014-02-22 11:52:01 +01:00
|
|
|
my $focus = AnyEvent->condvar;
|
2013-01-11 19:58:32 +01:00
|
|
|
|
2017-09-24 15:40:30 +02:00
|
|
|
my @events = events_for(
|
|
|
|
sub { open_window },
|
|
|
|
'window');
|
2013-01-11 19:58:32 +01:00
|
|
|
|
2017-09-24 15:40:30 +02:00
|
|
|
is(scalar @events, 2, 'Received 2 events');
|
|
|
|
is($events[0]->{container}->{focused}, 0, 'Window "new" event received');
|
|
|
|
is($events[1]->{container}->{focused}, 1, 'Window "focus" event received');
|
2013-02-18 10:59:32 +01:00
|
|
|
|
2013-01-11 19:58:32 +01:00
|
|
|
done_testing;
|