3 test_description="emacs tree view interface"
4 . ./test-lib.sh || exit 1
6 EXPECTED=$TEST_DIRECTORY/tree.expected-output
10 test_begin_subtest "Basic notmuch-tree view in emacs"
11 test_emacs '(notmuch-tree "tag:inbox")
14 (delete-other-windows)'
15 test_expect_equal_file OUTPUT $EXPECTED/notmuch-tree-tag-inbox
17 test_begin_subtest "Refreshed notmuch-tree view in emacs"
18 test_emacs '(notmuch-tree "tag:inbox")
20 (notmuch-tree-refresh-view)
23 (delete-other-windows)'
24 test_expect_equal_file OUTPUT $EXPECTED/notmuch-tree-tag-inbox
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
30 test_begin_subtest "Tag message in notmuch tree view (display)"
31 test_emacs '(notmuch-tree "tag:inbox")
34 (notmuch-tree-tag (list "+test_tag"))
36 (delete-other-windows)'
37 test_expect_equal_file OUTPUT $EXPECTED/notmuch-tree-tag-inbox-tagged
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"
43 test_begin_subtest "Untag message in notmuch tree view"
44 test_emacs '(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
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" ""
56 test_begin_subtest "Tag thread in notmuch tree view"
57 test_emacs '(notmuch-tree "tag:inbox")
59 ;; move to a sizable thread
61 (notmuch-tree-tag-thread (list "+test_thread_tag"))
63 (delete-other-windows)'
64 test_expect_equal_file OUTPUT $EXPECTED/notmuch-tree-tag-inbox-thread-tagged
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"
77 test_begin_subtest "Untag thread in notmuch tree view"
78 test_emacs '(notmuch-tree "tag:inbox")
80 ;; move to the same sizable thread as above
82 (notmuch-tree-tag-thread (list "-test_thread_tag"))
84 (delete-other-windows)'
85 test_expect_equal_file OUTPUT $EXPECTED/notmuch-tree-tag-inbox
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" ""
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)))
97 (notmuch-tree-from-search-current-query)
100 (delete-other-windows)'
101 test_expect_equal_file OUTPUT $EXPECTED/notmuch-tree-tag-inbox
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)))
109 (notmuch-tree-from-search-thread)
112 (delete-other-windows)'
113 test_expect_equal_file OUTPUT $EXPECTED/notmuch-tree-single-thread
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)))
121 (notmuch-search-show-thread)
122 (notmuch-tree-from-show-current-query)
125 (delete-other-windows)'
126 test_expect_equal_file OUTPUT $EXPECTED/notmuch-tree-single-thread
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)))
134 (notmuch-search-next-thread)
135 (notmuch-tree-from-search-thread)
137 (select-window notmuch-tree-message-window)
139 (delete-other-windows)'
140 cp OUTPUT /tmp/mjwout
141 test_expect_equal_file OUTPUT $EXPECTED/notmuch-tree-show-window
143 test_begin_subtest "Stash id"
144 output=$(test_emacs '(notmuch-tree "id:1258498485-sup-142@elly")
146 (notmuch-show-stash-message-id)')
147 test_expect_equal "$output" "\"Stashed: id:1258498485-sup-142@elly\""
149 test_begin_subtest "Move to next matching message"
150 output=$(test_emacs '(notmuch-tree "from:cworth")
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\""
156 test_begin_subtest "Move to next thread"
157 output=$(test_emacs '(notmuch-tree "tag:inbox")
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\""
164 test_begin_subtest "Move to previous thread"
165 output=$(test_emacs '(notmuch-tree "tag:inbox")
168 (notmuch-tree-prev-thread)
169 (notmuch-show-stash-message-id)')
170 test_expect_equal "$output" "\"Stashed: id:20091117190054.GU3165@dottiness.seas.harvard.edu\""
172 test_begin_subtest "Move to previous previous thread"
173 output=$(test_emacs '(notmuch-tree "tag:inbox")
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\""