[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/popup 2593e06 071/184: Add test for #18, #19, #20
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/popup 2593e06 071/184: Add test for #18, #19, #20 |
Date: |
Wed, 6 Oct 2021 00:01:09 -0400 (EDT) |
branch: elpa/popup
commit 2593e068d477efeaf4c46fa066aeccb895796dc9
Author: uk-ar <yuuki.ari@gmail.com>
Commit: uk-ar <yuuki.ari@gmail.com>
Add test for #18, #19, #20
---
tests/popup-test.el | 107 ++++++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 99 insertions(+), 8 deletions(-)
diff --git a/tests/popup-test.el b/tests/popup-test.el
index 819c0d7..d3ed9a7 100644
--- a/tests/popup-test.el
+++ b/tests/popup-test.el
@@ -123,16 +123,34 @@ batch mode."
(let ((end (point)))
(while (and (not (bobp))
(not (popup-test-helper-in-popup-p)))
+ (setq end (point))
(goto-char (or (previous-single-property-change (point) 'face)
(point-min))))
(if (popup-test-helper-in-popup-p)
;; todo visual line
- (line-number-at-pos (point)) nil)
+ (line-number-at-pos end) nil)
+ ))))
+
+(defun popup-test-helper-popup-end-column ()
+ (let ((buffer-contents (popup-test-helper-buffer-contents)))
+ (with-temp-buffer
+ (insert buffer-contents)
+ (goto-char (point-max))
+ (let ((end (point)))
+ (while (and (not (bobp))
+ (not (popup-test-helper-in-popup-p)))
+ (setq end (point))
+ (goto-char (or (previous-single-property-change (point) 'face)
+ (point-min))))
+ (when (popup-test-helper-in-popup-p)
+ (goto-char end)
+ (current-column))
))))
(defun popup-test-helper-debug ()
(let ((buffer-contents (popup-test-helper-buffer-contents)))
(with-current-buffer (get-buffer-create "*dump*")
+ (erase-buffer)
(insert buffer-contents)
(buffer-string)
)))
@@ -287,7 +305,6 @@ bla
bla
bla
bla" :nowait t)
- (message (popup-test-helper-debug))
(should (popup-test-helper-rectangle-match "\
bla
bla
@@ -337,10 +354,27 @@ bla"))
(popup-test-with-common-setup
(insert " ")
(popup-tip "Margin?" :nowait t :margin t)
- (should (popup-test-helper-rectangle-match "Margin?"))
- ;; Pending:
- ;; (should (eq (popup-test-helper-popup-beginning-column)
- ;; 1))
+ (should (eq (popup-test-helper-popup-beginning-column)
+ 0))
+ (should (popup-test-helper-rectangle-match " Margin? "))
+ ))
+
+(ert-deftest popup-test-margin-left ()
+ (popup-test-with-common-setup
+ (popup-tip "Margin?" :nowait t :margin t)
+ (should (eq (popup-test-helper-popup-beginning-column)
+ 0))
+ ;; Pending: #19
+ ;; (should (popup-test-helper-rectangle-match " Margin? "))
+ ))
+
+(ert-deftest popup-test-margin-right ()
+ (popup-test-with-common-setup
+ (insert (make-string (- (window-width) 1) ? ))
+ (popup-tip "Margin?" :nowait t :margin t)
+ (should (popup-test-helper-rectangle-match " Margin? "))
+ ;; Pending: #19
+ ;; (should (< (popup-test-helper-popup-end-column) (window-width)))
))
(ert-deftest popup-test-height-limit ()
@@ -416,8 +450,31 @@ Bazb"))
(should-not (popup-test-helper-rectangle-match "Oz"))
(should (eq (popup-test-helper-popup-beginning-line) 2))
(should (eq (popup-test-helper-popup-end-line) 4))
- ;; (should (eq (popup-test-helper-popup-beginning-column)
- ;; (- (window-width) 5)))
+ )))
+
+(ert-deftest popup-test-scroll-bar-right-margin ()
+ (popup-test-with-common-setup
+ (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-tip "\
+Foo
+Bar
+Baz
+Fez
+Oz"
+ :nowait t :height 3 :scroll-bar t :margin t)
+ (should-not (popup-test-helper-rectangle-match "Fez"))
+ (should-not (popup-test-helper-rectangle-match "Oz"))
+ (should (eq (popup-test-helper-popup-beginning-line) 2))
+ (should (eq (popup-test-helper-popup-end-line) 4))
+ ;; Pending: #21
+ ;; (should (popup-test-helper-rectangle-match "\
+ ;; Foof
+ ;; Barb
+ ;; Bazb"))
)))
(ert-deftest popup-test-min-height ()
@@ -544,3 +601,37 @@ Foo2"))
(should-not (popup-test-helper-rectangle-match "Foo81"))
(should (eq (popup-test-helper-popup-beginning-line) 2))
))
+
+(ert-deftest popup-test-two-tip ()
+ (popup-test-with-common-setup
+ (popup-tip "\
+Foo
+Bar" :nowait t)
+ (save-excursion (insert "\n"))
+ (popup-tip "\
+Baz
+Qux" :nowait t)
+ ;; Pending: #20
+ ;; (should (popup-test-helper-rectangle-match "\
+ ;; Foo
+ ;; Bar"))
+ ;; (should (popup-test-helper-rectangle-match "\
+ ;; Baz
+ ;; Qux"))
+ ))
+
+(defun popup-test-helper-input (key)
+ (push key unread-command-events))
+
+(ert-deftest popup-test-isearch ()
+ (popup-test-with-common-setup
+ (popup-test-helper-create-popup "\
+foo
+bar
+baz")
+ (popup-isearch-update popup "a")
+ (should (popup-test-helper-rectangle-match "\
+bar
+baz"))
+ (should-not (popup-test-helper-rectangle-match "foo"))
+ ))
- [nongnu] elpa/popup 2609811 022/184: Add Travis CI configuration, (continued)
- [nongnu] elpa/popup 2609811 022/184: Add Travis CI configuration, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup e76230b 059/184: Add summary-face keyword argument to popup-set-line-item, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup ab23548 031/184: Change popup-test-helper-overlays-to-text spec and function name to return overlays buffer., ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 498cb64 061/184: Define popup-summary-face, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 54ed4bd 048/184: Add test case:popup-next, popup-previous, popup-select, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup fd8a372 039/184: Remove unused code., ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 72c6e4d 027/184: Port some test cases from popup-interactive-test.el, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 180516e 079/184: Use cl-lib functions instead of cl, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 28cb27c 074/184: Add next/previous page commands., ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 7fda072 042/184: Add check for row position., ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 2593e06 071/184: Add test for #18, #19, #20,
ELPA Syncer <=
- [nongnu] elpa/popup 48b0fa4 020/184: Add a simple test using ERT, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup e208b13 035/184: Setup for batch mode, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 9814c88 038/184: Add test for test helper, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 581f35b 062/184: Define popup-menu-summary-face, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 4e19acb 036/184: Remove dependency on auto-complete, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup bec50cc 076/184: Merge pull request #41 from kostafey/master, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 4e8824e 051/184: Add some make rules for test., ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup f2fc154 058/184: Add summary-face keyword argument to popup-create-line-string, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup b45aa2d 060/184: Handle summary-face in popup-draw, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup e645eae 049/184: Add test case:popup-scroll-down, popup-scroll-up, ELPA Syncer, 2021/10/06