diff options
author | Daniel Friesel <derf@finalrewind.org> | 2013-09-26 19:36:15 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2013-09-26 19:36:15 +0200 |
commit | 013b068c7650ab1ef92cab6a54da6abf39673eba (patch) | |
tree | d513070f538443b7d561c5e46f988a857741d9d0 /test/feh-bg.i | |
parent | f74385dec092224d046dddc02b731ee30405710f (diff) |
test re-organization and code cleanup
Diffstat (limited to 'test/feh-bg.i')
-rwxr-xr-x | test/feh-bg.i | 79 |
1 files changed, 0 insertions, 79 deletions
diff --git a/test/feh-bg.i b/test/feh-bg.i deleted file mode 100755 index 0e3b546..0000000 --- a/test/feh-bg.i +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/env perl -use strict; -use warnings; -use 5.010; -use autodie qw/:all/; - -use GD qw/:DEFAULT :cmp/; -use Test::More tests => 70; -use Time::HiRes qw/sleep/; - -my ($pid_xnest, $pid_twm); - -$ENV{HOME} = 'test'; - -sub set_bg { - my ($mode, $file) = @_; - - ok( - system("feh --bg-${mode} test/bg/${file}") == 0, - "Ran feh --bg-${mode} test/bg/${file}" - ); -} - -sub same_files { - my ($one, $two) = @_; - - 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 /tmp/feh_${$}.png"); - - ok( - same_files("test/bg/${file}", "/tmp/feh_${$}.png"), - "Wallpaper is test/bg/${file}" - ); -} - -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'); - check_bg('exact/out'); - - for my $type (qw( exact small large )) { - for my $orientation (qw( w h )) { - - set_bg($mode, "${type}/${orientation}/in"); - check_bg("${type}/${orientation}/${mode}"); - - } - } -} - -kill(15, $pid_twm); -sleep(0.2); -kill(15, $pid_xnest); -sleep(0.2); - -unlink("/tmp/feh_${$}.png"); -unlink('test/.fehbg'); |