summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/bg/exact/h/centerbin0 -> 6737 bytes
-rw-r--r--test/bg/exact/h/fillbin0 -> 9290 bytes
-rw-r--r--test/bg/exact/h/inbin0 -> 9687 bytes
l---------test/bg/exact/h/max1
-rw-r--r--test/bg/exact/h/scalebin0 -> 10842 bytes
-rw-r--r--test/bg/exact/h/tilebin0 -> 6755 bytes
-rw-r--r--test/bg/exact/inbin0 -> 9815 bytes
-rw-r--r--test/bg/exact/outbin0 -> 6525 bytes
-rw-r--r--test/bg/exact/w/centerbin0 -> 6344 bytes
-rw-r--r--test/bg/exact/w/fillbin0 -> 11586 bytes
-rw-r--r--test/bg/exact/w/inbin0 -> 9135 bytes
l---------test/bg/exact/w/max1
-rw-r--r--test/bg/exact/w/scalebin0 -> 11681 bytes
-rw-r--r--test/bg/exact/w/tilebin0 -> 9170 bytes
-rw-r--r--test/bg/large/h/centerbin0 -> 23632 bytes
-rw-r--r--test/bg/large/h/fillbin0 -> 84198 bytes
-rw-r--r--test/bg/large/h/inbin0 -> 229116 bytes
-rw-r--r--test/bg/large/h/maxbin0 -> 35271 bytes
-rw-r--r--test/bg/large/h/scalebin0 -> 94912 bytes
-rw-r--r--test/bg/large/h/tilebin0 -> 13552 bytes
-rw-r--r--test/bg/large/w/centerbin0 -> 29104 bytes
-rw-r--r--test/bg/large/w/fillbin0 -> 125501 bytes
-rw-r--r--test/bg/large/w/inbin0 -> 87657 bytes
-rw-r--r--test/bg/large/w/maxbin0 -> 17916 bytes
-rw-r--r--test/bg/large/w/scalebin0 -> 102207 bytes
-rw-r--r--test/bg/large/w/tilebin0 -> 19070 bytes
-rw-r--r--test/bg/small/h/centerbin0 -> 2243 bytes
-rw-r--r--test/bg/small/h/fillbin0 -> 77707 bytes
-rw-r--r--test/bg/small/h/inbin0 -> 2453 bytes
-rw-r--r--test/bg/small/h/maxbin0 -> 40925 bytes
-rw-r--r--test/bg/small/h/scalebin0 -> 69223 bytes
-rw-r--r--test/bg/small/h/tilebin0 -> 9703 bytes
-rw-r--r--test/bg/small/w/centerbin0 -> 1919 bytes
-rw-r--r--test/bg/small/w/fillbin0 -> 68182 bytes
-rw-r--r--test/bg/small/w/inbin0 -> 1229 bytes
-rw-r--r--test/bg/small/w/maxbin0 -> 35987 bytes
-rw-r--r--test/bg/small/w/scalebin0 -> 68174 bytes
-rw-r--r--test/bg/small/w/tilebin0 -> 12148 bytes
-rw-r--r--test/bg/transparencybin0 -> 4397 bytes
-rw-r--r--test/config/keys/feh/keys17
-rw-r--r--test/config/themes/feh/themes5
-rw-r--r--test/customlist4
-rw-r--r--test/fail/gif (renamed from test/fail.gif)0
-rw-r--r--test/fail/jpg (renamed from test/fail.jpg)0
-rw-r--r--test/fail/png (renamed from test/fail.png)0
-rw-r--r--test/fail/pnm (renamed from test/fail.pnm)0
-rwxr-xr-xtest/feh-bg-i.t82
-rwxr-xr-xtest/feh-i.t463
-rwxr-xr-xtest/feh-scr-i.t326
-rw-r--r--test/feh.t179
-rw-r--r--test/huge.pngbin0 -> 149669 bytes
-rw-r--r--test/imlib2-bug-notice11
-rw-r--r--test/list5
-rw-r--r--test/list/custom4
-rw-r--r--test/list/default5
l---------test/list/filename1
-rw-r--r--test/list/filename_recursive7
l---------test/list/format1
-rw-r--r--test/list/format_reverse5
l---------test/list/height1
l---------test/list/name1
l---------test/list/pixels1
-rw-r--r--test/list/size5
l---------test/list/width1
l---------test/list_filename1
l---------test/list_format1
-rw-r--r--test/list_format_reverse5
l---------test/list_height1
-rw-r--r--test/list_imlib2_1.6/custom4
-rw-r--r--test/list_imlib2_1.6/default5
l---------test/list_imlib2_1.6/filename1
-rw-r--r--test/list_imlib2_1.6/filename_recursive7
l---------test/list_imlib2_1.6/format1
-rw-r--r--test/list_imlib2_1.6/format_reverse5
l---------test/list_imlib2_1.6/height1
l---------test/list_imlib2_1.6/name1
l---------test/list_imlib2_1.6/pixels1
-rw-r--r--test/list_imlib2_1.6/size5
l---------test/list_imlib2_1.6/width1
l---------test/list_name1
l---------test/list_pixels1
-rw-r--r--test/list_size5
l---------test/list_width1
-rwxr-xr-xtest/mandoc.t22
-rw-r--r--test/no-loadable-files2
-rw-r--r--test/no-loadable-files.help2
-rw-r--r--test/nx_action/loadable_action8
-rw-r--r--test/nx_action/loadable_naction8
-rw-r--r--test/nx_action/unloadable_action8
-rw-r--r--test/nx_action/unloadable_naction8
-rw-r--r--test/ok/gif (renamed from test/ok.gif)bin953 -> 953 bytes
-rw-r--r--test/ok/jpg (renamed from test/ok.jpg)bin354 -> 354 bytes
-rw-r--r--test/ok/jpg_exifbin0 -> 9821 bytes
-rw-r--r--test/ok/png (renamed from test/ok.png)bin403 -> 403 bytes
-rw-r--r--test/ok/pnm (renamed from test/ok.pnm)bin269 -> 269 bytes
-rw-r--r--test/ok/recursive/pngbin0 -> 403 bytes
-rwxr-xr-xtest/run-interactive15
-rw-r--r--test/scr/caption_donebin0 -> 6830 bytes
-rw-r--r--test/scr/caption_newbin0 -> 13437 bytes
-rw-r--r--test/scr/caption_nonebin0 -> 4532 bytes
-rw-r--r--test/scr/caption_whilebin0 -> 14923 bytes
-rw-r--r--test/scr/draw_actionbin0 -> 5869 bytes
-rw-r--r--test/scr/draw_action_tintedbin0 -> 6211 bytes
-rw-r--r--test/scr/draw_all_multibin0 -> 7658 bytes
-rw-r--r--test/scr/draw_all_onebin0 -> 7422 bytes
-rw-r--r--test/scr/draw_filenamebin0 -> 5552 bytes
-rw-r--r--test/scr/draw_filename_actionbin0 -> 6462 bytes
-rw-r--r--test/scr/draw_filename_action_tintedbin0 -> 6953 bytes
-rw-r--r--test/scr/draw_filename_tintedbin0 -> 5777 bytes
-rw-r--r--test/scr/draw_infobin0 -> 5874 bytes
-rw-r--r--test/scr/draw_info_tintedbin0 -> 6152 bytes
-rw-r--r--test/scr/draw_nothingbin0 -> 4532 bytes
-rw-r--r--test/scr/feh_full_lwibin0 -> 11374 bytes
-rw-r--r--test/scr/feh_ibg_blackbin0 -> 3346 bytes
-rw-r--r--test/scr/feh_ibg_defaultbin0 -> 10808 bytes
-rw-r--r--test/scr/feh_ibg_whitebin0 -> 3883 bytes
-rw-r--r--test/scr/feh_lhibin0 -> 10743 bytes
-rw-r--r--test/scr/feh_lhi_ibin0 -> 24321 bytes
-rw-r--r--test/scr/feh_lhi_iibin0 -> 49181 bytes
-rw-r--r--test/scr/feh_lhi_iirbin0 -> 12745 bytes
-rw-r--r--test/scr/feh_lhi_iirrbin0 -> 12748 bytes
-rw-r--r--test/scr/feh_lhi_iirribin0 -> 42802 bytes
-rw-r--r--test/scr/feh_lhi_iirriobin0 -> 49288 bytes
-rw-r--r--test/scr/feh_lhi_obin0 -> 14900 bytes
-rw-r--r--test/scr/feh_lhi_oobin0 -> 22116 bytes
-rw-r--r--test/scr/feh_lhi_ooobin0 -> 97221 bytes
-rw-r--r--test/scr/feh_lwibin0 -> 15333 bytes
-rw-r--r--test/scr/feh_lwi_scroll_rbin0 -> 15268 bytes
-rw-r--r--test/scr/feh_lwi_scroll_rdbin0 -> 15287 bytes
-rw-r--r--test/scr/feh_lwi_scroll_rdrbin0 -> 15383 bytes
-rw-r--r--test/scr/feh_lwi_scroll_rdrubin0 -> 15330 bytes
-rw-r--r--test/scr/feh_lwi_scroll_rdrulbin0 -> 15268 bytes
-rw-r--r--test/scr/feh_scaledown_lwibin0 -> 12407 bytes
-rw-r--r--test/scr/geometry_offset_onlybin0 -> 628 bytes
-rw-r--r--test/scr/index_full_h400bin0 -> 3357 bytes
-rw-r--r--test/scr/index_full_w400bin0 -> 2252 bytes
-rw-r--r--test/scr/index_h400bin0 -> 1794 bytes
-rw-r--r--test/scr/index_w400bin0 -> 1199 bytes
-rw-r--r--test/scr/thumbnail_defaultbin0 -> 1199 bytes
-rw-r--r--test/status401
-rw-r--r--test/tiny.pbm4
-rw-r--r--test/warning-no-loader8
142 files changed, 1582 insertions, 78 deletions
diff --git a/test/bg/exact/h/center b/test/bg/exact/h/center
new file mode 100644
index 0000000..99555af
--- /dev/null
+++ b/test/bg/exact/h/center
Binary files differ
diff --git a/test/bg/exact/h/fill b/test/bg/exact/h/fill
new file mode 100644
index 0000000..6906f52
--- /dev/null
+++ b/test/bg/exact/h/fill
Binary files differ
diff --git a/test/bg/exact/h/in b/test/bg/exact/h/in
new file mode 100644
index 0000000..3b64670
--- /dev/null
+++ b/test/bg/exact/h/in
Binary files differ
diff --git a/test/bg/exact/h/max b/test/bg/exact/h/max
new file mode 120000
index 0000000..0a90d85
--- /dev/null
+++ b/test/bg/exact/h/max
@@ -0,0 +1 @@
+center \ No newline at end of file
diff --git a/test/bg/exact/h/scale b/test/bg/exact/h/scale
new file mode 100644
index 0000000..fd884f6
--- /dev/null
+++ b/test/bg/exact/h/scale
Binary files differ
diff --git a/test/bg/exact/h/tile b/test/bg/exact/h/tile
new file mode 100644
index 0000000..1fcc1dd
--- /dev/null
+++ b/test/bg/exact/h/tile
Binary files differ
diff --git a/test/bg/exact/in b/test/bg/exact/in
new file mode 100644
index 0000000..0c1f09f
--- /dev/null
+++ b/test/bg/exact/in
Binary files differ
diff --git a/test/bg/exact/out b/test/bg/exact/out
new file mode 100644
index 0000000..5903c34
--- /dev/null
+++ b/test/bg/exact/out
Binary files differ
diff --git a/test/bg/exact/w/center b/test/bg/exact/w/center
new file mode 100644
index 0000000..7db9571
--- /dev/null
+++ b/test/bg/exact/w/center
Binary files differ
diff --git a/test/bg/exact/w/fill b/test/bg/exact/w/fill
new file mode 100644
index 0000000..5e5f26c
--- /dev/null
+++ b/test/bg/exact/w/fill
Binary files differ
diff --git a/test/bg/exact/w/in b/test/bg/exact/w/in
new file mode 100644
index 0000000..8fad57c
--- /dev/null
+++ b/test/bg/exact/w/in
Binary files differ
diff --git a/test/bg/exact/w/max b/test/bg/exact/w/max
new file mode 120000
index 0000000..0a90d85
--- /dev/null
+++ b/test/bg/exact/w/max
@@ -0,0 +1 @@
+center \ No newline at end of file
diff --git a/test/bg/exact/w/scale b/test/bg/exact/w/scale
new file mode 100644
index 0000000..fee0647
--- /dev/null
+++ b/test/bg/exact/w/scale
Binary files differ
diff --git a/test/bg/exact/w/tile b/test/bg/exact/w/tile
new file mode 100644
index 0000000..5c8e1a4
--- /dev/null
+++ b/test/bg/exact/w/tile
Binary files differ
diff --git a/test/bg/large/h/center b/test/bg/large/h/center
new file mode 100644
index 0000000..711704f
--- /dev/null
+++ b/test/bg/large/h/center
Binary files differ
diff --git a/test/bg/large/h/fill b/test/bg/large/h/fill
new file mode 100644
index 0000000..8503fc8
--- /dev/null
+++ b/test/bg/large/h/fill
Binary files differ
diff --git a/test/bg/large/h/in b/test/bg/large/h/in
new file mode 100644
index 0000000..8167288
--- /dev/null
+++ b/test/bg/large/h/in
Binary files differ
diff --git a/test/bg/large/h/max b/test/bg/large/h/max
new file mode 100644
index 0000000..bbad392
--- /dev/null
+++ b/test/bg/large/h/max
Binary files differ
diff --git a/test/bg/large/h/scale b/test/bg/large/h/scale
new file mode 100644
index 0000000..5e88336
--- /dev/null
+++ b/test/bg/large/h/scale
Binary files differ
diff --git a/test/bg/large/h/tile b/test/bg/large/h/tile
new file mode 100644
index 0000000..f16d150
--- /dev/null
+++ b/test/bg/large/h/tile
Binary files differ
diff --git a/test/bg/large/w/center b/test/bg/large/w/center
new file mode 100644
index 0000000..1f425ea
--- /dev/null
+++ b/test/bg/large/w/center
Binary files differ
diff --git a/test/bg/large/w/fill b/test/bg/large/w/fill
new file mode 100644
index 0000000..61b5448
--- /dev/null
+++ b/test/bg/large/w/fill
Binary files differ
diff --git a/test/bg/large/w/in b/test/bg/large/w/in
new file mode 100644
index 0000000..dc1f30b
--- /dev/null
+++ b/test/bg/large/w/in
Binary files differ
diff --git a/test/bg/large/w/max b/test/bg/large/w/max
new file mode 100644
index 0000000..6b3b450
--- /dev/null
+++ b/test/bg/large/w/max
Binary files differ
diff --git a/test/bg/large/w/scale b/test/bg/large/w/scale
new file mode 100644
index 0000000..20cfab3
--- /dev/null
+++ b/test/bg/large/w/scale
Binary files differ
diff --git a/test/bg/large/w/tile b/test/bg/large/w/tile
new file mode 100644
index 0000000..16855f7
--- /dev/null
+++ b/test/bg/large/w/tile
Binary files differ
diff --git a/test/bg/small/h/center b/test/bg/small/h/center
new file mode 100644
index 0000000..3071ee6
--- /dev/null
+++ b/test/bg/small/h/center
Binary files differ
diff --git a/test/bg/small/h/fill b/test/bg/small/h/fill
new file mode 100644
index 0000000..76b2702
--- /dev/null
+++ b/test/bg/small/h/fill
Binary files differ
diff --git a/test/bg/small/h/in b/test/bg/small/h/in
new file mode 100644
index 0000000..74f9b29
--- /dev/null
+++ b/test/bg/small/h/in
Binary files differ
diff --git a/test/bg/small/h/max b/test/bg/small/h/max
new file mode 100644
index 0000000..9caa5d3
--- /dev/null
+++ b/test/bg/small/h/max
Binary files differ
diff --git a/test/bg/small/h/scale b/test/bg/small/h/scale
new file mode 100644
index 0000000..d51d64a
--- /dev/null
+++ b/test/bg/small/h/scale
Binary files differ
diff --git a/test/bg/small/h/tile b/test/bg/small/h/tile
new file mode 100644
index 0000000..5f66296
--- /dev/null
+++ b/test/bg/small/h/tile
Binary files differ
diff --git a/test/bg/small/w/center b/test/bg/small/w/center
new file mode 100644
index 0000000..d5635c3
--- /dev/null
+++ b/test/bg/small/w/center
Binary files differ
diff --git a/test/bg/small/w/fill b/test/bg/small/w/fill
new file mode 100644
index 0000000..812bb18
--- /dev/null
+++ b/test/bg/small/w/fill
Binary files differ
diff --git a/test/bg/small/w/in b/test/bg/small/w/in
new file mode 100644
index 0000000..d281c6b
--- /dev/null
+++ b/test/bg/small/w/in
Binary files differ
diff --git a/test/bg/small/w/max b/test/bg/small/w/max
new file mode 100644
index 0000000..d38f45e
--- /dev/null
+++ b/test/bg/small/w/max
Binary files differ
diff --git a/test/bg/small/w/scale b/test/bg/small/w/scale
new file mode 100644
index 0000000..2688754
--- /dev/null
+++ b/test/bg/small/w/scale
Binary files differ
diff --git a/test/bg/small/w/tile b/test/bg/small/w/tile
new file mode 100644
index 0000000..b4bf86f
--- /dev/null
+++ b/test/bg/small/w/tile
Binary files differ
diff --git a/test/bg/transparency b/test/bg/transparency
new file mode 100644
index 0000000..1d4a171
--- /dev/null
+++ b/test/bg/transparency
Binary files differ
diff --git a/test/config/keys/feh/keys b/test/config/keys/feh/keys
new file mode 100644
index 0000000..7114ecc
--- /dev/null
+++ b/test/config/keys/feh/keys
@@ -0,0 +1,17 @@
+action_1 x
+action_2 X
+action_3 C-x
+action_4 C-X
+action_5 1-x
+action_6
+action_7
+
+next_img a b c
+prev_img d e f
+
+# conflict with next_img/prev_img
+toggle_actions
+toggle_caption
+toggle_filenames
+save_filelist
+close
diff --git a/test/config/themes/feh/themes b/test/config/themes/feh/themes
new file mode 100644
index 0000000..d4b7f69
--- /dev/null
+++ b/test/config/themes/feh/themes
@@ -0,0 +1,5 @@
+test_general --action1 "touch a1"
+
+test_multiline --action1 "touch a1" \
+--action2 "touch a2" \
+ --action3 "touch a3"
diff --git a/test/customlist b/test/customlist
deleted file mode 100644
index 3595be4..0000000
--- a/test/customlist
+++ /dev/null
@@ -1,4 +0,0 @@
-test/ok.gif; 16; 4; list; ok.gif; 256; 953; gif; 0; 16
-test/ok.jpg; 16; 4; list; ok.jpg; 256; 354; jpeg; 0; 16
-test/ok.png; 16; 4; list; ok.png; 256; 403; png; 0; 16
-test/ok.pnm; 16; 4; list; ok.pnm; 256; 269; pnm; 0; 16
diff --git a/test/fail.gif b/test/fail/gif
index e69de29..e69de29 100644
--- a/test/fail.gif
+++ b/test/fail/gif
diff --git a/test/fail.jpg b/test/fail/jpg
index e69de29..e69de29 100644
--- a/test/fail.jpg
+++ b/test/fail/jpg
diff --git a/test/fail.png b/test/fail/png
index e69de29..e69de29 100644
--- a/test/fail.png
+++ b/test/fail/png
diff --git a/test/fail.pnm b/test/fail/pnm
index e69de29..e69de29 100644
--- a/test/fail.pnm
+++ b/test/fail/pnm
diff --git a/test/feh-bg-i.t b/test/feh-bg-i.t
new file mode 100755
index 0000000..1f22c9d
--- /dev/null
+++ b/test/feh-bg-i.t
@@ -0,0 +1,82 @@
+#!/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 $scr_dir = '/tmp/feh-test-scr';
+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 ${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' );
+ 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("${scr_dir}/feh_${$}.png");
+unlink('test/.fehbg');
diff --git a/test/feh-i.t b/test/feh-i.t
new file mode 100755
index 0000000..24775e3
--- /dev/null
+++ b/test/feh-i.t
@@ -0,0 +1,463 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use 5.010;
+
+no if $] >= 5.018, warnings => 'experimental::smartmatch';
+
+use Cwd;
+use Test::More tests => 103;
+use Time::HiRes qw/sleep/;
+use X11::GUITest qw/:ALL/;
+
+my $win;
+my ( $width, $height );
+my $pwd = getcwd();
+
+$ENV{HOME} = 'test';
+
+sub waitfor(&) {
+ my ($sub) = @_;
+ my $out;
+ for ( 1 .. 40 ) {
+ sleep(0.05);
+ $out = &{$sub};
+ if ($out) {
+ return $out;
+ }
+ }
+ return 0;
+}
+
+sub feh_start {
+ my ( $opts, $files ) = @_;
+ my $id;
+
+ $opts //= q{};
+ $files //= 'test/ok/png';
+
+ StartApp("feh ${opts} ${files}");
+ ($id) = WaitWindowViewable(qr{^feh});
+
+ if ( not $id ) {
+ BAIL_OUT("Unable to start feh ${opts} ${files}");
+ }
+
+ if ( not SetInputFocus($id) ) {
+ BAIL_OUT("Unable to focus window");
+ }
+
+ return $id;
+}
+
+sub feh_stop {
+ SendKeys('{ESC}');
+ if ( not waitfor { not FindWindowLike(qr{^feh}) } ) {
+ BAIL_OUT("Unclosed feh window still open, cannot continue");
+ }
+}
+
+sub test_no_win {
+ my ($reason) = @_;
+
+ if ( waitfor { not FindWindowLike(qr{^feh}) } ) {
+ pass("Window closed ($reason)");
+ }
+ else {
+ fail("Window closed ($reason)");
+ BAIL_OUT("unclosed window still open, cannot continue");
+ }
+}
+
+sub test_win_title {
+ my ( $win, $wtitle ) = @_;
+ my $rtitle;
+
+ if ( waitfor { GetWindowName($win) eq $wtitle } ) {
+ pass("Window has title: $wtitle");
+ }
+ else {
+ $rtitle = GetWindowName($win);
+ fail("Window has title: $wtitle");
+ diag("expected: $wtitle");
+ diag(" got: $rtitle");
+ }
+}
+
+sub slurp {
+ my ($file) = @_;
+ my $ret;
+ local $/ = undef;
+ open( my $fh, '<', $file ) or die("Can't open $file: $!");
+ $ret = <$fh>;
+ close($fh) or die("Can't close $file: $!");
+ return ($ret);
+}
+
+if ( FindWindowLike(qr{^feh}) ) {
+ BAIL_OUT('It appears you have an open feh window. Please close it.');
+}
+
+for my $key (qw/q x {ESC}/) {
+ feh_start();
+ SendKeys($key);
+ test_no_win("$key pressed");
+}
+
+$win = feh_start( q{}, 'test/ok/png' );
+test_win_title( $win, 'feh [1 of 1] - test/ok/png' );
+feh_stop();
+
+$win = feh_start( q{}, 'test/ok/png test/ok/jpg test/ok/gif' );
+test_win_title( $win, 'feh [1 of 3] - test/ok/png' );
+SendKeys('{RIG}');
+test_win_title( $win, 'feh [2 of 3] - test/ok/jpg' );
+SendKeys('n');
+test_win_title( $win, 'feh [3 of 3] - test/ok/gif' );
+SendKeys('{SPA}');
+test_win_title( $win, 'feh [1 of 3] - test/ok/png' );
+SendKeys('{LEF}');
+test_win_title( $win, 'feh [3 of 3] - test/ok/gif' );
+SendKeys('p');
+test_win_title( $win, 'feh [2 of 3] - test/ok/jpg' );
+SendKeys('{BAC}');
+test_win_title( $win, 'feh [1 of 3] - test/ok/png' );
+SendKeys('p');
+test_win_title( $win, 'feh [3 of 3] - test/ok/gif' );
+SendKeys('{DEL}');
+test_win_title( $win, 'feh [2 of 2] - test/ok/jpg' );
+SendKeys('{DEL}');
+test_win_title( $win, 'feh [1 of 1] - test/ok/png' );
+SendKeys('{DEL}');
+test_no_win("Removed all images from slideshow");
+
+$win = feh_start( '--title \'feh %m %u/%l %n\'',
+ 'test/ok/png test/ok/jpg test/ok/gif' );
+test_win_title( $win, 'feh slideshow 1/3 png' );
+SendKeys('{RIG}');
+test_win_title( $win, 'feh slideshow 2/3 jpg' );
+feh_stop();
+
+feh_start( '--on-last-slide=quit', 'test/ok/png test/ok/jpg' );
+for ( 1 .. 2 ) {
+ SendKeys('{RIG}');
+}
+test_no_win("--on-last-slide=quit -> window closed");
+
+feh_start(
+ '--on-last-slide=quit --slideshow-delay 0.5',
+ 'test/ok/png test/ok/jpg test/ok/gif'
+);
+sleep(1.5);
+test_no_win('on-last-slide=quit + slideshow-delay -> window closed');
+
+$win = feh_start(
+ '--on-last-slide=quit --slideshow-delay -0.01',
+ 'test/ok/png test/ok/jpg test/ok/gif'
+);
+
+test_win_title( $win, 'feh [1 of 3] - test/ok/png [Paused]' );
+
+SendKeys('h');
+test_no_win('on-last-slide=quit + negative delay + [h]');
+
+$win = feh_start( q{}, 'test/ok/png test/ok/gif test/ok/gif test/ok/jpg' );
+for ( 1 .. 2 ) {
+ SendKeys('{END}');
+ test_win_title( $win, 'feh [4 of 4] - test/ok/jpg' );
+}
+for ( 1 .. 2 ) {
+ SendKeys('{HOM}');
+ test_win_title( $win, 'feh [1 of 4] - test/ok/png' );
+}
+
+SendKeys('{PGU}');
+test_win_title( $win, 'feh [4 of 4] - test/ok/jpg' );
+SendKeys('{PGD}');
+test_win_title( $win, 'feh [1 of 4] - test/ok/png' );
+SendKeys('{PGD}');
+test_win_title( $win, 'feh [2 of 4] - test/ok/gif' );
+
+feh_stop();
+
+$win
+ = feh_start( '--slideshow-delay 1', 'test/ok/png test/ok/gif test/ok/jpg' );
+sleep(1.7);
+test_win_title( $win, 'feh [3 of 3] - test/ok/jpg' );
+SendKeys('h');
+test_win_title( $win, 'feh [3 of 3] - test/ok/jpg [Paused]' );
+SendKeys('{RIG}');
+test_win_title( $win, 'feh [1 of 3] - test/ok/png [Paused]' );
+SendKeys('h');
+test_win_title( $win, 'feh [1 of 3] - test/ok/png' );
+sleep(0.8);
+test_win_title( $win, 'feh [2 of 3] - test/ok/gif' );
+feh_stop();
+
+$win = feh_start(
+ '--action3 ";echo foo" --action7 "echo foo" '
+ . '--action8 ";touch feh_test_%u_%l" --action9 "rm feh_test_%u_%l"',
+ 'test/ok/png test/ok/gif test/ok/jpg'
+);
+test_win_title( $win, 'feh [1 of 3] - test/ok/png' );
+SendKeys('3');
+test_win_title( $win, 'feh [1 of 3] - test/ok/png' );
+SendKeys('7');
+test_win_title( $win, 'feh [2 of 3] - test/ok/gif' );
+SendKeys('8');
+test_win_title( $win, 'feh [2 of 3] - test/ok/gif' );
+ok( -e 'feh_test_2_3',
+ 'feh action created file with correct format specifiers' );
+SendKeys('9');
+ok( waitfor { not -e 'feh_test_2_3' }, 'feh action removed file' );
+test_win_title( $win, 'feh [3 of 3] - test/ok/jpg' );
+feh_stop();
+
+# .config/feh/keys
+# Action Unbinding + non-conflicting none/shift/control/meta modifiers
+
+$ENV{XDG_CONFIG_HOME} = 'test/config/keys';
+
+$win = feh_start(
+ '--action1 "touch a1" --action2 "touch a2" '
+ . '--action3 "touch a3" --action4 "touch a4" '
+ . '--action5 "touch a5" --action6 "touch a6" ',
+ 'test/ok/png test/ok/jpg test/ok/pnm'
+);
+test_win_title( $win, 'feh [1 of 3] - test/ok/png' );
+SendKeys('6');
+test_win_title( $win, 'feh [1 of 3] - test/ok/png' );
+SendKeys('{RIG}');
+test_win_title( $win, 'feh [1 of 3] - test/ok/png' );
+SendKeys('a');
+test_win_title( $win, 'feh [2 of 3] - test/ok/jpg' );
+SendKeys('b');
+test_win_title( $win, 'feh [3 of 3] - test/ok/pnm' );
+SendKeys('c');
+test_win_title( $win, 'feh [1 of 3] - test/ok/png' );
+SendKeys('d');
+test_win_title( $win, 'feh [3 of 3] - test/ok/pnm' );
+SendKeys('e');
+test_win_title( $win, 'feh [2 of 3] - test/ok/jpg' );
+SendKeys('f');
+test_win_title( $win, 'feh [1 of 3] - test/ok/png' );
+SendKeys('1');
+test_win_title( $win, 'feh [1 of 3] - test/ok/png' );
+SendKeys('x');
+ok( waitfor { -e 'a1' }, 'action 1 = X ok' );
+SendKeys('X');
+ok( waitfor { -e 'a2' }, 'action 2 = Shift+X ok' );
+SendKeys('^(x)');
+ok( waitfor { -e 'a3' }, 'action 3 = Ctrl+X ok' );
+SendKeys('^(X)');
+ok( waitfor { -e 'a4' }, 'action 4 = Ctrl+Shift+X ok' );
+SendKeys('%(x)');
+ok( waitfor { -e 'a5' }, 'action 5 = Alt+X ok' );
+
+for my $f (qw(a1 a2 a3 a4 a5)) {
+ unlink($f);
+}
+feh_stop();
+
+$ENV{XDG_CONFIG_HOME} = 'test/config/themes';
+
+$win = feh_start( '-Ttest_general', 'test/ok/png test/ok/jpg' );
+SendKeys('1');
+ok( waitfor { -e 'a1' }, 'theme: action 1 okay' );
+unlink('a1');
+feh_stop();
+
+$win = feh_start( '-Ttest_general --action1 "touch c1"',
+ 'test/ok/png test/ok/jpg' );
+SendKeys('1');
+ok( waitfor { -e 'c1' }, 'theme: commandline overrides theme' );
+unlink('c1');
+feh_stop();
+
+$win = feh_start( '-Ttest_multiline', 'test/ok/png test/ok/jpg' );
+SendKeys('1');
+ok( waitfor { -e 'a1' }, 'multiline theme: first line ok' );
+SendKeys('2');
+ok( waitfor { -e 'a2' }, 'multiline theme: second line ok' );
+SendKeys('3');
+ok( waitfor { -e 'a3' }, 'multiline theme: last line ok' );
+for my $f (qw(a1 a2 a3)) {
+ unlink($f);
+}
+feh_stop();
+
+delete $ENV{XDG_CONFIG_HOME};
+
+$win = feh_start( q{}, 'test/ok/png ' x 100 );
+test_win_title( $win, 'feh [1 of 100] - test/ok/png' );
+SendKeys('{PGD}');
+test_win_title( $win, 'feh [6 of 100] - test/ok/png' );
+SendKeys('{PGD}');
+test_win_title( $win, 'feh [11 of 100] - test/ok/png' );
+SendKeys('{HOM PGU}');
+test_win_title( $win, 'feh [96 of 100] - test/ok/png' );
+feh_stop();
+
+$win = feh_start( '--thumbnails -H 300 -W 310 --thumb-title "feh [%l] %f"',
+ 'test/ok/png test/ok/gif test/ok/jpg' );
+test_win_title( $win, 'feh [thumbnail mode]' );
+( $width, $height ) = ( GetWindowPos($win) )[ 2, 3 ];
+is( $width, 310, 'thumbnail win: Set correct width' );
+is( $height, 300, 'thumbnail win: Set correct height' );
+MoveMouseAbs( 30, 30 );
+ClickMouseButton(M_BTN1);
+($win) = WaitWindowViewable(qr{test/ok/png$});
+ok( $win, 'Thumbnail mode: Window opened' );
+test_win_title( $win, 'feh [3] test/ok/png' );
+SetInputFocus($win);
+SendKeys('x');
+ok( waitfor { not FindWindowLike(qr{^ok/png$}) }, 'Thumbnail mode: closed' );
+
+MoveMouseAbs( 90, 30 );
+ClickMouseButton(M_BTN1);
+($win) = WaitWindowViewable(qr{test/ok/gif$});
+ok( $win, 'Thumbnail mode: Window opened' );
+test_win_title( $win, 'feh [3] test/ok/gif' );
+
+MoveMouseAbs( 150, 30 );
+ClickMouseButton(M_BTN1);
+($win) = WaitWindowViewable(qr{test/ok/jpg$});
+ok( $win, 'Thumbnail mode: Other window opened' );
+test_win_title( $win, 'feh [3] test/ok/jpg' );
+
+feh_stop();
+
+feh_start( '--multiwindow', 'test/ok/png test/ok/gif test/ok/jpg' );
+ok( waitfor { FindWindowLike(qr{^feh - test/ok/png$}) }, 'multiwindow 1/3' );
+ok( waitfor { FindWindowLike(qr{^feh - test/ok/gif$}) }, 'multiwindow 2/3' );
+ok( waitfor { FindWindowLike(qr{^feh - test/ok/jpg$}) }, 'multiwindow 3/3' );
+
+($win) = FindWindowLike(qr{^feh - test/ok/gif$});
+SetInputFocus($win);
+SendKeys('x');
+ok( waitfor { not FindWindowLike(qr{^feh - test/ok/gif$}) }, 'win 1 closed' );
+ok( FindWindowLike(qr{^feh - test/ok/png$}), 'multiwindow 1/2' );
+ok( FindWindowLike(qr{^feh - test/ok/jpg$}), 'multiwindow 2/2' );
+
+($win) = FindWindowLike(qr{^feh - test/ok/jpg$});
+SetInputFocus($win);
+SendKeys('x');
+ok( waitfor { not FindWindowLike(qr{^feh - test/ok/jpg$}) }, 'win 2 closed' );
+
+($win) = FindWindowLike(qr{^feh - test/ok/png$});
+SetInputFocus($win);
+SendKeys('x');
+test_no_win('all multiwindows closed');
+
+$win = feh_start( '--start-at test/ok/jpg',
+ 'test/ok/png test/ok/gif test/ok/jpg' );
+test_win_title( $win, 'feh [3 of 3] - test/ok/jpg' );
+SendKeys('{RIG}');
+test_win_title( $win, 'feh [1 of 3] - test/ok/png' );
+feh_stop();
+
+feh_start( '--caption-path .captions', 'test/ok/png' );
+SendKeys('cFoo Bar Quux Moep~');
+feh_stop();
+ok( -d 'test/ok/.captions', 'autocreated captions directory' );
+is(
+ slurp('test/ok/.captions/png.txt'),
+ 'Foo Bar Quux Moep',
+ 'Correct caption saved'
+);
+
+feh_start( '--caption-path .captions', 'test/ok/png' );
+SendKeys('c');
+SendKeys( '{BKS}' x length('Foo Bar Quux Moep') );
+SendKeys('Foo Bar^(~)miep~');
+feh_stop();
+is(
+ slurp('test/ok/.captions/png.txt'),
+ "Foo Bar\nmiep",
+ 'Caption with newline + correct backspace'
+);
+
+unlink('test/ok/.captions/png.txt');
+rmdir('test/ok/.captions');
+
+$win = feh_start( '--filelist test/filelist',
+ 'test/ok/png test/ok/gif test/ok/png test/ok/jpg' );
+SendKeys('{DEL}');
+test_win_title( $win, "feh [1 of 3] - ${pwd}/test/ok/gif" );
+feh_stop();
+
+is( slurp('test/filelist'), <<"EOF", 'Filelist saved' );
+${pwd}/test/ok/gif
+${pwd}/test/ok/png
+${pwd}/test/ok/jpg
+EOF
+
+$win = feh_start( '--filelist test/filelist', q{} );
+test_win_title( $win, "feh [1 of 3] - ${pwd}/test/ok/gif" );
+feh_stop();
+unlink('test/filelist');
+
+$win = feh_start('--geometry 423x232');
+( undef, undef, $width, $height ) = GetWindowPos($win);
+is( $width, 423, '--geometry: correct width' );
+is( $height, 232, '--geometry: correct height' );
+feh_stop();
+
+$win = feh_start('--fullscreen');
+( undef, undef, $width, $height ) = GetWindowPos($win);
+ok( [ ( GetWindowPos($win) )[ 2, 3 ] ] ~~ [ GetScreenRes() ],
+ 'fullscreen uses full screen size' );
+feh_stop();
+
+$win = feh_start( q{}, 'test/ok/png ' . 'test/fail/png ' x 7 . 'test/ok/gif' );
+test_win_title( $win, 'feh [1 of 9] - test/ok/png' );
+SendKeys('{RIG}');
+test_win_title( $win, 'feh [2 of 2] - test/ok/gif' );
+SendKeys('{LEF}');
+test_win_title( $win, 'feh [1 of 2] - test/ok/png' );
+SendKeys('{LEF}');
+test_win_title( $win, 'feh [2 of 2] - test/ok/gif' );
+feh_stop();
+
+$win = feh_start();
+( undef, undef, $width, $height ) = GetWindowPos($win);
+is( $width, 16, 'correct default window width' );
+is( $height, 16, 'correct default window height' );
+
+ResizeWindow( $win, 25, 30 );
+( undef, undef, $width, $height ) = GetWindowPos($win);
+
+SKIP: {
+ if ( not( [ $width, $height ] ~~ [ 25, 30 ] ) ) {
+ skip( 'ResizeWindow failed', 2 );
+ }
+ PressKey('w');
+ ok( waitfor { [ ( GetWindowPos($win) )[ 2, 3 ] ] ~~ [ 16, 16 ] },
+ 'w key resizes correctly' );
+}
+feh_stop();
+
+$win = feh_start( q{}, 'test/huge.png' );
+ok(
+ waitfor {
+ ( GetWindowPos($win) )[2] == ( GetScreenRes() )[0]
+ || ( GetWindowPos($win) )[3] == ( GetScreenRes() )[1];
+ },
+ 'Large window limited to screen size'
+);
+feh_stop();
+
+$win = feh_start( '--no-screen-clip', 'test/huge.png' );
+ok(
+ waitfor {
+ [ ( GetWindowPos($win) )[ 2, 3 ] ] ~~ [ 4000, 3000 ];
+ },
+ 'disabled screen clip'
+);
+feh_stop();
+
+# GH-35 "Custom window title crashes feh on unloadable files"
+$win = feh_start( '--title "feh %h"', 'test/ok/png test/fail/png test/ok/jpg' );
+SendKeys('{RIG}');
+test_win_title( $win, 'feh 16' );
+feh_stop();
diff --git a/test/feh-scr-i.t b/test/feh-scr-i.t
new file mode 100755
index 0000000..36cb494
--- /dev/null
+++ b/test/feh-scr-i.t
@@ -0,0 +1,326 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use 5.010;
+use autodie qw/:all/;
+
+use Cwd;
+use GD qw/:DEFAULT :cmp/;
+use Test::More tests => 54;
+use Time::HiRes qw/sleep/;
+use X11::GUITest qw/:ALL/;
+
+my ( $pid_xnest, $pid_twm );
+my $win;
+my ( $width, $height );
+my $pwd = getcwd();
+my $test_id = 0;
+my $scr_dir = '/tmp/feh-test-scr';
+
+$ENV{HOME} = 'test';
+
+sub waitfor(&) {
+ my ($sub) = @_;
+ my $out;
+ for ( 1 .. 10 ) {
+ sleep(0.05);
+ $out = &{$sub};
+ if ($out) {
+ return $out;
+ }
+ }
+ return 0;
+}
+
+sub feh_start {
+ my ( $opts, $files ) = @_;
+ my $id;
+
+ $opts //= q{};
+ $files //= 'test/ok/png';
+
+ StartApp("feh ${opts} ${files}");
+ ($id) = WaitWindowViewable(qr{^feh});
+
+ if ( not $id ) {
+ BAIL_OUT("Unable to start feh ${opts} ${files}");
+ }
+
+ if ( not SetInputFocus($id) ) {
+ BAIL_OUT("Unable to focus window");
+ }
+
+ return $id;
+}
+
+sub feh_stop {
+ SendKeys('{ESC}');
+ if ( not waitfor { not FindWindowLike(qr{^feh}) } ) {
+ BAIL_OUT("Unclosed feh window still open, cannot continue");
+ }
+}
+
+sub same_files {
+ my ( $one, $two ) = @_;
+
+ my $img_one = GD::Image->new($one);
+ my $img_two = GD::Image->new($two);
+
+ if ( not defined $img_one or not defined $img_two ) {
+ return 0;
+ }
+
+ return ( !( $img_one->compare($img_two) & GD_CMP_IMAGE ) );
+}
+
+sub check_scr {
+ my ($file) = @_;
+
+ system("import -silent -window root ${scr_dir}/feh_${$}.png");
+
+ return same_files( "test/scr/${file}", "${scr_dir}/feh_${$}.png" );
+}
+
+sub test_scr {
+ my ($file) = @_;
+ my $msg = "X root window is test/scr/${file}";
+
+ $test_id++;
+
+ if ( waitfor { check_scr($file) } ) {
+ pass($msg);
+ }
+ else {
+ fail($msg);
+ rename( "${scr_dir}/feh_${$}.png",
+ "${scr_dir}/feh_${$}_${test_id}_${file}.png" );
+ }
+}
+
+if ( FindWindowLike(qr{^feh}) ) {
+ BAIL_OUT('It appears you have an open feh window. Please close it.');
+}
+
+if ( not -d $scr_dir ) {
+ mkdir($scr_dir);
+}
+
+feh_start(
+ "--draw-actions --draw-filename --info 'echo foo; echo bar' "
+ . '--action quux --action5 baz --action8 "nrm \'%f\'"',
+ 'test/bg/exact/in test/bg/large/w/in test/bg/large/h/in'
+);
+test_scr('draw_all_multi');
+feh_stop();
+
+feh_start(
+ "--draw-actions --draw-filename --info 'echo foo; echo bar' "
+ . '--action quux --action5 baz --action8 "nrm \'%f\'"',
+ 'test/bg/exact/in'
+);
+test_scr('draw_all_one');
+feh_stop();
+
+feh_start( '--fullscreen', 'test/bg/large/w/in' );
+test_scr('feh_full_lwi');
+feh_stop();
+
+feh_start( q{}, 'test/bg/large/w/in' );
+test_scr('feh_lwi');
+
+SendKeys('^({RIG})');
+test_scr('feh_lwi_scroll_r');
+
+SendKeys('^({DOWN})');
+test_scr('feh_lwi_scroll_rd');
+
+SendKeys('^({RIG})');
+test_scr('feh_lwi_scroll_rdr');
+
+SendKeys('^({UP})');
+test_scr('feh_lwi_scroll_rdru');
+
+SendKeys('^({LEF})');
+test_scr('feh_lwi_scroll_rdrul');
+
+feh_stop();
+
+feh_start( '--scale-down', 'test/bg/large/w/in' );
+test_scr('feh_scaledown_lwi');
+feh_stop();
+
+feh_start( '--thumbnails', 'test/ok/gif test/ok/jpg test/ok/png test/ok/pnm' );
+test_scr('thumbnail_default');
+feh_stop();
+
+feh_start( '--index --limit-width 400',
+ 'test/ok/gif test/ok/jpg test/ok/png test/ok/pnm' );
+test_scr('index_w400');
+feh_stop();
+
+feh_start( '--fullindex --limit-width 400',
+ 'test/ok/gif test/ok/jpg test/ok/png test/ok/pnm' );
+test_scr('index_full_w400');
+feh_stop();
+
+feh_start(
+ '--index --limit-width 400 --index-info "%n\n%S\n%wx%h"',
+ 'test/ok/gif test/ok/jpg test/ok/png test/ok/pnm'
+);
+test_scr('index_full_w400');
+feh_stop();
+
+feh_start( '--index --limit-height 400',
+ 'test/ok/gif test/ok/jpg test/ok/png test/ok/pnm' );
+test_scr('index_h400');
+feh_stop();
+
+feh_start( '--fullindex --limit-height 400',
+ 'test/ok/gif test/ok/jpg test/ok/png test/ok/pnm' );
+test_scr('index_full_h400');
+feh_stop();
+
+feh_start( '--geometry +10+20', 'test/ok/png' );
+test_scr('geometry_offset_only');
+feh_stop();
+
+feh_start( '--caption-path .tc', 'test/bg/exact/in' );
+test_scr('caption_none');
+
+SendKeys('c');
+test_scr('caption_new');
+
+SendKeys(
+ 'Picknick im Zenit metaphysischen Wiederscheins der astralen Kuhglocke');
+test_scr('caption_while');
+
+SendKeys('~');
+test_scr('caption_done');
+
+SendKeys('c');
+test_scr('caption_while');
+
+SendKeys( '{BKS}' x 80 );
+test_scr('caption_new');
+
+SendKeys('~');
+test_scr('caption_none');
+
+SendKeys('cfoobar{ESC}');
+test_scr('caption_none');
+
+feh_stop();
+
+feh_start( '--info "echo \'%f\n%wx%h\'"', 'test/bg/exact/in' );
+test_scr('draw_info');
+feh_stop();
+
+feh_start( '--info "echo \'%f\n%wx%h\'" --draw-tinted', 'test/bg/exact/in' );
+test_scr('draw_info_tinted');
+feh_stop();
+
+feh_start( '--draw-actions --action8 "nrm \'%f\'"', 'test/bg/exact/in' );
+test_scr('draw_action');
+feh_stop();
+
+feh_start( '--draw-actions --action8 "nrm \'%f\'" --draw-tinted',
+ 'test/bg/exact/in' );
+test_scr('draw_action_tinted');
+feh_stop();
+
+feh_start( '--draw-filename', 'test/bg/exact/in' );
+test_scr('draw_filename');
+feh_stop();
+
+feh_start( '--draw-filename --draw-tinted', 'test/bg/exact/in' );
+test_scr('draw_filename_tinted');
+feh_stop();
+
+feh_start( '--draw-filename --draw-actions --action8 "nrm \'%f\'"',
+ 'test/bg/exact/in' );
+test_scr('draw_filename_action');
+feh_stop();
+
+feh_start(
+ '--draw-filename --draw-actions --action8 "nrm \'%f\'" --draw-tinted',
+ 'test/bg/exact/in' );
+test_scr('draw_filename_action_tinted');
+feh_stop();
+
+feh_start( '--action8 "nrm \'%f\'"', 'test/bg/exact/in' );
+test_scr('draw_nothing');
+
+SendKeys('d');
+test_scr('draw_filename');
+
+SendKeys('da');
+test_scr('draw_action');
+
+SendKeys('d');
+test_scr('draw_filename_action');
+
+SendKeys('da');
+test_scr('draw_nothing');
+
+feh_stop();
+
+feh_start( '--draw-tinted', 'test/bg/exact/in' );
+test_scr('draw_nothing');
+feh_stop();
+
+feh_start( q{}, 'test/bg/large/h/in' );
+test_scr('feh_lhi');
+
+SendKeys('{UP}');
+test_scr('feh_lhi_i');
+
+SendKeys('{UP}');
+test_scr('feh_lhi_ii');
+
+SendKeys('^({RIG})');
+test_scr('feh_lhi_iir');
+
+SendKeys('^({RIG})');
+test_scr('feh_lhi_iirr');
+
+SendKeys('{UP}');
+test_scr('feh_lhi_iirri');
+
+SendKeys('{DOWN}');
+test_scr('feh_lhi_iirrio');
+
+feh_stop();
+
+feh_start( q{}, 'test/bg/large/h/in' );
+test_scr('feh_lhi');
+
+SendKeys('{DOWN}');
+test_scr('feh_lhi_o');
+
+SendKeys('{DOWN}');
+test_scr('feh_lhi_oo');
+
+SendKeys('{DOWN}');
+test_scr('feh_lhi_ooo');
+
+feh_stop();
+
+feh_start( q{}, 'test/bg/transparency' );
+test_scr('feh_ibg_default');
+feh_stop();
+
+feh_start( '--image-bg checks', 'test/bg/transparency' );
+test_scr('feh_ibg_default');
+feh_stop();
+
+feh_start( '--image-bg black', 'test/bg/transparency' );
+test_scr('feh_ibg_black');
+feh_stop();
+
+feh_start( '--image-bg white', 'test/bg/transparency' );
+test_scr('feh_ibg_white');
+feh_stop();
+
+unlink('test/bg/exact/.tc/in.txt');
+rmdir('test/bg/exact/.tc');
+unlink("${scr_dir}/feh_${$}.png");
diff --git a/test/feh.t b/test/feh.t
index 29ba144..b9025b4 100644
--- a/test/feh.t
+++ b/test/feh.t
@@ -2,99 +2,194 @@
use strict;
use warnings;
use 5.010;
-use Test::Command tests => 48;
+use Test::Command tests => 73;
-my $feh = 'src/feh';
-my $images = 'test/ok.* test/fail.*';
+$ENV{HOME} = 'test';
-my ($feh_name, $feh_version) = @ENV{'PACKAGE', 'VERSION'};
+my $feh = "src/feh";
+my $images_ok = 'test/ok/gif test/ok/jpg test/ok/png test/ok/pnm';
+my $images_fail = 'test/fail/gif test/fail/jpg test/fail/png test/fail/pnm';
+my $images = "${images_ok} ${images_fail}";
+my $has_help = 0;
+
+my $feh_name = $ENV{'PACKAGE'};
+
+# These tests are meant to run non-interactively and without X.
+# make sure they are capable of doing so.
+delete $ENV{'DISPLAY'};
my $err_no_env = <<'EOF';
-Unable to determine feh PACKAGE or VERSION.
+Unable to determine feh PACKAGE.
This is most likely because you ran 'prove test' or 'perl test/feh.t'.
-Sinc this test uses make variables and is therefore designed to be run from
+Since this test uses make variables and is therefore designed to be run from
the Makefile only, use 'make test' instead.
If you absolutely need to run it the other way, use
- PACKAGE=feh VERSION=1.5 ${your_command}
-(with the appropiate values, of course).
+ PACKAGE=feh ${your_command}
EOF
-if (length($feh_name) == 0 or length($feh_version) == 0) {
+if ( length($feh_name) == 0 ) {
die($err_no_env);
}
-my $re_warning =
- qr{${feh_name} WARNING: test/fail\.... \- No Imlib2 loader for that file format\n};
-my $re_loadable = qr{test/ok\....};
-my $re_unloadable = qr{test/fail\....};
-my $re_list_action = qr{test/ok\.... 16x16 \(${feh_name}\)};
+# Imlib2 1.6+ reports JPEG file format as 'jpg', older versions use 'jpeg'.
+# Determine the output format used in this version with a --customlist call.
+my $list_dir = 'list';
+if (qx{$feh --customlist %t test/ok/jpg} =~ m{jpg}) {
+ $list_dir = 'list_imlib2_1.6';
+}
-my $cmd = Test::Command->new(cmd => $feh);
+my $version = qx{$feh --version};
+if ( $version =~ m{ Compile-time \s switches : \s .* help }ox ) {
+ $has_help = 1;
+}
-# Insufficient Arguments -> Usage should return failure
-$cmd->exit_is_num(1, 'missing arguments return 1');
-$cmd->stdout_is_eq('', 'missing arguments print usage (!stdout)');
-$cmd->stderr_is_eq(<<"EOF", 'missing arguments print usage (stderr)');
-${feh_name} - No loadable images specified.
-Use ${feh_name} --help for detailed usage information
-EOF
+# Imlib2 1.8+ returns "Invalid image file" rather than "No Imlib2 loader".
+# feh compiled with magic=1 returns "Does not look like an image (magic bytes missing)"
+# Here, we accept all three.
+my $re_warning
+ = qr{${feh_name} WARNING: test/fail/... \- (Invalid image file|No Imlib2 loader for that file format|Does not look like an image \(magic bytes missing\))\n};
+my $re_loadable = qr{test/ok/...};
+my $re_unloadable = qr{test/fail/...};
+my $re_list_action = qr{test/ok/... 16x16};
-$cmd = Test::Command->new(cmd => "$feh --version");
+my $cmd = Test::Command->new( cmd => "$feh --version" );
$cmd->exit_is_num(0);
-$cmd->stdout_is_eq("${feh_name} version ${feh_version}\n");
$cmd->stderr_is_eq('');
-$cmd = Test::Command->new(cmd => "$feh --loadable $images");
+$cmd = Test::Command->new( cmd => "$feh --loadable $images" );
-$cmd->exit_is_num(0);
+$cmd->exit_is_num(1);
$cmd->stdout_like($re_loadable);
$cmd->stderr_is_eq('');
-$cmd = Test::Command->new(cmd => "$feh --unloadable $images");
+$cmd = Test::Command->new(
+ cmd => "$feh --loadable --action 'echo touch %f' $images" );
-$cmd->exit_is_num(0);
+$cmd->exit_is_num(1);
+$cmd->stdout_is_file('test/nx_action/loadable_action');
+$cmd->stderr_is_eq('');
+
+$cmd = Test::Command->new(
+ cmd => "$feh --loadable --action ';echo touch %f' $images" );
+
+$cmd->exit_is_num(1);
+$cmd->stdout_is_file('test/nx_action/loadable_naction');
+$cmd->stderr_is_eq('');
+
+$cmd = Test::Command->new(
+ cmd => "$feh --unloadable --action 'echo rm %f' $images" );
+
+$cmd->exit_is_num(1);
+$cmd->stdout_is_file('test/nx_action/unloadable_action');
+$cmd->stderr_is_eq('');
+
+$cmd = Test::Command->new(
+ cmd => "$feh --unloadable --action ';echo rm %f' $images" );
+
+$cmd->exit_is_num(1);
+$cmd->stdout_is_file('test/nx_action/unloadable_naction');
+$cmd->stderr_is_eq('');
+
+$cmd = Test::Command->new( cmd => "$feh --unloadable $images" );
+
+$cmd->exit_is_num(1);
$cmd->stdout_like($re_unloadable);
$cmd->stderr_is_eq('');
-$cmd = Test::Command->new(cmd => "$feh --list $images");
+$cmd = Test::Command->new( cmd => "$feh --list $images" );
$cmd->exit_is_num(0);
-$cmd->stdout_is_file('test/list');
+$cmd->stdout_is_file("test/${list_dir}/default");
$cmd->stderr_like($re_warning);
for my $sort (qw/name filename width height pixels size format/) {
- $cmd = Test::Command->new(cmd => "$feh --list $images --sort $sort");
+ $cmd = Test::Command->new( cmd => "$feh --list $images --sort $sort" );
$cmd->exit_is_num(0);
- $cmd->stdout_is_file("test/list_$sort");
+ $cmd->stdout_is_file("test/${list_dir}/$sort");
$cmd->stderr_like($re_warning);
}
-$cmd = Test::Command->new(cmd => "$feh --list $images --sort format --reverse");
+$cmd
+ = Test::Command->new( cmd => "$feh --list $images --sort format --reverse" );
$cmd->exit_is_num(0);
-$cmd->stdout_is_file('test/list_format_reverse');
+$cmd->stdout_is_file("test/${list_dir}/format_reverse");
$cmd->stderr_like($re_warning);
-$cmd = Test::Command->new(cmd => "$feh --customlist '%f; %h; %l; %m; %n; %p; "
- . "%s; %t; %u; %w' $images");
+$cmd = Test::Command->new(
+ cmd => "$feh --list --recursive --sort filename test/ok" );
+
+$cmd->exit_is_num(0);
+
+# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=813729
+#$cmd->stdout_is_file("test/${list_dir}/filename_recursive");
+#$cmd->stderr_is_eq('');
+# dummy tests to match number of planned tests
+$cmd->exit_is_num(0);
+$cmd->exit_is_num(0);
+
+$cmd = Test::Command->new( cmd => "$feh --customlist '%f; %h; %l; %m; %n; %p; "
+ . "%s; %t; %u; %w' $images" );
$cmd->exit_is_num(0);
-$cmd->stdout_is_file('test/customlist');
+$cmd->stdout_is_file("test/${list_dir}/custom");
$cmd->stderr_like($re_warning);
-$cmd = Test::Command->new(cmd => "$feh --list --quiet $images");
+$cmd = Test::Command->new( cmd => "$feh --list --quiet $images" );
$cmd->exit_is_num(0);
-$cmd->stdout_is_file('test/list');
+$cmd->stdout_is_file("test/${list_dir}/default");
$cmd->stderr_is_eq('');
-$cmd = Test::Command->new(cmd =>
- "$feh --quiet --list --action 'echo \"%f %wx%h (%P)\" >&2' $images");
+$cmd = Test::Command->new(
+ cmd => "$feh --quiet --list --action 'echo \"%f %wx%h\" >&2' $images" );
$cmd->exit_is_num(0);
-$cmd->stdout_is_file('test/list');
+$cmd->stdout_is_file("test/${list_dir}/default");
$cmd->stderr_like($re_list_action);
+
+$cmd
+ = Test::Command->new( cmd => "$feh --list --min-dimension 20x20 $images_ok" );
+
+$cmd->exit_is_num(1);
+$cmd->stdout_is_eq('');
+if ($has_help) {
+ $cmd->stderr_is_file('test/no-loadable-files.help');
+}
+else {
+ $cmd->stderr_is_file('test/no-loadable-files');
+}
+
+$cmd
+ = Test::Command->new( cmd => "$feh --list --max-dimension 10x10 $images_ok" );
+
+$cmd->exit_is_num(1);
+$cmd->stdout_is_eq('');
+if ($has_help) {
+ $cmd->stderr_is_file('test/no-loadable-files.help');
+}
+else {
+ $cmd->stderr_is_file('test/no-loadable-files');
+}
+
+$cmd
+ = Test::Command->new( cmd => "$feh --list --min-dimension 16x16 $images_ok" );
+
+$cmd->exit_is_num(0);
+$cmd->stdout_is_file("test/${list_dir}/default");
+$cmd->stderr_is_eq('');
+
+$cmd
+ = Test::Command->new( cmd => "$feh --list --max-dimension 16x16 $images_ok" );
+
+$cmd->exit_is_num(0);
+$cmd->stdout_is_file("test/${list_dir}/default");
+$cmd->stderr_is_eq('');
+
+$cmd = Test::Command->new( cmd => "$feh --list test/tiny.pbm" );
+$cmd->exit_is_num(0);
+$cmd->stderr_is_eq('');
diff --git a/test/huge.png b/test/huge.png
new file mode 100644
index 0000000..1b7e6b0
--- /dev/null
+++ b/test/huge.png
Binary files differ
diff --git a/test/imlib2-bug-notice b/test/imlib2-bug-notice
new file mode 100644
index 0000000..3cfccf5
--- /dev/null
+++ b/test/imlib2-bug-notice
@@ -0,0 +1,11 @@
+[!] Possibly broken imlib2 / libgif detected - ignoring test results
+
+Imlib2 1.4.7 with giflib 5.1.2 is unable to load GIF images. On x86 / x86_64
+this applies to most gifs which are not the first file in the filelist, while
+on mips/mipsel and (some?) arm boxes it is unable to load any gif files. Since
+feh's tests include gifs, they fail.
+
+As there's nothing we can do about it (and other image formats still work
+fine), we'll just pretend everything's okay.
+
+See <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=813729> for details.
diff --git a/test/list b/test/list
deleted file mode 100644
index 036b0f4..0000000
--- a/test/list
+++ /dev/null
@@ -1,5 +0,0 @@
-NUM FORMAT WIDTH HEIGHT PIXELS SIZE(bytes) ALPHA FILENAME
-1 gif 16 16 256 953 - test/ok.gif
-2 jpeg 16 16 256 354 - test/ok.jpg
-3 png 16 16 256 403 X test/ok.png
-4 pnm 16 16 256 269 - test/ok.pnm
diff --git a/test/list/custom b/test/list/custom
new file mode 100644
index 0000000..dbe2074
--- /dev/null
+++ b/test/list/custom
@@ -0,0 +1,4 @@
+test/ok/gif; 16; 4; list; gif; 256; 953; gif; 1; 16
+test/ok/jpg; 16; 4; list; jpg; 256; 354; jpeg; 2; 16
+test/ok/png; 16; 4; list; png; 256; 403; png; 3; 16
+test/ok/pnm; 16; 4; list; pnm; 256; 269; pnm; 4; 16
diff --git a/test/list/default b/test/list/default
new file mode 100644
index 0000000..bc0ef52
--- /dev/null
+++ b/test/list/default
@@ -0,0 +1,5 @@
+NUM FORMAT WIDTH HEIGHT PIXELS SIZE ALPHA FILENAME
+1 gif 16 16 256 953 - test/ok/gif
+2 jpeg 16 16 256 354 - test/ok/jpg
+3 png 16 16 256 403 X test/ok/png
+4 pnm 16 16 256 269 - test/ok/pnm
diff --git a/test/list/filename b/test/list/filename
new file mode 120000
index 0000000..331d858
--- /dev/null
+++ b/test/list/filename
@@ -0,0 +1 @@
+default \ No newline at end of file
diff --git a/test/list/filename_recursive b/test/list/filename_recursive
new file mode 100644
index 0000000..6e2de8a
--- /dev/null
+++ b/test/list/filename_recursive
@@ -0,0 +1,7 @@
+NUM FORMAT WIDTH HEIGHT PIXELS SIZE ALPHA FILENAME
+1 gif 16 16 256 953 - test/ok/gif
+2 jpeg 16 16 256 354 - test/ok/jpg
+3 jpeg 16 16 256 9k - test/ok/jpg_exif
+4 png 16 16 256 403 X test/ok/png
+5 pnm 16 16 256 269 - test/ok/pnm
+6 png 16 16 256 403 X test/ok/recursive/png
diff --git a/test/list/format b/test/list/format
new file mode 120000
index 0000000..331d858
--- /dev/null
+++ b/test/list/format
@@ -0,0 +1 @@
+default \ No newline at end of file
diff --git a/test/list/format_reverse b/test/list/format_reverse
new file mode 100644
index 0000000..9216184
--- /dev/null
+++ b/test/list/format_reverse
@@ -0,0 +1,5 @@
+NUM FORMAT WIDTH HEIGHT PIXELS SIZE ALPHA FILENAME
+1 pnm 16 16 256 269 - test/ok/pnm
+2 png 16 16 256 403 X test/ok/png
+3 jpeg 16 16 256 354 - test/ok/jpg
+4 gif 16 16 256 953 - test/ok/gif
diff --git a/test/list/height b/test/list/height
new file mode 120000
index 0000000..331d858
--- /dev/null
+++ b/test/list/height
@@ -0,0 +1 @@
+default \ No newline at end of file
diff --git a/test/list/name b/test/list/name
new file mode 120000
index 0000000..331d858
--- /dev/null
+++ b/test/list/name
@@ -0,0 +1 @@
+default \ No newline at end of file
diff --git a/test/list/pixels b/test/list/pixels
new file mode 120000
index 0000000..331d858
--- /dev/null
+++ b/test/list/pixels
@@ -0,0 +1 @@
+default \ No newline at end of file
diff --git a/test/list/size b/test/list/size
new file mode 100644
index 0000000..cad60b0
--- /dev/null
+++ b/test/list/size
@@ -0,0 +1,5 @@
+NUM FORMAT WIDTH HEIGHT PIXELS SIZE ALPHA FILENAME
+1 pnm 16 16 256 269 - test/ok/pnm
+2 jpeg 16 16 256 354 - test/ok/jpg
+3 png 16 16 256 403 X test/ok/png
+4 gif 16 16 256 953 - test/ok/gif
diff --git a/test/list/width b/test/list/width
new file mode 120000
index 0000000..331d858
--- /dev/null
+++ b/test/list/width
@@ -0,0 +1 @@
+default \ No newline at end of file
diff --git a/test/list_filename b/test/list_filename
deleted file mode 120000
index e48b39a..0000000
--- a/test/list_filename
+++ /dev/null
@@ -1 +0,0 @@
-list \ No newline at end of file
diff --git a/test/list_format b/test/list_format
deleted file mode 120000
index e48b39a..0000000
--- a/test/list_format
+++ /dev/null
@@ -1 +0,0 @@
-list \ No newline at end of file
diff --git a/test/list_format_reverse b/test/list_format_reverse
deleted file mode 100644
index 71d1067..0000000
--- a/test/list_format_reverse
+++ /dev/null
@@ -1,5 +0,0 @@
-NUM FORMAT WIDTH HEIGHT PIXELS SIZE(bytes) ALPHA FILENAME
-1 pnm 16 16 256 269 - test/ok.pnm
-2 png 16 16 256 403 X test/ok.png
-3 jpeg 16 16 256 354 - test/ok.jpg
-4 gif 16 16 256 953 - test/ok.gif
diff --git a/test/list_height b/test/list_height
deleted file mode 120000
index e48b39a..0000000
--- a/test/list_height
+++ /dev/null
@@ -1 +0,0 @@
-list \ No newline at end of file
diff --git a/test/list_imlib2_1.6/custom b/test/list_imlib2_1.6/custom
new file mode 100644
index 0000000..40ac557
--- /dev/null
+++ b/test/list_imlib2_1.6/custom
@@ -0,0 +1,4 @@
+test/ok/gif; 16; 4; list; gif; 256; 953; gif; 1; 16
+test/ok/jpg; 16; 4; list; jpg; 256; 354; jpg; 2; 16
+test/ok/png; 16; 4; list; png; 256; 403; png; 3; 16
+test/ok/pnm; 16; 4; list; pnm; 256; 269; pnm; 4; 16
diff --git a/test/list_imlib2_1.6/default b/test/list_imlib2_1.6/default
new file mode 100644
index 0000000..e480db3
--- /dev/null
+++ b/test/list_imlib2_1.6/default
@@ -0,0 +1,5 @@
+NUM FORMAT WIDTH HEIGHT PIXELS SIZE ALPHA FILENAME
+1 gif 16 16 256 953 - test/ok/gif
+2 jpg 16 16 256 354 - test/ok/jpg
+3 png 16 16 256 403 X test/ok/png
+4 pnm 16 16 256 269 - test/ok/pnm
diff --git a/test/list_imlib2_1.6/filename b/test/list_imlib2_1.6/filename
new file mode 120000
index 0000000..331d858
--- /dev/null
+++ b/test/list_imlib2_1.6/filename
@@ -0,0 +1 @@
+default \ No newline at end of file
diff --git a/test/list_imlib2_1.6/filename_recursive b/test/list_imlib2_1.6/filename_recursive
new file mode 100644
index 0000000..e42ce14
--- /dev/null
+++ b/test/list_imlib2_1.6/filename_recursive
@@ -0,0 +1,7 @@
+NUM FORMAT WIDTH HEIGHT PIXELS SIZE ALPHA FILENAME
+1 gif 16 16 256 953 - test/ok/gif
+2 jpg 16 16 256 354 - test/ok/jpg
+3 jpg 16 16 256 9k - test/ok/jpg_exif
+4 png 16 16 256 403 X test/ok/png
+5 pnm 16 16 256 269 - test/ok/pnm
+6 png 16 16 256 403 X test/ok/recursive/png
diff --git a/test/list_imlib2_1.6/format b/test/list_imlib2_1.6/format
new file mode 120000
index 0000000..331d858
--- /dev/null
+++ b/test/list_imlib2_1.6/format
@@ -0,0 +1 @@
+default \ No newline at end of file
diff --git a/test/list_imlib2_1.6/format_reverse b/test/list_imlib2_1.6/format_reverse
new file mode 100644
index 0000000..3301f78
--- /dev/null
+++ b/test/list_imlib2_1.6/format_reverse
@@ -0,0 +1,5 @@
+NUM FORMAT WIDTH HEIGHT PIXELS SIZE ALPHA FILENAME
+1 pnm 16 16 256 269 - test/ok/pnm
+2 png 16 16 256 403 X test/ok/png
+3 jpg 16 16 256 354 - test/ok/jpg
+4 gif 16 16 256 953 - test/ok/gif
diff --git a/test/list_imlib2_1.6/height b/test/list_imlib2_1.6/height
new file mode 120000
index 0000000..331d858
--- /dev/null
+++ b/test/list_imlib2_1.6/height
@@ -0,0 +1 @@
+default \ No newline at end of file
diff --git a/test/list_imlib2_1.6/name b/test/list_imlib2_1.6/name
new file mode 120000
index 0000000..331d858
--- /dev/null
+++ b/test/list_imlib2_1.6/name
@@ -0,0 +1 @@
+default \ No newline at end of file
diff --git a/test/list_imlib2_1.6/pixels b/test/list_imlib2_1.6/pixels
new file mode 120000
index 0000000..331d858
--- /dev/null
+++ b/test/list_imlib2_1.6/pixels
@@ -0,0 +1 @@
+default \ No newline at end of file
diff --git a/test/list_imlib2_1.6/size b/test/list_imlib2_1.6/size
new file mode 100644
index 0000000..7716239
--- /dev/null
+++ b/test/list_imlib2_1.6/size
@@ -0,0 +1,5 @@
+NUM FORMAT WIDTH HEIGHT PIXELS SIZE ALPHA FILENAME
+1 pnm 16 16 256 269 - test/ok/pnm
+2 jpg 16 16 256 354 - test/ok/jpg
+3 png 16 16 256 403 X test/ok/png
+4 gif 16 16 256 953 - test/ok/gif
diff --git a/test/list_imlib2_1.6/width b/test/list_imlib2_1.6/width
new file mode 120000
index 0000000..331d858
--- /dev/null
+++ b/test/list_imlib2_1.6/width
@@ -0,0 +1 @@
+default \ No newline at end of file
diff --git a/test/list_name b/test/list_name
deleted file mode 120000
index e48b39a..0000000
--- a/test/list_name
+++ /dev/null
@@ -1 +0,0 @@
-list \ No newline at end of file
diff --git a/test/list_pixels b/test/list_pixels
deleted file mode 120000
index e48b39a..0000000
--- a/test/list_pixels
+++ /dev/null
@@ -1 +0,0 @@
-list \ No newline at end of file
diff --git a/test/list_size b/test/list_size
deleted file mode 100644
index 62fa3ba..0000000
--- a/test/list_size
+++ /dev/null
@@ -1,5 +0,0 @@
-NUM FORMAT WIDTH HEIGHT PIXELS SIZE(bytes) ALPHA FILENAME
-1 pnm 16 16 256 269 - test/ok.pnm
-2 jpeg 16 16 256 354 - test/ok.jpg
-3 png 16 16 256 403 X test/ok.png
-4 gif 16 16 256 953 - test/ok.gif
diff --git a/test/list_width b/test/list_width
deleted file mode 120000
index e48b39a..0000000
--- a/test/list_width
+++ /dev/null
@@ -1 +0,0 @@
-list \ No newline at end of file
diff --git a/test/mandoc.t b/test/mandoc.t
index b0882ab..9e7ffc3 100755
--- a/test/mandoc.t
+++ b/test/mandoc.t
@@ -3,17 +3,25 @@ use strict;
use warnings;
use 5.010;
-use Test::More tests => 3;
+use Test::More tests => 1;
SKIP: {
- qx{mandoc -V};
+ my $mandoc_present = 0;
- if ($? != 0) {
- skip('mandoc not installed', 3);
+ for my $path (split(qr{:}, $ENV{PATH})) {
+ if (-x "${path}/mandoc") {
+ $mandoc_present = 1;
+ last;
+ }
}
- for my $file ('feh', 'feh-cam', 'gen-cam-menu') {
- qx{mandoc -Tlint man/${file}.1};
- is($?, 0, "${file}.1: Valid mdoc syntax");
+ if ( not $mandoc_present ) {
+ diag('mandoc not installed, test skipped. This is NOT fatal.');
+ skip( 'mandoc not installed', 1 );
+ }
+
+ for my $file ('feh') {
+ qx{mandoc -Tlint -Werror man/${file}.1};
+ is( $?, 0, "${file}.1: Valid mdoc syntax" );
}
}
diff --git a/test/no-loadable-files b/test/no-loadable-files
new file mode 100644
index 0000000..bc5871d
--- /dev/null
+++ b/test/no-loadable-files
@@ -0,0 +1,2 @@
+feh: No loadable images specified.
+See 'man feh' for detailed usage information
diff --git a/test/no-loadable-files.help b/test/no-loadable-files.help
new file mode 100644
index 0000000..b1b61d8
--- /dev/null
+++ b/test/no-loadable-files.help
@@ -0,0 +1,2 @@
+feh: No loadable images specified.
+See 'feh --help' or 'man feh' for detailed usage information
diff --git a/test/nx_action/loadable_action b/test/nx_action/loadable_action
new file mode 100644
index 0000000..fbf517b
--- /dev/null
+++ b/test/nx_action/loadable_action
@@ -0,0 +1,8 @@
+test/ok/gif
+touch test/ok/gif
+test/ok/jpg
+touch test/ok/jpg
+test/ok/png
+touch test/ok/png
+test/ok/pnm
+touch test/ok/pnm
diff --git a/test/nx_action/loadable_naction b/test/nx_action/loadable_naction
new file mode 100644
index 0000000..fbf517b
--- /dev/null
+++ b/test/nx_action/loadable_naction
@@ -0,0 +1,8 @@
+test/ok/gif
+touch test/ok/gif
+test/ok/jpg
+touch test/ok/jpg
+test/ok/png
+touch test/ok/png
+test/ok/pnm
+touch test/ok/pnm
diff --git a/test/nx_action/unloadable_action b/test/nx_action/unloadable_action
new file mode 100644
index 0000000..cdf3ed8
--- /dev/null
+++ b/test/nx_action/unloadable_action
@@ -0,0 +1,8 @@
+test/fail/gif
+rm test/fail/gif
+test/fail/jpg
+rm test/fail/jpg
+test/fail/png
+rm test/fail/png
+test/fail/pnm
+rm test/fail/pnm
diff --git a/test/nx_action/unloadable_naction b/test/nx_action/unloadable_naction
new file mode 100644
index 0000000..cdf3ed8
--- /dev/null
+++ b/test/nx_action/unloadable_naction
@@ -0,0 +1,8 @@
+test/fail/gif
+rm test/fail/gif
+test/fail/jpg
+rm test/fail/jpg
+test/fail/png
+rm test/fail/png
+test/fail/pnm
+rm test/fail/pnm
diff --git a/test/ok.gif b/test/ok/gif
index 613264e..613264e 100644
--- a/test/ok.gif
+++ b/test/ok/gif
Binary files differ
diff --git a/test/ok.jpg b/test/ok/jpg
index 060565e..060565e 100644
--- a/test/ok.jpg
+++ b/test/ok/jpg
Binary files differ
diff --git a/test/ok/jpg_exif b/test/ok/jpg_exif
new file mode 100644
index 0000000..34c3846
--- /dev/null
+++ b/test/ok/jpg_exif
Binary files differ
diff --git a/test/ok.png b/test/ok/png
index 2f06506..2f06506 100644
--- a/test/ok.png
+++ b/test/ok/png
Binary files differ
diff --git a/test/ok.pnm b/test/ok/pnm
index d62d062..d62d062 100644
--- a/test/ok.pnm
+++ b/test/ok/pnm
Binary files differ
diff --git a/test/ok/recursive/png b/test/ok/recursive/png
new file mode 100644
index 0000000..2f06506
--- /dev/null
+++ b/test/ok/recursive/png
Binary files differ
diff --git a/test/run-interactive b/test/run-interactive
new file mode 100755
index 0000000..788ca3b
--- /dev/null
+++ b/test/run-interactive
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+Xephyr -screen 500x500 :7 > /dev/null 2>&1 &
+pid=${!}
+
+sleep 2
+
+DISPLAY=:7 prove -j1 test/feh-scr-i.t test/feh-i.t
+ret=${?}
+
+kill ${pid}
+
+sleep 2
+
+exit ${ret}
diff --git a/test/scr/caption_done b/test/scr/caption_done
new file mode 100644
index 0000000..3353d56
--- /dev/null
+++ b/test/scr/caption_done
Binary files differ
diff --git a/test/scr/caption_new b/test/scr/caption_new
new file mode 100644
index 0000000..ce44a08
--- /dev/null
+++ b/test/scr/caption_new
Binary files differ
diff --git a/test/scr/caption_none b/test/scr/caption_none
new file mode 100644
index 0000000..a1993ef
--- /dev/null
+++ b/test/scr/caption_none
Binary files differ
diff --git a/test/scr/caption_while b/test/scr/caption_while
new file mode 100644
index 0000000..b8bbde2
--- /dev/null
+++ b/test/scr/caption_while
Binary files differ
diff --git a/test/scr/draw_action b/test/scr/draw_action
new file mode 100644
index 0000000..668d23f
--- /dev/null
+++ b/test/scr/draw_action
Binary files differ
diff --git a/test/scr/draw_action_tinted b/test/scr/draw_action_tinted
new file mode 100644
index 0000000..68ce1cd
--- /dev/null
+++ b/test/scr/draw_action_tinted
Binary files differ
diff --git a/test/scr/draw_all_multi b/test/scr/draw_all_multi
new file mode 100644
index 0000000..768a00b
--- /dev/null
+++ b/test/scr/draw_all_multi
Binary files differ
diff --git a/test/scr/draw_all_one b/test/scr/draw_all_one
new file mode 100644
index 0000000..44bb2d1
--- /dev/null
+++ b/test/scr/draw_all_one
Binary files differ
diff --git a/test/scr/draw_filename b/test/scr/draw_filename
new file mode 100644
index 0000000..4d7cea5
--- /dev/null
+++ b/test/scr/draw_filename
Binary files differ
diff --git a/test/scr/draw_filename_action b/test/scr/draw_filename_action
new file mode 100644
index 0000000..2c9bbe6
--- /dev/null
+++ b/test/scr/draw_filename_action
Binary files differ
diff --git a/test/scr/draw_filename_action_tinted b/test/scr/draw_filename_action_tinted
new file mode 100644
index 0000000..58c43cd
--- /dev/null
+++ b/test/scr/draw_filename_action_tinted
Binary files differ
diff --git a/test/scr/draw_filename_tinted b/test/scr/draw_filename_tinted
new file mode 100644
index 0000000..c2a8cef
--- /dev/null
+++ b/test/scr/draw_filename_tinted
Binary files differ
diff --git a/test/scr/draw_info b/test/scr/draw_info
new file mode 100644
index 0000000..dee6b4a
--- /dev/null
+++ b/test/scr/draw_info
Binary files differ
diff --git a/test/scr/draw_info_tinted b/test/scr/draw_info_tinted
new file mode 100644
index 0000000..6a11a8e
--- /dev/null
+++ b/test/scr/draw_info_tinted
Binary files differ
diff --git a/test/scr/draw_nothing b/test/scr/draw_nothing
new file mode 100644
index 0000000..58923f6
--- /dev/null
+++ b/test/scr/draw_nothing
Binary files differ
diff --git a/test/scr/feh_full_lwi b/test/scr/feh_full_lwi
new file mode 100644
index 0000000..2601133
--- /dev/null
+++ b/test/scr/feh_full_lwi
Binary files differ
diff --git a/test/scr/feh_ibg_black b/test/scr/feh_ibg_black
new file mode 100644
index 0000000..90a666b
--- /dev/null
+++ b/test/scr/feh_ibg_black
Binary files differ
diff --git a/test/scr/feh_ibg_default b/test/scr/feh_ibg_default
new file mode 100644
index 0000000..d0555fa
--- /dev/null
+++ b/test/scr/feh_ibg_default
Binary files differ
diff --git a/test/scr/feh_ibg_white b/test/scr/feh_ibg_white
new file mode 100644
index 0000000..53c084f
--- /dev/null
+++ b/test/scr/feh_ibg_white
Binary files differ
diff --git a/test/scr/feh_lhi b/test/scr/feh_lhi
new file mode 100644
index 0000000..8ba9a22
--- /dev/null
+++ b/test/scr/feh_lhi
Binary files differ
diff --git a/test/scr/feh_lhi_i b/test/scr/feh_lhi_i
new file mode 100644
index 0000000..5d2febb
--- /dev/null
+++ b/test/scr/feh_lhi_i
Binary files differ
diff --git a/test/scr/feh_lhi_ii b/test/scr/feh_lhi_ii
new file mode 100644
index 0000000..3d7c2fd
--- /dev/null
+++ b/test/scr/feh_lhi_ii
Binary files differ
diff --git a/test/scr/feh_lhi_iir b/test/scr/feh_lhi_iir
new file mode 100644
index 0000000..a0d4f5e
--- /dev/null
+++ b/test/scr/feh_lhi_iir
Binary files differ
diff --git a/test/scr/feh_lhi_iirr b/test/scr/feh_lhi_iirr
new file mode 100644
index 0000000..c3ac6d5
--- /dev/null
+++ b/test/scr/feh_lhi_iirr
Binary files differ
diff --git a/test/scr/feh_lhi_iirri b/test/scr/feh_lhi_iirri
new file mode 100644
index 0000000..310a238
--- /dev/null
+++ b/test/scr/feh_lhi_iirri
Binary files differ
diff --git a/test/scr/feh_lhi_iirrio b/test/scr/feh_lhi_iirrio
new file mode 100644
index 0000000..4d064ed
--- /dev/null
+++ b/test/scr/feh_lhi_iirrio
Binary files differ
diff --git a/test/scr/feh_lhi_o b/test/scr/feh_lhi_o
new file mode 100644
index 0000000..bdef5db
--- /dev/null
+++ b/test/scr/feh_lhi_o
Binary files differ
diff --git a/test/scr/feh_lhi_oo b/test/scr/feh_lhi_oo
new file mode 100644
index 0000000..9499dfd
--- /dev/null
+++ b/test/scr/feh_lhi_oo
Binary files differ
diff --git a/test/scr/feh_lhi_ooo b/test/scr/feh_lhi_ooo
new file mode 100644
index 0000000..ec3eab6
--- /dev/null
+++ b/test/scr/feh_lhi_ooo
Binary files differ
diff --git a/test/scr/feh_lwi b/test/scr/feh_lwi
new file mode 100644
index 0000000..37fa6c1
--- /dev/null
+++ b/test/scr/feh_lwi
Binary files differ
diff --git a/test/scr/feh_lwi_scroll_r b/test/scr/feh_lwi_scroll_r
new file mode 100644
index 0000000..0baa70d
--- /dev/null
+++ b/test/scr/feh_lwi_scroll_r
Binary files differ
diff --git a/test/scr/feh_lwi_scroll_rd b/test/scr/feh_lwi_scroll_rd
new file mode 100644
index 0000000..ce3271d
--- /dev/null
+++ b/test/scr/feh_lwi_scroll_rd
Binary files differ
diff --git a/test/scr/feh_lwi_scroll_rdr b/test/scr/feh_lwi_scroll_rdr
new file mode 100644
index 0000000..52f6b6f
--- /dev/null
+++ b/test/scr/feh_lwi_scroll_rdr
Binary files differ
diff --git a/test/scr/feh_lwi_scroll_rdru b/test/scr/feh_lwi_scroll_rdru
new file mode 100644
index 0000000..afad9de
--- /dev/null
+++ b/test/scr/feh_lwi_scroll_rdru
Binary files differ
diff --git a/test/scr/feh_lwi_scroll_rdrul b/test/scr/feh_lwi_scroll_rdrul
new file mode 100644
index 0000000..7b5196a
--- /dev/null
+++ b/test/scr/feh_lwi_scroll_rdrul
Binary files differ
diff --git a/test/scr/feh_scaledown_lwi b/test/scr/feh_scaledown_lwi
new file mode 100644
index 0000000..623d63d
--- /dev/null
+++ b/test/scr/feh_scaledown_lwi
Binary files differ
diff --git a/test/scr/geometry_offset_only b/test/scr/geometry_offset_only
new file mode 100644
index 0000000..b1618ec
--- /dev/null
+++ b/test/scr/geometry_offset_only
Binary files differ
diff --git a/test/scr/index_full_h400 b/test/scr/index_full_h400
new file mode 100644
index 0000000..50c3c36
--- /dev/null
+++ b/test/scr/index_full_h400
Binary files differ
diff --git a/test/scr/index_full_w400 b/test/scr/index_full_w400
new file mode 100644
index 0000000..a86b2af
--- /dev/null
+++ b/test/scr/index_full_w400
Binary files differ
diff --git a/test/scr/index_h400 b/test/scr/index_h400
new file mode 100644
index 0000000..bcae91d
--- /dev/null
+++ b/test/scr/index_h400
Binary files differ
diff --git a/test/scr/index_w400 b/test/scr/index_w400
new file mode 100644
index 0000000..1038e59
--- /dev/null
+++ b/test/scr/index_w400
Binary files differ
diff --git a/test/scr/thumbnail_default b/test/scr/thumbnail_default
new file mode 100644
index 0000000..8d70a5b
--- /dev/null
+++ b/test/scr/thumbnail_default
Binary files differ
diff --git a/test/status b/test/status
new file mode 100644
index 0000000..6db362e
--- /dev/null
+++ b/test/status
@@ -0,0 +1,401 @@
+Overall test status, what's covered / missing
+
+# Features
+
+# Options
+
+--action
+--action1
+--action2
+--action3
+--action4
+--action5
+--action6
+--action7
+--action8
+--action9
+
+ [x] correct command execution
+ [x] hold-action flag
+ [x] supports format specifiers
+ [x] with --list
+ [x] with --loadable
+ [x] with --unloadable
+
+--alpha
+--auto-zoom
+
+ [ ] zooms to fullscreen
+ [ ] with --stretch
+ [ ] with --ignore-aspect
+
+
+--bg
+--bg-center
+
+ [x] sets centered wallpaper
+
+
+--bg-fill
+
+ [x] Sets wallpaper zoomed to fill
+
+
+--bg-max
+
+ [x] Sets wallpaper zoomed to max
+
+
+--bg-scale
+
+ [x] sets scaled wallpaper, ignoring aspect ratio
+
+
+--bg-tile
+
+ [x] sets tiled wallpaper
+
+
+--blur-button
+--borderless
+
+ [ ] create borderless window (need test WM with borders first...)
+
+
+--cache-thumbnails
+
+ [ ] ./thumbnails/normal
+ [ ] ./thumbnails/large
+
+
+--caption-path
+
+ [x] loads/saves captions
+ [x] autocreates caption dir
+ [x] caption newline support
+ [x] correct caption display
+
+
+--customlist
+
+ [x] correct output
+ [x] format specifiers
+
+
+--on-last-slide=quit
+
+ [x] closes feh window at end of slideshow
+ [x] combination with --slideshow-delay
+
+
+--draw-actions
+
+ [x] lists correct actions
+ [x] Alignment with/without --draw-filename
+
+
+--draw-filename
+
+ [x] shows filename
+ [ ] shows filename and position in fullscreen
+
+
+--filelist
+
+ [x] saves filelist
+ [x] loads filelist
+
+
+--font
+
+ [ ] Sets different font
+
+
+--fontpath
+
+ [ ] Adds font path
+
+
+--fullindex
+
+ [ ] Shows correct image size
+ [ ] Shows correct image dimensions
+ [ ] With --cache-thumbnails
+
+
+--fullscreen
+
+ [x] uses full screen size
+
+
+--geometry
+
+ [x] correct window dimensions
+
+
+--hide-pointer
+
+ [ ] Hides pointer visibility
+
+
+--ignore-aspect
+--image-bg
+
+ [x] black
+ [x] white
+ [x] default
+
+
+--index
+--index-dim
+--index-name
+--index-size
+
+--info
+
+ [x] executes commands
+ [x] correct output
+ [x] format specifiers
+
+
+--keep-http
+
+ [ ] keeps local file copies
+
+
+--limit-height
+
+ [x] sets correct thumbnail window height
+
+
+--limit-width
+
+ [x] sets correct thumbnail window width
+
+
+--list
+
+ [x] correct output
+
+
+--loadable
+
+ [x] lists loadable images
+
+
+--menu-button
+--menu-ctrl-mask
+--menu-font
+
+ [ ] changes menu font
+
+
+--montage
+--multiwindow
+
+ [x] opens one window per image
+
+
+--next-button
+--no-blur-ctrl-mask
+--no-jump-on-resort
+--no-menus
+
+ [ ] disables menu
+
+
+--no-rotate-ctrl-mask
+--no-screen-clip
+
+ [x] creates huge window
+
+
+--no-xinerama
+
+ [ ] disables xinerama support
+
+
+--output
+--output-dir
+
+ to be deprecated
+
+
+--output-only
+--pan-button
+--preload
+
+ [ ] weeds out unloadable images
+
+
+--prev-button
+--quiet
+
+ [x] quiet output
+
+
+--randomize
+
+ [ ] random filelist order
+
+
+--recursive
+
+ [x] recurses into subdirectories
+
+
+--reload
+
+ [ ] automatically reloads image
+
+
+--reload-button
+--reverse
+
+ [x] reverse sort order
+
+
+--rotate-button
+--scale-down
+
+ [x] correct window size
+ [x] correct zoom level
+ [ ] correct zoom behaviour
+
+
+--slideshow-delay
+
+ [x] positive delay -> automatic window change
+ [x] negative delay -> starts paused
+
+
+--sort
+
+ [x] name
+ [x] filename
+ [x] width
+ [x] height
+ [x] pixels
+ [x] size
+ [x] format
+
+
+--start-at
+
+ [x] starts at correct image
+
+
+--stretch
+--theme
+
+ [x] loads correct options
+ [x] commandline overrides theme
+ [x] multiline theme specifications
+
+
+--thumb-height
+
+ [ ] sets correct thumbnail height
+
+
+--thumbnails
+
+ [x] starts thumbnail mode
+ [ ] shows correct thumbnail dimensions (GH-29)
+
+
+--thumb-redraw
+--thumb-title
+
+ [ ] sets title for windows opened from thumbnail mode
+
+
+--thumb-width
+
+ [ ] sets correct thumbnail width
+
+
+--title
+
+ [x] Sets correct window title
+ [x] Supports format specifiers
+
+
+--title-font
+--unloadable
+
+ [x] lists unloadable images
+
+
+--verbose
+
+ [ ] outputs progress bars etc.
+
+
+--version
+
+ [x] correct output
+
+
+--zoom
+
+ [ ] percent
+ [ ] max
+ [ ] fill
+
+
+--zoom-button
+
+# Keys
+
+action_0
+action_1
+action_2
+action_3
+action_4
+action_5
+action_6
+action_7
+action_8
+action_9
+[x] close
+delete
+[x] jump_back
+[x] jump_first
+[x] jump_fwd
+[x] jump_last
+jump_random
+menu_child
+menu_close
+menu_down
+menu_parent
+menu_select
+menu_up
+[x] next_img
+orient_1
+orient_3
+[x] prev_img
+[x] quit
+reload_image
+reload_minus
+reload_plus
+[x] remove
+render
+save_filelist
+save_image
+[x] scroll_down
+[x] scroll_left
+[x] scroll_right
+[x] scroll_up
+[x] size_to_image
+[x] toggle_actions
+[x] toggle_caption
+[x] toggle_filenames
+toggle_fullscreen
+toggle_menu
+[x] toggle_pause
+toggle_pointer
+zoom_default
+zoom_fit
+[x] zoom_in
+[x] zoom_out
diff --git a/test/tiny.pbm b/test/tiny.pbm
new file mode 100644
index 0000000..3fb3e4e
--- /dev/null
+++ b/test/tiny.pbm
@@ -0,0 +1,4 @@
+P4
+1 1
+
+
diff --git a/test/warning-no-loader b/test/warning-no-loader
index 0ab95a5..9a1ff9e 100644
--- a/test/warning-no-loader
+++ b/test/warning-no-loader
@@ -1,4 +1,4 @@
-feh WARNING: test/fail.pnm - No Imlib2 loader for that file format
-feh WARNING: test/fail.png - No Imlib2 loader for that file format
-feh WARNING: test/fail.jpg - No Imlib2 loader for that file format
-feh WARNING: test/fail.gif - No Imlib2 loader for that file format
+feh WARNING: test/fail/pnm - No Imlib2 loader for that file format
+feh WARNING: test/fail/png - No Imlib2 loader for that file format
+feh WARNING: test/fail/jpg - No Imlib2 loader for that file format
+feh WARNING: test/fail/gif - No Imlib2 loader for that file format