diff options
| author | Mark Oteiza | 2017-09-16 12:49:28 -0400 |
|---|---|---|
| committer | Mark Oteiza | 2017-09-16 12:49:28 -0400 |
| commit | 5490ccc5ebf39759dfd084bbd31f464701a3e775 (patch) | |
| tree | 6cb907ef8a9d624e6f48da59e4015854383ffadf /test/src | |
| parent | dee96f4a170be134fafd2d11f264952b7e030303 (diff) | |
| download | emacs-5490ccc5ebf39759dfd084bbd31f464701a3e775.tar.gz emacs-5490ccc5ebf39759dfd084bbd31f464701a3e775.zip | |
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')
| -rw-r--r-- | test/src/lcms-tests.el | 19 |
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 @@ | |||
| 33 | (require 'ert) | 33 | (require 'ert) |
| 34 | (require 'color) | 34 | (require 'color) |
| 35 | 35 | ||
| 36 | (defconst lcms-colorspacious-d65 '(0.95047 1.0 1.08883) | ||
| 37 | "D65 white point from colorspacious.") | ||
| 38 | |||
| 36 | (defun lcms-approx-p (a b &optional delta) | 39 | (defun lcms-approx-p (a b &optional delta) |
| 37 | "Check if A and B are within relative error DELTA of one another. | 40 | "Check if A and B are within relative error DELTA of one another. |
| 38 | B is considered the exact value." | 41 | B is considered the exact value." |
| @@ -46,6 +49,22 @@ B is considered the exact value." | |||
| 46 | (lcms-approx-p a2 b2 delta) | 49 | (lcms-approx-p a2 b2 delta) |
| 47 | (lcms-approx-p a3 b3 delta)))) | 50 | (lcms-approx-p a3 b3 delta)))) |
| 48 | 51 | ||
| 52 | (ert-deftest lcms-cri-cam02-ucs () | ||
| 53 | "Test use of `lcms-cam02-ucs'." | ||
| 54 | (should-error (lcms-cam02-ucs '(0 0 0) '(0 0 0) "error")) | ||
| 55 | (should-error (lcms-cam02-ucs '(0 0 0) 'error)) | ||
| 56 | (should-not | ||
| 57 | (lcms-approx-p | ||
| 58 | (let ((lcms-d65-xyz '(0.44757 1.0 0.40745))) | ||
| 59 | (lcms-cam02-ucs '(0.5 0.5 0.5) '(0 0 0))) | ||
| 60 | (lcms-cam02-ucs '(0.5 0.5 0.5) '(0 0 0)))) | ||
| 61 | (should (eql 0.0 (lcms-cam02-ucs '(0.5 0.5 0.5) '(0.5 0.5 0.5)))) | ||
| 62 | (should | ||
| 63 | (lcms-approx-p (lcms-cam02-ucs lcms-colorspacious-d65 | ||
| 64 | '(0 0 0) | ||
| 65 | lcms-colorspacious-d65) | ||
| 66 | 100.0))) | ||
| 67 | |||
| 49 | (ert-deftest lcms-whitepoint () | 68 | (ert-deftest lcms-whitepoint () |
| 50 | "Test use of `lcms-temp->white-point'." | 69 | "Test use of `lcms-temp->white-point'." |
| 51 | (should-error (lcms-temp->white-point 3999)) | 70 | (should-error (lcms-temp->white-point 3999)) |