summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/action1
l---------test/list_filename1
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
-rw-r--r--test/test.pl35
10 files changed, 50 insertions, 2 deletions
diff --git a/test/action b/test/action
new file mode 100644
index 0000000..4f28175
--- /dev/null
+++ b/test/action
@@ -0,0 +1 @@
+test/ok.pnm 16x16 (feh)
diff --git a/test/list_filename b/test/list_filename
new file mode 120000
index 0000000..e48b39a
--- /dev/null
+++ b/test/list_filename
@@ -0,0 +1 @@
+list \ No newline at end of file
diff --git a/test/list_format b/test/list_format
new file mode 120000
index 0000000..e48b39a
--- /dev/null
+++ b/test/list_format
@@ -0,0 +1 @@
+list \ No newline at end of file
diff --git a/test/list_format_reverse b/test/list_format_reverse
new file mode 100644
index 0000000..71d1067
--- /dev/null
+++ b/test/list_format_reverse
@@ -0,0 +1,5 @@
+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
new file mode 120000
index 0000000..e48b39a
--- /dev/null
+++ b/test/list_height
@@ -0,0 +1 @@
+list \ No newline at end of file
diff --git a/test/list_name b/test/list_name
new file mode 120000
index 0000000..e48b39a
--- /dev/null
+++ b/test/list_name
@@ -0,0 +1 @@
+list \ No newline at end of file
diff --git a/test/list_pixels b/test/list_pixels
new file mode 120000
index 0000000..e48b39a
--- /dev/null
+++ b/test/list_pixels
@@ -0,0 +1 @@
+list \ No newline at end of file
diff --git a/test/list_size b/test/list_size
new file mode 100644
index 0000000..62fa3ba
--- /dev/null
+++ b/test/list_size
@@ -0,0 +1,5 @@
+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
new file mode 120000
index 0000000..e48b39a
--- /dev/null
+++ b/test/list_width
@@ -0,0 +1 @@
+list \ No newline at end of file
diff --git a/test/test.pl b/test/test.pl
index 69ba824..4b18ccc 100644
--- a/test/test.pl
+++ b/test/test.pl
@@ -2,7 +2,7 @@
use strict;
use warnings;
use 5.010;
-use Test::Command tests => 18;
+use Test::Command tests => 48;
my $feh = 'src/feh';
my $images = 'test/ok.* test/fail.*';
@@ -13,6 +13,7 @@ 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}\)};
my $cmd = Test::Command->new(cmd => $feh);
@@ -24,29 +25,59 @@ ${feh_name} - No loadable images specified.
Use ${feh_name} --help for detailed usage information
EOF
-# feh --version / feh -v
$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->exit_is_num(0);
$cmd->stdout_like($re_loadable);
$cmd->stderr_is_eq('');
$cmd = Test::Command->new(cmd => "$feh --unloadable $images");
+
$cmd->exit_is_num(0);
$cmd->stdout_like($re_unloadable);
$cmd->stderr_is_eq('');
$cmd = Test::Command->new(cmd => "$feh --list $images");
+
$cmd->exit_is_num(0);
$cmd->stdout_is_file('test/list');
$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->exit_is_num(0);
+ $cmd->stdout_is_file("test/list_$sort");
+ $cmd->stderr_like($re_warning);
+}
+
+$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->stderr_like($re_warning);
+
$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->stderr_like($re_warning);
+
+$cmd = Test::Command->new(cmd => "$feh --list --quiet $images");
+$cmd->exit_is_num(0);
+$cmd->stdout_is_file('test/list');
+$cmd->stderr_is_eq('');
+
+$cmd = Test::Command->new(cmd =>
+ "$feh --quiet --list --action 'echo \"%f %wx%h (%P)\" >&2' $images");
+
+$cmd->exit_is_num(0);
+$cmd->stdout_is_file('test/list');
+$cmd->stderr_like($re_list_action);