diff options
author | Daniel Friesel <derf@finalrewind.org> | 2010-10-02 22:51:38 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2010-10-02 22:51:38 +0200 |
commit | 485d0c8c0a58b85c5c80f31627d89e3b5d449ff2 (patch) | |
tree | 7ed617eed72769306f0f7e8e4b9d9544bf8b715c | |
parent | 7b86f410356941010402b2602eaf023b75438858 (diff) |
Begin work on --bg tests
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | README | 6 | ||||
-rw-r--r-- | test/bg.png | bin | 0 -> 9815 bytes | |||
-rw-r--r-- | test/bg_451x500.png | bin | 0 -> 9687 bytes | |||
-rw-r--r-- | test/bg_451x500_center.png | bin | 0 -> 6737 bytes | |||
-rw-r--r-- | test/bg_451x500_fill.png | bin | 0 -> 15089 bytes | |||
l--------- | test/bg_451x500_max.png | 1 | ||||
-rw-r--r-- | test/bg_451x500_scale.png | bin | 0 -> 10842 bytes | |||
-rw-r--r-- | test/bg_451x500_tile.png | bin | 0 -> 6755 bytes | |||
-rw-r--r-- | test/bg_500x333.png | bin | 0 -> 9135 bytes | |||
-rw-r--r-- | test/bg_500x333_center.png | bin | 0 -> 6344 bytes | |||
-rw-r--r-- | test/bg_500x333_fill.png | bin | 0 -> 18419 bytes | |||
l--------- | test/bg_500x333_max.png | 1 | ||||
-rw-r--r-- | test/bg_500x333_scale.png | bin | 0 -> 11681 bytes | |||
-rw-r--r-- | test/bg_500x333_tile.png | bin | 0 -> 9170 bytes | |||
-rw-r--r-- | test/bg_all.png | bin | 0 -> 6525 bytes | |||
-rwxr-xr-x | test/feh-bg.i | 52 | ||||
-rwxr-xr-x | test/run-bg | 11 |
18 files changed, 71 insertions, 4 deletions
@@ -12,7 +12,9 @@ test: all @PACKAGE=${PACKAGE} VERSION=${VERSION} prove test test-x11: all - @test/run-interactive + test/run-interactive + sleep 3 + test/run-bg install: install-man install-doc install-bin install-font install-img @@ -43,9 +43,9 @@ work without X, so they can safely be run even on a headless buildserver. Testing (X): Requires - * perl >= 5.10 - * Test::More - * X11::GUITest + * import (usually supplied by imagemagick) + * perl >= 5.10 with GD, Test::More and X11::GUITest + * twm * Xnest $ make test-x11 diff --git a/test/bg.png b/test/bg.png Binary files differnew file mode 100644 index 0000000..0c1f09f --- /dev/null +++ b/test/bg.png diff --git a/test/bg_451x500.png b/test/bg_451x500.png Binary files differnew file mode 100644 index 0000000..3b64670 --- /dev/null +++ b/test/bg_451x500.png diff --git a/test/bg_451x500_center.png b/test/bg_451x500_center.png Binary files differnew file mode 100644 index 0000000..99555af --- /dev/null +++ b/test/bg_451x500_center.png diff --git a/test/bg_451x500_fill.png b/test/bg_451x500_fill.png Binary files differnew file mode 100644 index 0000000..18e1da9 --- /dev/null +++ b/test/bg_451x500_fill.png 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 Binary files differnew file mode 100644 index 0000000..fd884f6 --- /dev/null +++ b/test/bg_451x500_scale.png diff --git a/test/bg_451x500_tile.png b/test/bg_451x500_tile.png Binary files differnew file mode 100644 index 0000000..1fcc1dd --- /dev/null +++ b/test/bg_451x500_tile.png diff --git a/test/bg_500x333.png b/test/bg_500x333.png Binary files differnew file mode 100644 index 0000000..8fad57c --- /dev/null +++ b/test/bg_500x333.png diff --git a/test/bg_500x333_center.png b/test/bg_500x333_center.png Binary files differnew file mode 100644 index 0000000..7db9571 --- /dev/null +++ b/test/bg_500x333_center.png diff --git a/test/bg_500x333_fill.png b/test/bg_500x333_fill.png Binary files differnew file mode 100644 index 0000000..eeec8ca --- /dev/null +++ b/test/bg_500x333_fill.png 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 Binary files differnew file mode 100644 index 0000000..fee0647 --- /dev/null +++ b/test/bg_500x333_scale.png diff --git a/test/bg_500x333_tile.png b/test/bg_500x333_tile.png Binary files differnew file mode 100644 index 0000000..5c8e1a4 --- /dev/null +++ b/test/bg_500x333_tile.png diff --git a/test/bg_all.png b/test/bg_all.png Binary files differnew file mode 100644 index 0000000..5903c34 --- /dev/null +++ b/test/bg_all.png 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} |