summaryrefslogtreecommitdiff
path: root/t/09-colorlibrary.t
blob: 53c6f21a51271b26772c5b00a2db675a919caf77 (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
38
39
#!/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" );
    }

}