From 661be73b5eb148a6cd6d79837487375cfd422d4d Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Wed, 21 Sep 2022 15:13:40 +0200 Subject: [PATCH] * test/lisp/image/image-dired-util-tests.el: New file. --- test/lisp/image/image-dired-util-tests.el | 40 +++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 test/lisp/image/image-dired-util-tests.el diff --git a/test/lisp/image/image-dired-util-tests.el b/test/lisp/image/image-dired-util-tests.el new file mode 100644 index 00000000000..547e3914013 --- /dev/null +++ b/test/lisp/image/image-dired-util-tests.el @@ -0,0 +1,40 @@ +;;; image-dired-util-tests.el --- Tests for image-dired.el -*- lexical-binding: t -*- + +;; Copyright (C) 2022 Free Software Foundation, Inc. + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Code: + +(require 'ert) +(require 'image-dired) +(require 'image-dired-util) + +(ert-deftest image-dired-thumb-name () + (let ((image-dired-thumbnail-storage 'standard)) + (should (file-name-absolute-p (image-dired-thumb-name "foo.jpg"))) + (should (equal (file-name-nondirectory (image-dired-thumb-name "foo.jpg")) + "4abfc97f9a5d3c4c519bfb23e4da8b90.png"))) + (let ((image-dired-thumbnail-storage 'image-dired)) + (should (file-name-absolute-p (image-dired-thumb-name "foo.jpg"))) + (should (equal (file-name-nondirectory (image-dired-thumb-name "foo.jpg")) + "foo_5baffb8d7984b3088db58efd7d8909c5.thumb.jpg"))) + (let ((image-dired-thumbnail-storage 'per-directory)) + (should (file-name-absolute-p (image-dired-thumb-name "foo.jpg"))) + (should (equal (file-name-nondirectory (image-dired-thumb-name "foo.jpg")) + "foo.thumb.jpg")))) + +;;; image-dired-util-tests.el ends here -- 2.39.2