summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rwxr-xr-xtest/feh-bg.i22
-rwxr-xr-xtest/run-bg14
-rwxr-xr-xtest/run-interactive2
3 files changed, 24 insertions, 14 deletions
diff --git a/test/feh-bg.i b/test/feh-bg.i
index 1cfb43f..eeff836 100755
--- a/test/feh-bg.i
+++ b/test/feh-bg.i
@@ -2,11 +2,14 @@
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);
+
sub set_bg {
my ($mode, $file) = @_;
@@ -36,6 +39,20 @@ sub check_bg {
);
}
+if (($pid_xnest = fork()) == 0) {
+ exec(qw( Xnest -geometry 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');
@@ -51,4 +68,9 @@ for my $mode (qw( center fill max scale tile )) {
}
}
+kill(15, $pid_twm);
+sleep(0.2);
+kill(15, $pid_xnest);
+sleep(0.2);
+
unlink("/tmp/feh_${$}.png");
diff --git a/test/run-bg b/test/run-bg
deleted file mode 100755
index ee4dee5..0000000
--- a/test/run-bg
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-
-Xnest -geometry 500x500 :7 > /dev/null 2>&1 &
-pid=${!}
-
-# Wallpaper setting requires a window manager to work reliably
-DISPLAY=:7 twm > /dev/null 2>&1 &
-
-DISPLAY=:7 prove -v test/feh-bg.i
-ret=${?}
-
-kill ${pid}
-
-exit ${ret}
diff --git a/test/run-interactive b/test/run-interactive
index 01dc773..6a3e5e3 100755
--- a/test/run-interactive
+++ b/test/run-interactive
@@ -8,4 +8,6 @@ ret=${?}
kill ${pid}
+sleep 2
+
exit ${ret}