2
2
3
3
use v5.12;
4
4
use warnings;
5
- use Test::More tests => 101 ;
5
+ use Test::More tests => 107 ;
6
6
7
7
BEGIN { unshift @INC , ' lib' , ' ../lib' }
8
8
my $module = ' Graphics::Toolkit::Color::Space::Format' ;
@@ -20,6 +20,8 @@ is( ref $obj, $module, 'one constructor argument is enough');
20
20
my $pobj = Graphics::Toolkit::Color::Space::Format-> new( $basis , ' %' );
21
21
is( ref $pobj , $module , ' used second argument: suffix' );
22
22
23
+ my $vobj = Graphics::Toolkit::Color::Space::Format-> new( $basis , ' %' , ' \d{2}' );
24
+ is( ref $pobj , $module , ' used third argument argument: value format' );
23
25
24
26
my ($vals , $name ) = $obj -> deformat(' abg:0,2.2,-3' );
25
27
is( ref $vals , ' ARRAY' , ' could deformat values' );
@@ -41,6 +43,12 @@ is( $name, 'named_string', 'found right format name');
41
43
is( ref $vals , ' ARRAY' , ' ignored inserted spaces in named string' );
42
44
is( $name , ' named_string' , ' recognized named string format' );
43
45
46
+ ($vals , $name ) = $vobj -> deformat(' abg: 1 %, 2 % , 3% ' );
47
+ is( ref $vals , ' ' , ' values need to have two digits with custom value format' );
48
+ ($vals , $name ) = $vobj -> deformat(' abg: 11 %, 22 % , 33% ' );
49
+ is( ref $vals , ' ARRAY' , ' ignored inserted spaces in named string with custom value format' );
50
+ is( $name , ' named_string' , ' recognized named string format with custom value format' );
51
+
44
52
45
53
($vals , $name ) = $pobj -> deformat(' abg( 1 %, 2 % , 3% ) ' );
46
54
is( ref $vals , ' ARRAY' , ' ignored inserted spaces in css string' );
@@ -106,6 +114,10 @@ is( $name, 'hash', 'recognized hash format with full names');
106
114
is( $name , ' hash' , ' recognized hash even when left suffixes' );
107
115
($vals , $name ) = $pobj -> deformat( {ALPHA => ' 1 %' , BETA => ' 2% ' , GAMMA => ' 3%' } );
108
116
is( $name , ' hash' , ' recognized hash with suffixes' );
117
+ ($vals , $name ) = $vobj -> deformat( {ALPHA => ' 1 %' , BETA => ' 2% ' , GAMMA => ' 3%' } );
118
+ is( $name , undef , ' values needed 2 digits in custom value format' );
119
+ ($vals , $name ) = $vobj -> deformat( {ALPHA => ' 21 %' , BETA => ' 92% ' , GAMMA => ' 13%' } );
120
+ is( $name , ' hash' , ' recognized hash with suffixes and custom value format' );
109
121
110
122
111
123
0 commit comments