Newer
Older
#!/usr/bin/env perl
use strict;
use warnings;
use 5.010;
use Test::More tests => 70;
my $scr_dir = '/tmp/feh-test-scr';
my ( $pid_xnest, $pid_twm );
Birte Kristina Friesel
committed
$ENV{HOME} = 'test';
system("feh --bg-${mode} test/bg/${file}") == 0,
"Ran feh --bg-${mode} test/bg/${file}"
my $img_one = GD::Image->new($one);
my $img_two = GD::Image->new($two);
return ( !( $img_one->compare($img_two) & GD_CMP_IMAGE ) );
}
sub check_bg {
my ($file) = @_;
system("import -silent -window root ${scr_dir}/feh_${$}.png");
ok( same_files( "test/bg/${file}", "${scr_dir}/feh_${$}.png" ),
"Wallpaper is test/bg/${file}" );
}
if ( not -d $scr_dir ) {
mkdir($scr_dir);
if ( ( $pid_xnest = fork() ) == 0 ) {
exec(qw( Xephyr -screen 500x500 :7 ));
}
sleep(0.5);
$ENV{'DISPLAY'} = ':7';
if ( ( $pid_twm = fork() ) == 0 ) {
exec('twm');
}
sleep(0.5);
for my $mode (qw( center fill max scale tile )) {
set_bg( $mode, 'exact/in' );
for my $type (qw( exact small large )) {
for my $orientation (qw( w h )) {
set_bg( $mode, "${type}/${orientation}/in" );
check_bg("${type}/${orientation}/${mode}");
unlink("${scr_dir}/feh_${$}.png");
Birte Kristina Friesel
committed
unlink('test/.fehbg');