]> code.delx.au - gnu-emacs-elpa/blobdiff - packages/company/test/frontends-tests.el
Merge commit 'e085a333867959a1b36015a3ad8e12e5bd6550d9' from company
[gnu-emacs-elpa] / packages / company / test / frontends-tests.el
index a10f91461f2c6ef2a4e65640ef97c8a08a8091d7..613856e57418c2a7ee298b5ed786f3a3e7343800 100644 (file)
                      " b ︸︸ ")
                    (company--create-lines 0 999)))))
 
+(ert-deftest company-create-lines-with-multiple-width-and-keep-prefix ()
+  :tags '(interactive)
+  (let* (company-show-numbers
+         (company-candidates '("MIRAI発売1カ月"
+                               "MIRAI発売2カ月"))
+         (company-candidates-length 2)
+         (company-prefix "MIRAI発")
+         (company-backend (lambda (c &optional _arg)
+                            (pcase c
+                              (`ignore-case 'keep-prefix)))))
+    (should (equal '(" MIRAI発売1カ月 "
+                     " MIRAI発売2カ月 ")
+                   (company--create-lines 0 999)))))
+
+(ert-deftest company-fill-propertize-truncates-search-highlight ()
+  (let ((company-search-string "foo")
+        (company-backend #'ignore)
+        (company-prefix ""))
+    (should (equal-including-properties
+             (company-fill-propertize "barfoo" nil 6 t nil nil)
+             #("barfoo"
+               0 3 (face company-tooltip mouse-face company-tooltip-mouse)
+               3 6 (face company-tooltip-search mouse-face company-tooltip-mouse))))
+    (should (equal-including-properties
+             (company-fill-propertize "barfoo" nil 5 t "" " ")
+             #("barfo "
+               0 3 (face company-tooltip mouse-face company-tooltip-mouse)
+               3 5 (face company-tooltip-search mouse-face company-tooltip-mouse)
+               5 6 (face company-tooltip mouse-face company-tooltip-mouse))))
+    (should (equal-including-properties
+             (company-fill-propertize "barfoo" nil 3 t " " " ")
+             #(" bar "
+               0 5 (face company-tooltip mouse-face company-tooltip-mouse))))))
+
 (ert-deftest company-column-with-composition ()
   :tags '(interactive)
   (with-temp-buffer