[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2-v1 (test v1)] New: auto display inline images under subtree
From: |
Christopher M. Miles |
Subject: |
Re: [PATCH 2-v1 (test v1)] New: auto display inline images under subtree when `org-cycle'. |
Date: |
Thu, 29 Sep 2022 14:57:26 +0800 |
User-agent: |
mu4e 1.8.9; emacs 29.0.50 |
Ihor Radchenko <yantar92@gmail.com> writes:
> "Christopher M. Miles" <numbchild@gmail.com> 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
- Re: [PATCH 3] New: auto display inline images under subtree when `org-cycle'., (continued)
- Message not available
- Message not available
- Re: [PATCH 3] New: auto display inline images under subtree when `org-cycle'., Ihor Radchenko, 2022/09/14
- [PATCH 4] New: auto display inline images under subtree when `org-cycle'., Christopher M. Miles, 2022/09/15
- Message not available
- Re: [PATCH 4] New: auto display inline images under subtree when `org-cycle'., Ihor Radchenko, 2022/09/15
- [PATCH 5] New: auto display inline images under subtree when `org-cycle'., Christopher M. Miles, 2022/09/15
- Message not available
- [PATCH v6] Re: [PATCH 5] New: auto display inline images under subtree when `org-cycle'., Ihor Radchenko, 2022/09/20
- Re: [PATCH v6] New: auto display inline images under subtree when `org-cycle'., Christopher M. Miles, 2022/09/20
- Message not available
- Re: [PATCH v6] New: auto display inline images under subtree when `org-cycle'., Ihor Radchenko, 2022/09/21
- [PATCH 2-v1] New: auto display inline images under subtree when `org-cycle'., Christopher M. Miles, 2022/09/28
- Message not available
- Re: [PATCH 2-v1] New: auto display inline images under subtree when `org-cycle'., Ihor Radchenko, 2022/09/28
- Re: [PATCH 2-v1] New: auto display inline images under subtree when `org-cycle'., Christopher M. Miles, 2022/09/29
- Re: [PATCH 2-v1 (test v1)] New: auto display inline images under subtree when `org-cycle'.,
Christopher M. Miles <=
- Message not available
- Re: [PATCH 2-v1] New: auto display inline images under subtree when `org-cycle'., Ihor Radchenko, 2022/09/29
- Re: [PATCH 2-v2] New: auto display inline images under subtree when `org-cycle'., Christopher M. Miles, 2022/09/30
- Message not available
- Re: [PATCH 2-v2] New: auto display inline images under subtree when `org-cycle'., Ihor Radchenko, 2022/09/30
- Message not available
- [ISSUE] Re: [PATCH] New: auto display inline images under subtree when `org-cycle'., Christopher M. Miles, 2022/09/12