[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/popup 64102c2 046/184: Add test case:popup-tip(scroll-bar,
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/popup 64102c2 046/184: Add test case:popup-tip(scroll-bar, min-height) |
Date: |
Wed, 6 Oct 2021 00:01:04 -0400 (EDT) |
branch: elpa/popup
commit 64102c2bdfa44402c251cb256b350f912a729f34
Author: yuuki arisawa <yuuki.ari@gmail.com>
Commit: yuuki arisawa <yuuki.ari@gmail.com>
Add test case:popup-tip(scroll-bar,min-height)
---
tests/popup-test.el | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 74 insertions(+), 1 deletion(-)
diff --git a/tests/popup-test.el b/tests/popup-test.el
index 0fb85ec..c346edc 100644
--- a/tests/popup-test.el
+++ b/tests/popup-test.el
@@ -78,7 +78,9 @@ into real text. Return *text* buffer"
"Return list of colum"
(mapcar
(lambda (point)
- (save-excursion (goto-char point) (current-column)))
+ (if point
+ (save-excursion (goto-char point) (current-column))
+ nil))
points))
(defun popup-test-helper-same-all-p (seq)
@@ -88,6 +90,26 @@ into real text. Return *text* buffer"
(defun popup-test-helper-input (key)
(push key unread-command-events))
+(defun popup-test-helper-in-popup-p ()
+ (let* ((face (get-text-property (point) 'face))
+ (face (if (listp face) face (list face))))
+ (some (lambda (face) (if (memq face '(popup-tip-face popup-face)) t nil))
+ face)))
+
+(defun popup-test-helper-last-popup-line ()
+ "Return (START END) list of last popup line"
+ (save-excursion
+ (end-of-buffer)
+ (let ((end (point)))
+ (while (and (not (popup-test-helper-in-popup-p))
+ (let ((pos (previous-single-property-change (point) 'face)))
+ (when pos
+ (setq end (point))
+ (goto-char pos))
+ pos)))
+ (if (popup-test-helper-in-popup-p) `(,(point) ,end) nil)
+ )))
+
;; Test for helper method
(ert-deftest popup-test-test-helper ()
(should (eq (popup-test-helper-same-all-p '(0 0 0)) 0))
@@ -274,3 +296,54 @@ HELP-DELAY is a delay of displaying helps."
(should (eq (line-number-at-pos (car points))
(- (window-body-height) 2)))
)))))
+
+(ert-deftest popup-test-scroll-bar ()
+ (popup-test-with-temp-buffer
+ (let* ((popup-scroll-bar-foreground-char
+ (propertize "f" 'face 'popup-scroll-bar-foreground-face))
+ (popup-scroll-bar-background-char
+ (propertize "b" 'face 'popup-scroll-bar-background-face))
+ (popup (popup-tip "Foo\nBar\nBaz\nFez\nOz"
+ :nowait t :height 3 :scroll-bar t :margin t)))
+ (with-current-buffer (popup-test-helper-get-overlays-buffer)
+ (let ((points (popup-test-helper-match-points
+ '("Foo f" "Bar b" "Baz b" "Fez"))))
+ (should (equal (popup-test-helper-points-to-columns points)
+ '(0 0 0 nil)))
+ (should (eq (line-number-at-pos (car points)) 2))
+ )))))
+
+(ert-deftest popup-test-scroll-bar-right-no-margin ()
+ (popup-test-with-temp-buffer
+ (insert (make-string (- (window-width) 1) ? ))
+ (let* ((popup-scroll-bar-foreground-char
+ (propertize "f" 'face 'popup-scroll-bar-foreground-face))
+ (popup-scroll-bar-background-char
+ (propertize "b" 'face 'popup-scroll-bar-background-face))
+ (popup (popup-tip "Foo\nBar\nBaz\nFez\nOz"
+ :nowait t :height 3 :scroll-bar t)))
+ (with-current-buffer (popup-test-helper-get-overlays-buffer)
+ (let ((points (popup-test-helper-match-points
+ '("Foof" "Barb" "Bazb"))))
+ (should (equal (popup-test-helper-same-all-p
+ (popup-test-helper-points-to-columns points))
+ (- (window-width) 5)))
+ (should (eq (line-number-at-pos (car points)) 2))
+ )))))
+
+(ert-deftest popup-test-min-height ()
+ (popup-test-with-temp-buffer
+ (insert (make-string (- (window-width) 1) ? ))
+ (let ((popup (popup-tip "Hello" :nowait t :min-height 10)))
+ (with-current-buffer (popup-test-helper-get-overlays-buffer)
+ (let ((points (popup-test-helper-match-points
+ '("Hello")))
+ (last-bounds (popup-test-helper-last-popup-line)))
+ (should (eq (line-number-at-pos (car points)) 2))
+ (should (eq
+ (car (popup-test-helper-points-to-columns points))
+ (car (popup-test-helper-points-to-columns last-bounds))))
+ (should (eq (line-number-at-pos (car last-bounds)) 11))
+ (should (eq (nth 1 (popup-test-helper-points-to-columns last-bounds))
+ (1- (window-width))))
+ )))))
- [nongnu] elpa/popup e645eae 049/184: Add test case:popup-scroll-down, popup-scroll-up, (continued)
- [nongnu] elpa/popup e645eae 049/184: Add test case:popup-scroll-down, popup-scroll-up, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup ee5b4b0 034/184: Add test case when point is on the corner, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 1d692e4 066/184: Replace helper functions for some tests., ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 25e2e7f 043/184: Merge pull request #17 from uk-ar/feature, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 9dcce09 024/184: Merge branch 'master' of github.com:auto-complete/popup-el, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup e995ffa 030/184: Add check for columns of starting points., ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 8d7e57e 065/184: Replace popup-test-with-create-popup to popup-create, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 357f037 045/184: Add test case:popup-tip(height), ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup b8c1cb4 054/184: At least one space before summary, if possible, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 7533efe 078/184: Merge pull request #53 from auto-complete/fix-travis, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 64102c2 046/184: Add test case:popup-tip(scroll-bar, min-height),
ELPA Syncer <=
- [nongnu] elpa/popup 487c0a8 109/184: add :initial-index parameter test, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 8719cd9 105/184: Merge pull request #71 from auto-complete/use-cask, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 1510820 100/184: activate isearch in cascade menu, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 58f55de 096/184: Merge pull request #62 from auto-complete/support-max-width, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup afeaed3 082/184: Merge branch 'master' into use-cl-lib, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 70c2583 093/184: Add 'nostrip' parameter explanation to docstring, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 69d5bf9 095/184: Support max-width for popup instance, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 9587ace 085/184: Merge pull request #55 from auto-complete/fix-bytecompile-warnings, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup d70cff9 101/184: Merge pull request #64 from aki2o/cascade-isearch, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup c02ec73 111/184: Apply the patch of #8., ELPA Syncer, 2021/10/06