3 test_description="emacs tree view interface"
6 EXPECTED=$TEST_DIRECTORY/tree.expected-output
10 test_begin_subtest "Basic notmuch-tree view in emacs"
11 test_emacs '(add-to-list (quote load-path) "'$PICK_DIR'")
12 (require (quote notmuch-tree))
13 (notmuch-tree "tag:inbox")
16 (delete-other-windows)'
17 test_expect_equal_file OUTPUT $EXPECTED/notmuch-tree-tag-inbox
19 test_begin_subtest "Refreshed notmuch-tree view in emacs"
20 test_emacs '(add-to-list (quote load-path) "'$PICK_DIR'")
21 (require (quote notmuch-tree))
22 (notmuch-tree "tag:inbox")
24 (notmuch-tree-refresh-view)
27 (delete-other-windows)'
28 test_expect_equal_file OUTPUT $EXPECTED/notmuch-tree-tag-inbox
30 # In the following tag tests we make sure the display is updated
31 # correctly and, in a separate test, that the database is updated
34 test_begin_subtest "Tag message in notmuch tree view (display)"
35 test_emacs '(add-to-list (quote load-path) "'$PICK_DIR'")
36 (require (quote notmuch-tree))
37 (notmuch-tree "tag:inbox")
40 (notmuch-tree-tag (list "+test_tag"))
42 (delete-other-windows)'
43 test_expect_equal_file OUTPUT $EXPECTED/notmuch-tree-tag-inbox-tagged
45 test_begin_subtest "Tag message in notmuch tree view (database)"
46 output=$(notmuch search --output=messages 'tag:test_tag')
47 test_expect_equal "$output" "id:877h1wv7mg.fsf@inf-8657.int-evry.fr"
49 test_begin_subtest "Untag message in notmuch tree view"
50 test_emacs '(add-to-list (quote load-path) "'$PICK_DIR'")
51 (require (quote notmuch-tree))
52 (notmuch-tree "tag:inbox")
55 (notmuch-tree-tag (list "-test_tag"))
57 (delete-other-windows)'
58 test_expect_equal_file OUTPUT $EXPECTED/notmuch-tree-tag-inbox
60 test_begin_subtest "Untag message in notmuch tree view (database)"
61 output=$(notmuch search --output=messages 'tag:test_tag')
62 test_expect_equal "$output" ""
64 test_begin_subtest "Tag thread in notmuch tree view"
65 test_emacs '(add-to-list (quote load-path) "'$PICK_DIR'")
66 (require (quote notmuch-tree))
67 (notmuch-tree "tag:inbox")
69 ;; move to a sizable thread
71 (notmuch-tree-tag-thread (list "+test_thread_tag"))
73 (delete-other-windows)'
74 test_expect_equal_file OUTPUT $EXPECTED/notmuch-tree-tag-inbox-thread-tagged
76 test_begin_subtest "Tag message in notmuch tree view (database)"
77 output=$(notmuch search --output=messages 'tag:test_thread_tag')
78 test_expect_equal "$output" \
79 "id:87ocn0qh6d.fsf@yoom.home.cworth.org
80 id:20091118005040.GA25380@dottiness.seas.harvard.edu
81 id:yunaayketfm.fsf@aiko.keithp.com
82 id:87fx8can9z.fsf@vertex.dottedmag
83 id:20091117203301.GV3165@dottiness.seas.harvard.edu
84 id:87iqd9rn3l.fsf@vertex.dottedmag
85 id:20091117190054.GU3165@dottiness.seas.harvard.edu"
87 test_begin_subtest "Untag thread in notmuch tree view"
88 test_emacs '(add-to-list (quote load-path) "'$PICK_DIR'")
89 (require (quote notmuch-tree))
90 (notmuch-tree "tag:inbox")
92 ;; move to the same sizable thread as above
94 (notmuch-tree-tag-thread (list "-test_thread_tag"))
96 (delete-other-windows)'
97 test_expect_equal_file OUTPUT $EXPECTED/notmuch-tree-tag-inbox
99 test_begin_subtest "Untag message in notmuch tree view (database)"
100 output=$(notmuch search --output=messages 'tag:test_thread_tag')
101 test_expect_equal "$output" ""
103 test_begin_subtest "Navigation of notmuch-hello to search results"
104 test_emacs '(notmuch-hello)
105 (goto-char (point-min))
106 (re-search-forward "inbox")
107 (widget-button-press (1- (point)))
109 (notmuch-tree-from-search-current-query)
112 (delete-other-windows)'
113 test_expect_equal_file OUTPUT $EXPECTED/notmuch-tree-tag-inbox
115 test_begin_subtest "Tree view of a single thread (from search)"
116 test_emacs '(notmuch-hello)
117 (goto-char (point-min))
118 (re-search-forward "inbox")
119 (widget-button-press (1- (point)))
121 (notmuch-tree-from-search-thread)
124 (delete-other-windows)'
125 test_expect_equal_file OUTPUT $EXPECTED/notmuch-tree-single-thread
127 test_begin_subtest "Tree view of a single thread (from show)"
128 test_emacs '(notmuch-hello)
129 (goto-char (point-min))
130 (re-search-forward "inbox")
131 (widget-button-press (1- (point)))
133 (notmuch-search-show-thread)
134 (notmuch-tree-from-show-current-query)
137 (delete-other-windows)'
138 test_expect_equal_file OUTPUT $EXPECTED/notmuch-tree-single-thread
140 test_begin_subtest "Message window of tree view"
141 test_emacs '(notmuch-hello)
142 (goto-char (point-min))
143 (re-search-forward "inbox")
144 (widget-button-press (1- (point)))
146 (notmuch-search-next-thread)
147 (notmuch-tree-from-search-thread)
149 (select-window notmuch-tree-message-window)
151 (delete-other-windows)'
152 cp OUTPUT /tmp/mjwout
153 test_expect_equal_file OUTPUT $EXPECTED/notmuch-tree-show-window
155 test_begin_subtest "Stash id"
156 output=$(test_emacs '(add-to-list (quote load-path) "'$PICK_DIR'")
157 (require (quote notmuch-tree))
158 (notmuch-tree "id:1258498485-sup-142@elly")
160 (notmuch-show-stash-message-id)')
161 test_expect_equal "$output" "\"Stashed: id:1258498485-sup-142@elly\""
163 test_begin_subtest "Move to next matching message"
164 output=$(test_emacs '(add-to-list (quote load-path) "'$PICK_DIR'")
165 (require (quote notmuch-tree))
166 (notmuch-tree "from:cworth")
168 (notmuch-tree-next-matching-message)
169 (notmuch-show-stash-message-id)')
170 test_expect_equal "$output" "\"Stashed: id:878we4qdqf.fsf@yoom.home.cworth.org\""
172 test_begin_subtest "Move to next thread"
173 output=$(test_emacs '(add-to-list (quote load-path) "'$PICK_DIR'")
174 (require (quote notmuch-tree))
175 (notmuch-tree "tag:inbox")
178 (notmuch-tree-next-thread)
179 (notmuch-show-stash-message-id)')
180 test_expect_equal "$output" "\"Stashed: id:1258471718-6781-1-git-send-email-dottedmag@dottedmag.net\""
182 test_begin_subtest "Move to previous thread"
183 output=$(test_emacs '(add-to-list (quote load-path) "'$PICK_DIR'")
184 (require (quote notmuch-tree))
185 (notmuch-tree "tag:inbox")
188 (notmuch-tree-prev-thread)
189 (notmuch-show-stash-message-id)')
190 test_expect_equal "$output" "\"Stashed: id:20091117190054.GU3165@dottiness.seas.harvard.edu\""
192 test_begin_subtest "Move to previous previous thread"
193 output=$(test_emacs '(add-to-list (quote load-path) "'$PICK_DIR'")
194 (require (quote notmuch-tree))
195 (notmuch-tree "tag:inbox")
198 (notmuch-tree-prev-thread)
199 (notmuch-tree-prev-thread)
200 (notmuch-show-stash-message-id)')
201 test_expect_equal "$output" "\"Stashed: id:1258493565-13508-1-git-send-email-keithp@keithp.com\""