summaryrefslogtreecommitdiff
path: root/test/feh-scr.i
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2010-10-04 20:24:34 +0200
committerDaniel Friesel <derf@finalrewind.org>2010-10-04 20:24:34 +0200
commitf75aea0e0a57a603203e6334fba4936bc5623a74 (patch)
treef40d58af80871b1b07f532a1f57c4a4791d8c0e7 /test/feh-scr.i
parent47e9cf3210355a1ccd3c5ad9c9577421d59094c5 (diff)
Tests for keyboard based zooming
Diffstat (limited to 'test/feh-scr.i')
-rwxr-xr-xtest/feh-scr.i59
1 files changed, 54 insertions, 5 deletions
diff --git a/test/feh-scr.i b/test/feh-scr.i
index 05960a2..5067ba7 100755
--- a/test/feh-scr.i
+++ b/test/feh-scr.i
@@ -6,7 +6,7 @@ use autodie qw/:all/;
use Cwd;
use GD qw/:DEFAULT :cmp/;
-use Test::More tests => 27;
+use Test::More tests => 38;
use Time::HiRes qw/sleep/;
use X11::GUITest qw/:ALL/;
@@ -14,6 +14,7 @@ my ($pid_xnest, $pid_twm);
my $win;
my ($width, $height);
my $pwd = getcwd();
+my $test_id = 0;
sub waitfor(&) {
my ($sub) = @_;
@@ -62,6 +63,10 @@ sub same_files {
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));
}
@@ -75,11 +80,17 @@ sub check_scr {
sub test_scr {
my ($file) = @_;
+ my $msg = "X root window is test/scr/${file}";
+
+ $test_id++;
- ok(
- waitfor { check_scr($file) },
- "X root window is test/scr/${file}",
- );
+ if (waitfor { check_scr($file) }) {
+ pass($msg);
+ }
+ else {
+ fail($msg);
+ rename("/tmp/feh_${$}.png", "/tmp/feh_${$}_${test_id}_${file}.png");
+ }
}
if (FindWindowLike(qr{^feh})) {
@@ -216,6 +227,44 @@ 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('{DOW}');
+test_scr('feh_lhi_iirrio');
+
+feh_stop();
+
+feh_start(q{}, 'test/bg/large/h/in');
+test_scr('feh_lhi');
+
+SendKeys('{DOW}');
+test_scr('feh_lhi_o');
+
+SendKeys('{DOW}');
+test_scr('feh_lhi_oo');
+
+SendKeys('{DOW}');
+test_scr('feh_lhi_ooo');
+
+feh_stop();
+
+
unlink('test/bg/exact/.tc/in.txt');
rmdir('test/bg/exact/.tc');
unlink("/tmp/feh_${$}.png");