]>
iEval git - convert-color-hsluv.git/blob - t/Convert-Color-HUSL.t
5 use Convert
::Color
::RGB8
;
6 use JSON
::PP qw
/decode_json/;
9 use constant EPSILON
=> 1e-4; # 1e-11 is OK on amd64
11 open my $fh, '<', 't/snapshot-rev4.json';
12 my $snapshot = join '', <$fh>;
15 my %tests = %{decode_json
$snapshot};
16 my @colors = sort keys %tests;
18 plan tests
=> 5 * @colors;
21 my ($x, $y, $name) = @_;
23 $ok &&= abs ($x->[$_] - $y->[$_]) < EPSILON
for 0, 1, 2;
24 return pass
$name if $ok;
27 diag "[@
$x] != [@
$y]";
30 for my $color (@colors) {
31 my %color = %{$tests{$color}};
32 my $col = Convert::Color::RGB8->new(substr $color, 1);
33 isf $col->convert_to('xyz'), $color{xyz}, "convert
$color to XYZ
";
34 isf $col->convert_to('luv'), $color{luv}, "convert
$color to LUV
";
35 isf $col->convert_to('lch'), $color{lch}, "convert
$color to LCh
";
36 isf $col->convert_to('husl'), $color{husl}, "convert
$color to HUSL
";
37 isf $col->convert_to('huslp'), $color{huslp}, "convert
$color to HUSLp
";
This page took 0.053364 seconds and 5 git commands to generate.