From 27f4147609d3c08cf1b2a5bf457ceed23cce52be Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 25 Jan 2011 20:38:16 +0100 Subject: Add tests for themes * general * commandline option overrides same theme option * multiline theme definitions --- test/config/feh/keys | 17 ----------------- test/config/keys/feh/keys | 17 +++++++++++++++++ test/config/themes/feh/themes | 5 +++++ test/feh.i | 43 ++++++++++++++++++++++++++++++++++++++++--- 4 files changed, 62 insertions(+), 20 deletions(-) delete mode 100644 test/config/feh/keys create mode 100644 test/config/keys/feh/keys create mode 100644 test/config/themes/feh/themes (limited to 'test') diff --git a/test/config/feh/keys b/test/config/feh/keys deleted file mode 100644 index 7114ecc..0000000 --- a/test/config/feh/keys +++ /dev/null @@ -1,17 +0,0 @@ -action_1 x -action_2 X -action_3 C-x -action_4 C-X -action_5 1-x -action_6 -action_7 - -next_img a b c -prev_img d e f - -# conflict with next_img/prev_img -toggle_actions -toggle_caption -toggle_filenames -save_filelist -close diff --git a/test/config/keys/feh/keys b/test/config/keys/feh/keys new file mode 100644 index 0000000..7114ecc --- /dev/null +++ b/test/config/keys/feh/keys @@ -0,0 +1,17 @@ +action_1 x +action_2 X +action_3 C-x +action_4 C-X +action_5 1-x +action_6 +action_7 + +next_img a b c +prev_img d e f + +# conflict with next_img/prev_img +toggle_actions +toggle_caption +toggle_filenames +save_filelist +close diff --git a/test/config/themes/feh/themes b/test/config/themes/feh/themes new file mode 100644 index 0000000..d4b7f69 --- /dev/null +++ b/test/config/themes/feh/themes @@ -0,0 +1,5 @@ +test_general --action1 "touch a1" + +test_multiline --action1 "touch a1" \ +--action2 "touch a2" \ + --action3 "touch a3" diff --git a/test/feh.i b/test/feh.i index a19d5cd..7ac6202 100755 --- a/test/feh.i +++ b/test/feh.i @@ -4,7 +4,7 @@ use warnings; use 5.010; use Cwd; -use Test::More tests => 97; +use Test::More tests => 102; use Time::HiRes qw/sleep/; use X11::GUITest qw/:ALL/; @@ -209,7 +209,8 @@ feh_stop(); # .config/feh/keys # Action Unbinding + non-conflicting none/shift/control/meta modifiers -$ENV{XDG_CONFIG_HOME} = 'test/config'; +$ENV{XDG_CONFIG_HOME} = 'test/config/keys'; + $win = feh_start( '--action1 "touch a1" --action2 "touch a2" ' . '--action3 "touch a3" --action4 "touch a4" ' . @@ -245,12 +246,48 @@ SendKeys('^(X)'); ok(waitfor { -e 'a4' }, 'action 4 = Ctrl+Shift+X ok'); SendKeys('%(x)'); ok(waitfor { -e 'a5' }, 'action 5 = Alt+X ok'); -delete $ENV{XDG_CONFIG_HOME}; 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'); -- cgit v1.2.3