File: 03hsl.t

package info (click to toggle)
libconvert-color-perl 0.08-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 256 kB
  • sloc: perl: 1,546; makefile: 2
file content (37 lines) | stat: -rw-r--r-- 1,091 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/perl

use Test::More tests => 16;

use Convert::Color::HSL;

my $red = Convert::Color::HSL->new( 0, 1, 0.5 );

is( $red->hue,          0, 'red hue' );
is( $red->saturation,   1, 'red saturation' );
is( $red->lightness,  0.5, 'red lightness' );

is_deeply( [ $red->hsl ], [ 0, 1, 0.5 ], 'red hsl' );

my $green = Convert::Color::HSL->new( 120, 1, 0.5 );

is( $green->hue,        120, 'green hue' );
is( $green->saturation,   1, 'green saturation' );
is( $green->lightness,  0.5, 'green lightness' );

is_deeply( [ $green->hsl ], [ 120, 1, 0.5 ], 'green hsl' );

my $blue = Convert::Color::HSL->new( 240, 1, 0.5 );

is( $blue->hue,        240, 'blue hue' );
is( $blue->saturation,   1, 'blue saturation' );
is( $blue->lightness,  0.5, 'blue lightness' );

is_deeply( [ $blue->hsl ], [ 240, 1, 0.5 ], 'blue hsl' );

my $yellow = Convert::Color::HSL->new( '60,1,0.5' );

is( $yellow->hue,         60, 'yellow hue' );
is( $yellow->saturation,   1, 'yellow saturation' );
is( $yellow->lightness,  0.5, 'yellow lightness' );

is_deeply( [ $yellow->hsl ], [ 60, 1, 0.5 ], 'yellow hsl' );