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

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

[elpa] externals/pyim 5611319de0 35/41: Add page test


From: ELPA Syncer
Subject: [elpa] externals/pyim 5611319de0 35/41: Add page test
Date: Sat, 4 Jun 2022 09:57:48 -0400 (EDT)

branch: externals/pyim
commit 5611319de0e7b90ae3c60f4fd0be9585f45b4e8e
Author: Feng Shu <tumashu@163.com>
Commit: Feng Shu <tumashu@163.com>

    Add page test
---
 tests/pyim-tests.el | 49 ++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 48 insertions(+), 1 deletion(-)

diff --git a/tests/pyim-tests.el b/tests/pyim-tests.el
index de399489e4..9ba4bacb8a 100644
--- a/tests/pyim-tests.el
+++ b/tests/pyim-tests.el
@@ -46,7 +46,7 @@
 ;; 18. TODO   pyim-indicator.el
 ;; 19. IGNORE pyim-liberime.el
 ;; 20. TODO   pyim-outcome.el
-;; 21. TODO   pyim-page.el
+;; 21. [30%]  pyim-page.el
 ;; 22. DONE   pyim-pinyin.el
 ;; 23. TODO   pyim-preview.el
 ;; 24. [95%]  pyim-probe.el
@@ -1484,6 +1484,53 @@ Transfer-Encoding: chunked
   ;; TODO
   )
 
+;; ** pyim-probe 相关单元测试
+(ert-deftest pyim-tests-pyim-page-get-page-style ()
+  (let ((pyim-page-tooltip-style-alist
+         '((minibuffer . minibuffer)))
+        (pyim-page-style 'test))
+    (should (equal (pyim-page-get-page-style 'minibuffer)
+                   'minibuffer))
+    (should (equal (pyim-page-get-page-style 'test)
+                   'test))))
+
+(ert-deftest pyim-tests-pyim-page-info-format ()
+  (let ((page-info (make-hash-table)))
+    (puthash :scheme (pyim-scheme-get 'quanpin) page-info)
+    (puthash :current-page 1 page-info)
+    (puthash :total-page 26 page-info)
+    (puthash :candidates '("你好" "尼耗" "您耗" "您好" "你") page-info)
+    (puthash :position 3 page-info)
+    (puthash :hightlight-current 'hightlight-current page-info)
+    (puthash :assistant-enable nil page-info)
+
+    (should (equal (pyim-page-info-format 'two-lines page-info)
+                   "=> | [1/26]: 
+1.你好 2.尼耗 3[您耗]4.您好 5.你 "))
+    (should (equal (pyim-page-info-format 'one-line page-info)
+                   "[|]: 1.你好 2.尼耗 3[您耗]4.您好 5.你 (1/26)"))
+    (should (equal (pyim-page-info-format 'vertical page-info)
+                   "=> | [1/26]: 
+1.你好 
+2.尼耗 
+3[您耗]
+4.您好 
+5.你 "))
+    (should (equal (pyim-page-info-format 'minibuffer page-info)
+                   "[|              ]: 1.你好 2.尼耗 3[您耗]4.您好 5.你 (1/26) $ "))))
+
+(ert-deftest pyim-tests-pyim-page-menu-create ()
+  (should
+   (equal (pyim-page-menu-create '("你好" "尼耗" "您耗" "您好" "你") 0 nil t)
+          #("1.你好 2.尼耗 3.您耗 4.您好 5.你 " 13 17 (face pyim-page-selection))))
+  (should
+   (equal (pyim-page-menu-create '("你好" "尼耗" "您耗" "您好" "你") 1 nil t)
+          #("1[你好]2.尼耗 3.您耗 4.您好 5.你 " 1 5 (face pyim-page-selection))))
+  (should
+   (equal (pyim-page-menu-create '("你好" "尼耗" "您耗" "您好" "你") 3 nil t)
+          #("1.你好 2.尼耗 3[您耗]4.您好 5.你 " 11 15 (face pyim-page-selection)))))
+
+
 (ert-run-tests-batch-and-exit)
 ;; * Footer
 ;;; pyim-tests.el ends here



reply via email to

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