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

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

[nongnu] elpa/popup e645eae 049/184: Add test case:popup-scroll-down, po


From: ELPA Syncer
Subject: [nongnu] elpa/popup e645eae 049/184: Add test case:popup-scroll-down, popup-scroll-up
Date: Wed, 6 Oct 2021 00:01:04 -0400 (EDT)

branch: elpa/popup
commit e645eae7e430812df9c8ae6217ec0e9b03f06dc0
Author: yuuki arisawa <yuuki.ari@gmail.com>
Commit: yuuki arisawa <yuuki.ari@gmail.com>

    Add test case:popup-scroll-down,popup-scroll-up
---
 tests/popup-test.el | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/tests/popup-test.el b/tests/popup-test.el
index aab2157..4dda31f 100644
--- a/tests/popup-test.el
+++ b/tests/popup-test.el
@@ -436,3 +436,56 @@ HELP-DELAY is a delay of displaying helps."
           (should (equal (popup-test-helper-points-to-columns points)
                          '(0 0 0)))
           )))))
+
+(ert-deftest popup-test-scroll-down ()
+  (popup-test-with-temp-buffer
+    (let ((popup
+           (popup-cascade-menu (loop for x to 100 collect (format "Foo%d" x))
+                               :nowait t :height 10 :margin t :scroll-bar t)))
+      (with-current-buffer (popup-test-helper-get-overlays-buffer)
+        (let ((points (popup-test-helper-match-points
+                       '("Foo0" "Foo1" "Foo2"))))
+          (should (eq (line-number-at-pos (car points)) 2))
+          (should (equal (popup-test-helper-points-to-columns points)
+                         '(0 0 0)))
+          ))
+      (should (equal (popup-selected-item popup) "Foo0"))
+      (popup-scroll-down popup 10)
+      (should (equal (popup-selected-item popup) "Foo10"))
+      (popup-scroll-down popup 10)
+      (should (equal (popup-selected-item popup) "Foo20"))
+      (popup-scroll-down popup 100)
+      (with-current-buffer (popup-test-helper-get-overlays-buffer)
+        (let ((points (popup-test-helper-match-points
+                       '("Foo91" "Foo100" "Foo90"))))
+          (should (eq (line-number-at-pos (car points)) 2))
+          (should (equal (popup-test-helper-points-to-columns points)
+                         '(0 0 nil)))
+          ))
+      )))
+
+(ert-deftest popup-test-scroll-up ()
+  (popup-test-with-temp-buffer
+    (let ((popup
+           (popup-cascade-menu (loop for x to 100 collect (format "Foo%d" x))
+                               :nowait t :height 10 :margin t :scroll-bar t)))
+      (with-current-buffer (popup-test-helper-get-overlays-buffer)
+        (let ((points (popup-test-helper-match-points
+                       '("Foo0" "Foo1" "Foo2"))))
+          (should (eq (line-number-at-pos (car points)) 2))
+          (should (equal (popup-test-helper-points-to-columns points)
+                         '(0 0 0)))
+          ))
+      (should (equal (popup-selected-item popup) "Foo0"))
+      (popup-scroll-down popup 100)
+      (should (equal (popup-selected-item popup) "Foo91"))
+      (popup-scroll-up popup 10)
+      (should (equal (popup-selected-item popup) "Foo81"))
+      (with-current-buffer (popup-test-helper-get-overlays-buffer)
+        (let ((points (popup-test-helper-match-points
+                       '("Foo81" "Foo90" "Foo80"))))
+          (should (eq (line-number-at-pos (car points)) 2))
+          (should (equal (popup-test-helper-points-to-columns points)
+                         '(0 0 nil)))
+          ))
+      )))



reply via email to

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