2012-05-28 17:04:43 -07:00
|
|
|
#!/usr/bin/env perl
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
use Test::More;
|
|
|
|
use DDG::Test::Goodie;
|
|
|
|
|
|
|
|
zci answer_type => 'color_code';
|
|
|
|
zci is_cached => 1;
|
|
|
|
|
2014-09-09 14:37:19 -07:00
|
|
|
ddg_goodie_test([qw(
|
|
|
|
DDG::Goodie::ColorCodes
|
|
|
|
)
|
|
|
|
],
|
|
|
|
'hex color code for cyan' => test_zci(
|
|
|
|
'Hex: #00ffff ~ rgb(0, 255, 255) ~ rgb(0%, 100%, 100%) ~ hsl(180, 100%, 50%) ~ cmyb(100%, 0%, 0%, 0%)',
|
2014-09-10 15:33:05 -07:00
|
|
|
html => qr/background:#00ffff/,
|
2014-09-09 14:37:19 -07:00
|
|
|
),
|
|
|
|
'rgb(173,216,230)' => test_zci(
|
|
|
|
'Hex: #add8e6 ~ rgb(173, 216, 230) ~ rgb(68%, 85%, 90%) ~ hsl(195, 53%, 79%) ~ cmyb(25%, 6%, 0%, 10%)',
|
2014-09-10 15:33:05 -07:00
|
|
|
html => qr/background:#add8e6/,
|
2014-09-09 14:37:19 -07:00
|
|
|
),
|
|
|
|
'hsl 194 0.53 0.79' => test_zci(
|
|
|
|
'Hex: #add8e5 ~ rgb(173, 216, 229) ~ rgb(68%, 85%, 90%) ~ hsl(194, 53%, 79%) ~ cmyb(25%, 6%, 0%, 10%)',
|
2014-09-10 15:33:05 -07:00
|
|
|
html => qr/background:#add8e5/,
|
2014-09-09 14:37:19 -07:00
|
|
|
),
|
2013-03-20 16:33:06 -07:00
|
|
|
'cmyk(0.12, 0, 0, 0)' => test_zci(
|
2014-09-09 14:37:19 -07:00
|
|
|
'Hex: #e0ffff ~ rgb(224, 255, 255) ~ rgb(88%, 100%, 100%) ~ hsl(180, 100%, 94%) ~ cmyb(12%, 0%, 0%, 0%)',
|
2014-09-10 15:33:05 -07:00
|
|
|
html => qr/background:#e0ffff/,
|
2013-03-20 16:33:06 -07:00
|
|
|
),
|
|
|
|
'#00ff00' => test_zci(
|
2014-09-09 14:37:19 -07:00
|
|
|
'Hex: #00ff00 ~ rgb(0, 255, 0) ~ rgb(0%, 100%, 0%) ~ hsl(120, 100%, 50%) ~ cmyb(100%, 0%, 100%, 0%)',
|
2014-09-10 15:33:05 -07:00
|
|
|
html => qr/background:#00ff00/,
|
2013-03-20 16:33:06 -07:00
|
|
|
),
|
|
|
|
'#0f0' => test_zci(
|
2014-09-09 14:37:19 -07:00
|
|
|
'Hex: #00ff00 ~ rgb(0, 255, 0) ~ rgb(0%, 100%, 0%) ~ hsl(120, 100%, 50%) ~ cmyb(100%, 0%, 100%, 0%)',
|
2014-09-10 15:33:05 -07:00
|
|
|
html => qr/background:#00ff00/,
|
2013-03-20 16:33:06 -07:00
|
|
|
),
|
2013-11-30 13:15:51 -08:00
|
|
|
'inverse of the color red' => test_zci(
|
|
|
|
'Hex: #00ffff ~ rgb(0, 255, 255) ~ rgb(0%, 100%, 100%) ~ hsl(180, 100%, 50%) ~ cmyb(100%, 0%, 0%, 0%)',
|
2014-09-10 15:33:05 -07:00
|
|
|
html => qr/background:#00ffff/,
|
2013-11-30 13:15:51 -08:00
|
|
|
),
|
|
|
|
'rgb(0 255 0)\'s inverse' => test_zci(
|
|
|
|
'Hex: #ff00ff ~ rgb(255, 0, 255) ~ rgb(100%, 0%, 100%) ~ hsl(300, 100%, 50%) ~ cmyb(0%, 100%, 0%, 0%)',
|
2014-09-10 15:33:05 -07:00
|
|
|
html => qr/background:#ff00ff/,
|
2013-11-30 13:15:51 -08:00
|
|
|
),
|
2014-06-27 19:12:01 -07:00
|
|
|
'html bluishblack' => test_zci(
|
|
|
|
'Hex: #202428 ~ rgb(32, 36, 40) ~ rgb(13%, 14%, 16%) ~ hsl(210, 11%, 14%) ~ cmyb(20%, 10%, 0%, 84%)',
|
2014-09-10 15:33:05 -07:00
|
|
|
html => qr/background:#202428/,
|
2014-06-27 19:12:01 -07:00
|
|
|
),
|
2014-09-09 14:37:19 -07:00
|
|
|
# Single full HTML check.
|
2014-08-28 14:20:15 -07:00
|
|
|
'red html code' => test_zci(
|
|
|
|
'Hex: #ff0000 ~ rgb(255, 0, 0) ~ rgb(100%, 0%, 0%) ~ hsl(0, 100%, 50%) ~ cmyb(0%, 100%, 100%, 0%)',
|
2014-09-09 14:37:19 -07:00
|
|
|
html =>
|
2014-09-11 14:37:13 -07:00
|
|
|
qq(<div class="zci--color-codes"><div class="colorcodesbox" style="background:#ff0000"></div>Hex: #ff0000 · rgb(255, 0, 0) · rgb(100%, 0%, 0%) <br> hsl(0, 100%, 50%) · cmyb(0%, 100%, 100%, 0%) · [<a href='http://labs.tineye.com/multicolr#colors=ff0000;weights=100;'>Images</a>] [<a href='http://www.color-hex.com/color/ff0000' title='Tints, information and similar colors on color-hex.com'>Info</a>]</div>),
|
2014-09-09 14:37:19 -07:00
|
|
|
),
|
|
|
|
# Queries to ignore.
|
2014-06-27 19:12:01 -07:00
|
|
|
'bluishblack html' => undef,
|
|
|
|
'HTML email' => undef,
|
|
|
|
'wield color' => undef,
|
2012-05-28 17:04:43 -07:00
|
|
|
);
|
|
|
|
|
|
|
|
done_testing;
|
|
|
|
|
|
|
|
|