diff options
| author | Lars Ingebrigtsen | 2020-03-19 16:15:04 +0100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2020-03-19 16:17:48 +0100 |
| commit | d801d1d8ccae3d8c9ea3d55c27ae16cd28212734 (patch) | |
| tree | cf25ad2557d091abcc167722bd841512230bef65 /test | |
| parent | bed04c502caa8cf0365a0808adb70451b3d8761a (diff) | |
| download | emacs-d801d1d8ccae3d8c9ea3d55c27ae16cd28212734.tar.gz emacs-d801d1d8ccae3d8c9ea3d55c27ae16cd28212734.zip | |
Don't have exif bugging out on short strings
* lisp/image/exif.el (exif--direct-ascii-value): New function
(bug#40127).
(exif--parse-directory): Use it to get the correct values for
in-directory (i.e., shorter than 4 octets) strings.
Diffstat (limited to 'test')
| -rw-r--r-- | test/data/image/black-short.jpg | bin | 0 -> 31779 bytes | |||
| -rw-r--r-- | test/lisp/image/exif-tests.el | 11 |
2 files changed, 11 insertions, 0 deletions
diff --git a/test/data/image/black-short.jpg b/test/data/image/black-short.jpg new file mode 100644 index 00000000000..02a5b0b72ef --- /dev/null +++ b/test/data/image/black-short.jpg | |||
| Binary files differ | |||
diff --git a/test/lisp/image/exif-tests.el b/test/lisp/image/exif-tests.el index cb7c9ecbda6..8a2231106f0 100644 --- a/test/lisp/image/exif-tests.el +++ b/test/lisp/image/exif-tests.el | |||
| @@ -41,4 +41,15 @@ | |||
| 41 | (should (equal (exif-elem exif 'orientation) 1)) | 41 | (should (equal (exif-elem exif 'orientation) 1)) |
| 42 | (should (equal (exif-elem exif 'x-resolution) '(180 . 1))))) | 42 | (should (equal (exif-elem exif 'x-resolution) '(180 . 1))))) |
| 43 | 43 | ||
| 44 | (ert-deftest test-exif-parse-short () | ||
| 45 | (let ((exif (exif-parse-file (test-image-file "black-short.jpg")))) | ||
| 46 | (should (equal (exif-elem exif 'make) "thr")) | ||
| 47 | (should (equal (exif-elem exif 'model) "four")) | ||
| 48 | (should (equal (exif-elem exif 'software) "em")) | ||
| 49 | (should (equal (exif-elem exif 'artist) "z")))) | ||
| 50 | |||
| 51 | (ert-deftest test-exit-direct-ascii-value () | ||
| 52 | (equal (exif--direct-ascii-value 28005 2 t) (string ?e ?m 0)) | ||
| 53 | (equal (exif--direct-ascii-value 28005 2 nil) (string ?m ?e 0))) | ||
| 54 | |||
| 44 | ;;; exif-tests.el ends here | 55 | ;;; exif-tests.el ends here |