Browse files

Fix controller tests

  • Loading branch information...
1 parent f60bc23 commit 6598ad11d6f9d503584bb91d8107500b4b88af09 @Blaizer Blaizer committed Apr 7, 2012
Showing with 4 additions and 29 deletions.
  1. +3 −3 lib/SDLx/Controller.pm
  2. +1 −26 t/sdlx_controller.t
View
6 lib/SDLx/Controller.pm
@@ -144,7 +144,7 @@ sub stop {
}
sub stopped {
# returns true if the app is stopped or about to stop
- $_stop{ refaddr $_[0]};
+ $_stop{ refaddr $_[0] };
}
sub _pause {
@@ -171,12 +171,12 @@ sub pause {
# if we're going to stop we don't want to pause
return if !$_paused{ $ref } and $_stop{ $ref };
- $_paused{ $ref } = $callback;
$_stop{ $ref } = 1;
+ $_paused{ $ref } = $callback;
}
sub paused {
# returns the callback (always true) if the app is paused or about to pause
- $_paused{ refaddr $_[0]};
+ $_paused{ refaddr $_[0] };
}
sub _event {
View
27 t/sdlx_controller.t
@@ -173,32 +173,6 @@ ok( $app->stopped, 'stopped still true when used stop' );
is( $in_callback, 3, 'callback called exactly three times' );
}
-# stop handler ending pause
-{
- my $in_callback;
-
- $app = SDLx::Controller->new(
- show_handlers => [sub {
- my $event = SDL::Event->new;
- my $quit_event = SDL::Event->new;
- $quit_event->type(SDL_QUIT);
- SDL::Events::push_event($event);
- SDL::Events::push_event($event);
- SDL::Events::push_event($quit_event);
-
- $app->pause(sub {
- $in_callback++;
- return;
- });
- }],
- );
- $app->run;
-
- ok( $app->stopped, 'stopped true after being paused' );
- ok( !$app->paused, 'paused not true after stopped' );
- is( $in_callback, 2, 'callback only called twice' );
-}
-
# stop overriding pause
{
my $didnt_override;
@@ -338,6 +312,7 @@ is($app->stop_handler, \&dummy_sub2, 'stop_handler set in constructor' );
$app = SDLx::Controller->new(
dt => 0.1,
min_t => 0.5,
+ max_t => 1e9999,
);
sub dummy_sub {1}

0 comments on commit 6598ad1

Please sign in to comment.