diff options
author | Damyan Ivanov <dmn@debian.org> | 2015-07-24 04:59:11 -0700 |
---|---|---|
committer | Damyan Ivanov <dmn@debian.org> | 2015-07-24 04:59:11 -0700 |
commit | 54f5e952958474e8a788c161d0700dba8017a5ea (patch) | |
tree | 8e9969fa196d3cfeb03b316501d07f988ec0c869 /t/08-filehandle.t |
libgraphics-colornames-perl (2.11-6.1) unstable; urgency=medium
* Non-maintainer upload.
* Add build dependency on libmodule-build-perl and replace perl-modules
build dependency with perl
Closes: #789334 -- FTBFS with perl 5.22
# imported from the archive
Diffstat (limited to 't/08-filehandle.t')
-rw-r--r-- | t/08-filehandle.t | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/t/08-filehandle.t b/t/08-filehandle.t new file mode 100644 index 0000000..fae6f9e --- /dev/null +++ b/t/08-filehandle.t @@ -0,0 +1,81 @@ +#!/usr/bin/perl
+
+use strict;
+use Test::More tests => 28;
+
+use FileHandle;
+use IO::File;
+
+use_ok('Graphics::ColorNames', 1.10, qw( hex2tuple tuple2hex ));
+
+{
+ my $fh = new IO::File;
+ open($fh, './t/rgb.txt');
+
+
+ tie my %colors, 'Graphics::ColorNames', $fh;
+ ok(tied %colors);
+
+ ok(keys %colors == 6); #
+
+ my $count = 0;
+ foreach my $name (keys %colors)
+ {
+ my @RGB = hex2tuple( $colors{$name} );
+ $count++, if (tuple2hex(@RGB) eq $colors{$name} );
+ }
+ ok($count == keys %colors);
+
+ foreach my $name (qw( one two three four five six)) {
+ ok(exists $colors{$name});
+ }
+
+ close $fh;
+}
+
+{
+ my $fh = new FileHandle;
+ open($fh, './t/rgb.txt');
+
+ tie my %colors, 'Graphics::ColorNames', $fh;
+ ok(tied %colors);
+
+ ok(keys %colors == 6); #
+
+ my $count = 0;
+ foreach my $name (keys %colors)
+ {
+ my @RGB = hex2tuple( $colors{$name} );
+ $count++, if (tuple2hex(@RGB) eq $colors{$name} );
+ }
+ ok($count == keys %colors);
+
+ foreach my $name (qw( one two three four five six)) {
+ ok(exists $colors{$name});
+ }
+
+ close $fh;
+}
+
+{
+ open(my $fh, './t/rgb.txt');
+
+ tie my %colors, 'Graphics::ColorNames', $fh;
+ ok(tied %colors);
+
+ ok(keys %colors == 6); #
+
+ my $count = 0;
+ foreach my $name (keys %colors)
+ {
+ my @RGB = hex2tuple( $colors{$name} );
+ $count++, if (tuple2hex(@RGB) eq $colors{$name} );
+ }
+ ok($count == keys %colors);
+
+ foreach my $name (qw( one two three four five six)) {
+ ok(exists $colors{$name});
+ }
+
+ close $fh;
+}
|