summaryrefslogtreecommitdiff
path: root/test/feh.i
diff options
context:
space:
mode:
Diffstat (limited to 'test/feh.i')
-rwxr-xr-xtest/feh.i112
1 files changed, 111 insertions, 1 deletions
diff --git a/test/feh.i b/test/feh.i
index ffa9c5a..231f260 100755
--- a/test/feh.i
+++ b/test/feh.i
@@ -4,7 +4,7 @@ use warnings;
use 5.010;
use Cwd;
-use Test::More tests => 75;
+use Test::More tests => 103;
use Time::HiRes qw/sleep/;
use X11::GUITest qw/:ALL/;
@@ -12,6 +12,8 @@ my $win;
my ($width, $height);
my $pwd = getcwd();
+$ENV{HOME} = 'test';
+
sub waitfor(&) {
my ($sub) = @_;
my $out;
@@ -185,6 +187,108 @@ 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}');
@@ -341,3 +445,9 @@ ok(waitfor {
},
'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();