Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
feh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
derf
feh
Commits
fec1ed90
Commit
fec1ed90
authored
14 years ago
by
Birte Kristina Friesel
Browse files
Options
Downloads
Patches
Plain Diff
test/feh.i: Some refactoring, fix timing fuckup
parent
61fe36f9
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Makefile
+0
-3
0 additions, 3 deletions
Makefile
test/feh.i
+31
-28
31 additions, 28 deletions
test/feh.i
with
31 additions
and
31 deletions
Makefile
+
0
−
3
View file @
fec1ed90
...
@@ -7,9 +7,6 @@ test: all
...
@@ -7,9 +7,6 @@ test: all
@
PACKAGE
=
${
PACKAGE
}
VERSION
=
${
VERSION
}
prove
test
@
PACKAGE
=
${
PACKAGE
}
VERSION
=
${
VERSION
}
prove
test
test-interactive
:
all
test-interactive
:
all
@
echo
'Note: X Testing sucks, and Xnest is also prone to weird behaviour.'
@
echo
'If the test fails, try rerunning it one or two times.'
@
echo
'If it works then, everything is fine.'
@
test
/run-interactive
@
test
/run-interactive
install
:
install-man install-doc install-bin install-font install-img
install
:
install-man install-doc install-bin install-font install-img
...
...
This diff is collapsed.
Click to expand it.
test/feh.i
+
31
−
28
View file @
fec1ed90
...
@@ -4,11 +4,25 @@ use warnings;
...
@@ -4,11 +4,25 @@ use warnings;
use
5.010
;
use
5.010
;
use
Test
::
More
tests
=>
34
;
use
Test
::
More
tests
=>
34
;
use
Time
::
HiRes
qw
/
sleep
/
;
use
X11
::
GUITest
qw
/:
ALL
/
;
use
X11
::
GUITest
qw
/:
ALL
/
;
my
$
win
;
my
$
win
;
my
(
$
width
,
$
height
)
;
my
(
$
width
,
$
height
)
;
sub
waitfor
(
&
)
{
my ($sub) = @_;
my $out;
for (1 .. 40) {
sleep(0.05);
$out = &{$sub};
if ($out) {
return $out;
}
}
return 0;
}
sub
feh_start
{
sub
feh_start
{
my
(
$
opts
,
$
files
)
=
@_
;
my
(
$
opts
,
$
files
)
=
@_
;
my
$
id
;
my
$
id
;
...
@@ -32,44 +46,36 @@ sub feh_start {
...
@@ -32,44 +46,36 @@ sub feh_start {
sub
feh_stop
{
sub
feh_stop
{
SendKeys('{ESC}');
SendKeys('{ESC}');
for (1 .. 10) {
if (not waitfor { not FindWindowLike(qr{^feh}) }) {
sleep(0.1);
BAIL_OUT("Unclosed feh window still open, cannot continue");
if (FindWindowLike(qr{^feh}) == 0) {
return;
}
}
}
BAIL_OUT("Unclosed feh window still open, cannot continue");
}
}
sub
test_no_win
{
sub
test_no_win
{
my ($reason) = @_;
my ($reason) = @_;
for (1 .. 10
) {
if (waitfor { not FindWindowLike(qr{^feh}) }
) {
sleep(0.1
);
pass("Window closed ($reason)"
);
if (FindWindowLike(qr{^feh}) == 0) {
}
pass("Window closed ($reason)");
else {
return
;
fail("Window closed ($reason)")
;
}
BAIL_OUT("unclosed window still open, cannot continue");
}
}
fail("Window closed ($reason)");
BAIL_OUT("unclosed window still open, cannot continue");
}
}
sub
test_win_title
{
sub
test_win_title
{
my ($win, $wtitle) = @_;
my ($win, $wtitle) = @_;
my $rtitle;
my $rtitle;
for (1 .. 10) {
if (waitfor { GetWindowName($win) eq $wtitle }) {
sleep(0.1);
pass("Window has title: $wtitle");
}
else {
$rtitle = GetWindowName($win);
$rtitle = GetWindowName($win);
if ($rtitle eq $wtitle) {
fail("Window has title: $wtitle");
pass("Window has title: $wtitle");
diag("expected: $wtitle");
return;
diag(" got: $rtitle");
}
}
}
fail("Window has title: $wtitle");
diag("expected: $wtitle");
diag(" got: $rtitle");
}
}
if
(
FindWindowLike
(
qr
{^feh}
))
{
if
(
FindWindowLike
(
qr
{^feh}
))
{
...
@@ -117,15 +123,13 @@ test_no_win("--cycle-once -> window closed");
...
@@ -117,15 +123,13 @@ test_no_win("--cycle-once -> window closed");
feh_start
(
'
--cycle-once --slideshow-delay 0.5
'
,
feh_start
(
'
--cycle-once --slideshow-delay 0.5
'
,
'
test/ok.png test/ok.jpg test/ok.gif
'
)
;
'
test/ok.png test/ok.jpg test/ok.gif
'
)
;
sleep
(
1
)
;
sleep
(
1
.5
)
;
test_no_win
(
'
cycle-once + slideshow-delay -> window closed
'
)
;
test_no_win
(
'
cycle-once + slideshow-delay -> window closed
'
)
;
$
win
=
feh_start
(
'
--cycle-once --slideshow-delay -0.01
'
,
$
win
=
feh_start
(
'
--cycle-once --slideshow-delay -0.01
'
,
'
test/ok.png test/ok.jpg test/ok.gif
'
)
;
'
test/ok.png test/ok.jpg test/ok.gif
'
)
;
sleep
(
0.1
)
;
test_win_title
(
$
win
,
'
feh [1 of 3] - test/ok.png
'
)
;
test_win_title
(
$
win
,
'
feh [1 of 3] - test/ok.png
'
)
;
SendKeys
(
'
h
'
)
;
SendKeys
(
'
h
'
)
;
sleep
(
1
)
;
test_no_win
(
'
cycle-once + negative delay + [h]
'
)
;
test_no_win
(
'
cycle-once + negative delay + [h]
'
)
;
$
win
=
feh_start
(
q{}
,
'
test/ok.png test/ok.gif test/ok.gif test/ok.jpg
'
)
;
$
win
=
feh_start
(
q{}
,
'
test/ok.png test/ok.gif test/ok.gif test/ok.jpg
'
)
;
...
@@ -167,6 +171,5 @@ ClickMouseButton(M_BTN1);
...
@@ -167,6 +171,5 @@ ClickMouseButton(M_BTN1);
ok
(
$
win
,
'
Thumbnail mode: Window opened
'
)
;
ok
(
$
win
,
'
Thumbnail mode: Window opened
'
)
;
SetInputFocus
(
$
win
)
;
SetInputFocus
(
$
win
)
;
SendKeys
(
'
x
'
)
;
SendKeys
(
'
x
'
)
;
sleep
(
0.2
)
;
ok
(
waitfor
{ not FindWindowLike(qr{^ok\.png$}) }
,
'
Thumbnail mode: closed
'
)
;
is
(
FindWindowLike
(
qr
{^ok\.png$}
),
0
,
'
Thumbnail mode: Window closed (x)
'
)
;
feh_stop
()
;
feh_stop
()
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment