4f03b98b61faeccd3ea98bd8b3c91a268d2d6452
[sdlgit/SDL_perl.git] / t / core_video.t
1 #!/usr/bin/perl -w
2 use strict;
3 use SDL;
4 use SDL::Surface;
5 use SDL::Config;
6 use Devel::Peek;
7 use Data::Dumper;
8 use Test::More;
9 use SDL::Rect;
10
11 plan ( tests => 10 );
12
13 use_ok( 'SDL::Video' ); 
14   
15 can_ok ('SDL::Video', qw/
16         get_video_surface
17         get_video_info
18         video_driver_name
19         list_modes
20         set_video_mode
21         video_mode_ok
22         update_rect
23         update_rects
24         flip
25         /);
26
27 #testing get_video_surface
28 SDL::Init(SDL_INIT_VIDEO);                                                                          
29                                                                                                     
30 my $display = SDL::SetVideoMode(640,480,32, SDL_SWSURFACE );
31
32 #diag('Testing SDL::Video');
33
34 isa_ok(SDL::Video::get_video_surface(), 'SDL::Surface', '[get_video_surface] Checking if we get a surface ref back'); 
35
36 isa_ok(SDL::Video::get_video_info(), 'SDL::VideoInfo', '[get_video_info] Checking if we get videoinfo ref back');
37
38 my $driver_name = SDL::Video::video_driver_name();
39
40 pass '[video_driver_name] This is your driver name: '.$driver_name;
41
42
43
44 is( ref( SDL::Video::list_modes( $display->format , SDL_SWSURFACE )), 'ARRAY', '[list_modes] Returned an ARRAY! ');
45
46 cmp_ok(SDL::Video::video_mode_ok( 100, 100, 16, SDL_SWSURFACE), '>=', 0, "[video_mode_ok] Checking if an integer was return");
47
48 isa_ok(SDL::Video::set_video_mode( 100, 100 ,16, SDL_SWSURFACE), 'SDL::Surface', '[set_video_more] Checking if we get a surface ref back'); 
49
50
51
52 #TODO: Write to surface and check inf pixel in that area got updated.
53
54 SDL::Video::update_rect($display, 0, 0, 0, 0);
55
56 #TODO: Write to surface and check inf pixel in that area got updated.
57 SDL::Video::update_rects($display, SDL::Rect->new(0, 10, 20, 20));
58
59 is( (SDL::Video::flip($display) == 0 || -1), 1,  '[flip] returns 0 or -1'  );
60
61 pass "Are we still alive?";
62
63 =skip
64         get_video_surface
65         get_video_info
66         video_driver_name
67         list_modes
68         set_video_mode
69         video_mode_ok
70         update_rect
71         update_rects
72         flip
73         set_colors
74         set_palette
75         set_gamma
76         get_gamma_ramp
77         set_gmmma_ramp
78         map_RGB
79         map_RGBA
80         get_RGB
81         get_RGBA
82         create_RGB_surface_from
83         lock_surface
84         unlock_surface
85         convert_surface
86         display_format
87         display_format_alpha
88         load_BMP
89         save_BMP
90         set_color_key
91         set_alpha
92         set_clip_rect
93         get_clip_rect
94         blit_surface
95         fill_rect
96         GL_load_library
97         GL_get_proc_address
98         GL_get_attribute
99         GL_set_attribute
100         GL_swap_buffers
101         GL_attr
102         lock_YUV_overlay
103         unlock_YUV_overlay
104         display_YUV_overlay
105         /);
106