4 use Test::More tests => 9;
5 use_ok('SDL::Palette');
7 can_ok('SDL::Palette', qw/ ncolors colors color_index /);
13 SDL::Init(SDL_INIT_VIDEO);
15 my $display = SDL::SetVideoMode(640,480,32, SDL_SWSURFACE );
17 isa_ok($display->format, 'SDL::PixelFormat', 'Are we a SDL::PixelFormat?');
19 is( !defined $display->format->palette , 1, 'Palette is not defined as BitPerPixels is greater then 8');
21 $display = SDL::SetVideoMode(640,480,8, SDL_SWSURFACE );
22 isa_ok($display->format, 'SDL::PixelFormat', 'Are we a SDL::PixelFormat?');
24 isa_ok( $display->format->palette , 'SDL::Palette', 'Palette is SDL::Palette when BitPerPixels is 8 ');
26 is( $display->format->palette->ncolors, 256, '256 colors in palette');
28 isa_ok( $display->format->palette->colors(), 'ARRAY', 'Palette->colors[x] is a color');
30 isa_ok( $display->format->palette->color_index(23), 'SDL::Color', 'Palette->color_index() is a SDL::Color');