2 # vim:ts=4:sw=4:expandtab
3 # © 2012 Michael Stapelberg and contributors
4 # Script to create a new testcase from a template.
6 # # Create (and edit) a new test for moving floating windows
7 # ./new-test floating move
9 # # Create (and edit) a multi-monitor test for moving workspaces
10 # ./new-test -m move workspaces
14 use File::Basename qw(basename);
20 my $result = GetOptions(
21 'multi-monitor|mm' => \$multi_monitor
24 my $testname = join(' ', @ARGV);
29 # vim:ts=4:sw=4:expandtab
31 # Please read the following documents before working on tests:
32 # • http://build.i3wm.org/docs/testsuite.html
35 # • http://build.i3wm.org/docs/lib-i3test.html
36 # (alternatively: perldoc ./testcases/lib/i3test.pm)
38 # • http://build.i3wm.org/docs/ipc.html
41 # • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
42 # (unless you are already familiar with Perl)
44 # TODO: Description of this file.
46 # Bug still in: #GITREV#
49 # Figure out the next test filename.
52 @files = grep { basename($_) =~ /^5/ } <t/*.t>;
54 @files = grep { basename($_) !~ /^5/ } <t/*.t>;
56 my ($latest) = sort { $b cmp $a } @files;
57 my ($num) = (basename($latest) =~ /^([0-9]+)/);
58 my $filename = "t/" . ($num+1) . "-" . lc($testname) . ".t";
60 # Get the current git revision.
61 chomp(my $gitrev = qx(git describe --tags));
62 $header =~ s/#GITREV#/$gitrev/g;
64 # Create the file based on our template.
65 open(my $fh, '>', $filename);
69 use i3test i3_autostart => 0;
71 # Ensure the pointer is at (0, 0) so that we really start on the first
72 # (the left) workspace.
73 $x->root->warp_pointer(0, 0);
77 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
79 fake-outputs 1024x768+0+0,1024x768+1024+0
84 exit_gracefully($pid);
98 my $editor = $ENV{EDITOR};
100 exec $editor, $filename;