dotemacs

My Emacs configuration
git clone git://git.entf.net/dotemacs
Log | Files | Refs | LICENSE

pdf-cache-test.el (1173B)


      1 ;; -*- lexical-binding: t; -*-
      2 
      3 ;; * ================================================================== *
      4 ;; * Tests for pdf-cache.el
      5 ;; * ================================================================== *
      6 
      7 (require 'pdf-cache)
      8 (require 'ert)
      9 
     10 (ert-deftest pdf-cache-get-image ()
     11   (let (pdf-cache--image-cache)
     12     (should-not (pdf-cache-get-image 1 1))
     13     (setq pdf-cache--image-cache
     14           (list
     15            (pdf-cache--make-image 1 1 "1" nil)
     16            (pdf-cache--make-image 2 1 "2" nil)
     17            (pdf-cache--make-image 3 1 "3" nil)))
     18     (should (equal (pdf-cache-get-image 1 1) "1"))
     19     (should (equal pdf-cache--image-cache
     20                    (list
     21                     (pdf-cache--make-image 1 1 "1" nil)
     22                     (pdf-cache--make-image 2 1 "2" nil)
     23                     (pdf-cache--make-image 3 1 "3" nil))))
     24     (should (equal (pdf-cache-get-image 2 1) "2"))
     25     (should (equal pdf-cache--image-cache
     26                    (list
     27                     (pdf-cache--make-image 2 1 "2" nil)
     28                     (pdf-cache--make-image 1 1 "1" nil)
     29                     (pdf-cache--make-image 3 1 "3" nil))))
     30     (should-not (pdf-cache-get-image 4 1))))