summaryrefslogtreecommitdiff
path: root/test/src/lcms-tests.el
diff options
context:
space:
mode:
authorMark Oteiza <mvoteiza@udel.edu>2017-09-16 12:49:28 -0400
committerMark Oteiza <mvoteiza@udel.edu>2017-09-16 12:49:28 -0400
commit5490ccc5ebf39759dfd084bbd31f464701a3e775 (patch)
tree6cb907ef8a9d624e6f48da59e4015854383ffadf /test/src/lcms-tests.el
parentdee96f4a170be134fafd2d11f264952b7e030303 (diff)
downloademacs-5490ccc5ebf39759dfd084bbd31f464701a3e775.tar.gz
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.
Diffstat (limited to 'test/src/lcms-tests.el')
-rw-r--r--test/src/lcms-tests.el19
1 files changed, 19 insertions, 0 deletions
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))