Skip to content
This repository was archived by the owner on May 30, 2023. It is now read-only.

Commit a0452c0

Browse files
committed
Add an end-to-end test on the ares logo.
1 parent 5720c74 commit a0452c0

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

tests/nasa_ares_logo.png

31 KB
Loading

tests/test_colorific.py

+19
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
# palette-detect
55
#
66

7+
import os
78
import unittest
89
import itertools
910

1011
import colorific
12+
from colorific import palette
1113

1214
CORE_COLORS = [
1315
'#000000', # black
@@ -18,6 +20,22 @@
1820
]
1921

2022

23+
class ExtractionTest(unittest.TestCase):
24+
def setUp(self):
25+
self.filename = os.path.join(os.path.dirname(__file__),
26+
'nasa_ares_logo.png')
27+
28+
def test_extraction(self):
29+
expected = [(0, 101, 185),
30+
(187, 214, 236),
31+
(255, 0, 0),
32+
(45, 68, 86),
33+
(119, 173, 218)]
34+
p = palette.extract_colors(self.filename)
35+
found = [c.value for c in p.colors]
36+
self.assertEquals(found, expected)
37+
38+
2139
class ConversionTest(unittest.TestCase):
2240
def setUp(self):
2341
self.pairs = [
@@ -66,6 +84,7 @@ def similar(self, c1, c2):
6684

6785
def suite():
6886
return unittest.TestSuite((
87+
unittest.makeSuite(ExtractionTest),
6988
unittest.makeSuite(ConversionTest),
7089
unittest.makeSuite(VisualDistanceTest),
7190
))

0 commit comments

Comments
 (0)