d7cf95545a62ca1bc92409b8d207f85ccf2c6da8
[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 my $value = SDL::Video::flip($display);
60 is( ($value == 0)  ||  ($value == -1), 1,  '[flip] returns 0 or -1'  );
61
62 pass "Are we still alive?";
63
64 =skip
65         get_video_surface
66         get_video_info
67         video_driver_name
68         list_modes
69         set_video_mode
70         video_mode_ok
71         update_rect
72         update_rects
73         flip
74         set_colors
75         set_palette
76         set_gamma
77         get_gamma_ramp
78         set_gmmma_ramp
79         map_RGB
80         map_RGBA
81         get_RGB
82         get_RGBA
83         create_RGB_surface_from
84         lock_surface
85         unlock_surface
86         convert_surface
87         display_format
88         display_format_alpha
89         load_BMP
90         save_BMP
91         set_color_key
92         set_alpha
93         set_clip_rect
94         get_clip_rect
95         blit_surface
96         fill_rect
97         GL_load_library
98         GL_get_proc_address
99         GL_get_attribute
100         GL_set_attribute
101         GL_swap_buffers
102         GL_attr
103         lock_YUV_overlay
104         unlock_YUV_overlay
105         display_YUV_overlay
106         /);
107