#!perl
eval
"use Tk; use AnyEvent; 1"
or
plan
skip_all
=>
"AnyEvent and/or Tk is not installed."
;
BEGIN {
$ENV
{PERL_RL} =
'Stub o=0'
;
$ENV
{PERL_ANYEVENT_MODEL} =
'Tk'
;
}
eval
{
my
$mw
= MainWindow->new();
$mw
->withdraw();
1;
} or plan
skip_all
=>
"Tk can't start. DISPLAY not set?"
;
plan
tests
=> 3;
my
$t
= Term::ReadLine->new(
'AE/Tk'
);
ok(
$t
,
"Created object"
);
is(
$t
->ReadLine,
'Term::ReadLine::Stub'
,
'Correct type'
);
my
(
$cv
,
$fe
);
$t
->event_loop(
sub
{
$cv
= AE::cv();
$cv
->
recv
();
},
sub
{
my
$fh
=
shift
;
$fe
||= AE::io(
$fh
, 0,
sub
{
$cv
->
send
() });
}
);
my
$text
=
'some text'
;
my
$T
=
$text
.
"\n"
;
my
$w
= AE::timer(0,1,
sub
{
pass(
"Event loop called"
);
exit
0;
});
my
$result
=
$t
->
readline
(
'Do not press enter>'
);
fail(
"Should not get here."
);