6 use Tests_Helper qw(test_app);
7 use Test::More Wx::wxMAC() ? ( 'skip_all' => 'Hangs on wxMac' ) :
10 use Wx::Event qw(EVT_TIMER);
14 Wx::Frame->new( undef, -1, 'X' )->Show( 1 ); # to appease wxGTK
17 my $timer = Wx::Timer->new($app, 123);
20 ok( 1, 'Timer fired' );
21 eval 'BEGIN { die "Fatal!" }';
22 ok( $@, 'Error was generated and trapped' );
24 EVT_TIMER( $app, 123, undef ); # disconnect
25 EVT_TIMER( $app, 123, \&onTimer1 );
26 $timer->Start( 20, 1 );
30 ok( 1, 'Second timer fired' );
31 eval 'use ThisModuleDoesNotExist';
32 ok( $@, 'Error was generated and trapped' );
34 EVT_TIMER( $app, 123, undef ); # disconnect
35 EVT_TIMER( $app, 123, \&onTimer2 );
36 $timer->Start( 20, 1 );
40 ok( 1, 'Third timer fired' );
41 die "I am going away...";
42 fail( 'panic: die() did not work' );
45 EVT_TIMER( $app, 123, \&onTimer0 );
46 $timer->Start( 10, 1 );
48 eval { $app->MainLoop };
50 like( $@, qr/^I am going away\.\.\./, 'Exception correctly propagated' );