Commit 9271b3c2 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

Graphical --caption-path tests

parent 095bf053
Loading
Loading
Loading
Loading
+52 −15
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ use autodie qw/:all/;

use Cwd;
use GD qw/:DEFAULT :cmp/;
use Test::More tests => 11;
use Test::More tests => 19;
use Time::HiRes qw/sleep/;
use X11::GUITest qw/:ALL/;

@@ -18,7 +18,7 @@ my $pwd = getcwd();
sub waitfor(&) {
	my ($sub) = @_;
	my $out;
	for (1 .. 40) {
	for (1 .. 10) {
		sleep(0.05);
		$out = &{$sub};
		if ($out) {
@@ -70,9 +70,15 @@ sub check_scr {

	system("import -silent -window root /tmp/feh_${$}.png");

	return same_files("test/scr/${file}", "/tmp/feh_${$}.png");
}

sub test_scr {
	my ($file) = @_;

	ok(
		same_files("test/scr/${file}", "/tmp/feh_${$}.png"),
		"X root window is test/scr/${file}"
		waitfor { check_scr($file) },
		"X root window is test/scr/${file}",
	);
}

@@ -85,7 +91,7 @@ feh_start(
	. '--action quux --action5 baz --action8 "nrm \'%f\'"',
	'test/bg/exact/in test/bg/large/w/in test/bg/large/h/in'
);
check_scr('draw_all_multi');
test_scr('draw_all_multi');
feh_stop();

feh_start(
@@ -93,36 +99,36 @@ feh_start(
	. '--action quux --action5 baz --action8 "nrm \'%f\'"',
	'test/bg/exact/in'
);
check_scr('draw_all_one');
test_scr('draw_all_one');
feh_stop();

feh_start(
	'--fullscreen',
	'test/bg/large/w/in'
);
check_scr('feh_full_lwi');
test_scr('feh_full_lwi');
feh_stop();

feh_start(
	q{},
	'test/bg/large/w/in'
);
check_scr('feh_lwi');
test_scr('feh_lwi');

SendKeys('^({RIG})');
check_scr('feh_lwi_scroll_r');
test_scr('feh_lwi_scroll_r');

SendKeys('^({DOW})');
check_scr('feh_lwi_scroll_rd');
test_scr('feh_lwi_scroll_rd');

SendKeys('^({RIG})');
check_scr('feh_lwi_scroll_rdr');
test_scr('feh_lwi_scroll_rdr');

SendKeys('^({UP})');
check_scr('feh_lwi_scroll_rdru');
test_scr('feh_lwi_scroll_rdru');

SendKeys('^({LEF})');
check_scr('feh_lwi_scroll_rdrul');
test_scr('feh_lwi_scroll_rdrul');

feh_stop();

@@ -130,14 +136,45 @@ feh_start(
	'--scale-down',
	'test/bg/large/w/in'
);
check_scr('feh_scaledown_lwi');
test_scr('feh_scaledown_lwi');
feh_stop();

feh_start(
	'--thumbnails',
	'test/ok/gif test/ok/jpg test/ok/png test/ok/pnm'
);
check_scr('thumbnail_default');
test_scr('thumbnail_default');
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();

unlink('test/bg/exact/.tc/in.txt');
rmdir('test/bg/exact/.tc');
unlink("/tmp/feh_${$}.png");

test/scr/caption_done

0 → 100644
+9.44 KiB

File added.

No diff preview for this file type.

test/scr/caption_new

0 → 100644
+18.9 KiB

File added.

No diff preview for this file type.

test/scr/caption_none

0 → 100644
+6.37 KiB

File added.

No diff preview for this file type.

test/scr/caption_while

0 → 100644
+21 KiB

File added.

No diff preview for this file type.