aboutsummaryrefslogtreecommitdiffstats
path: root/test/src
diff options
context:
space:
mode:
authorRasmus2017-09-29 10:41:51 +0200
committerRasmus2017-09-29 10:41:51 +0200
commitd4b2bbdc73ace5cb0971a32a75941486489d1cc5 (patch)
treedc92eb83d4a66f112e3688ad10632e14ca6601ff /test/src
parenteaefbc26d5c6cffbe4a22d3a9f4c7e6209a7b5a7 (diff)
parentaf130f900fc499f71ea22f10ba055a75ce35ed4e (diff)
downloademacs-d4b2bbdc73ace5cb0971a32a75941486489d1cc5.tar.gz
emacs-d4b2bbdc73ace5cb0971a32a75941486489d1cc5.zip
Merge branch 'emacs-26' into scratch/org-mode-merge
Diffstat (limited to 'test/src')
-rw-r--r--test/src/data-tests.el6
-rw-r--r--test/src/editfns-tests.el8
-rw-r--r--test/src/fileio-tests.el2
-rw-r--r--test/src/lcms-tests.el41
4 files changed, 50 insertions, 7 deletions
diff --git a/test/src/data-tests.el b/test/src/data-tests.el
index 5dc26348a6f..8de8c145d40 100644
--- a/test/src/data-tests.el
+++ b/test/src/data-tests.el
@@ -101,7 +101,11 @@
101 (should (= 3 (apply #'min '(3 8 3)))) 101 (should (= 3 (apply #'min '(3 8 3))))
102 (should-error (min 9 8 'foo)) 102 (should-error (min 9 8 'foo))
103 (should-error (min (make-marker))) 103 (should-error (min (make-marker)))
104 (should (eql 1 (min (point-min-marker) 1)))) 104 (should (eql 1 (min (point-min-marker) 1)))
105 (should (isnan (min 0.0e+NaN)))
106 (should (isnan (min 0.0e+NaN 1 2)))
107 (should (isnan (min 1.0 0.0e+NaN)))
108 (should (isnan (min 1.0 0.0e+NaN 1.1))))
105 109
106;; Bool vector tests. Compactly represent bool vectors as hex 110;; Bool vector tests. Compactly represent bool vectors as hex
107;; strings. 111;; strings.
diff --git a/test/src/editfns-tests.el b/test/src/editfns-tests.el
index 1c3fde888f6..70dc9372fad 100644
--- a/test/src/editfns-tests.el
+++ b/test/src/editfns-tests.el
@@ -166,6 +166,14 @@
166 (should (string-equal 166 (should (string-equal
167 (format-time-string format look '(-28800 "PST")) 167 (format-time-string format look '(-28800 "PST"))
168 "1972-06-30 15:59:59.999 -0800 (PST)")) 168 "1972-06-30 15:59:59.999 -0800 (PST)"))
169 ;; Negative UTC offset, as a Lisp integer.
170 (should (string-equal
171 (format-time-string format look -28800)
172 ;; MS-Windows build replaces unrecognizable TZ values,
173 ;; such as "-08", with "ZZZ".
174 (if (eq system-type 'windows-nt)
175 "1972-06-30 15:59:59.999 -0800 (ZZZ)"
176 "1972-06-30 15:59:59.999 -0800 (-08)")))
169 ;; Positive UTC offset that is not an hour multiple, as a string. 177 ;; Positive UTC offset that is not an hour multiple, as a string.
170 (should (string-equal 178 (should (string-equal
171 (format-time-string format look "IST-5:30") 179 (format-time-string format look "IST-5:30")
diff --git a/test/src/fileio-tests.el b/test/src/fileio-tests.el
index a56fb4474d6..01c280d2752 100644
--- a/test/src/fileio-tests.el
+++ b/test/src/fileio-tests.el
@@ -35,6 +35,8 @@
35 (char 0)) 35 (char 0))
36 (while (and (not failure) (< char 127)) 36 (while (and (not failure) (< char 127))
37 (setq char (1+ char)) 37 (setq char (1+ char))
38 (when (and (eq system-type 'cygwin) (eq char 92))
39 (setq char (1+ char)))
38 (setq failure (try-link (string char) link))) 40 (setq failure (try-link (string char) link)))
39 (or failure 41 (or failure
40 (try-link "/:" link))) 42 (try-link "/:" link)))
diff --git a/test/src/lcms-tests.el b/test/src/lcms-tests.el
index e176cff2dc6..d6d1d16b9ad 100644
--- a/test/src/lcms-tests.el
+++ b/test/src/lcms-tests.el
@@ -1,6 +1,6 @@
1;;; lcms-tests.el --- tests for Little CMS interface -*- lexical-binding: t -*- 1;;; lcms-tests.el --- tests for Little CMS interface -*- lexical-binding: t -*-
2 2
3;; Copyright (C) 2017 Free Software Foundation, Inc. 3;; Copyright (C) 2017 Free Software Foundation, Inc.
4 4
5;; Maintainer: emacs-devel@gnu.org 5;; Maintainer: emacs-devel@gnu.org
6 6
@@ -21,9 +21,11 @@
21 21
22;;; Commentary: 22;;; Commentary:
23 23
24;; Some "exact" values computed using the colorspacious python library 24;; Some reference values computed using the colorspacious python
25;; written by Nathaniel J. Smith. See 25;; library, assimilated from its test suite, or adopted from its
26;; https://colorspacious.readthedocs.io/en/v1.1.0/ 26;; aggregation of gold values.
27;; See https://colorspacious.readthedocs.io/en/v1.1.0/ and
28;; https://github.com/njsmith/colorspacious
27 29
28;; Other references: 30;; Other references:
29;; http://www.babelcolor.com/index_htm_files/A%20review%20of%20RGB%20color%20spaces.pdf 31;; http://www.babelcolor.com/index_htm_files/A%20review%20of%20RGB%20color%20spaces.pdf
@@ -49,14 +51,20 @@ B is considered the exact value."
49 (lcms-approx-p a2 b2 delta) 51 (lcms-approx-p a2 b2 delta)
50 (lcms-approx-p a3 b3 delta)))) 52 (lcms-approx-p a3 b3 delta))))
51 53
54(defun lcms-rgb255->xyz (rgb)
55 "Return XYZ tristimulus values corresponding to RGB."
56 (let ((rgb1 (mapcar (lambda (x) (/ x 255.0)) rgb)))
57 (apply #'color-srgb-to-xyz rgb1)))
58
52(ert-deftest lcms-cri-cam02-ucs () 59(ert-deftest lcms-cri-cam02-ucs ()
53 "Test use of `lcms-cam02-ucs'." 60 "Test use of `lcms-cam02-ucs'."
61 (skip-unless (featurep 'lcms2))
54 (should-error (lcms-cam02-ucs '(0 0 0) '(0 0 0) "error")) 62 (should-error (lcms-cam02-ucs '(0 0 0) '(0 0 0) "error"))
55 (should-error (lcms-cam02-ucs '(0 0 0) 'error)) 63 (should-error (lcms-cam02-ucs '(0 0 0) 'error))
56 (should-not 64 (should-not
57 (lcms-approx-p 65 (lcms-approx-p
58 (let ((lcms-d65-xyz '(0.44757 1.0 0.40745))) 66 (let ((wp '(0.44757 1.0 0.40745)))
59 (lcms-cam02-ucs '(0.5 0.5 0.5) '(0 0 0))) 67 (lcms-cam02-ucs '(0.5 0.5 0.5) '(0 0 0) wp))
60 (lcms-cam02-ucs '(0.5 0.5 0.5) '(0 0 0)))) 68 (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)))) 69 (should (eql 0.0 (lcms-cam02-ucs '(0.5 0.5 0.5) '(0.5 0.5 0.5))))
62 (should 70 (should
@@ -67,6 +75,7 @@ B is considered the exact value."
67 75
68(ert-deftest lcms-whitepoint () 76(ert-deftest lcms-whitepoint ()
69 "Test use of `lcms-temp->white-point'." 77 "Test use of `lcms-temp->white-point'."
78 (skip-unless (featurep 'lcms2))
70 (should-error (lcms-temp->white-point 3999)) 79 (should-error (lcms-temp->white-point 3999))
71 (should-error (lcms-temp->white-point 25001)) 80 (should-error (lcms-temp->white-point 25001))
72 ;; D55 81 ;; D55
@@ -85,4 +94,24 @@ B is considered the exact value."
85 (apply #'color-xyz-to-xyy (lcms-temp->white-point 7504)) 94 (apply #'color-xyz-to-xyy (lcms-temp->white-point 7504))
86 '(0.29902 0.31485 1.0)))) 95 '(0.29902 0.31485 1.0))))
87 96
97(ert-deftest lcms-dE-cam02-ucs-silver ()
98 "Test CRI-CAM02-UCS deltaE metric values from colorspacious."
99 (skip-unless (featurep 'lcms2))
100 (should
101 (lcms-approx-p
102 (lcms-cam02-ucs (lcms-rgb255->xyz '(173 52 52))
103 (lcms-rgb255->xyz '(59 120 51))
104 lcms-colorspacious-d65
105 (list 20 (/ 64 float-pi 5) 1 1))
106 44.698469808449964
107 0.03))
108 (should
109 (lcms-approx-p
110 (lcms-cam02-ucs (lcms-rgb255->xyz '(69 100 52))
111 (lcms-rgb255->xyz '(59 120 51))
112 lcms-colorspacious-d65
113 (list 20 (/ 64 float-pi 5) 1 1))
114 8.503323264883667
115 0.04)))
116
88;;; lcms-tests.el ends here 117;;; lcms-tests.el ends here