Add libwx-perl
[pkg-perl] / deb-src / libwx-perl / libwx-perl-0.96 / ext / pperl / splashfast / t / 04_app.t
diff --git a/deb-src/libwx-perl/libwx-perl-0.96/ext/pperl/splashfast/t/04_app.t b/deb-src/libwx-perl/libwx-perl-0.96/ext/pperl/splashfast/t/04_app.t
new file mode 100755 (executable)
index 0000000..67e910d
--- /dev/null
@@ -0,0 +1,48 @@
+#!/usr/bin/perl -w
+
+use lib '../../../t';
+use Test::More ( $^O eq 'MSWin32' && $] == 5.008000 ) ?
+               ( 'skip_all' => 'Bug with Win32 WM_TIMER handling in 5.8.0' ) :
+               ( 'tests' => 5 );
+
+use Wx::Perl::SplashFast '../../../wxpl.xpm', 800;
+
+package myApp;
+
+use base 'Wx::App';
+
+sub OnInit {
+  my $this = shift;
+
+  $this->{FOO} = 'bar';
+  main::ok( 1, "OnInit was called" ); # OnInit called
+
+  my $timer = Wx::Timer->new( $this );
+
+  Wx::Event::EVT_TIMER( $this, -1, sub {
+                          $this->ExitMainLoop;
+                        } );
+
+  $timer->Start( 500, 1 );
+  Wx::WakeUpIdle;
+
+  1;
+}
+
+package main;
+
+use Wx 'wxTheApp';
+
+ok( 1, "compilation OK" ); # got there
+
+my $app = myApp->new;
+
+isa_ok( $app, 'myApp' );
+is( $app->{FOO}, 'bar', "fields are preserved" );
+is( wxTheApp, $app, "wxTheApp and myApp->new return the same value" );
+
+wxTheApp->MainLoop();
+
+# local variables:
+# mode: cperl
+# end: