3 test_description="emacs tree view interface"
6 EXPECTED=$TEST_DIRECTORY/tree.expected-output
9 test_begin_subtest "Do we have emacs"
10 test_emacs '(insert "hello\n")
15 test_expect_equal_file OUTPUT EXPECTED
17 test_begin_subtest "Basic notmuch-tree view in emacs"
18 test_emacs '(add-to-list (quote load-path) "'$PICK_DIR'")
19 (require (quote notmuch-tree))
20 (notmuch-tree "tag:inbox")
23 (delete-other-windows)'
24 test_expect_equal_file OUTPUT $EXPECTED/notmuch-tree-tag-inbox
26 test_begin_subtest "Refreshed notmuch-tree view in emacs"
27 test_emacs '(add-to-list (quote load-path) "'$PICK_DIR'")
28 (require (quote notmuch-tree))
29 (notmuch-tree "tag:inbox")
31 (notmuch-tree-refresh-view)
34 (delete-other-windows)'
35 test_expect_equal_file OUTPUT $EXPECTED/notmuch-tree-tag-inbox
37 # In the following tag tests we make sure the display is updated
38 # correctly and, in a separate test, that the database is updated
41 test_begin_subtest "Tag message in notmuch tree view (display)"
42 test_emacs '(add-to-list (quote load-path) "'$PICK_DIR'")
43 (require (quote notmuch-tree))
44 (notmuch-tree "tag:inbox")
47 (notmuch-tree-tag (list "+test_tag"))
49 (delete-other-windows)'
50 test_expect_equal_file OUTPUT $EXPECTED/notmuch-tree-tag-inbox-tagged
52 test_begin_subtest "Tag message in notmuch tree view (database)"
53 output=$(notmuch search --output=messages 'tag:test_tag')
54 test_expect_equal "$output" "id:877h1wv7mg.fsf@inf-8657.int-evry.fr"
56 test_begin_subtest "Untag message in notmuch tree view"
57 test_emacs '(add-to-list (quote load-path) "'$PICK_DIR'")
58 (require (quote notmuch-tree))
59 (notmuch-tree "tag:inbox")
62 (notmuch-tree-tag (list "-test_tag"))
64 (delete-other-windows)'
65 test_expect_equal_file OUTPUT $EXPECTED/notmuch-tree-tag-inbox
67 test_begin_subtest "Untag message in notmuch tree view (database)"
68 output=$(notmuch search --output=messages 'tag:test_tag')
69 test_expect_equal "$output" ""
71 test_begin_subtest "Tag thread in notmuch tree view"
72 test_emacs '(add-to-list (quote load-path) "'$PICK_DIR'")
73 (require (quote notmuch-tree))
74 (notmuch-tree "tag:inbox")
76 ;; move to a sizable thread
78 (notmuch-tree-tag-thread (list "+test_thread_tag"))
80 (delete-other-windows)'
81 test_expect_equal_file OUTPUT $EXPECTED/notmuch-tree-tag-inbox-thread-tagged
83 test_begin_subtest "Tag message in notmuch tree view (database)"
84 output=$(notmuch search --output=messages 'tag:test_thread_tag')
85 test_expect_equal "$output" \
86 "id:87ocn0qh6d.fsf@yoom.home.cworth.org
87 id:20091118005040.GA25380@dottiness.seas.harvard.edu
88 id:yunaayketfm.fsf@aiko.keithp.com
89 id:87fx8can9z.fsf@vertex.dottedmag
90 id:20091117203301.GV3165@dottiness.seas.harvard.edu
91 id:87iqd9rn3l.fsf@vertex.dottedmag
92 id:20091117190054.GU3165@dottiness.seas.harvard.edu"
94 test_begin_subtest "Untag thread in notmuch tree view"
95 test_emacs '(add-to-list (quote load-path) "'$PICK_DIR'")
96 (require (quote notmuch-tree))
97 (notmuch-tree "tag:inbox")
99 ;; move to the same sizable thread as above
101 (notmuch-tree-tag-thread (list "-test_thread_tag"))
103 (delete-other-windows)'
104 test_expect_equal_file OUTPUT $EXPECTED/notmuch-tree-tag-inbox
106 test_begin_subtest "Untag message in notmuch tree view (database)"
107 output=$(notmuch search --output=messages 'tag:test_thread_tag')
108 test_expect_equal "$output" ""
110 test_begin_subtest "Navigation of notmuch-hello to search results"
111 test_emacs '(notmuch-hello)
112 (goto-char (point-min))
113 (re-search-forward "inbox")
114 (widget-button-press (1- (point)))
116 (notmuch-tree-from-search-current-query)
119 (delete-other-windows)'
120 test_expect_equal_file OUTPUT $EXPECTED/notmuch-tree-tag-inbox
122 test_begin_subtest "Tree view of a single thread (from search)"
123 test_emacs '(notmuch-hello)
124 (goto-char (point-min))
125 (re-search-forward "inbox")
126 (widget-button-press (1- (point)))
128 (notmuch-tree-from-search-thread)
131 (delete-other-windows)'
132 test_expect_equal_file OUTPUT $EXPECTED/notmuch-tree-single-thread
134 test_begin_subtest "Tree view of a single thread (from show)"
135 test_emacs '(notmuch-hello)
136 (goto-char (point-min))
137 (re-search-forward "inbox")
138 (widget-button-press (1- (point)))
140 (notmuch-search-show-thread)
141 (notmuch-tree-from-show-current-query)
144 (delete-other-windows)'
145 test_expect_equal_file OUTPUT $EXPECTED/notmuch-tree-single-thread
147 test_begin_subtest "Message window of tree view"
148 test_emacs '(notmuch-hello)
149 (goto-char (point-min))
150 (re-search-forward "inbox")
151 (widget-button-press (1- (point)))
153 (notmuch-search-next-thread)
154 (notmuch-tree-from-search-thread)
156 (select-window notmuch-tree-message-window)
158 (delete-other-windows)'
159 cp OUTPUT /tmp/mjwout
160 test_expect_equal_file OUTPUT $EXPECTED/notmuch-tree-show-window
162 test_begin_subtest "Stash id"
163 output=$(test_emacs '(add-to-list (quote load-path) "'$PICK_DIR'")
164 (require (quote notmuch-tree))
165 (notmuch-tree "id:1258498485-sup-142@elly")
167 (notmuch-show-stash-message-id)')
168 test_expect_equal "$output" "\"Stashed: id:1258498485-sup-142@elly\""
170 test_begin_subtest "Move to next matching message"
171 output=$(test_emacs '(add-to-list (quote load-path) "'$PICK_DIR'")
172 (require (quote notmuch-tree))
173 (notmuch-tree "from:cworth")
175 (notmuch-tree-next-matching-message)
176 (notmuch-show-stash-message-id)')
177 test_expect_equal "$output" "\"Stashed: id:878we4qdqf.fsf@yoom.home.cworth.org\""
179 test_begin_subtest "Move to next thread"
180 output=$(test_emacs '(add-to-list (quote load-path) "'$PICK_DIR'")
181 (require (quote notmuch-tree))
182 (notmuch-tree "tag:inbox")
185 (notmuch-tree-next-thread)
186 (notmuch-show-stash-message-id)')
187 test_expect_equal "$output" "\"Stashed: id:1258471718-6781-1-git-send-email-dottedmag@dottedmag.net\""
189 test_begin_subtest "Move to previous thread"
190 output=$(test_emacs '(add-to-list (quote load-path) "'$PICK_DIR'")
191 (require (quote notmuch-tree))
192 (notmuch-tree "tag:inbox")
195 (notmuch-tree-prev-thread)
196 (notmuch-show-stash-message-id)')
197 test_expect_equal "$output" "\"Stashed: id:20091117190054.GU3165@dottiness.seas.harvard.edu\""
199 test_begin_subtest "Move to previous previous thread"
200 output=$(test_emacs '(add-to-list (quote load-path) "'$PICK_DIR'")
201 (require (quote notmuch-tree))
202 (notmuch-tree "tag:inbox")
205 (notmuch-tree-prev-thread)
206 (notmuch-tree-prev-thread)
207 (notmuch-show-stash-message-id)')
208 test_expect_equal "$output" "\"Stashed: id:1258493565-13508-1-git-send-email-keithp@keithp.com\""