14 use_ok( 'SDL::Video' );
31 can_ok ('SDL::Video', @done);
33 #testing get_video_surface
34 SDL::Init(SDL_INIT_VIDEO);
36 my $display = SDL::Video::set_video_mode(640,480,32, SDL_SWSURFACE );
39 plan skip_all => 'Couldn\'t set video mode: '. SDL::GetError();
42 #diag('Testing SDL::Video');
44 isa_ok(SDL::Video::get_video_surface(), 'SDL::Surface', '[get_video_surface] Checking if we get a surface ref back');
46 isa_ok(SDL::Video::get_video_info(), 'SDL::VideoInfo', '[get_video_info] Checking if we get videoinfo ref back');
48 my $driver_name = SDL::Video::video_driver_name();
50 pass '[video_driver_name] This is your driver name: '.$driver_name;
54 is( ref( SDL::Video::list_modes( $display->format , SDL_SWSURFACE )), 'ARRAY', '[list_modes] Returned an ARRAY! ');
56 cmp_ok(SDL::Video::video_mode_ok( 100, 100, 16, SDL_SWSURFACE), '>=', 0, "[video_mode_ok] Checking if an integer was return");
58 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');
61 #TODO: Write to surface and check inf pixel in that area got updated.
63 SDL::Video::update_rect($display, 0, 0, 0, 0);
65 #TODO: Write to surface and check inf pixel in that area got updated.
66 SDL::Video::update_rects($display, SDL::Rect->new(0, 10, 20, 20));
68 my $value = SDL::Video::flip($display);
69 is( ($value == 0) || ($value == -1), 1, '[flip] returns 0 or -1' );
71 $value = SDL::Video::set_colors($display, 0, SDL::Color->new(0,0,0));
72 is( $value , 0, '[set_colors] returns 0 trying to write to 32 bit display' );
74 $value = SDL::Video::set_palette($display, 0x01|0x02, 0);
76 is( $value , 0, '[set_palette] returns 0 trying to write to 32 bit surface' );
82 for(my $i=0;$i<256;$i++){
83 $b_w_colors[$i] = SDL::Color->new($i,$i,$i);
85 my $hwdisplay = SDL::Video::set_video_mode(640,480,8, SDL_HWSURFACE );
88 plan skip_all => 'Couldn\'t set video mode: '. SDL::GetError();
91 $value = SDL::Video::set_colors($hwdisplay, 0);
92 is( $value , 0, '[set_colors] returns 0 trying to send empty colors to 8 bit surface' );
94 $value = SDL::Video::set_palette($hwdisplay, 0x01|0x02, 0);
96 is( $value , 0, '[set_palette] returns 0 trying to send empty colors to 8 bit surface' );
99 $value = SDL::Video::set_colors($hwdisplay, 0, @b_w_colors);
100 is( $value , 1, '[set_colors] returns '.$value );
102 $value = SDL::Video::set_palette($hwdisplay, 0x01|0x02, 0, @b_w_colors );
104 is( $value , 1, '[set_palette] returns 1' );
118 create_RGB_surface_from
143 my $why = '[Percentage Completion] '.int( 100 * $#done / ($#done + $#left) ) ."\% implementation. $#done / ".($#done+$#left);
148 pass "\nThe following functions:\n".join ",", @left;
153 pass 'Are we still alive? Checking for segfaults';