14 use_ok( 'SDL::Video' );
35 can_ok ('SDL::Video', @done);
37 #testing get_video_surface
38 SDL::init(SDL_INIT_VIDEO);
40 my $display = SDL::Video::set_video_mode(640,480,32, SDL_SWSURFACE );
43 plan skip_all => 'Couldn\'t set video mode: '. SDL::geterror();
46 #diag('Testing SDL::Video');
48 isa_ok(SDL::Video::get_video_surface(), 'SDL::Surface', '[get_video_surface] Checking if we get a surface ref back');
50 isa_ok(SDL::Video::get_video_info(), 'SDL::VideoInfo', '[get_video_info] Checking if we get videoinfo ref back');
52 my $driver_name = SDL::Video::video_driver_name();
54 pass '[video_driver_name] This is your driver name: '.$driver_name;
58 is( ref( SDL::Video::list_modes( $display->format , SDL_SWSURFACE )), 'ARRAY', '[list_modes] Returned an ARRAY! ');
60 cmp_ok(SDL::Video::video_mode_ok( 100, 100, 16, SDL_SWSURFACE), '>=', 0, "[video_mode_ok] Checking if an integer was return");
62 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');
65 #TODO: Write to surface and check inf pixel in that area got updated.
67 SDL::Video::update_rect($display, 0, 0, 0, 0);
69 #TODO: Write to surface and check inf pixel in that area got updated.
70 SDL::Video::update_rects($display, SDL::Rect->new(0, 10, 20, 20));
72 my $value = SDL::Video::flip($display);
73 is( ($value == 0) || ($value == -1), 1, '[flip] returns 0 or -1' );
75 $value = SDL::Video::set_colors($display, 0, SDL::Color->new(0,0,0));
76 is( $value , 0, '[set_colors] returns 0 trying to write to 32 bit display' );
78 $value = SDL::Video::set_palette($display, SDL_LOGPAL|SDL_PHYSPAL, 0);
80 is( $value , 0, '[set_palette] returns 0 trying to write to 32 bit surface' );
83 SDL::Video::set_gamma_ramp($zero, $zero, $zero); pass '[set_gamma_ramp] ran';
85 SDL::Video::set_gamma( 1.0, 1.0, 1.0 ); pass '[set_gamma] ran ';
89 for(my $i=0;$i<256;$i++){
90 $b_w_colors[$i] = SDL::Color->new($i,$i,$i);
92 my $hwdisplay = SDL::Video::set_video_mode(640,480,8, SDL_HWSURFACE );
95 plan skip_all => 'Couldn\'t set video mode: '. SDL::geterror();
98 $value = SDL::Video::set_colors($hwdisplay, 0);
99 is( $value , 0, '[set_colors] returns 0 trying to send empty colors to 8 bit surface' );
101 $value = SDL::Video::set_palette($hwdisplay, SDL_LOGPAL|SDL_PHYSPAL, 0);
103 is( $value , 0, '[set_palette] returns 0 trying to send empty colors to 8 bit surface' );
106 $value = SDL::Video::set_colors($hwdisplay, 0, @b_w_colors);
107 is( $value , 1, '[set_colors] returns '.$value );
109 $value = SDL::Video::set_palette($hwdisplay, SDL_LOGPAL|SDL_PHYSPAL, 0, @b_w_colors );
111 is( $value , 1, '[set_palette] returns 1' );
114 is( SDL::Video::map_RGB($hwdisplay->format, 10, 10 ,10) > 0, 1, '[map_RGB] maps correctly to 8-bit surface');
115 is( SDL::Video::map_RGBA($hwdisplay->format, 10, 10 ,10, 10) > 0, 1, '[map_RGBA] maps correctly to 8-bit surface');
121 create_RGB_surface_from
146 my $why = '[Percentage Completion] '.int( 100 * $#done / ($#done + $#left) ) ."\% implementation. $#done / ".($#done+$#left);
151 pass "\nThe following functions:\n".join ",", @left;
156 pass 'Are we still alive? Checking for segfaults';