diff --git a/test/feh-scr.i b/test/feh-scr.i index 05960a246f47667c57ba82200d047963e84aa94f..5067ba7808a819e8d6a98db33881a808fbf0f5cf 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"); diff --git a/test/scr/feh_lhi b/test/scr/feh_lhi new file mode 100644 index 0000000000000000000000000000000000000000..f16d1501dc7b867c73304901904b0c36c6022dea Binary files /dev/null and b/test/scr/feh_lhi differ diff --git a/test/scr/feh_lhi_i b/test/scr/feh_lhi_i new file mode 100644 index 0000000000000000000000000000000000000000..108dfb6bc7c8f79566b7d5a28c9228fdcdbd142e Binary files /dev/null and b/test/scr/feh_lhi_i differ diff --git a/test/scr/feh_lhi_ii b/test/scr/feh_lhi_ii new file mode 100644 index 0000000000000000000000000000000000000000..1fb695f110d3ca478a54f82f4258e8e469e25efd Binary files /dev/null and b/test/scr/feh_lhi_ii differ diff --git a/test/scr/feh_lhi_iir b/test/scr/feh_lhi_iir new file mode 100644 index 0000000000000000000000000000000000000000..396ee99961194450323b1c3154dca945f960050f Binary files /dev/null and b/test/scr/feh_lhi_iir differ diff --git a/test/scr/feh_lhi_iirr b/test/scr/feh_lhi_iirr new file mode 100644 index 0000000000000000000000000000000000000000..81748a3a48e5b0eb289faf45927715a9d267c3ef Binary files /dev/null and b/test/scr/feh_lhi_iirr differ diff --git a/test/scr/feh_lhi_iirri b/test/scr/feh_lhi_iirri new file mode 100644 index 0000000000000000000000000000000000000000..43b8fa126fa6ac2b9b83cb714a9c0e8da206f5b9 Binary files /dev/null and b/test/scr/feh_lhi_iirri differ diff --git a/test/scr/feh_lhi_iirrio b/test/scr/feh_lhi_iirrio new file mode 100644 index 0000000000000000000000000000000000000000..c9e287b9a3cd428d16cdc207c04be1df53dc7eea Binary files /dev/null and b/test/scr/feh_lhi_iirrio differ diff --git a/test/scr/feh_lhi_o b/test/scr/feh_lhi_o new file mode 100644 index 0000000000000000000000000000000000000000..ec48c017c3587ec8be53fe62be4f4b23df72a0cb Binary files /dev/null and b/test/scr/feh_lhi_o differ diff --git a/test/scr/feh_lhi_oo b/test/scr/feh_lhi_oo new file mode 100644 index 0000000000000000000000000000000000000000..784d7d77d395211e566cab5598cdd951d65520e5 Binary files /dev/null and b/test/scr/feh_lhi_oo differ diff --git a/test/scr/feh_lhi_ooo b/test/scr/feh_lhi_ooo new file mode 100644 index 0000000000000000000000000000000000000000..ad14384c2ef23d1b60b4282fa6a94fb14ff4a63e Binary files /dev/null and b/test/scr/feh_lhi_ooo differ