summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/bg.pngbin0 -> 9815 bytes
-rw-r--r--test/bg_451x500.pngbin0 -> 9687 bytes
-rw-r--r--test/bg_451x500_center.pngbin0 -> 6737 bytes
-rw-r--r--test/bg_451x500_fill.pngbin0 -> 15089 bytes
l---------test/bg_451x500_max.png1
-rw-r--r--test/bg_451x500_scale.pngbin0 -> 10842 bytes
-rw-r--r--test/bg_451x500_tile.pngbin0 -> 6755 bytes
-rw-r--r--test/bg_500x333.pngbin0 -> 9135 bytes
-rw-r--r--test/bg_500x333_center.pngbin0 -> 6344 bytes
-rw-r--r--test/bg_500x333_fill.pngbin0 -> 18419 bytes
l---------test/bg_500x333_max.png1
-rw-r--r--test/bg_500x333_scale.pngbin0 -> 11681 bytes
-rw-r--r--test/bg_500x333_tile.pngbin0 -> 9170 bytes
-rw-r--r--test/bg_all.pngbin0 -> 6525 bytes
-rwxr-xr-xtest/feh-bg.i52
-rwxr-xr-xtest/run-bg11
16 files changed, 65 insertions, 0 deletions
diff --git a/test/bg.png b/test/bg.png
new file mode 100644
index 0000000..0c1f09f
--- /dev/null
+++ b/test/bg.png
Binary files differ
diff --git a/test/bg_451x500.png b/test/bg_451x500.png
new file mode 100644
index 0000000..3b64670
--- /dev/null
+++ b/test/bg_451x500.png
Binary files differ
diff --git a/test/bg_451x500_center.png b/test/bg_451x500_center.png
new file mode 100644
index 0000000..99555af
--- /dev/null
+++ b/test/bg_451x500_center.png
Binary files differ
diff --git a/test/bg_451x500_fill.png b/test/bg_451x500_fill.png
new file mode 100644
index 0000000..18e1da9
--- /dev/null
+++ b/test/bg_451x500_fill.png
Binary files differ
diff --git a/test/bg_451x500_max.png b/test/bg_451x500_max.png
new file mode 120000
index 0000000..4721827
--- /dev/null
+++ b/test/bg_451x500_max.png
@@ -0,0 +1 @@
+bg_451x500_center.png \ No newline at end of file
diff --git a/test/bg_451x500_scale.png b/test/bg_451x500_scale.png
new file mode 100644
index 0000000..fd884f6
--- /dev/null
+++ b/test/bg_451x500_scale.png
Binary files differ
diff --git a/test/bg_451x500_tile.png b/test/bg_451x500_tile.png
new file mode 100644
index 0000000..1fcc1dd
--- /dev/null
+++ b/test/bg_451x500_tile.png
Binary files differ
diff --git a/test/bg_500x333.png b/test/bg_500x333.png
new file mode 100644
index 0000000..8fad57c
--- /dev/null
+++ b/test/bg_500x333.png
Binary files differ
diff --git a/test/bg_500x333_center.png b/test/bg_500x333_center.png
new file mode 100644
index 0000000..7db9571
--- /dev/null
+++ b/test/bg_500x333_center.png
Binary files differ
diff --git a/test/bg_500x333_fill.png b/test/bg_500x333_fill.png
new file mode 100644
index 0000000..eeec8ca
--- /dev/null
+++ b/test/bg_500x333_fill.png
Binary files differ
diff --git a/test/bg_500x333_max.png b/test/bg_500x333_max.png
new file mode 120000
index 0000000..13547b7
--- /dev/null
+++ b/test/bg_500x333_max.png
@@ -0,0 +1 @@
+bg_500x333_center.png \ No newline at end of file
diff --git a/test/bg_500x333_scale.png b/test/bg_500x333_scale.png
new file mode 100644
index 0000000..fee0647
--- /dev/null
+++ b/test/bg_500x333_scale.png
Binary files differ
diff --git a/test/bg_500x333_tile.png b/test/bg_500x333_tile.png
new file mode 100644
index 0000000..5c8e1a4
--- /dev/null
+++ b/test/bg_500x333_tile.png
Binary files differ
diff --git a/test/bg_all.png b/test/bg_all.png
new file mode 100644
index 0000000..5903c34
--- /dev/null
+++ b/test/bg_all.png
Binary files differ
diff --git a/test/feh-bg.i b/test/feh-bg.i
new file mode 100755
index 0000000..b26feff
--- /dev/null
+++ b/test/feh-bg.i
@@ -0,0 +1,52 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use 5.010;
+
+use GD qw/:DEFAULT :cmp/;
+use Test::More tests => 30;
+use Time::HiRes qw/sleep/;
+
+sub set_bg {
+ my ($mode, $file) = @_;
+
+ $file //= 'bg.png';
+
+ ok(
+ system("feh --bg-${mode} test/${file}") == 0,
+ "Ran feh --bg-${mode} test/${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/${file}", "/tmp/feh_${$}.png"),
+ "Wallpaper is test/${file}"
+ );
+}
+
+for my $mode (qw( center fill max scale tile )) {
+ set_bg($mode);
+ check_bg('bg_all.png');
+
+ set_bg($mode, 'bg_500x333.png');
+ check_bg("bg_500x333_${mode}.png");
+
+ set_bg($mode, 'bg_451x500.png');
+ check_bg("bg_451x500_${mode}.png");
+}
+
+unlink("/tmp/feh_${$}.png");
diff --git a/test/run-bg b/test/run-bg
new file mode 100755
index 0000000..df5d6ac
--- /dev/null
+++ b/test/run-bg
@@ -0,0 +1,11 @@
+#!/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
+
+kill ${pid}