blob: 0a38bf1ca34326d69c677733bde4684a5418a02c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#!/usr/bin/env perl
use strict;
use warnings;
use 5.010;
use Test::More tests => 3;
use X11::GUITest qw/
FindWindowLike
StartApp
SendKeys
WaitWindowViewable
/;
sub feh_start {
my ($opts, $files) = @_;
$opts //= q{};
$files //= 'test/ok.png';
StartApp("feh ${opts} ${files}");
if (WaitWindowViewable(qr{^feh}) == 0) {
BAIL_OUT("Unable to start feh ${opts} ${files}");
}
}
sub test_no_win {
my ($reason) = @_;
for (1 .. 10) {
sleep(0.1);
if (FindWindowLike(qr{^feh}) == 0) {
pass("Window closed ($reason)");
return;
}
}
fail("Window closed ($reason)");
BAIL_OUT("unclosed window still open, cannot continue");
}
if (FindWindowLike(qr{^feh})) {
BAIL_OUT('It appears you have an open feh window. Please close it.');
}
for my $key (qw/q x {ESC}/) {
feh_start();
SendKeys($key);
test_no_win("$key pressed");
}
|