File: 04_app.t

package info (click to toggle)
libwx-perl 1%3A0.9909-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 3,912 kB
  • sloc: cpp: 9,728; perl: 8,182; ansic: 626; makefile: 41
file content (48 lines) | stat: -rwxr-xr-x 933 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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: