Ihor Radchenko <[email protected]> writes: > "Christopher M. Miles" <[email protected]> writes: > >> Ok, I created the patch for subtree cycling display inline images. >> Tested by edebug when org cycling, it should works fine. I don't know >> how to write test for this. > > Thanks for the update! > > For tests, you will need to test the existence of image overlays. > You can refer to test-org-fold/org-fold-reveal-broken-structure but > need to test overlays-at instead of just org-invisible-p.
I write a testing prototype, got a problem which I marked TODO in code.
And can you check whether my tests correct? Thanks
#+begin_src emacs-lisp
;;; TODO: reference `test-org-fold/org-fold-reveal-broken-structure'
(ert-deftest test-org-fold/org-fold-display-inline-images ()
"Test inline images displaying when cycling."
(let ((org-fold-core-style 'text-properties)
(org-cycle-inline-images-display t))
;; `org-cycle' -(state)-> `'children' display child inline images.
(org-test-with-temp-text
"<point>* Heading 1
[[file:image.png]]"
(org-overview)
(org-cycle)
(org-next-link)
(should (overlays-at (point)))
(org-toggle-inline-images)
(should-not (overlays-at (point))))
;; `org-cycle' -(state)-> `'subtree' display subtrees inline images.
(org-test-with-temp-text
"<point>* Heading 1
[[file:image.png]]
** Subheading 1
[[file:image2.png]]
** Subheading 2
[[file:image3.png]]"
(org-overview)
(org-cycle)
(org-cycle)
(org-next-link)
(org-next-link)
(should (overlays-at (point)))
(org-toggle-inline-images)
(should-not (overlays-at (point))))
;; `org-cycle' -(state)-> `'folded' remove inline image overlays.
(org-test-with-temp-text
"<point>* Heading 1
[[file:image.png]]
** Subheading 1
[[file:image2.png]]
** Subheading 2
[[file:image3.png]]"
(org-overview)
(org-cycle)
(org-cycle)
(org-cycle)
;; TODO: how to detect inline image overlays are deleted after folded?
(should (overlays-at (point)))
(org-toggle-inline-images)
(should-not (overlays-at (point))))))
#+end_src
--
[ stardiviner ]
I try to make every word tell the meaning that I want to express without
misunderstanding.
Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
signature.asc
Description: PGP signature
