1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-08 04:30:45 -08:00

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.
This commit is contained in:
Mark Oteiza 2017-09-16 12:49:28 -04:00
parent dee96f4a17
commit 5490ccc5eb
2 changed files with 29 additions and 8 deletions

View file

@ -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))