org-manual: Improve accuracy of a paragraph
[org-mode/org-tableheadings.git] / testing / lisp / test-org-inlinetask.el
blob1e8c9ff0356f516ce778aaab3e3232a8d5be0548
1 ;;; test-org-inlinetask.el --- Tests for org-inlinetask.el
3 ;; Copyright (c) Marco Wahl
4 ;; Authors: Marco Wahl
6 ;; This program is free software; you can redistribute it and/or modify
7 ;; it under the terms of the GNU General Public License as published by
8 ;; the Free Software Foundation, either version 3 of the License, or
9 ;; (at your option) any later version.
11 ;; This program is distributed in the hope that it will be useful,
12 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;; GNU General Public License for more details.
16 ;; You should have received a copy of the GNU General Public License
17 ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
19 ;;; Comments:
21 ;; Tests for org-inlinetask.el.
23 ;;; Code:
25 (require 'org-inlinetask)
28 ;;; Test movement
30 (ert-deftest test-org-inlinetask/org-inlinetask-goto-end ()
31 ;; Goto end.
32 (should
33 (equal
34 (let ((org-inlinetask-min-level 5)
35 (org-adapt-indentation t))
36 (org-test-with-temp-text
37 "** H
38 <point>***** I
39 ***** END
40 foo"
41 (org-inlinetask-goto-end)
42 (insert "<point>")
43 (buffer-string)))
44 "** H
45 ***** I
46 ***** END
47 <point>foo"))
49 ;; Goto end. End is buffer end.
50 (should
51 (equal
52 (let ((org-inlinetask-min-level 5)
53 (org-adapt-indentation t))
54 (org-test-with-temp-text
55 "** H
56 <point>***** I
57 ***** END"
58 (org-inlinetask-goto-end)
59 (insert "<point>")
60 (buffer-string)))
61 "** H
62 ***** I
63 ***** END<point>"))
65 ;; Goto end. Starting somewhere.
66 (should
67 (equal
68 (let ((org-inlinetask-min-level 5)
69 (org-adapt-indentation t))
70 (org-test-with-temp-text
71 "** H
72 ****<point>* I
73 ***** END
74 ***** I
75 ***** END"
76 (org-inlinetask-goto-end)
77 (insert "<point>")
78 (buffer-string)))
79 "** H
80 ***** I
81 ***** END
82 <point>***** I
83 ***** END"))
85 (should
86 (equal
87 (let ((org-inlinetask-min-level 5)
88 (org-adapt-indentation t))
89 (org-test-with-temp-text
90 "** H
91 ***** I
92 <point> inside
93 ***** END
94 ***** I
95 ***** END"
96 (org-inlinetask-goto-end)
97 (insert "<point>")
98 (buffer-string)))
99 "** H
100 ***** I
101 inside
102 ***** END
103 <point>***** I
104 ***** END")))
106 (ert-deftest test-org-inlinetask/inlinetask-within-plain-list ()
107 "Fold inlinetasks in plain-lists.
108 Report:
109 http://lists.gnu.org/archive/html/emacs-orgmode/2017-12/msg00502.html"
110 (should
111 (org-test-with-temp-text
112 "* Test
113 <point>- x
115 *************** List folding stopped here
116 *************** END
119 (org-cycle-internal-local)
120 (invisible-p (1- (search-forward "- b"))))))
122 (ert-deftest test-org-inlinetask/folding-directly-consecutive-tasks/0 ()
123 "Fold directly consecutive inlinetasks."
124 (should
125 (org-test-with-temp-text
126 "* Test
127 <point>- x
129 *************** List folding stopped here
130 *************** END
131 *************** List folding stopped here
132 *************** END
135 (org-cycle-internal-local)
136 (invisible-p (1- (search-forward "- b"))))))
138 (ert-deftest test-org-inlinetask/folding-directly-consecutive-tasks/1 ()
139 "Fold directly consecutive inlinetasks."
140 (should
141 (org-test-with-temp-text
142 "<point>* Test
143 *************** p1
145 *************** END
146 *************** p3
148 *************** END
151 (outline-hide-subtree)
152 (org-cycle)
153 (and
154 (not (invisible-p (1- (search-forward "p1"))))
155 (invisible-p (1- (search-forward "p2")))
156 (not (invisible-p (1- (search-forward "p3"))))
157 (invisible-p (1- (search-forward "p4")))))))
161 (provide 'test-org-inlinetask)
163 ;;; test-org-inlinetask.el ends here