summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2021-11-24 19:38:41 +0100
committerLars Ingebrigtsen <larsi@gnus.org>2021-11-24 19:38:41 +0100
commitfde9363a57d0d38d592122fe5ca01aaafd0afa52 (patch)
tree0f80c2aa5effa3bea4248d6c5a741e23dc75b93b /test/lisp/emacs-lisp
parent34f2878ce25a74c1283266b67575a56554684be5 (diff)
downloademacs-fde9363a57d0d38d592122fe5ca01aaafd0afa52.tar.gz
emacs-fde9363a57d0d38d592122fe5ca01aaafd0afa52.tar.bz2
emacs-fde9363a57d0d38d592122fe5ca01aaafd0afa52.zip
Add new function 'add-display-text-property'
* doc/lispref/display.texi (Display Property): Document it. * lisp/emacs-lisp/subr-x.el (add-display-text-property): New function.
Diffstat (limited to 'test/lisp/emacs-lisp')
-rw-r--r--test/lisp/emacs-lisp/subr-x-tests.el18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/subr-x-tests.el b/test/lisp/emacs-lisp/subr-x-tests.el
index f9cfea888c7..69d59e84f6d 100644
--- a/test/lisp/emacs-lisp/subr-x-tests.el
+++ b/test/lisp/emacs-lisp/subr-x-tests.el
@@ -676,5 +676,23 @@
(buffer-string))
"foo\n")))
+(ert-deftest test-add-display-text-property ()
+ (with-temp-buffer
+ (insert "Foo bar zot gazonk")
+ (add-display-text-property 4 8 'height 2.0)
+ (add-display-text-property 2 12 'raise 0.5)
+ (should (equal (get-text-property 2 'display) '(raise 0.5)))
+ (should (equal (get-text-property 5 'display)
+ '((raise 0.5) (height 2.0))))
+ (should (equal (get-text-property 9 'display) '(raise 0.5))))
+ (with-temp-buffer
+ (insert "Foo bar zot gazonk")
+ (put-text-property 4 8 'display [(height 2.0)])
+ (add-display-text-property 2 12 'raise 0.5)
+ (should (equal (get-text-property 2 'display) '(raise 0.5)))
+ (should (equal (get-text-property 5 'display)
+ [(raise 0.5) (height 2.0)]))
+ (should (equal (get-text-property 9 'display) '(raise 0.5)))))
+
(provide 'subr-x-tests)
;;; subr-x-tests.el ends here