From 5490ccc5ebf39759dfd084bbd31f464701a3e775 Mon Sep 17 00:00:00 2001 From: Mark Oteiza Date: Sat, 16 Sep 2017 12:49:28 -0400 Subject: Add lisp variable lcms-d65-xyz This serves as the default optional argument for functions in this library. * src/lcms.c (lcms-d65-xyz): New variable. (lcms-cam02-ucs): Use it. Use better word in docstring. Fix bug color1 -> color2. * test/src/lcms-tests.el: Add some tests for lcms-cri-cam02-ucs. (lcms-colorspacious-d65): New variable. --- test/src/lcms-tests.el | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'test/src') diff --git a/test/src/lcms-tests.el b/test/src/lcms-tests.el index 0d6b8db3d4b..e176cff2dc6 100644 --- a/test/src/lcms-tests.el +++ b/test/src/lcms-tests.el @@ -33,6 +33,9 @@ (require 'ert) (require 'color) +(defconst lcms-colorspacious-d65 '(0.95047 1.0 1.08883) + "D65 white point from colorspacious.") + (defun lcms-approx-p (a b &optional delta) "Check if A and B are within relative error DELTA of one another. B is considered the exact value." @@ -46,6 +49,22 @@ B is considered the exact value." (lcms-approx-p a2 b2 delta) (lcms-approx-p a3 b3 delta)))) +(ert-deftest lcms-cri-cam02-ucs () + "Test use of `lcms-cam02-ucs'." + (should-error (lcms-cam02-ucs '(0 0 0) '(0 0 0) "error")) + (should-error (lcms-cam02-ucs '(0 0 0) 'error)) + (should-not + (lcms-approx-p + (let ((lcms-d65-xyz '(0.44757 1.0 0.40745))) + (lcms-cam02-ucs '(0.5 0.5 0.5) '(0 0 0))) + (lcms-cam02-ucs '(0.5 0.5 0.5) '(0 0 0)))) + (should (eql 0.0 (lcms-cam02-ucs '(0.5 0.5 0.5) '(0.5 0.5 0.5)))) + (should + (lcms-approx-p (lcms-cam02-ucs lcms-colorspacious-d65 + '(0 0 0) + lcms-colorspacious-d65) + 100.0))) + (ert-deftest lcms-whitepoint () "Test use of `lcms-temp->white-point'." (should-error (lcms-temp->white-point 3999)) -- cgit v1.2.1