Add libwx-perl
[pkg-perl] / deb-src / libwx-perl / libwx-perl-0.96 / ext / pperl / splashfast / t / 04_app.t
1 #!/usr/bin/perl -w
2
3 use lib '../../../t';
4 use Test::More ( $^O eq 'MSWin32' && $] == 5.008000 ) ?
5                ( 'skip_all' => 'Bug with Win32 WM_TIMER handling in 5.8.0' ) :
6                ( 'tests' => 5 );
7
8 use Wx::Perl::SplashFast '../../../wxpl.xpm', 800;
9
10 package myApp;
11
12 use base 'Wx::App';
13
14 sub OnInit {
15   my $this = shift;
16
17   $this->{FOO} = 'bar';
18   main::ok( 1, "OnInit was called" ); # OnInit called
19
20   my $timer = Wx::Timer->new( $this );
21
22   Wx::Event::EVT_TIMER( $this, -1, sub {
23                           $this->ExitMainLoop;
24                         } );
25
26   $timer->Start( 500, 1 );
27   Wx::WakeUpIdle;
28
29   1;
30 }
31
32 package main;
33
34 use Wx 'wxTheApp';
35
36 ok( 1, "compilation OK" ); # got there
37
38 my $app = myApp->new;
39
40 isa_ok( $app, 'myApp' );
41 is( $app->{FOO}, 'bar', "fields are preserved" );
42 is( wxTheApp, $app, "wxTheApp and myApp->new return the same value" );
43
44 wxTheApp->MainLoop();
45
46 # local variables:
47 # mode: cperl
48 # end: