summaryrefslogtreecommitdiff
path: root/test/pdf-cache-test.el
blob: 24abf6df4537cc25db11023773368c89db49f667 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
;; -*- lexical-binding: t; -*-

;; * ================================================================== *
;; * Tests for pdf-cache.el
;; * ================================================================== *

(require 'pdf-cache)
(require 'ert)

(ert-deftest pdf-cache-get-image ()
  (let (pdf-cache--image-cache)
    (should-not (pdf-cache-get-image 1 1))
    (setq pdf-cache--image-cache
          (list
           (pdf-cache--make-image 1 1 "1" nil)
           (pdf-cache--make-image 2 1 "2" nil)
           (pdf-cache--make-image 3 1 "3" nil)))
    (should (equal (pdf-cache-get-image 1 1) "1"))
    (should (equal pdf-cache--image-cache
                   (list
                    (pdf-cache--make-image 1 1 "1" nil)
                    (pdf-cache--make-image 2 1 "2" nil)
                    (pdf-cache--make-image 3 1 "3" nil))))
    (should (equal (pdf-cache-get-image 2 1) "2"))
    (should (equal pdf-cache--image-cache
                   (list
                    (pdf-cache--make-image 2 1 "2" nil)
                    (pdf-cache--make-image 1 1 "1" nil)
                    (pdf-cache--make-image 3 1 "3" nil))))
    (should-not (pdf-cache-get-image 4 1))))