@@ -14,55 +14,20 @@ is( not($@), 1, 'could load the module');
14
14
is( ref $def , ' Graphics::Toolkit::Color::Space' , ' got tight return value by loading module' );
15
15
is( $def -> name, ' CIELUV' , ' color space has right name' );
16
16
is( $def -> axis, 3, ' color space has 3 dimensions' );
17
- is( $def -> is_array([0,0,0]), 1, ' vector has 3 elements' );
18
- is( $def -> is_partial_hash({i => 1, quadrature => 0}), 1, ' found hash with some keys' );
17
+ is( $def -> is_value_tuple([0,0,0]), 1, ' tuple has 3 elements' );
18
+ is( $def -> is_partial_hash({u => 1, v => 0}), 1, ' found hash with some axis names' );
19
+ is( $def -> is_partial_hash({u => 1, v => 0, l => 0}), 1, ' found hash with all axis names' );
20
+ is( $def -> is_partial_hash({a => 1, v => 0, l => 0}), 0, ' found hash with onw wrong axis name' );
19
21
is( $def -> can_convert(' rgb' ), 1, ' do only convert from and to rgb' );
20
22
is( $def -> can_convert(' yiq' ), 0, ' can not convert to itself' );
21
- is( $def -> format([0,0,0], ' css_string' ), ' yiq(0,0,0)' , ' can format css string' );
22
- my @val = $def -> deformat([' LUV' , 1, 0, -0.1]);
23
- is( int @val , 3, ' deformated value triplet (vector)' );
24
- is( $val [0], 1, ' first value good' );
25
- is( $val [1], 0, ' second value good' );
26
- is( $val [2], -0.1, ' third value good' );
23
+ is( $def -> format([0,0,0], ' css_string' ), ' cieluv(0, 0, 0)' , ' can format css string' );
27
24
28
- ok( !$def -> check([0, -0.5959, -0.5227]), ' check YIO values works on lower bound values' );
29
- ok( !$def -> check([1, 0.5959, 0.5227]), ' check YIO values works on upper bound values' );
30
- warning_like {$def -> check([0,0])} {carped => qr / needs 3 values/ }, " check YIQ got too few values" ;
31
- warning_like {$def -> check([0, 0, 0, 0])} {carped => qr / needs 3 values/ }, " check YIQ got too many values" ;
25
+ my $val = $def -> deformat([' CIELUV' , 1, 0, -0.1]);
26
+ is( ref $val , ' ARRAY' , ' deformated random value tuple' );
27
+ is( int @$val , 3, ' right amount of values' );
28
+ is( $val -> [0], 1, ' first value good' );
29
+ is( $val -> [1], 0, ' second value good' );
30
+ is( $val -> [2], -0.1, ' third value good' );
32
31
33
- is( $def -> check([0,0,0]), undef , ' checked neutral values' );
34
- warning_like {$def -> check([-0.1, 0, 0])} {carped => qr / luminance value is below/ }, " luminance value is too small" ;
35
- warning_like {$def -> check([ 1.1, 0,0])} {carped => qr / luminance value is above/ }, " luminance value is too big" ;
36
- warning_like {$def -> check([0, -0.6, 0])} {carped => qr / in-phase value is below/ }, " whiteness value is too small" ;
37
- warning_like {$def -> check([0, 0.6,0])} {carped => qr / in-phase value is above/ }, " whiteness value is too big" ;
38
- warning_like {$def -> check([0,0, -0.53 ])} {carped => qr / quadrature value is below/ }," quadrature value is too small" ;
39
- warning_like {$def -> check([0,0, 0.53])} {carped => qr / quadrature value is above/ }, " quadrature value is too big" ;
40
-
41
-
42
-
43
- my @yiq = $def -> deconvert( [ 0.5, 0.5, 0.5], ' RGB' );
44
- is( int @yiq , 3, ' converted color grey has three YIQ values' );
45
- is( $yiq [0], 0.5, ' converted color grey has computed right luminance value' );
46
- is( $yiq [1], 0.5, ' converted color grey has computed right in-phase' );
47
- is( $yiq [2], 0.5, ' converted color grey has computed right quadrature' );
48
-
49
- my @rgb = $def -> convert( [0.5, 0.5, 0.5], ' RGB' );
50
- is( int @rgb , 3, ' converted back color grey has three rgb values' );
51
- is( $rgb [0], 0.5, ' converted back color grey has right red value' );
52
- is( $rgb [1], 0.5, ' converted back color grey has right green value' );
53
- is( $rgb [2], 0.5, ' converted back color grey has right blue value' );
54
-
55
- @yiq = $def -> deconvert( [0.1, 0, 1], ' RGB' );
56
- is( int @yiq , 3, ' converted blue has three YIQ values' );
57
- is( close_enough( $yiq [0], 0.1439 ) , 1 , ' converted nice blue has right Y value' );
58
- is( close_enough( $yiq [1], 0.280407787), 1 , ' converted nice blue has right I value' );
59
- is( close_enough( $yiq [2], 0.817916587), 1 , ' converted nice blue has right Q value' );
60
-
61
-
62
- @rgb = $def -> convert( [0.1439, 0.280407787, 0.817916587], ' RGB' );
63
- is( int @rgb , 3, ' converted back nice blue' );
64
- is( close_enough($rgb [0], 0.1), 1, ' right red value' );
65
- is( close_enough($rgb [1], 0 ), 1, ' right green value' );
66
- is( close_enough($rgb [2], 1, ), 1, ' right blue value' );
67
32
68
33
exit 0;
0 commit comments