Fixed the pod path in archive
[sdlgit/SDL_perl.git] / t / core_palette.t
1 #!perl
2 use strict;
3 use warnings;
4 use Test::More tests => 9;
5 use_ok('SDL::Palette');
6
7 can_ok('SDL::Palette', qw/ ncolors colors color_index /); 
8
9 use SDL;
10 use SDL::Surface;
11 use SDL::PixelFormat;
12
13 SDL::init(SDL_INIT_VIDEO);
14
15 my $display = SDL::SetVideoMode(640,480,32, SDL_SWSURFACE );
16
17 isa_ok($display->format, 'SDL::PixelFormat', 'Are we a SDL::PixelFormat?');
18
19 is( !defined $display->format->palette , 1, 'Palette is not defined as BitPerPixels is greater then 8');
20
21 $display = SDL::SetVideoMode(640,480,8, SDL_SWSURFACE );
22 isa_ok($display->format, 'SDL::PixelFormat', 'Are we a SDL::PixelFormat?');
23
24 isa_ok( $display->format->palette , 'SDL::Palette', 'Palette is SDL::Palette when BitPerPixels is 8 ');
25
26 is( $display->format->palette->ncolors, 256, '256 colors in palette');
27
28 isa_ok( $display->format->palette->colors(), 'ARRAY', 'Palette->colors[x] is a color');
29
30 isa_ok( $display->format->palette->color_index(23), 'SDL::Color', 'Palette->color_index() is a SDL::Color');
31