]> git.notmuchmail.org Git - notmuch/blob - test/T460-emacs-tree.sh
emacs: Add new option notmuch-search-hide-excluded
[notmuch] / test / T460-emacs-tree.sh
1 #!/usr/bin/env bash
2
3 test_description="emacs tree view interface"
4 . $(dirname "$0")/test-lib.sh || exit 1
5
6 EXPECTED=$NOTMUCH_SRCDIR/test/emacs-tree.expected-output
7
8 test_require_emacs
9 add_email_corpus
10
11 test_begin_subtest "Basic notmuch-tree view in emacs"
12 test_emacs '(notmuch-tree "tag:inbox")
13             (notmuch-test-wait)
14             (test-output)
15             (delete-other-windows)'
16 test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox OUTPUT
17
18 test_begin_subtest "Refreshed notmuch-tree view in emacs"
19 test_emacs '(notmuch-tree "tag:inbox")
20             (notmuch-test-wait)
21             (notmuch-tree-refresh-view)
22             (notmuch-test-wait)
23             (test-output)
24             (delete-other-windows)'
25 test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox OUTPUT
26
27 # In the following tag tests we make sure the display is updated
28 # correctly and, in a separate test, that the database is updated
29 # correctly.
30
31 test_begin_subtest "Tag message in notmuch tree view (display)"
32 test_emacs '(notmuch-tree "tag:inbox")
33             (notmuch-test-wait)
34             (forward-line)
35             (notmuch-tree-tag (list "+test_tag"))
36             (test-output)
37             (delete-other-windows)'
38 test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-tagged OUTPUT
39
40 test_begin_subtest "Tag message in notmuch tree view (database)"
41 output=$(notmuch search --output=messages 'tag:test_tag')
42 test_expect_equal "$output" "id:877h1wv7mg.fsf@inf-8657.int-evry.fr"
43
44 test_begin_subtest "Untag message in notmuch tree view"
45 test_emacs '(notmuch-tree "tag:inbox")
46             (notmuch-test-wait)
47             (forward-line)
48             (notmuch-tree-tag (list "-test_tag"))
49             (test-output)
50             (delete-other-windows)'
51 test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox OUTPUT
52
53 test_begin_subtest "Untag message in notmuch tree view (database)"
54 output=$(notmuch search --output=messages 'tag:test_tag')
55 test_expect_equal "$output" ""
56
57 test_begin_subtest "Tag thread in notmuch tree view"
58 test_emacs '(notmuch-tree "tag:inbox")
59             (notmuch-test-wait)
60             ;; move to a sizable thread
61             (forward-line 26)
62             (notmuch-tree-tag-thread (list "+test_thread_tag"))
63             (test-output)
64             (delete-other-windows)'
65 test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-thread-tagged OUTPUT
66
67 test_begin_subtest "Tag message in notmuch tree view (database)"
68 output=$(notmuch search --output=messages 'tag:test_thread_tag')
69 test_expect_equal "$output" \
70 "id:87ocn0qh6d.fsf@yoom.home.cworth.org
71 id:20091118005040.GA25380@dottiness.seas.harvard.edu
72 id:yunaayketfm.fsf@aiko.keithp.com
73 id:87fx8can9z.fsf@vertex.dottedmag
74 id:20091117203301.GV3165@dottiness.seas.harvard.edu
75 id:87iqd9rn3l.fsf@vertex.dottedmag
76 id:20091117190054.GU3165@dottiness.seas.harvard.edu"
77
78 test_begin_subtest "Untag thread in notmuch tree view"
79 test_emacs '(notmuch-tree "tag:inbox")
80             (notmuch-test-wait)
81             ;; move to the same sizable thread as above
82             (forward-line 26)
83             (notmuch-tree-tag-thread (list "-test_thread_tag"))
84             (test-output)
85             (delete-other-windows)'
86 test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox OUTPUT
87
88 test_begin_subtest "Untag message in notmuch tree view (database)"
89 output=$(notmuch search --output=messages 'tag:test_thread_tag')
90 test_expect_equal "$output" ""
91
92 test_begin_subtest "Navigation of notmuch-hello to search results"
93 test_emacs '(notmuch-hello)
94             (goto-char (point-min))
95             (re-search-forward "inbox")
96             (widget-button-press (1- (point)))
97             (notmuch-test-wait)
98             (notmuch-tree-from-search-current-query)
99             (notmuch-test-wait)
100             (test-output)
101             (delete-other-windows)'
102 test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox OUTPUT
103
104 test_begin_subtest "Tree view of a single thread (from search)"
105 test_emacs '(notmuch-hello)
106             (goto-char (point-min))
107             (re-search-forward "inbox")
108             (widget-button-press (1- (point)))
109             (notmuch-test-wait)
110             (notmuch-tree-from-search-thread)
111             (notmuch-test-wait)
112             (test-output)
113             (delete-other-windows)'
114 test_expect_equal_file $EXPECTED/notmuch-tree-single-thread OUTPUT
115
116 test_begin_subtest "Tree view of a single thread (from show)"
117 test_emacs '(notmuch-hello)
118             (goto-char (point-min))
119             (re-search-forward "inbox")
120             (widget-button-press (1- (point)))
121             (notmuch-test-wait)
122             (notmuch-search-show-thread)
123             (notmuch-tree-from-show-current-query)
124             (notmuch-test-wait)
125             (test-output)
126             (delete-other-windows)'
127 test_expect_equal_file $EXPECTED/notmuch-tree-single-thread OUTPUT
128
129 test_begin_subtest "Message window of tree view"
130 test_emacs '(notmuch-hello)
131             (goto-char (point-min))
132             (re-search-forward "inbox")
133             (widget-button-press (1- (point)))
134             (notmuch-test-wait)
135             (notmuch-search-next-thread)
136             (notmuch-tree-from-search-thread)
137             (notmuch-test-wait)
138             (select-window notmuch-tree-message-window)
139             (test-output)
140             (delete-other-windows)'
141 test_expect_equal_file $EXPECTED/notmuch-tree-show-window OUTPUT
142
143 test_begin_subtest "Stash id"
144 output=$(test_emacs '(notmuch-tree "id:1258498485-sup-142@elly")
145                      (notmuch-test-wait)
146                      (notmuch-show-stash-message-id)')
147 test_expect_equal "$output" "\"Stashed: id:1258498485-sup-142@elly\""
148
149 test_begin_subtest "Move to next matching message"
150 output=$(test_emacs '(notmuch-tree "from:cworth")
151                      (notmuch-test-wait)
152                      (notmuch-tree-next-matching-message)
153                      (notmuch-show-stash-message-id)')
154 test_expect_equal "$output" "\"Stashed: id:878we4qdqf.fsf@yoom.home.cworth.org\""
155
156 test_begin_subtest "Move to next thread"
157 output=$(test_emacs '(notmuch-tree "tag:inbox")
158                      (notmuch-test-wait)
159                      (forward-line 26)
160                      (notmuch-tree-next-thread)
161                      (notmuch-show-stash-message-id)')
162 test_expect_equal "$output" "\"Stashed: id:1258471718-6781-1-git-send-email-dottedmag@dottedmag.net\""
163
164 test_begin_subtest "Move to previous thread"
165 output=$(test_emacs '(notmuch-tree "tag:inbox")
166                      (notmuch-test-wait)
167                      (forward-line 26)
168                      (notmuch-tree-prev-thread)
169                      (notmuch-show-stash-message-id)')
170 test_expect_equal "$output" "\"Stashed: id:20091117190054.GU3165@dottiness.seas.harvard.edu\""
171
172 test_begin_subtest "Move to previous previous thread"
173 output=$(test_emacs '(notmuch-tree "tag:inbox")
174                      (notmuch-test-wait)
175                      (forward-line 26)
176                      (notmuch-tree-prev-thread)
177                      (notmuch-tree-prev-thread)
178                      (notmuch-show-stash-message-id)')
179 test_expect_equal "$output" "\"Stashed: id:1258493565-13508-1-git-send-email-keithp@keithp.com\""
180
181 test_done