diff options
| author | Stefan Kangas | 2022-09-22 14:17:08 +0200 |
|---|---|---|
| committer | Stefan Kangas | 2022-09-22 14:20:15 +0200 |
| commit | fdfd7ef6f383391b24c296ba6217abcffd5c4586 (patch) | |
| tree | f3ca0b86cc1e352e3a89cb7071b0cca7286f843c | |
| parent | f43914b4d036ada1842e533cda34bc4379f47a26 (diff) | |
| download | emacs-fdfd7ef6f383391b24c296ba6217abcffd5c4586.tar.gz emacs-fdfd7ef6f383391b24c296ba6217abcffd5c4586.zip | |
Fix failing image-dired test
* test/lisp/image/image-dired-util-tests.el (ert-x, xdg): Require.
(image-dired-thumb-name/): Delete test.
(image-dired-thumb-name/standard)
(image-dired-thumb-name/image-dired)
(image-dired-thumb-name/per-directory): New tests.
| -rw-r--r-- | test/lisp/image/image-dired-util-tests.el | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/test/lisp/image/image-dired-util-tests.el b/test/lisp/image/image-dired-util-tests.el index 547e3914013..39862fc6faa 100644 --- a/test/lisp/image/image-dired-util-tests.el +++ b/test/lisp/image/image-dired-util-tests.el | |||
| @@ -20,21 +20,35 @@ | |||
| 20 | ;;; Code: | 20 | ;;; Code: |
| 21 | 21 | ||
| 22 | (require 'ert) | 22 | (require 'ert) |
| 23 | (require 'ert-x) | ||
| 23 | (require 'image-dired) | 24 | (require 'image-dired) |
| 24 | (require 'image-dired-util) | 25 | (require 'image-dired-util) |
| 26 | (require 'xdg) | ||
| 25 | 27 | ||
| 26 | (ert-deftest image-dired-thumb-name () | 28 | (ert-deftest image-dired-thumb-name/standard () |
| 27 | (let ((image-dired-thumbnail-storage 'standard)) | 29 | (let ((image-dired-thumbnail-storage 'standard)) |
| 28 | (should (file-name-absolute-p (image-dired-thumb-name "foo.jpg"))) | 30 | (should (file-name-absolute-p (image-dired-thumb-name "foo.jpg"))) |
| 29 | (should (equal (file-name-nondirectory (image-dired-thumb-name "foo.jpg")) | 31 | (should (string-search (xdg-cache-home) |
| 30 | "4abfc97f9a5d3c4c519bfb23e4da8b90.png"))) | 32 | (image-dired-thumb-name "foo.jpg"))) |
| 31 | (let ((image-dired-thumbnail-storage 'image-dired)) | 33 | (should (string-match (rx (in "0-9a-f") ".png") |
| 32 | (should (file-name-absolute-p (image-dired-thumb-name "foo.jpg"))) | 34 | (image-dired-thumb-name "foo.jpg"))))) |
| 33 | (should (equal (file-name-nondirectory (image-dired-thumb-name "foo.jpg")) | 35 | |
| 34 | "foo_5baffb8d7984b3088db58efd7d8909c5.thumb.jpg"))) | 36 | (ert-deftest image-dired-thumb-name/image-dired () |
| 37 | ;; Avoid trying to create `image-dired-dir'. | ||
| 38 | (ert-with-temp-directory dir | ||
| 39 | (let ((image-dired-dir dir) | ||
| 40 | (image-dired-thumbnail-storage 'image-dired)) | ||
| 41 | (should (file-name-absolute-p (image-dired-thumb-name "foo.jpg"))) | ||
| 42 | (should (equal (file-name-nondirectory | ||
| 43 | ;; The checksum is based on the directory name. | ||
| 44 | (image-dired-thumb-name "/some/path/foo.jpg")) | ||
| 45 | "foo_45fff7fcc4a0945679b7b11dec36a82d.thumb.jpg"))))) | ||
| 46 | |||
| 47 | (ert-deftest image-dired-thumb-name/per-directory () | ||
| 35 | (let ((image-dired-thumbnail-storage 'per-directory)) | 48 | (let ((image-dired-thumbnail-storage 'per-directory)) |
| 36 | (should (file-name-absolute-p (image-dired-thumb-name "foo.jpg"))) | 49 | (should (file-name-absolute-p (image-dired-thumb-name "foo.jpg"))) |
| 37 | (should (equal (file-name-nondirectory (image-dired-thumb-name "foo.jpg")) | 50 | (should (equal (file-name-nondirectory |
| 51 | (image-dired-thumb-name "foo.jpg")) | ||
| 38 | "foo.thumb.jpg")))) | 52 | "foo.thumb.jpg")))) |
| 39 | 53 | ||
| 40 | ;;; image-dired-util-tests.el ends here | 54 | ;;; image-dired-util-tests.el ends here |