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