Reduce color_xy_brightness_to_hsv to color_xy_to_hs (#7320)

This makes more sense because the input and output brightness is the same.

We currently convert through RGB which does contain a brightness so we supply
an arbitrary value as input and discard the output.
This commit is contained in:
Anders Melchiorsen
2017-04-27 00:59:49 -07:00
committed by Paulus Schoutsen
parent 9527390736
commit d1121478ab
4 changed files with 21 additions and 26 deletions
+12 -12
View File
@@ -56,22 +56,22 @@ class TestColorUtil(unittest.TestCase):
self.assertEqual((0, 255, 255),
color_util.color_RGB_to_hsv(255, 0, 0))
def test_color_xy_brightness_to_hsv(self):
"""Test color_RGB_to_xy."""
self.assertEqual(color_util.color_RGB_to_hsv(0, 0, 0),
color_util.color_xy_brightness_to_hsv(1, 1, 0))
def test_color_xy_to_hs(self):
"""Test color_xy_to_hs."""
self.assertEqual((8609, 255),
color_util.color_xy_to_hs(1, 1))
self.assertEqual(color_util.color_RGB_to_hsv(255, 243, 222),
color_util.color_xy_brightness_to_hsv(.35, .35, 255))
self.assertEqual((6950, 32),
color_util.color_xy_to_hs(.35, .35))
self.assertEqual(color_util.color_RGB_to_hsv(255, 0, 60),
color_util.color_xy_brightness_to_hsv(1, 0, 255))
self.assertEqual((62965, 255),
color_util.color_xy_to_hs(1, 0))
self.assertEqual(color_util.color_RGB_to_hsv(0, 255, 0),
color_util.color_xy_brightness_to_hsv(0, 1, 255))
self.assertEqual((21845, 255),
color_util.color_xy_to_hs(0, 1))
self.assertEqual(color_util.color_RGB_to_hsv(0, 63, 255),
color_util.color_xy_brightness_to_hsv(0, 0, 255))
self.assertEqual((40992, 255),
color_util.color_xy_to_hs(0, 0))
def test_rgb_hex_to_rgb_list(self):
"""Test rgb_hex_to_rgb_list."""