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