summaryrefslogtreecommitdiff
path: root/t/09-colorlibrary.t
blob: 5370c1afa82a07c121576182a3e96b609541d187 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/perl

use strict;
use Test::More;

eval "use Color::Library 0.02";

plan skip_all => "Color::Library 0.02 required" if $@;

use constant TEST_CASES => {
  "croceus"                   => 0xf4c2c2,
  "croceus28"                 => 0xf4c2c2,
  "croceus53"                 => 0xd99058,
#     "black"                 => 0x000000,
#     "aqua"                  => 0x00ffff,
#     "maroon"                => 0x800000,
#     "lime"                  => 0x00ff00,
};

my $tests = TEST_CASES;

plan tests => 3 + (keys %$tests);

use_ok("Graphics::ColorNames", "2.10002");

use_ok("Color::Library::Dictionary::NBS_ISCC::B");

{
    my $obj = Graphics::ColorNames->new( 'Color::Library::Dictionary::NBS_ISCC::B' );
    ok ($obj->isa("Graphics::ColorNames"));

    foreach my $name (keys %$tests) {
	ok($obj->hex($name) eq sprintf('%06x',$tests->{$name}), 
	   "failed test for color $name");
    }

}