use strict;
use warnings;
-use Test::More tests => 1 + 552; # use_ok + constants
+use SDL::Events;
+use Test::More tests => 1 + 610; # use_ok + constants
BEGIN { use_ok('SDL::Constants') }
is( SDL_ACTIVEEVENT, 1, 'SDL_ACTIVEEVENT should be imported' );
is( SDL_ACTIVEEVENT(), 1, 'SDL_ACTIVEEVENT() should also be available' );
+is( SDL_ACTIVEEVENTMASK, SDL_EVENTMASK(SDL_ACTIVEEVENT), 'SDL_ACTIVEVENTMASK should be imported');
+is( SDL_ACTIVEEVENTMASK(), SDL_EVENTMASK(SDL_ACTIVEEVENT), 'SDL_ACTIVEVENTMASK() should also be available');
is( SDL_ADDEVENT, 0, 'SDL_ADDEVENT should be imported' );
is( SDL_ADDEVENT(), 0, 'SDL_ADDEVENT() should also be available' );
is( SDL_ALLEVENTS, 0xFFFFFFFF, 'SDL_ALLEVENTS should be imported' );
is( SDL_DOUBLEBUF, 1073741824, 'SDL_DOUBLEBUF should be imported' );
is( SDL_DOUBLEBUF(), 1073741824, 'SDL_DOUBLEBUF() should also be available' );
-is( SDL_ENABLE, 1, 'SDL_ENABLE should be imported' );
-is( SDL_ENABLE(), 1, 'SDL_ENABLE() should also be available' );
+
+is( SDL_ENABLE, 1, 'SDL_ENABLE should be imported' );
+is( SDL_ENABLE(), 1, 'SDL_ENABLE() should also be available' );
+is( SDL_EVENT_RESERVEDA, 14, 'SDL_EVENT_RESERVEDA should be imported');
+is( SDL_EVENT_RESERVEDA(), 14, 'SDL_EVENT_RESERVEDA() should also be available');
+is( SDL_EVENT_RESERVEDB, 15, 'SDL_EVENT_RESERVEDB should be imported');
+is( SDL_EVENT_RESERVEDB(), 15, 'SDL_EVENT_RESERVEDB() should also be available');
+is( SDL_EVENT_RESERVED2, 18, 'SDL_EVENT_RESERVED2 should be imported');
+is( SDL_EVENT_RESERVED2(), 18, 'SDL_EVENT_RESERVED2() should also be available');
+is( SDL_EVENT_RESERVED3, 19, 'SDL_EVENT_RESERVED3 should be imported');
+is( SDL_EVENT_RESERVED3(), 19, 'SDL_EVENT_RESERVED3() should also be available');
+is( SDL_EVENT_RESERVED4, 20, 'SDL_EVENT_RESERVED4 should be imported');
+is( SDL_EVENT_RESERVED4(), 20, 'SDL_EVENT_RESERVED4() should also be available');
+is( SDL_EVENT_RESERVED5, 21, 'SDL_EVENT_RESERVED5 should be imported');
+is( SDL_EVENT_RESERVED5(), 21, 'SDL_EVENT_RESERVED5() should also be available');
+is( SDL_EVENT_RESERVED6, 22, 'SDL_EVENT_RESERVED6 should be imported');
+is( SDL_EVENT_RESERVED6(), 22, 'SDL_EVENT_RESERVED6() should also be available');
+is( SDL_EVENT_RESERVED7, 23, 'SDL_EVENT_RESERVED7 should be imported');
+is( SDL_EVENT_RESERVED7(), 23, 'SDL_EVENT_RESERVED7() should also be available');
+
is( SDL_FULLSCREEN, -2147483648, 'SDL_FULLSCREEN should be imported' );
is( SDL_FULLSCREEN(), -2147483648, 'SDL_FULLSCREEN() should also be available' );
is( SDL_JOYBUTTONUP(), 11, 'SDL_JOYBUTTONUP() should also be available' );
is( SDL_JOYHATMOTION, 9, 'SDL_JOYHATMOTION should be imported' );
is( SDL_JOYHATMOTION(), 9, 'SDL_JOYHATMOTION() should also be available' );
+is( SDL_JOYAXISMOTIONMASK, SDL_EVENTMASK(SDL_JOYAXISMOTION), 'SDL_JOYAXISMOTIONMASK should be imported');
+is( SDL_JOYAXISMOTIONMASK(), SDL_EVENTMASK(SDL_JOYAXISMOTION), 'SDL_JOYAXISMOTIONMASK() should also be available');
+is( SDL_JOYBALLMOTIONMASK, SDL_EVENTMASK(SDL_JOYBALLMOTION), 'SDL_JOYBALLMOTIONMASK should be imported');
+is( SDL_JOYBALLMOTIONMASK(), SDL_EVENTMASK(SDL_JOYBALLMOTION), 'SDL_JOYBALLMOTIONMASK() should also be available');
+is( SDL_JOYHATMOTIONMASK, SDL_EVENTMASK(SDL_JOYHATMOTION), 'SDL_JOYHATMOTIONMASK should be imported');
+is( SDL_JOYHATMOTIONMASK(), SDL_EVENTMASK(SDL_JOYHATMOTION), 'SDL_JOYHATMOTIONMASK() should also be available');
+is( SDL_JOYBUTTONDOWNMASK, SDL_EVENTMASK(SDL_JOYBUTTONDOWN), 'SDL_JOYBUTTONDOWNMASK should be imported');
+is( SDL_JOYBUTTONDOWNMASK(), SDL_EVENTMASK(SDL_JOYBUTTONDOWN), 'SDL_JOYBUTTONDOWNMASK() should also be available');
+is( SDL_JOYBUTTONUPMASK, SDL_EVENTMASK(SDL_JOYBUTTONUP), 'SDL_JOYBUTTONUPMASK should be imported');
+is( SDL_JOYBUTTONUPMASK(), SDL_EVENTMASK(SDL_JOYBUTTONUP), 'SDL_JOYBUTTONUPMASK() should also be available');
+is( SDL_JOYEVENTMASK, SDL_EVENTMASK(SDL_JOYAXISMOTION)|
+ SDL_EVENTMASK(SDL_JOYBALLMOTION)|
+ SDL_EVENTMASK(SDL_JOYHATMOTION)|
+ SDL_EVENTMASK(SDL_JOYBUTTONDOWN)|
+ SDL_EVENTMASK(SDL_JOYBUTTONUP), 'SDL_JOYEVENTMASK should be imported');
+is( SDL_JOYEVENTMASK(), SDL_EVENTMASK(SDL_JOYAXISMOTION)|
+ SDL_EVENTMASK(SDL_JOYBALLMOTION)|
+ SDL_EVENTMASK(SDL_JOYHATMOTION)|
+ SDL_EVENTMASK(SDL_JOYBUTTONDOWN)|
+ SDL_EVENTMASK(SDL_JOYBUTTONUP), 'SDL_JOYEVENTMASK() should also be available');
is( SDL_KEYDOWN, 2, 'SDL_KEYDOWN should be imported' );
is( SDL_KEYDOWN(), 2, 'SDL_KEYDOWN() should also be available' );
is( SDL_KEYUP, 3, 'SDL_KEYUP should be imported' );
is( SDL_KEYUP(), 3, 'SDL_KEYUP() should also be available' );
+is( SDL_KEYDOWNMASK, SDL_EVENTMASK(SDL_KEYDOWN), 'SDL_KEYDOWNMASK should be imported');
+is( SDL_KEYDOWNMASK(), SDL_EVENTMASK(SDL_KEYDOWN), 'SDL_KEYDOWNMASK() should also be available');
+is( SDL_KEYUPMASK, SDL_EVENTMASK(SDL_KEYUP), 'SDL_KEYUPMASK should be imported');
+is( SDL_KEYUPMASK(), SDL_EVENTMASK(SDL_KEYUP), 'SDL_KEYUPMASK() should also be available');
+is( SDL_KEYEVENTMASK, SDL_EVENTMASK(SDL_KEYDOWN)|
+ SDL_EVENTMASK(SDL_KEYUP), 'SDL_KEYEVENTMASK should be imported');
+is( SDL_KEYEVENTMASK(), SDL_EVENTMASK(SDL_KEYDOWN)|
+ SDL_EVENTMASK(SDL_KEYUP), 'SDL_KEYEVENTMASK() should also be available');
is( SDL_MIX_MAXVOLUME, 128, 'SDL_MIX_MAXVOLUME should be imported' );
is( SDL_MIX_MAXVOLUME(), 128, 'SDL_MIX_MAXVOLUME() should also be available' );
is( SDL_MOUSEBUTTONUP(), 6, 'SDL_MOUSEBUTTONUP() should also be available' );
is( SDL_MOUSEMOTION, 4, 'SDL_MOUSEMOTION should be imported' );
is( SDL_MOUSEMOTION(), 4, 'SDL_MOUSEMOTION() should also be available' );
+is( SDL_MOUSEMOTIONMASK, SDL_EVENTMASK(SDL_MOUSEMOTION), 'SDL_MOUSEMOTIONMASK should be imported');
+is( SDL_MOUSEMOTIONMASK(), SDL_EVENTMASK(SDL_MOUSEMOTION), 'SDL_MOUSEMOTIONMASK() should also be available');
+is( SDL_MOUSEBUTTONDOWNMASK, SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN), 'SDL_MOUSEBUTTONDOWNMASK should be imported');
+is( SDL_MOUSEBUTTONDOWNMASK(), SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN), 'SDL_MOUSEBUTTONDOWNMASK() should also be available');
+is( SDL_MOUSEBUTTONUPMASK, SDL_EVENTMASK(SDL_MOUSEBUTTONUP), 'SDL_MOUSEBUTTONUPMASK should be imported');
+is( SDL_MOUSEBUTTONUPMASK(), SDL_EVENTMASK(SDL_MOUSEBUTTONUP), 'SDL_MOUSEBUTTONUPMASK() should also be available');
+is( SDL_MOUSEEVENTMASK, SDL_EVENTMASK(SDL_MOUSEMOTION)|
+ SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN)|
+ SDL_EVENTMASK(SDL_MOUSEBUTTONUP), 'SDL_MOUSEEVENTMASK should be imported');
+is( SDL_MOUSEEVENTMASK(), SDL_EVENTMASK(SDL_MOUSEMOTION)|
+ SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN)|
+ SDL_EVENTMASK(SDL_MOUSEBUTTONUP), 'SDL_MOUSEEVENTMASK() should also be available');
+
+is( SDL_NOEVENT, 0, 'SDL_NOEVENT should be imported' );
+is( SDL_NOEVENT(), 0, 'SDL_NOEVENT() should also be available' );
+is( SDL_NUMEVENTS, 32, 'SDL_NUMEVENTS should be imported' );
+is( SDL_NUMEVENTS(), 32, 'SDL_NUMEVENTS() should also be available' );
is( SDL_OPENGL, 2, 'SDL_OPENGL should be imported' );
is( SDL_OPENGL(), 2, 'SDL_OPENGL() should also be available' );
is( SDL_QUERY(), -1, 'SDL_QUERY() should also be available' );
is( SDL_QUIT, 12, 'SDL_QUIT should be imported' );
is( SDL_QUIT(), 12, 'SDL_QUIT() should also be available' );
+is( SDL_QUITMASK, SDL_EVENTMASK(SDL_QUIT), 'SDL_QUITMASK should be imported');
+is( SDL_QUITMASK(), SDL_EVENTMASK(SDL_QUIT), 'SDL_QUITMASK() should also be available');
is( SDL_RELEASED, 0, 'SDL_RELEASED should be imported' );
is( SDL_RELEASED(), 0, 'SDL_RELEASED() should also be available' );
is( SDL_SWSURFACE(), 0, 'SDL_SWSURFACE() should also be available' );
is( SDL_SYSWMEVENT, 13, 'SDL_SYSWMEVENT should be imported' );
is( SDL_SYSWMEVENT(), 13, 'SDL_SYSWMEVENT() should also be available' );
+is( SDL_SYSWMEVENTMASK, SDL_EVENTMASK(SDL_SYSWMEVENT), 'SDL_SYSWMEVENTMASK should be imported');
+is( SDL_SYSWMEVENTMASK(), SDL_EVENTMASK(SDL_SYSWMEVENT), 'SDL_SYSWMEVENTMASK() should also be available');
+
+is( SDL_USEREVENT, 24, 'SDL_USEREVENT should be imported' );
+is( SDL_USEREVENT(), 24, 'SDL_USEREVENT() should also be available' );
+is( SDL_UYVY_OVERLAY, 1498831189, 'SDL_UYVY_OVERLAY should be imported' );
+is( SDL_UYVY_OVERLAY(), 1498831189, 'SDL_UYVY_OVERLAY() should also be available' );
+
+is( SDL_VIDEOEXPOSE, 17, 'SDL_VIDEOEXPOSE should be imported' );
+is( SDL_VIDEOEXPOSE(), 17, 'SDL_VIDEOEXPOSE() should also be available' );
+is( SDL_VIDEOEXPOSEMASK, SDL_EVENTMASK(SDL_VIDEOEXPOSE), 'SDL_VIDEOEXPOSEMASK should be imported');
+is( SDL_VIDEOEXPOSEMASK(), SDL_EVENTMASK(SDL_VIDEOEXPOSE), 'SDL_VIDEOEXPOSEMASK() should also be available');
+is( SDL_VIDEORESIZE, 16, 'SDL_VIDEORESIZE should be imported' );
+is( SDL_VIDEORESIZE(), 16, 'SDL_VIDEORESIZE() should also be available' );
+is( SDL_VIDEORESIZEMASK, SDL_EVENTMASK(SDL_VIDEORESIZE), 'SDL_VIDEORESIZEMASK should be imported');
+is( SDL_VIDEORESIZEMASK(), SDL_EVENTMASK(SDL_VIDEORESIZE), 'SDL_VIDEORESIZEMASK() should also be available');
-is( SDL_UYVY_OVERLAY, 1498831189, 'SDL_UYVY_OVERLAY should be imported' );
-is( SDL_UYVY_OVERLAY(), 1498831189,'SDL_UYVY_OVERLAY() should also be available' );
-
-is( SDL_VIDEOEXPOSE, 17, 'SDL_VIDEOEXPOSE should be imported' );
-is( SDL_VIDEOEXPOSE(), 17, 'SDL_VIDEOEXPOSE() should also be available' );
-is( SDL_VIDEORESIZE, 16, 'SDL_VIDEORESIZE should be imported' );
-is( SDL_VIDEORESIZE(), 16, 'SDL_VIDEORESIZE() should also be available' );
is( SDL_YUY2_OVERLAY, 844715353, 'SDL_YUY2_OVERLAY should be imported' );
is( SDL_YUY2_OVERLAY(), 844715353,'SDL_YUY2_OVERLAY() should also be available' );
use SDL::Video;
use Test::More;
-plan ( tests => 111 );
+plan ( tests => 66 );
my @done =qw/
pump_events
isa_ok( $wmevent, 'SDL::SysWMEvent', '[SDL::SysWMEvent::new] is creating an SysWMEvent');
isa_ok( $uevent, 'SDL::UserEvent', '[SDL::UserEvent::new] is creating an UserEvent');
-# checking constants
-is(SDL_NOEVENT, 0, 'Constant SDL_NOEVENT'); # Unused
-is(SDL_ACTIVEEVENT, 1, 'Constant SDL_ACTIVEVENT'); # Application loses/gains visibility
-is(SDL_KEYDOWN, 2, 'Constant SDL_KEYDOWN'); # Keys pressed
-is(SDL_KEYUP, 3, 'Constant SDL_KEYUP'); # Keys released
-is(SDL_MOUSEMOTION, 4, 'Constant SDL_MOUSEMOTION'); # Mouse moved
-is(SDL_MOUSEBUTTONDOWN, 5, 'Constant SDL_MOUSEBUTTONDOWN'); # Mouse button pressed
-is(SDL_MOUSEBUTTONUP, 6, 'Constant SDL_MOUSEBUTTONUP'); # Mouse button released
-is(SDL_JOYAXISMOTION, 7, 'Constant SDL_JOYAXISMOTION'); # Joystick axis motion
-is(SDL_JOYBALLMOTION, 8, 'Constant SDL_JOYBALLMOTION'); # Joystick trackball motion
-is(SDL_JOYHATMOTION, 9, 'Constant SDL_JOYHATMOTION'); # Joystick hat position change
-is(SDL_JOYBUTTONDOWN, 10, 'Constant SDL_JOYBUTTONDOWN'); # Joystick button pressed
-is(SDL_JOYBUTTONUP, 11, 'Constant SDL_JOYBUTTONUP'); # Joystick button released
-is(SDL_QUIT, 12, 'Constant SDL_QUIT'); # User-requested quit
-is(SDL_SYSWMEVENT, 13, 'Constant SDL_SYSWMEVENT'); # System specific event
-is(SDL_EVENT_RESERVEDA, 14, 'Constant SDL_EVENT_RESERVEDA'); # Reserved for future use..
-is(SDL_EVENT_RESERVEDB, 15, 'Constant SDL_EVENT_RESERVEDB'); # Reserved for future use..
-is(SDL_VIDEORESIZE, 16, 'Constant SDL_VIDEORESIZE'); # User resized video mode
-is(SDL_VIDEOEXPOSE, 17, 'Constant SDL_VIDEOEXPOSE'); # Screen needs to be redrawn
-is(SDL_EVENT_RESERVED2, 18, 'Constant SDL_EVENT_RESERVED2'); # Reserved for future use..
-is(SDL_EVENT_RESERVED3, 19, 'Constant SDL_EVENT_RESERVED3'); # Reserved for future use..
-is(SDL_EVENT_RESERVED4, 20, 'Constant SDL_EVENT_RESERVED4'); # Reserved for future use..
-is(SDL_EVENT_RESERVED5, 21, 'Constant SDL_EVENT_RESERVED5'); # Reserved for future use..
-is(SDL_EVENT_RESERVED6, 22, 'Constant SDL_EVENT_RESERVED6'); # Reserved for future use..
-is(SDL_EVENT_RESERVED7, 23, 'Constant SDL_EVENT_RESERVED7'); # Reserved for future use..
-is(SDL_USEREVENT, 24, 'Constant SDL_USEREVENT');
-is(SDL_NUMEVENTS, 32, 'Constant SDL_NUMEVENTS');
-
-# checking eventmasks
-is(SDL_ACTIVEEVENTMASK, SDL_EVENTMASK(SDL_ACTIVEEVENT), 'Constant SDL_ACTIVEVENTMASK');
-is(SDL_KEYDOWNMASK, SDL_EVENTMASK(SDL_KEYDOWN), 'Constant SDL_KEYDOWNMASK');
-is(SDL_KEYUPMASK, SDL_EVENTMASK(SDL_KEYUP), 'Constant SDL_KEYUPMASK');
-is(SDL_KEYEVENTMASK, SDL_EVENTMASK(SDL_KEYDOWN)|
- SDL_EVENTMASK(SDL_KEYUP), 'Constant SDL_KEYEVENTMASK');
-is(SDL_MOUSEMOTIONMASK, SDL_EVENTMASK(SDL_MOUSEMOTION), 'Constant SDL_MOUSEMOTIONMASK');
-is(SDL_MOUSEBUTTONDOWNMASK, SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN), 'Constant SDL_MOUSEBUTTONDOWNMASK');
-is(SDL_MOUSEBUTTONUPMASK, SDL_EVENTMASK(SDL_MOUSEBUTTONUP), 'Constant SDL_MOUSEBUTTONUPMASK');
-is(SDL_MOUSEEVENTMASK, SDL_EVENTMASK(SDL_MOUSEMOTION)|
- SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN)|
- SDL_EVENTMASK(SDL_MOUSEBUTTONUP), 'Constant SDL_MOUSEEVENTMASK');
-is(SDL_JOYAXISMOTIONMASK, SDL_EVENTMASK(SDL_JOYAXISMOTION), 'Constant SDL_JOYAXISMOTIONMASK');
-is(SDL_JOYBALLMOTIONMASK, SDL_EVENTMASK(SDL_JOYBALLMOTION), 'Constant SDL_JOYBALLMOTIONMASK');
-is(SDL_JOYHATMOTIONMASK, SDL_EVENTMASK(SDL_JOYHATMOTION), 'Constant SDL_JOYHATMOTIONMASK');
-is(SDL_JOYBUTTONDOWNMASK, SDL_EVENTMASK(SDL_JOYBUTTONDOWN), 'Constant SDL_JOYBUTTONDOWNMASK');
-is(SDL_JOYBUTTONUPMASK, SDL_EVENTMASK(SDL_JOYBUTTONUP), 'Constant SDL_JOYBUTTONUPMASK');
-is(SDL_JOYEVENTMASK, SDL_EVENTMASK(SDL_JOYAXISMOTION)|
- SDL_EVENTMASK(SDL_JOYBALLMOTION)|
- SDL_EVENTMASK(SDL_JOYHATMOTION)|
- SDL_EVENTMASK(SDL_JOYBUTTONDOWN)|
- SDL_EVENTMASK(SDL_JOYBUTTONUP), 'Constant SDL_JOYEVENTMASK');
-is(SDL_VIDEORESIZEMASK, SDL_EVENTMASK(SDL_VIDEORESIZE), 'Constant SDL_VIDEORESIZEMASK');
-is(SDL_VIDEOEXPOSEMASK, SDL_EVENTMASK(SDL_VIDEOEXPOSE), 'Constant SDL_VIDEOEXPOSEMASK');
-is(SDL_QUITMASK, SDL_EVENTMASK(SDL_QUIT), 'Constant SDL_QUITMASK');
-is(SDL_SYSWMEVENTMASK, SDL_EVENTMASK(SDL_SYSWMEVENT), 'Constant SDL_SYSWMEVENTMASK');
-is(SDL_ALLEVENTS, 0xFFFFFFFF, 'Constant SDL_SYSWMEVENTMASK');
-
# checking the ->type of an event
#is($event->type, SDL_EVENT, '[SDL::Event->type] returns correctly');
is($aevent->type, SDL_ACTIVEEVENT, '[SDL::ActiveEvent->type] returns correctly');