3 # Copyright (C) 2003,2006 Tels
4 # Copyright (C) 2004 David J. Goehrig
6 # basic testing of SDL::Color
9 unshift @INC, 'blib/lib','blib/arch';
18 use_ok( 'SDL::Color' );
20 can_ok ('SDL::Color', qw/
30 my $color = SDL::Color->new();
31 is (ref($color), 'SDL::Color', 'new was ok');
32 is ($color->r(),0, 'r is 0');
33 is ($color->g(),0, 'g is 0');
34 is ($color->b(),0, 'b is 0');
36 is (join(":", $color->rgb()), '0:0:0', 'r, g and b are 0');
38 $color = SDL::Color->new( -r => 0xff, -g => 0xff, -b => 0xff);
39 is (ref($color), 'SDL::Color', 'new was ok');
40 is ($color->r(),255, 'r is 255');
41 is ($color->g(),255, 'g is 255');
42 is ($color->b(),255, 'b is 255');
44 is (join(":", $color->rgb()), '255:255:255', 'r, g and b are 255');
45 is (join(":", $color->rgb(128,0,80)), '128:0:80', 'r, g and b are set');
46 is (join(":", $color->rgb()), '128:0:80', 'r, g and b still set');
48 # test the new new($r,$g,$b) calling style
49 $color = SDL::Color->new( 255,70,128);
50 is (join(":", $color->rgb()), '255:70:128', 'r, g and b are set via new($r,$g,$b)');