First commit of SDL_Perl-2.1.3
[sdlgit/SDL_perl.git] / t / timerpm.t
1 #!/usr/bin/perl -w
2 #
3 # Copyright (C) 2003 Tels
4 # Copyright (C) 2004 David J. Goehrig
5 #
6 # basic testing of SDL::Timer
7
8 BEGIN {
9         unshift @INC, 'blib/lib','blib/arch';
10 }
11
12 use strict;
13 use SDL;
14 use SDL::Config;
15
16 use Test::More;
17
18 plan ( tests => 4 );
19
20 use_ok( 'SDL::Timer' ); 
21   
22 can_ok ('SDL::Timer', qw/
23         new run stop
24         /);
25
26 my $fired = 0;
27
28 SDL::Init(SDL_INIT_TIMER);
29
30 my $timer = new SDL::Timer 
31         sub { $fired++ }, -delay => 30, -times => 1;
32
33 isa_ok($timer, 'SDL::Timer');
34
35 SDL::Delay(100);
36 is ($fired, 1,'timer fired once');