File: colors.t

package info (click to toggle)
libcolor-scheme-perl 1.08-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 200 kB
  • sloc: perl: 731; makefile: 2
file content (57 lines) | stat: -rw-r--r-- 1,297 bytes parent folder | download | duplicates (3)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!perl
use strict;
use warnings;

use Test::More;
use Color::Scheme;

use t::lib::ColorTest;

{
    my $c     = Color::Scheme->new->from_hex('ff9900')->distance(0.5);
    my %tests = (
        mono => [
            qw(
                ff9900 b36b00 ffe6bf ffcc80
                )
        ],
        contrast => [
            qw(
                ff9900 b36b00 ffe6bf ffcc80
                0040ff 002db3 bfcfff 809fff
                )
        ],
        triade => [
            qw(
                ff9900 b36b00 ffe6bf ffcc80
                00ffff 00b3b3 bfffff 80ffff
                5500ff 3c00b3 d5bfff aa80ff
                )
        ],
        tetrade => [
            qw(
                ff9900 b36b00 ffe6bf ffcc80
                0040ff 002db3 bfcfff 809fff
                6b00ff 4b00b3 dabfff b580ff
                ffe500 b3a000 fff9bf fff280
                )
        ],
        analogic => [
            qw(
                ff9900 b36b00 ffe6bf ffcc80
                ffcc00 b38f00 fff2bf ffe680
                ff6600 b34700 ffd9bf ffb380
                )
        ],
    );

    while ( my ( $scheme, $colors ) = each %tests ) {
        color_test(
            [ $c->scheme($scheme)->colors ],
            $colors,
            "$scheme scheme",
        );
    }
}

done_testing;