|
2 | 2 |
|
3 | 3 | use v5.12;
|
4 | 4 | use warnings;
|
5 |
| -use Test::More tests => 126; |
| 5 | +use Test::More tests => 140; |
6 | 6 |
|
7 | 7 | BEGIN { unshift @INC, 'lib', '../lib'}
|
8 | 8 | my $module = 'Graphics::Toolkit::Color::Space';
|
@@ -108,6 +108,28 @@ is( $val->[1], 19, 'second value correct');
|
108 | 108 | is( $val->[2], -1, 'third value correct');
|
109 | 109 | is( $val->[3], -2, 'fourth value correct - range had none zero min');
|
110 | 110 |
|
| 111 | +$space = Graphics::Toolkit::Color::Space->new( |
| 112 | + axis => [qw/AAA BBB CCC DDD/], range => 10, precision => [0,1,2,-1], |
| 113 | +); |
| 114 | +is( ref $space, $module, 'created color space with axis names, ranges and precision'); |
| 115 | +is( ref $space->shape, 'Graphics::Toolkit::Color::Space::Shape', 'have a valid space shape sub object'); |
| 116 | +$val = $space->round([ 1.11111, 1.11111, 1.11111, 1.11111]); |
| 117 | +is( ref $val, 'ARRAY', 'rounded value tuple is a tuple'); |
| 118 | +is( int @$val, 4, 'right amount of values'); |
| 119 | +is( $val->[0], 1, 'first value correct'); |
| 120 | +is( $val->[1], 1.1, 'second value correct'); |
| 121 | +is( $val->[2], 1.11, 'third value correct'); |
| 122 | +is( $val->[3], 1.11111, 'fourth value correct - range had none zero min'); |
| 123 | + |
| 124 | +$val = $space->clamp([ -0.1111, 1.1111, 200, 0.1111]); |
| 125 | +is( ref $val, 'ARRAY', 'clamped value tuple into a tuple'); |
| 126 | +is( int @$val, 4, 'right amount of values'); |
| 127 | +is( $val->[0], 0, 'clamped up to min'); |
| 128 | +is( $val->[1], 1.1, 'second value correct'); |
| 129 | +is( $val->[2], 10, 'third value correct'); |
| 130 | +is( $val->[3], 0.1111, 'fourth value correct'); |
| 131 | + |
| 132 | + |
111 | 133 | is( $space->has_format('bbb'), 0, 'vector name is not a format');
|
112 | 134 | is( $space->has_format('c'), 0, 'vector sigil is not a format');
|
113 | 135 | is( $space->has_format('list'),1, 'list is a format');
|
|
0 commit comments