Debian Codegraph @

t/fileevent2.t

raw
1 #!/usr/bin/perl -w
2 # -*- perl -*-
3
4 #
5 # $Id: $
6 # Author: Slaven Rezic
7 #
8
9 use strict;
10
11 use Tk;
12
13 BEGIN {
14 if (!eval q{
15 use 5.006; # three-arg open
16 use Test::More;
17 1;
18 }) {
19 print "1..0 # skip: no Test::More module\n";
20 exit;
21 }
22 }
23
24 plan tests => 2;
25
26 my @fh;
27 my $callback_called = 0;
28
29 my $mw = tkinit;
30 $mw->geometry("+10+10");
31 $mw->idletasks;
32
33 # A variant of the problem reported in
34 # http://rt.cpan.org/Ticket/Display.html?id=32034
35 #
36 # tclUnixNotify.c used to do bit-handling for the select() mask
37 # itself, but this was broken for 64bit machines.
38 my ($rpipe, $wpipe);
39 ok(pipe($rpipe, $wpipe), 'create blocking descriptors');
40 for (1..100) {
41 open my $dup, "<&", $rpipe or die "Can't dup rpipe: $!";
42 push @fh, $dup;
43 $mw->fileevent($dup, "readable", sub { $callback_called++ });
44 }
45
46 $mw->after(300, sub { $mw->destroy });
47 MainLoop;
48
49 local $TODO;
50 $TODO = "Known to break on $^O" if $^O eq 'cygwin';
51
52 is($callback_called, 0, "Fileevent callback should never be called");
53
54 __END__