Skipping some tests for now
[sdlgit/SDL_perl.git] / t / colorpm.t
1 #!perl
2 use strict;
3 use warnings;
4 use Test::More tests => 15;
5 use_ok('SDL::Color');
6
7 # check empty: black
8 my $black = SDL::Color->new( 0, 0, 0 );
9 isa_ok( $black, 'SDL::Color' );
10 is( $black->r(), 0, 'black r is 0' );
11 is( $black->g(), 0, 'black g is 0' );
12 is( $black->b(), 0, 'black b is 0' );
13
14 # check full: white
15 my $white = SDL::Color->new( 0xff, 0xff, 0xff );
16 isa_ok( $white, 'SDL::Color' );
17 is( $white->r(), 255, 'white r is 255' );
18 is( $white->g(), 255, 'white g is 255' );
19 is( $white->b(), 255, 'white b is 255' );
20
21 # check setting a value
22 my $orange = $white;
23 $orange->r(254);
24 $orange->g(153);
25 $orange->b(0);
26 is( $orange->r(), 254, 'orange_notcloned r is 254' );
27 is( $orange->g(), 153, 'orange_notcloned g is 153' );
28 is( $orange->b(), 0,   'orange_notcloned b is 0' );
29
30 # check that copies also change
31 is( $white->r(), 254, 'white (now orange) r is 254' );
32 is( $white->g(), 153, 'white (now orange) g is 154' );
33 is( $white->b(), 0,   'white (now orange) b is 0' );