emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/pdf-tools 365d2d8e8e 03/16: Remove guards in `pdf-virtual`


From: ELPA Syncer
Subject: [nongnu] elpa/pdf-tools 365d2d8e8e 03/16: Remove guards in `pdf-virtual` tests and code.
Date: Tue, 29 Nov 2022 01:59:28 -0500 (EST)

branch: elpa/pdf-tools
commit 365d2d8e8ed45c4358ff767a40fdc184746e043b
Author: Vedang Manerikar <ved.manerikar@gmail.com>
Commit: Vedang Manerikar <ved.manerikar@gmail.com>

    Remove guards in `pdf-virtual` tests and code.
    
    This is dead-code for supporting Emacs <26.3
    
    Relates to: #26
---
 lisp/pdf-virtual.el      |   6 --
 test/pdf-virtual-test.el | 199 +++++++++++++++++++++++------------------------
 2 files changed, 98 insertions(+), 107 deletions(-)

diff --git a/lisp/pdf-virtual.el b/lisp/pdf-virtual.el
index 575f62229e..f8ecf970ad 100644
--- a/lisp/pdf-virtual.el
+++ b/lisp/pdf-virtual.el
@@ -31,12 +31,6 @@
 ;; asynchronous case.
 
 ;;; Code:
-(eval-when-compile
-  (unless (or (> emacs-major-version 24)
-              (and (= emacs-major-version 24)
-                   (>= emacs-minor-version 4)))
-    (error "pdf-virtual.el only works with Emacs >= 24.4")))
-
 (require 'let-alist)
 (require 'pdf-info)
 (require 'pdf-util)
diff --git a/test/pdf-virtual-test.el b/test/pdf-virtual-test.el
index fc20981f53..ed5e0520b0 100644
--- a/test/pdf-virtual-test.el
+++ b/test/pdf-virtual-test.el
@@ -1,6 +1,5 @@
 ;; -*- lexical-binding: t -*-
 
-(unless (version< emacs-version "24.4")
 (require 'pdf-virtual)
 (require 'ert)
 
@@ -40,28 +39,28 @@
 
 (ert-deftest pdf-virtual-document-filenames ()
   (with-pdf-virtual-test-document doc
-    (should (equal (pdf-virtual-document-filenames doc)
-                   '("test.pdf")))))
+                                  (should (equal 
(pdf-virtual-document-filenames doc)
+                                                 '("test.pdf")))))
 
 (ert-deftest pdf-virtual-document-pages ()
   (with-pdf-virtual-test-document doc
-    (should (equal '(("test.pdf" (4 . 4) nil)
-                     ("test.pdf" (3 . 3) nil)
-                     ("test.pdf" (5 . 6) nil))
-                   (pdf-virtual-document-pages '(3 . 6) doc)))))
+                                  (should (equal '(("test.pdf" (4 . 4) nil)
+                                                   ("test.pdf" (3 . 3) nil)
+                                                   ("test.pdf" (5 . 6) nil))
+                                                 (pdf-virtual-document-pages 
'(3 . 6) doc)))))
 
 (ert-deftest pdf-virtual-document-page ()
   (with-pdf-virtual-test-document doc
-    (should (equal '("test.pdf" 6 nil)
-                   (pdf-virtual-document-page 6 doc)))))
+                                  (should (equal '("test.pdf" 6 nil)
+                                                 (pdf-virtual-document-page 6 
doc)))))
 
 (ert-deftest pdf-virtual-document-page-of ()
   (with-pdf-virtual-test-document doc
-    (let ((pages '(2 1 4 3 5 6)))
-      (dotimes (i (length pages))
-        (should (equal (1+ i)
-                       (pdf-virtual-document-page-of
-                        "test.pdf" (nth i pages) nil doc)))))))
+                                  (let ((pages '(2 1 4 3 5 6)))
+                                    (dotimes (i (length pages))
+                                      (should (equal (1+ i)
+                                                     
(pdf-virtual-document-page-of
+                                                      "test.pdf" (nth i pages) 
nil doc)))))))
 
 (ert-deftest pdf-virtual-open ()
   (with-pdf-virtual-test-buffer
@@ -77,29 +76,29 @@
 
 (ert-deftest pdf-virtual-search ()
   (with-pdf-virtual-test-buffer
-    (dolist (m (list (pdf-info-search-string "PDF" 2)
-                     (pdf-info-search-regexp "PDF" 2)))
-      (should (= 2 (length m)))
-      (should (equal (mapcar (apply-partially 'alist-get 'page)
-                             m)
-                     '(2 2)))
-      (should (cl-every (lambda (elt)
-                          (cl-every 'pdf-test-relative-edges-p elt))
-                        (mapcar (apply-partially 'alist-get 'edges)
-                                m))))))
+   (dolist (m (list (pdf-info-search-string "PDF" 2)
+                    (pdf-info-search-regexp "PDF" 2)))
+     (should (= 2 (length m)))
+     (should (equal (mapcar (apply-partially 'alist-get 'page)
+                            m)
+                    '(2 2)))
+     (should (cl-every (lambda (elt)
+                         (cl-every 'pdf-test-relative-edges-p elt))
+                       (mapcar (apply-partially 'alist-get 'edges)
+                               m))))))
 
 (ert-deftest pdf-virtual-pagelinks ()
   (with-pdf-virtual-test-buffer
-    (let ((links (pdf-info-pagelinks 4)))
-      (should (cl-every 'pdf-test-relative-edges-p
-                        (mapcar (apply-partially 'alist-get 'edges)
-                                links)))
-      (should (equal (mapcar (apply-partially 'alist-get 'type)
-                             links)
-                     '(goto-dest uri)))
-      (should (equal (mapcar (apply-partially 'alist-get 'uri)
-                             links)
-                     '(nil "http://www.gnu.org";))))))
+   (let ((links (pdf-info-pagelinks 4)))
+     (should (cl-every 'pdf-test-relative-edges-p
+                       (mapcar (apply-partially 'alist-get 'edges)
+                               links)))
+     (should (equal (mapcar (apply-partially 'alist-get 'type)
+                            links)
+                    '(goto-dest uri)))
+     (should (equal (mapcar (apply-partially 'alist-get 'uri)
+                            links)
+                    '(nil "http://www.gnu.org";))))))
 
 (ert-deftest pdf-virtual-number-of-pages ()
   (with-pdf-virtual-test-buffer
@@ -107,23 +106,23 @@
 
 (ert-deftest pdf-virtual-outline ()
   (with-pdf-virtual-test-buffer
-    (let ((outline (pdf-info-outline)))
-      (should (= 8 (length outline)))
-      (should (equal (mapcar (apply-partially 'alist-get 'depth)
-                             outline)
-                     '(1 2 2 2 2 2 3 4)))
-      (should (cl-every (lambda (type)
-                          (equal type 'goto-dest))
-                        (mapcar (apply-partially 'alist-get 'type)
-                                (cdr outline)))))))
+   (let ((outline (pdf-info-outline)))
+     (should (= 8 (length outline)))
+     (should (equal (mapcar (apply-partially 'alist-get 'depth)
+                            outline)
+                    '(1 2 2 2 2 2 3 4)))
+     (should (cl-every (lambda (type)
+                         (equal type 'goto-dest))
+                       (mapcar (apply-partially 'alist-get 'type)
+                               (cdr outline)))))))
 
 (ert-deftest pdf-virtual-gettext ()
   (with-pdf-virtual-test-buffer
-    (let ((text (pdf-info-gettext 2 '(0 0 1 1))))
-      (should
-       (= 2 (with-temp-buffer
-              (insert text)
-              (count-matches "PDF" 1 (point))))))))
+   (let ((text (pdf-info-gettext 2 '(0 0 1 1))))
+     (should
+      (= 2 (with-temp-buffer
+             (insert text)
+             (count-matches "PDF" 1 (point))))))))
 
 (ert-deftest pdf-virtual-getselection ()
   (with-pdf-virtual-test-buffer
@@ -144,29 +143,29 @@
 
 (ert-deftest pdf-virtual-pagesize ()
   (with-pdf-virtual-test-buffer
-    (let* ((os '(612 . 792))
-           (s (pdf-info-pagesize 1))
-           (ds (cons (* (- 0.4046 0.1879) (car os))
-                     (* (- 0.3392 0.2462) (cdr os)))))
-      (should (< (abs (- (car s) (car ds))) 10))
-      (should (< (abs (- (cdr s) (cdr ds))) 10)))))
+   (let* ((os '(612 . 792))
+          (s (pdf-info-pagesize 1))
+          (ds (cons (* (- 0.4046 0.1879) (car os))
+                    (* (- 0.3392 0.2462) (cdr os)))))
+     (should (< (abs (- (car s) (car ds))) 10))
+     (should (< (abs (- (cdr s) (cdr ds))) 10)))))
 
 (ert-deftest pdf-virtual-getannots ()
   (with-pdf-virtual-test-buffer
-    (let ((a (pdf-info-getannots 1)))
-      (should (= 3 (length a)))
-      (should (equal (sort (copy-sequence '(highlight underline squiggly))
-                           'string<)
-                     (sort (mapcar (lambda (elt)
-                                     (cdr (assq 'type elt)))
-                                   a)
-                           'string<))))))
+   (let ((a (pdf-info-getannots 1)))
+     (should (= 3 (length a)))
+     (should (equal (sort (copy-sequence '(highlight underline squiggly))
+                          'string<)
+                    (sort (mapcar (lambda (elt)
+                                    (cdr (assq 'type elt)))
+                                  a)
+                          'string<))))))
 
 (ert-deftest pdf-virtual-getannot ()
   (with-pdf-virtual-test-buffer
-    (let* ((a1 (car (pdf-info-getannots 1)))
-           (a2 (pdf-info-getannot (cdr (assq 'id a1)))))
-      (should (equal a1 a2)))))
+   (let* ((a1 (car (pdf-info-getannots 1)))
+          (a2 (pdf-info-getannot (cdr (assq 'id a1)))))
+     (should (equal a1 a2)))))
 
 (ert-deftest pdf-virtual-addannot ()
   (with-pdf-virtual-test-buffer
@@ -175,8 +174,8 @@
 (ert-deftest pdf-virtual-delannot ()
   (skip-unless (pdf-info-writable-annotations-p))
   (with-pdf-virtual-test-buffer
-  (should-error (pdf-info-delannot
-                 (cdr (assq 'id (car (pdf-info-getannots 1))))))))
+   (should-error (pdf-info-delannot
+                  (cdr (assq 'id (car (pdf-info-getannots 1))))))))
 
 (ert-deftest pdf-virtual-mvannot ()
   (skip-unless (pdf-info-writable-annotations-p))
@@ -203,49 +202,47 @@
         (progn
           (pdf-virtual-global-minor-mode 1)
           (with-pdf-virtual-test-buffer
-            (should (stringp (pdf-info-renderpage 1 100 :alpha 0.1)))
-            (should (stringp (pdf-info-renderpage
-                              1 100 (current-buffer) :alpha 0.2))))
+           (should (stringp (pdf-info-renderpage 1 100 :alpha 0.1)))
+           (should (stringp (pdf-info-renderpage
+                             1 100 (current-buffer) :alpha 0.2))))
           (pdf-test-with-test-pdf
-            (should (plist-get (pdf-info-setoptions
-                                :render/printed t)
-                               :render/printed))
-            (should-not (plist-get (pdf-info-setoptions
-                                    (current-buffer)
-                                    :render/printed nil)
-                                   :render/printed))
-            (should (plist-get (pdf-info-setoptions
-                                (buffer-file-name)
-                                :render/printed t)
-                               :render/printed))))
+           (should (plist-get (pdf-info-setoptions
+                               :render/printed t)
+                              :render/printed))
+           (should-not (plist-get (pdf-info-setoptions
+                                   (current-buffer)
+                                   :render/printed nil)
+                                  :render/printed))
+           (should (plist-get (pdf-info-setoptions
+                               (buffer-file-name)
+                               :render/printed t)
+                              :render/printed))))
       (unless enabled-p
         (pdf-virtual-global-minor-mode -1)))))
 
-  ;; (ert-deftest pdf-virtual-getattachment-from-annot ()
-  ;;   )
+;; (ert-deftest pdf-virtual-getattachment-from-annot ()
+;;   )
 
-  ;; (ert-deftest pdf-virtual-getattachments ()
-  ;;   )
+;; (ert-deftest pdf-virtual-getattachments ()
+;;   )
 
-  ;; (ert-deftest pdf-virtual-synctex-forward-search ()
-  ;;   )
+;; (ert-deftest pdf-virtual-synctex-forward-search ()
+;;   )
 
-  ;; (ert-deftest pdf-virtual-synctex-backward-search ()
-  ;;   )
+;; (ert-deftest pdf-virtual-synctex-backward-search ()
+;;   )
 
-  ;; (ert-deftest pdf-virtual-renderpage ()
-  ;;   )
+;; (ert-deftest pdf-virtual-renderpage ()
+;;   )
 
-  ;; (ert-deftest pdf-virtual-boundingbox ()
-  ;;   )
+;; (ert-deftest pdf-virtual-boundingbox ()
+;;   )
 
-  ;; (ert-deftest pdf-virtual-pagelabels ()
-  ;;   )
+;; (ert-deftest pdf-virtual-pagelabels ()
+;;   )
 
-  ;; (ert-deftest pdf-virtual-setoptions ()
-  ;;   )
+;; (ert-deftest pdf-virtual-setoptions ()
+;;   )
 
-  ;; (ert-deftest pdf-virtual-getoptions ()
-  ;;   )
-
-  )
+;; (ert-deftest pdf-virtual-getoptions ()
+;;   )



reply via email to

[Prev in Thread] Current Thread [Next in Thread]