7dbb66b1268c98d2c349b252ddf5cd4c2c8450be
[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 => 9 );
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         /);
25
26 #testing get_video_surface
27 SDL::Init(SDL_INIT_VIDEO);                                                                          
28                                                                                                     
29 my $display = SDL::SetVideoMode(640,480,32, SDL_SWSURFACE );
30
31 #diag('Testing SDL::Video');
32
33 isa_ok(SDL::Video::get_video_surface(), 'SDL::Surface', '[get_video_surface] Checking if we get a surface ref back'); 
34
35 isa_ok(SDL::Video::get_video_info(), 'SDL::VideoInfo', '[get_video_info] Checking if we get videoinfo ref back');
36
37 my $driver_name = SDL::Video::video_driver_name();
38
39 pass '[video_driver_name] This is your driver name: '.$driver_name;
40
41
42
43 is( ref( SDL::Video::list_modes( $display->format , SDL_SWSURFACE )), 'ARRAY', '[list_modes] Returned an ARRAY! ');
44
45 cmp_ok(SDL::Video::video_mode_ok( 100, 100, 16, SDL_SWSURFACE), '>=', 0, "[video_mode_ok] Checking if an integer was return");
46
47 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'); 
48
49
50
51 #TODO: Write to surface and check inf pixel in that area got updated.
52
53 SDL::Video::update_rect($display, 0, 0, 0, 0);
54
55 #TODO: Write to surface and check inf pixel in that area got updated.
56 SDL::Video::update_rects($display, SDL::Rect->new(0, 10, 20, 20));
57
58 pass "Are we still alive?";
59
60 =skip
61         video_mode_ok
62         set_video_mode
63         update_rect
64         update_rects
65         flip
66         set_colors
67         set_palette
68         set_gamma
69         get_gamma_ramp
70         set_gmmma_ramp
71         map_RGB
72         map_RGBA
73         get_RGB
74         get_RGBA
75         create_RGB_surface_from
76         lock_surface
77         unlock_surface
78         convert_surface
79         display_format
80         display_format_alpha
81         load_BMP
82         save_BMP
83         set_color_key
84         set_alpha
85         set_clip_rect
86         get_clip_rect
87         blit_surface
88         fill_rect
89         GL_load_library
90         GL_get_proc_address
91         GL_get_attribute
92         GL_set_attribute
93         GL_swap_buffers
94         GL_attr
95         lock_YUV_overlay
96         unlock_YUV_overlay
97         display_YUV_overlay
98         /);
99