int action
Uint32 mask
CODE:
- if(!(action & (SDL_ADDEVENT | SDL_PEEKEVENT | SDL_GETEVENT)))
+ if(action != (action & (SDL_ADDEVENT | SDL_PEEKEVENT | SDL_GETEVENT)))
{
- croak('Value of \'action\' should be SDL_ADDEVENT, SDL_PEEKEVENT or SDL_GETEVENT.');
+ croak("Value of 'action' should be SDL_ADDEVENT, SDL_PEEKEVENT or SDL_GETEVENT.");
}
RETVAL = SDL_PeepEvents(events,numevents,action,mask);
OUTPUT:
RETVAL = SDL_PollEvent(event);
OUTPUT:
RETVAL
+
+int
+events_push_event(event)
+ SDL_Event *event
+ CODE:
+ RETVAL = SDL_PushEvent(event);
+ OUTPUT:
+ RETVAL
+
+int
+events_wait_event(event = NULL)
+ SDL_Event *event
+ CODE:
+ RETVAL = SDL_WaitEvent(event);
+ OUTPUT:
+ RETVAL
\ No newline at end of file
#use SDL::Video;
use Test::More;
-plan ( tests => 7 );
+plan ( tests => 14 );
my @done =qw/
pump_events
peep_events
poll_event
+push_event
+wait_event
/;
my $value = SDL::Events::poll_event($event);
is(($value == 1) || ($value == 0), 1, '[poll_event] Returns 1 or 0');
+my $event2 = SDL::Event->new();
+is(SDL::Events::push_event($event2), 0, '[push_event] Returns 0 on success');
+my $event3 = SDL::Event->new();
+is(SDL::Events::push_event($event3), 0, '[push_event] Returns 0 on success');
+
+my $events2 = SDL::Event->new();
+my $num_peep_events2 = SDL::Events::peep_events( $events2, 127, SDL_PEEKEVENT, SDL_ALLEVENTS);
+is($num_peep_events2 > $num_peep_events, 1, '[peep_events] Size of event queue is ' . $num_peep_events2);
+
+my $events3 = SDL::Event->new();
+$num_peep_events = SDL::Events::peep_events( $events3, 1, SDL_ADDEVENT, SDL_ALLEVENTS);
+is($num_peep_events, 1, '[peep_events] Added 1 event to the back of the queue');
+
+my $events4 = SDL::Event->new();
+$num_peep_events = SDL::Events::peep_events( $events4, 1, SDL_GETEVENT, SDL_ALLEVENTS);
+is($num_peep_events, 1, '[peep_events] Got 1 event from the front of the queue');
+
+my $event4 = SDL::Event->new();
+is(SDL::Events::wait_event($event4), 1, '[wait_event] Returns 1 on success');
+is(SDL::Events::wait_event(), 1, '[wait_event] Returns 1 on success');
+
my @left = qw/
-waitevent
-pushevent
seteventfilter
eventstate
getkeystate