#!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) # # • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf # (unless you are already familiar with Perl) # # Verifies that i3-dmenu-desktop correctly parses Exec= lines in .desktop files # and sends the command to i3 for execution. # Ticket: #5152, #5156 # Bug still in: 4.21-17-g389d555d use i3test; use i3test::Util qw(slurp); use File::Temp qw(tempfile tempdir); use POSIX qw(mkfifo); use JSON::XS qw(decode_json); my $desktopdir = tempdir(CLEANUP => 1); $ENV{XDG_DATA_DIRS} = "$desktopdir"; mkdir("$desktopdir/applications"); # Create an i3-msg executable that dumps command line flags to a FIFO my $tmpdir = tempdir(CLEANUP => 1); $ENV{PATH} = "$tmpdir:" . $ENV{PATH}; mkfifo("$tmpdir/fifo", 0600) or BAIL_OUT "Could not create FIFO: $!"; open(my $i3msg_dump, '>', "$tmpdir/i3-msg"); say $i3msg_dump <', "$tmpdir/fifo"); say \$f encode_json(\\\@ARGV); close(\$f); EOT close($i3msg_dump); chmod 0755, "$tmpdir/i3-msg"; my $testcnt = 0; sub verify_exec { my ($execline, $want_arg) = @_; $testcnt++; open(my $desktop, '>', "$desktopdir/applications/desktop$testcnt.desktop"); say $desktop <